本文整理汇总了C++中SC_REPORT_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ SC_REPORT_ERROR函数的具体用法?C++ SC_REPORT_ERROR怎么用?C++ SC_REPORT_ERROR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SC_REPORT_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_properties
sc_time &tdma_bus::get_CurrentP2Pdelay(phy_link_t &plink,
unsigned int msg_size
) {
std::string msg;
unsigned int slots_allocated, first_slot;
sc_time current_offset_delay, data_tx_delay;
link_info_t *plink_info_p;
// retrieve properties stored (by the base comm_res)
plink_info_p = get_properties(plink, msg_size);
if(plink_info_p==NULL) { // property for the link-msg_size combination not found
this->set_CurrentP2Pdelay(plink,msg_size); // refer to plinks info
// retrieve the properties again
plink_info_p = get_properties(plink, msg_size);
// ... and it should not fail again
if(plink_info_p==NULL) {
std::string rpt_msg;
std::ostringstream os;
rpt_msg = "Setting properties of link ";
os << plink;
rpt_msg += os.str();
rpt_msg += " in TDMA bus ";
rpt_msg += name();
rpt_msg += " failed.";
SC_REPORT_ERROR("KisTA",rpt_msg.c_str());
}
}
data_tx_delay = plink_info_p->getMaxP2Pdelay(msg_size);
// NOTE:
// Notice that in the CurrentP2P call, only the time invariant component
// was cached.
// Now, the time dependent component is added.
// A faster alternative is to use the L1 accuracy level, which provides
// a random offset bounded by the maximum offset
switch(accuracy_level) {
case 0:
first_slot = first_slot_allocation_table[plink.src];
current_offset_delay = current_offset_delay_L0(sc_time_stamp(),first_slot);
break;
case 1:
slots_allocated = channel_allocation_table[plink.src];
current_offset_delay = current_offset_delay_L1(slots_allocated);
break;
default:
msg = "TDMA bus ";
msg += name();
msg += ": unknown accuracy level calculating Current P2P delay. Supported ones range 0(most accurate, slower) to 1(faster-less accurate)";
SC_REPORT_ERROR("KisTA",msg.c_str());
}
current_tx_delay = current_offset_delay + data_tx_delay; // Note that we use a member variable of tdma_bus class (instead a local variable)
// to enable the return of a refernce
return current_tx_delay;
}
示例2: sc_deprecated_report_ids
void sc_report::register_id( int id, const char* msg )
{
sc_deprecated_report_ids("sc_report::register_id()");
if ( id < 0 )
{
SC_REPORT_ERROR( SC_ID_REGISTER_ID_FAILED_,
"invalid report id" );
}
if ( msg == 0 )
{
SC_REPORT_ERROR( SC_ID_REGISTER_ID_FAILED_,
"invalid report message" );
}
sc_msg_def * md = sc_report_handler::mdlookup(id);
if ( !md )
md = sc_report_handler::add_msg_type(msg);
if ( !md )
{
SC_REPORT_ERROR( SC_ID_REGISTER_ID_FAILED_,
"report_map insertion error" );
}
if ( md->id != -1 )
{
if ( strcmp( msg, md->msg_type ) != 0 )
{
SC_REPORT_ERROR( SC_ID_REGISTER_ID_FAILED_,
"report id already exists" );
}
return;
}
md->id = id;
}
示例3: name
sc_time tdma_bus::calculate_MaxP2Pdelay(unsigned int msg_size, unsigned int slots_allocated) {
std::string msg;
//cout << "CALCULATE MAX (BOUND) P2P DELAY" << endl;
#ifdef _ENABLE_CHECK_ALLOCATED_CHANNELS_IN_CALCULATE_MAX_P2P_DELAY
if(slots_allocated>n_channels) {
msg = "Calling calculate_MaxP2Pdelay in TDMA bus ";
msg += name();
msg += " for ";
msg += std::to_string(slots_allocated);
msg += " slots, while the bus has ";
msg += n_channels;
msg += " slots.";
SC_REPORT_ERROR("KisTA", msg.c_str());
}
#endif
switch(accuracy_level){
case 0:
return calculate_MaxP2Pdelay_L0(msg_size,slots_allocated);
break;
case 1:
return calculate_MaxP2Pdelay_L1(msg_size,slots_allocated);
break;
case 2:
return calculate_MaxP2Pdelay_L2(msg_size,slots_allocated);
break;
default:
msg= "TDMA bus ";
msg += name();
msg += ": unknown accuracy level calculating Max. P2P delay. Supported ones range 0(most accurate, slower) to 2(faster-less accurate)";
SC_REPORT_ERROR("KisTA",msg.c_str());
}
}
示例4: switch
void handle_sc_kernel_exception_message
(
uvm_ml_kernel_exception_message message,
const char* string1,
const char* string2
) {
char msg[1024];
switch (message) {
case UVM_ML_CREATE_SC_INST:
sprintf(msg, "\nSystemC module defname is '%s' \nHDL instname is '%s'",
string1, string2
);
SC_REPORT_ERROR(msg,"\n");
break;
case UVM_ML_CREATE_SC_INST_2:
sprintf(msg, "instname is '%s'", string1);
SC_REPORT_ERROR(msg,"\n");
break;
case UVM_ML_QUASI_STATIC_ELABORATION:
SC_REPORT_ERROR("SC_ID_COSIM_ERR_IN_QUASI_STATIC_ELAB","\n");
CURRENT_SIMCONTEXT_SET_ERROR();
break;
default:
assert(false);
break;
}
}
示例5: name
void
sc_module::positional_bind( sc_port_base& port_ )
{
if( m_port_index == (int)m_port_vec->size() ) {
char msg[BUFSIZ];
if( m_port_index == 0 ) {
std::sprintf( msg, "module `%s' has no ports", name() );
} else {
std::sprintf( msg, "all ports of module `%s' are bound", name() );
}
SC_REPORT_ERROR( SC_ID_BIND_PORT_TO_PORT_, msg );
}
int status = (*m_port_vec)[m_port_index]->pbind( port_ );
if( status != 0 ) {
char msg[BUFSIZ];
switch( status ) {
case 1:
std::sprintf( msg, "port %d of module `%s' is already bound",
m_port_index, name() );
break;
case 2:
std::sprintf( msg, "type mismatch on port %d of module `%s'",
m_port_index, name() );
break;
default:
std::sprintf( msg, "unknown error" );
break;
}
SC_REPORT_ERROR( SC_ID_BIND_PORT_TO_PORT_, msg );
}
++ m_port_index;
}
示例6: sprintf
void uvm_factory_rep::set_type_override(
string original_type_name,
string replacement_type_name,
bool replace
) {
// check replace_ment_type_name is registered
if (!creator_map[(char*)(replacement_type_name.c_str())]) {
char msg[1024];
sprintf(msg,
" Problem with replacement type in set_type_override. Type = %s",
replacement_type_name.c_str()
);
SC_REPORT_ERROR(UVM_CREATOR_NOT_FOUND_,msg);
return;
}
if (!replace && type_overrides[(char*)(original_type_name.c_str())]) {
char msg[1024];
sprintf(msg," Type = %s", original_type_name.c_str());
SC_REPORT_ERROR(UVM_OVERRIDE_EXISTS_,msg);
return;
}
type_overrides.insert(
strdup(original_type_name.c_str()),
new string(replacement_type_name)
);
}
示例7: assert
//------------------------------------------------------------------------------
//"sc_reset_signal_is"
//
//------------------------------------------------------------------------------
void sc_reset::reset_signal_is( const sc_in<bool>& port, bool level )
{
const sc_signal_in_if<bool>* iface_p;
sc_process_b* process_p;
process_p = (sc_process_b*)sc_get_current_process_handle();
assert( process_p );
switch ( process_p->proc_kind() )
{
case SC_THREAD_PROC_:
case SC_METHOD_PROC_:
SC_REPORT_ERROR(SC_ID_RESET_SIGNAL_IS_NOT_ALLOWED_,"");
break;
case SC_CTHREAD_PROC_:
process_p->m_reset_level = level;
iface_p = DCAST<const sc_signal_in_if<bool>*>(port.get_interface());
if ( iface_p )
reset_signal_is( *iface_p, level );
else
{
new sc_reset_finder( &port, level, process_p );
}
break;
default:
SC_REPORT_ERROR(SC_ID_UNKNOWN_PROCESS_TYPE_, process_p->name());
break;
}
}
示例8: switch
tlm::tlm_response_status Intc::read(ensitlm::addr_t a, ensitlm::data_t &d) {
switch (a) {
case XIN_ISR_OFFSET: /* Interrupt Status Register */
d = m_active_it;
break;
case XIN_IPR_OFFSET: /* Interrupt Pending Register */
SC_REPORT_ERROR(name(),
"register XIN_IPR_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
case XIN_IER_OFFSET: /* Interrupt Enable Register */
d = m_enabled_it;
break;
case XIN_IAR_OFFSET: /* Interrupt Acknowledge Register */
SC_REPORT_ERROR(name(),
"register XIN_IAR_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
case XIN_SIE_OFFSET: /* Set Interrupt Enable Register */
SC_REPORT_ERROR(name(),
"register XIN_SIE_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
case XIN_CIE_OFFSET: /* Clear Interrupt Enable Register */
SC_REPORT_ERROR(name(),
"register XIN_CIE_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
case XIN_IVR_OFFSET: /* Interrupt Vector Register */
SC_REPORT_ERROR(name(),
"register XIN_IVR_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
case XIN_MER_OFFSET: /* Master Enable Register */
SC_REPORT_ERROR(name(),
"register XIN_MER_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
case XIN_IMR_OFFSET: /* Interrupt Mode Register */
SC_REPORT_ERROR(name(),
"register XIN_IMR_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
case XIN_ILR_OFFSET: /* Interrupt level register */
SC_REPORT_ERROR(name(),
"register XIN_ILR_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
case XIN_IVAR_OFFSET: /* Interrupt Vector Address Register */
SC_REPORT_ERROR(name(),
"register XIN_IVAR_OFFSET not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
break;
default:
SC_REPORT_ERROR(name(), "register not implemented");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
}
return tlm::TLM_OK_RESPONSE;
}
示例9: b_transport
//Method used for receiving acknowledgements of interrupts; the ack consists of
//uninteresting data and the address corresponds to the interrupt signal to
//be lowered
//As a response, I lower the interrupt by sending a NULL pointer on the init_socket
void b_transport(tlm::tlm_generic_payload& trans, sc_time& delay) {
if(this->lastIrq < 0) {
THROW_EXCEPTION("Error, lowering an interrupt which hasn't been raised yet!!");
}
tlm::tlm_command cmd = trans.get_command();
sc_dt::uint64 adr = trans.get_address();
unsigned char* ptr = trans.get_data_ptr();
if(trans.get_command() == tlm::TLM_READ_COMMAND) {
THROW_EXCEPTION("Error, the read request is not currently supported by external PINs");
}
else if(cmd == tlm::TLM_WRITE_COMMAND) {
if(this->lastIrq != adr) {
THROW_EXCEPTION("Error, lowering interrupt " << std::hex << std::showbase << (unsigned)adr << " while " << std::hex << std::showbase << this->lastIrq << " was raised");
}
else {
//finally I can really lower the interrupt: I send 0 on
//the initSocked
unsigned char data = 0;
trans.set_data_ptr(&data);
trans.set_dmi_allowed(false);
trans.set_response_status( tlm::TLM_INCOMPLETE_RESPONSE );
sc_time delay;
this->init_socket->b_transport(trans, delay);
if(trans.is_response_error()) {
std::string errorStr("Error in b_transport of PIN, response status = " + trans.get_response_string());
SC_REPORT_ERROR("TLM-2", errorStr.c_str());
}
this->lastIrq = -1;
}
}
trans.set_response_status(tlm::TLM_OK_RESPONSE);
}
示例10: SC_REPORT_ERROR
void sc_value_base::concat_set( uint64 /*src*/, int /*low_i*/ )
{
char error_message[128];
std::sprintf(error_message,
"concat_set(uint64) method not supported by this type");
SC_REPORT_ERROR( sc_core::SC_ID_OPERATION_FAILED_, error_message );
}
示例11: BASIC_TRACE_DEBUG
tlm::tlm_response_status
Bus::write(const basic::addr_t &a, const basic::data_t &d)
{
// Testing the bypass
BASIC_TRACE_DEBUG("[!] CALL THE BUS'S WRITE FUNCTION [!]\n");
if(a % sizeof(basic::data_t)) {
SC_REPORT_ERROR(name(),
"unaligned write");
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
}
addr_map_t::iterator it = addr_map.find(addr_range(a, a));
if(it == addr_map.end()) {
std::cerr << name() << ": no target at address " <<
std::hex << a << std::endl;
return tlm::TLM_ADDRESS_ERROR_RESPONSE;
}
#ifdef DEBUG
std::cout << "Debug: " << name() <<
": write access at 0x" << std::hex << a <<
" (data: 0x" << d << ")\n";
#endif
tlm::tlm_response_status s =
initiator.write(a - (*it).first.begin, d, (*it).second);
return s;
}
示例12: generateIrq
//Simple systemc thread which keeps on generating interrupts;
//the number of the interrupt is printed to the screen before sending it to
//the processor
void generateIrq() {
while(true) {
//An interrupt transaction is composed of a data pointer (containing
//0 if the interrupt has to be lowered, different if raised) and an
//address, corrisponding to the ID of the interrupt
if(this->lastIrq == -1) {
unsigned char data = 1;
tlm::tlm_generic_payload trans;
boost::uniform_int<> degen_dist(0x1, 0xe);
boost::variate_generator<boost::minstd_rand&, boost::uniform_int<> > deg(this->generator, degen_dist);
this->lastIrq = deg();
std::cerr << "Sending out IRQ id=" << std::hex << std::showbase << this->lastIrq << std::endl;
trans.set_address(this->lastIrq);
trans.set_data_ptr(&data);
trans.set_data_length(0);
trans.set_byte_enable_ptr(0);
trans.set_dmi_allowed(false);
trans.set_response_status( tlm::TLM_INCOMPLETE_RESPONSE );
sc_time delay;
this->init_socket->b_transport(trans, delay);
if(trans.is_response_error()) {
std::string errorStr("Error in generateIrq, response status = " + trans.get_response_string());
SC_REPORT_ERROR("TLM-2", errorStr.c_str());
}
}
wait(this->latency);
}
}
示例13: link
void tdma_bus::set_CurrentP2Pdelay(phy_link_t &plink,
unsigned int msg_size
) {
std::string rpt_msg;
unsigned int slots_allocated;
sc_time data_tx_delay;
//link_info_t *plink_info_p;
// retrieve slots allocated from the channel allocation table
slots_allocated = channel_allocation_table[plink.src];
if(slots_allocated==0) {
rpt_msg = "No slot allocated for the physical link (";
rpt_msg += plink.src->name();
rpt_msg += ",";
rpt_msg += plink.dest->name();
rpt_msg += ").";
SC_REPORT_ERROR("KisTA",rpt_msg.c_str());
}
data_tx_delay = calculate_data_tx_delay_L0(msg_size,slots_allocated);
// NOTES:
// - Here the inherited function of the comm_res base class is used
// to cache the transmission delay value (that is, only the time invariant)
// part. Therefore, the get_CurrentP2Pdelay has to take that into account
// in order to later one compose the accurate time-variant value
set_CurrentP2Pdelay(plink,data_tx_delay, msg_size);
}
示例14: SC_REPORT_ERROR
const char*
sc_name_gen::gen_unique_name( const char* basename_, bool preserve_first )
{
if ( basename_ == 0 )
{
SC_REPORT_ERROR( SC_ID_GEN_UNIQUE_NAME_, 0 );
}
int* c = m_unique_name_map[basename_];
if ( c == 0 )
{
c = new int( 0 );
m_unique_name_map.insert( CCAST<char*>( basename_ ), c );
if (preserve_first)
{
std::sprintf( m_unique_name, "%s", basename_ );
}
else
{
std::sprintf( m_unique_name, "%s_%d", basename_, *c );
}
}
else
{
std::sprintf( m_unique_name, "%s_%d", basename_, ++ (*c) );
}
return m_unique_name;
}
示例15: assert
void sc_reset::reset_signal_is(
bool async, const sc_out<bool>& port, bool level )
{
const sc_signal_in_if<bool>* iface_p;
sc_process_b* process_p;
process_p = (sc_process_b*)sc_get_current_process_handle();
assert( process_p );
process_p->m_has_reset_signal = true;
switch ( process_p->proc_kind() )
{
case SC_THREAD_PROC_:
case SC_METHOD_PROC_:
case SC_CTHREAD_PROC_:
iface_p = DCAST<const sc_signal_in_if<bool>*>(port.get_interface());
if ( iface_p )
reset_signal_is( async, *iface_p, level );
else
new sc_reset_finder( async, &port, level, process_p );
break;
default:
SC_REPORT_ERROR(SC_ID_UNKNOWN_PROCESS_TYPE_, process_p->name());
break;
}
}