// redefinition for generic network unsigned int tdma_bus::allocate_BW(phy_address src, unsigned int required_bps) { std::string rpt_msg; unsigned required_slots; #ifdef _REPORT_TDMA_BUS_CONFIGURATION rpt_msg= "Requesting "; rpt_msg+= std::to_string(required_bps); rpt_msg+= " (bps) to sender physical address (PE) "; rpt_msg+= src->name(); SC_REPORT_INFO("KisTA: TDMA bus",rpt_msg.c_str()); #endif // calculated required slots required_slots = (unsigned int)((double)required_bps/(double)channel_eBW)+1; allocate_channels(src,required_slots); #ifdef _REPORT_TDMA_BUS_CONFIGURATION rpt_msg= "Allocating "; rpt_msg+= std::to_string(required_slots*channel_eBW); rpt_msg+= " (bps) to sender physical address (PE) "; rpt_msg+= src->name(); SC_REPORT_INFO("KisTA: TDMA bus",rpt_msg.c_str()); #endif return required_slots*channel_eBW; }
void uvm_phase_controller::print_stop_reason(stop_reason_enum reason) { switch(m_stop_reason) { case UVM_STOP_REASON_DURATION_COMPLETE: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_DURATION,""); break; case UVM_STOP_REASON_GLOBAL_TIMEOUT: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_GLOBAL_TIMEOUT,""); break; case UVM_STOP_REASON_PHASE_COMPLETE: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_PHASE_COMPLETE,""); break; case UVM_STOP_REASON_USER_REQUEST: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_USER_REQUEST,""); break; case UVM_STOP_REASON_PRERUN_PHASE_FATAL: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_PRERUN_PHASE_FATAL,""); break; case UVM_STOP_REASON_POSTRUN_PHASE_FATAL: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_POSTRUN_PHASE_FATAL,""); break; case UVM_STOP_REASON_RUN_PHASE_FATAL: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_RUN_PHASE_FATAL,""); break; case UVM_STOP_REASON_MAX_ERRORS: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_MAX_ERRORS,""); break; default: SC_REPORT_INFO(UVM_PHASE_CTRL_STOP_UNKNOWN,""); break; }; return; }
Host::Host(sc_module_name p_ModuleName, Connection *p_ConnectionConfig):sc_module(p_ModuleName), m_Encoder("Encoder"), m_Decoder("Decoder"), m_MsgBuffer(START) { ///StringTools instance for reporting StringTools *l_Report = new StringTools(name()); l_Report->resetReportString(); //DEBUGGING SC_REPORT_INFO(g_DebugID, l_Report->newReportString("elaborates")); /// \li define clock period for Router m_ClkPeriod = new const sc_time(1, SC_SEC); /// \li Allocate clock for the Routers using the previously allocated period m_ClkRouter = new sc_clock("CLK", *m_ClkPeriod); SC_REPORT_INFO(g_DebugID, l_Report->newReportString("Building the network interfaces")); //allocate reference array for network interface modules m_NetworkInterface = new Interface*[1]; //allocate reference array for receiving exports export_ReceivingInterface = new sc_export<Interface_If>*[1]; //allocate reference array for fowarding ports port_ForwardingInterface = new sc_port<Interface_If, 1, SC_ZERO_OR_MORE_BOUND>*[1]; m_NetworkInterface[0] = new Interface(m_Name.getNextName(), p_ConnectionConfig); //instantiate hierarchial forwarding port port_ForwardingInterface[0] = new sc_port<Interface_If, 1, SC_ZERO_OR_MORE_BOUND>; //bind network interface port to host's hierarchial port m_NetworkInterface[0]->port_Output.bind(*port_ForwardingInterface[0]); //make the hierarchial binding for receiving exports export_ReceivingInterface[0] = new sc_export<Interface_If>; export_ReceivingInterface[0]->bind(*m_NetworkInterface[0]); //bind the clock to the network interface m_NetworkInterface[0]->port_Clk(*m_ClkRouter); //delete the StringTools object delete l_Report; SC_THREAD(hostMain); sensitive << *m_ClkRouter; }
void testbench::end_of_simulation() { if (!_checked_results) { SC_REPORT_INFO(name(), "Simulation ran into deadlock"); check_results(); } }
// for backward compatibility with 1.0 sc_clock::sc_clock( const char* name_, double period_, // in default time units double duty_cycle_, double start_time_, // in default time units bool posedge_first_ ) : sc_signal<bool>( name_ ) { static bool warn_sc_clock=true; if ( warn_sc_clock ) { warn_sc_clock = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "\n sc_clock(const char*, double, double, double, bool)\n" " is deprecated use a form that includes sc_time or\n" " sc_time_unit"); } init( sc_time( period_, true ), duty_cycle_, sc_time( start_time_, true ), posedge_first_ ); if( posedge_first_ ) { // posedge first m_next_posedge_event.notify_internal( m_start_time ); } else { // negedge first m_next_negedge_event.notify_internal( m_start_time ); } }
void testbench::mc_testbench_process_wait_ctrl(const sc_string &var,int &var_wait_cycles,mc_wait_ctrl &var_wait_ctrl,tlm::tlm_fifo_put_if< mc_wait_ctrl > *ccs_wait_ctrl_fifo_if,const int var_capture_count,const int var_stopat) { if (var_wait_cycles) { // backward compatibility mode var_wait_ctrl.cycles = var_wait_cycles; var_wait_cycles = 0; std::ostringstream msg; msg.str(""); msg << "Depricated use of '" << var << "_wait_cycles' variable. Use '" << var << "_wait_ctrl.cycles' instead."; SC_REPORT_WARNING("User testbench", msg.str().c_str()); } if (var_wait_ctrl.cycles != 0) { var_wait_ctrl.iteration = var_capture_count; var_wait_ctrl.stopat = var_stopat; if (var_wait_ctrl.cycles < 0) { std::ostringstream msg; msg.str(""); msg << "Ignoring negative value (" << var_wait_ctrl.cycles << ") for testbench control testbench::" << var << "_wait_ctrl.cycles."; SC_REPORT_WARNING("User testbench", msg.str().c_str()); var_wait_ctrl.cycles = 0; } if (var_wait_ctrl.interval < 0) { std::ostringstream msg; msg.str(""); msg << "Ignoring negative value (" << var_wait_ctrl.interval << ") for testbench control testbench::" << var << "_wait_ctrl.interval."; SC_REPORT_WARNING("User testbench", msg.str().c_str()); var_wait_ctrl.interval = 0; } if (var_wait_ctrl.is_set()) { std::ostringstream msg; msg.str(""); msg << "Captured wait_ctrl request " << var_wait_ctrl; SC_REPORT_INFO("User testbench", msg.str().c_str()); ccs_wait_ctrl_fifo_if->put(var_wait_ctrl); } } var_wait_ctrl.clear(); // reset wait_ctrl }
static void sc_warn_arrow_arrow_bind() { static bool warn_arrow_arrow_bind=true; if ( warn_arrow_arrow_bind ) { warn_arrow_arrow_bind = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "positional binding using << or , is deprecated, use () instead."); } }
void sc_deprecated_sc_bit() { static bool warn_sc_bit_deprecated=true; if ( warn_sc_bit_deprecated ) { warn_sc_bit_deprecated=false; SC_REPORT_INFO(sc_core::SC_ID_IEEE_1666_DEPRECATION_, "sc_bit is deprecated, use bool instead"); } }
void sc_deprecated_get_new_value() { static bool warn_new_value=true; if ( warn_new_value ) { warn_new_value=false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_signal<T>::get_new_value() is deprecated"); } }
void sc_deprecated_trace() { static bool warn_trace_deprecated=true; if ( warn_trace_deprecated ) { warn_trace_deprecated=false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_signal<T>::trace() is deprecated"); } }
void sc_deprecated_get_data_ref() { static bool warn_get_data_ref_deprecated=true; if ( warn_get_data_ref_deprecated ) { warn_get_data_ref_deprecated=false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "get_data_ref() is deprecated, use read() instead" ); } }
void testbench::wait_for_end() { // If run() has not finished, we do nothing here if (!testbench_ended) return; // check for completed outputs if (output_comp->get_compare_count() < output_capture_count) {testbench_end_event.notify(1,SC_NS); return;} // If we made it here, all outputs have flushed. Check the results SC_REPORT_INFO(name(), "Simulation completed"); check_results(); sc_stop(); }
void sc_warn_port_constructor() { static bool warn_port_constructor=true; if ( warn_port_constructor ) { warn_port_constructor = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "interface and/or port binding in port constructors is deprecated" ); } }
static void sc_deprecated_report_ids(const char* method) { static bool warn_report_ids_deprecated=true; if ( warn_report_ids_deprecated ) { std::string message; message = "integer report ids are deprecated, use string values: "; message += method; warn_report_ids_deprecated=false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, message.c_str()); } }
double sc_simulation_time() { static bool warn_simulation_time=true; if ( warn_simulation_time ) { warn_simulation_time=false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_simulation_time() is deprecated use sc_time_stamp()" ); } return sc_get_curr_simcontext()->time_stamp().to_default_time_units(); }
sc_dt::uint64 sc_simcontext::delta_count() const { static bool warn_delta_count=true; if ( warn_delta_count ) { warn_delta_count = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_simcontext::delta_count() is deprecated, use sc_delta_count()" ); } return m_delta_count; }
bool sc_simcontext::is_running() const { static bool warn_is_running=true; if ( warn_is_running ) { warn_is_running = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_simcontext::is_running() is deprecated, use sc_is_running()" ); } return m_ready_to_simulate; }
bool Interface::interfaceUp(void) { if(m_IfConfig->hasConnection()) { m_InterfaceState = UP; SC_REPORT_INFO(g_ReportID, m_Report.newReportString("UP")); } else m_InterfaceState = DOWN; return m_InterfaceState; }
sc_object* sc_object::get_parent() const { static bool warn_sc_get_parent_deprecated=true; if ( warn_sc_get_parent_deprecated ) { warn_sc_get_parent_deprecated=false; SC_REPORT_INFO(sc_core::SC_ID_IEEE_1666_DEPRECATION_, "sc_object::get_parent() is deprecated, " "use get_parent_object() instead"); } return get_parent_object(); }
void sc_initialize() { static bool warning_initialize = true; if ( warning_initialize ) { warning_initialize = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_initialize() is deprecated: use sc_start(SC_ZERO_TIME)" ); } sc_get_curr_simcontext()->initialize(); }
void sc_cycle( const sc_time& duration ) { static bool warning_cycle = true; if ( warning_cycle ) { warning_cycle = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_cycle is deprecated: use sc_start(sc_time)" ); } sc_get_curr_simcontext()->cycle( duration ); }
void Interface::interfaceMain(void) { SC_REPORT_INFO(g_ReportID, m_Report.newReportString("starting") ); while(true) { wait(); if(m_InterfaceState) //only if interface is up //Forward the next packet from the local forwarding queue port_Output->forward(m_ForwardingBuffer.read()); } }
sc_object* sc_simcontext::find_object( const char* name ) { static bool warn_find_object=true; if ( warn_find_object ) { warn_find_object = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_simcontext::find_object() is deprecated,\n" \ " use sc_find_object()" ); } return m_object_manager->find_object( name ); }
const ::std::vector<sc_object*>& sc_simcontext::get_child_objects() const { static bool warn_get_child_objects=true; if ( warn_get_child_objects ) { warn_get_child_objects = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_simcontext::get_child_objects() is deprecated,\n" \ " use sc_get_top_level_objects()" ); } return m_child_objects; }
void uvm_phase_controller::do_postrun(void) { std::string phase_name; std::ostringstream outmsg; uvm_phase_state state; puvm_phase pcurrent_phase = m_pcommon_schedule->get_current_phase(); // Note: Get all tops including pure sc_modules, in case they have uvm_comp children std::vector<sc_core::sc_module *> all_tops = uvm_get_tops(); // Set common schedule to first postrun phase (ie. 'extract') // Note: set to the first postrun phase after 'run' phase; // accounts for cases where run phase terminates early due to timeout or errors pcurrent_phase = m_pcommon_schedule->get_phase("extract"); // first postrun phase after run if (pcurrent_phase == NULL) { SC_REPORT_INFO(UVM_PHASE_CTRL_POST_RUN_NONE,""); return; // No post-run schedules to execute } if(pcurrent_phase->get_phase_type() != UVM_POSTRUN_PHASE) { outmsg << pcurrent_phase->get_name() << endl; SC_REPORT_FATAL(UVM_PHASE_CTRL_PHASE_TYPE,outmsg.str().c_str()); exit(1); } m_pcommon_schedule->set_current_phase(pcurrent_phase); // Loop over post-run phases while((pcurrent_phase != NULL) &&(pcurrent_phase->get_phase_type() == UVM_POSTRUN_PHASE)) { phase_name = pcurrent_phase->get_name(); state = pcurrent_phase->get_phase_state(); while(state != UVM_PHASE_DONE) { for (unsigned int i = 0; i < all_tops.size(); i++) { m_pcommon_schedule->execute_nonruntime_phase(all_tops[i]); // setting the phase state // TODO: Any results to check here? } state = m_pcommon_schedule->update_phase_state(); } pcurrent_phase = m_pcommon_schedule->get_current_phase(); } // TODO - check for fatal errors here (try/catch?) // Note: Needs to work in ML as well... }
// THE FOLLOWING FUNCTION IS DEPRECATED IN 2.1 sc_process_b* sc_get_curr_process_handle() { static bool warn=true; if ( warn ) { warn = false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "sc_get_curr_process_handle deprecated use sc_get_current_process_handle" ); } return sc_get_curr_simcontext()->get_curr_proc_info()->process_handle; }
int sc_elab_and_sim( int argc, char* argv[] ) { int status = 1; argc_copy = argc; argv_copy = argv; std::vector<char*> argv_call; for ( int i = 0; i < argc; i++ ) argv_call.push_back(argv[i]); try { pln(); // Perform initialization here sc_in_action = true; status = sc_main( argc, &argv_call[0] ); // Perform cleanup here sc_in_action = false; } catch( const sc_report& x ) { message_function( x.what() ); } catch( ... ) { // translate other escaping exceptions sc_report* err_p = sc_handle_exception(); if( err_p ) message_function( err_p->what() ); delete err_p; } // IF DEPRECATION WARNINGS WERE ISSUED TELL THE USER HOW TO TURN THEM OFF if ( sc_report_handler::get_count("/IEEE_Std_1666/deprecated") > 0 ) { SC_REPORT_INFO("/IEEE_Std_1666/deprecated", "You can turn off warnings about\n" \ " IEEE 1666 deprecated features by placing this method " \ "call as the\n" \ " first statement in your sc_main() function:\n" \ "\n sc_report_handler::set_actions(\"/IEEE_Std_1666/deprecated\", " \ "SC_DO_NOTHING);\n\n" ); } return status; }
void sc_trace( sc_trace_file* tf, const unsigned int& object, const std::string& name, const char** enum_literals ) { static bool warn_sc_trace_literals=true; if ( warn_sc_trace_literals ) { warn_sc_trace_literals=false; SC_REPORT_INFO(SC_ID_IEEE_1666_DEPRECATION_, "tracing of enumerated literals is deprecated" ); } if( tf ) tf->trace( object, name, enum_literals ); }
void tdma_bus::allocate_channels(phy_address src, unsigned int required_channels, unsigned int first_slot) { std::string msg; manual_slot_allocation = true; // check there is enough slots available (this is actually redundant, since the // assgin_free_slots function makes a tighter check, but it allows to early detect // bad configurations if( (required_channels + n_allocated_channels) > n_channels ) { msg= "In TDMA bus "; msg += name(); msg= ": Trying to assign more transmission slots ("; msg+= std::to_string(required_channels); msg+= ") to sender physical address (PE) "; msg+= src->name(); msg+= ") than the available slots ("; msg+= std::to_string(n_channels-n_allocated_channels); msg+= ")"; SC_REPORT_ERROR("KisTA",msg.c_str()); } assign_free_slots(required_channels, first_slot); // associates the assigned channels to the PE in the channel allocation table channel_allocation_table[src] = required_channels; // associates the first slot allocated to the PE in the first_slot allocation_table first_slot_allocation_table[src] = first_slot; // update the account of channels assigned n_allocated_channels += required_channels; #ifdef _REPORT_TDMA_BUS_CONFIGURATION msg = "TDMA bus "; msg += name(); msg += ": Assigning "; msg += std::to_string(required_channels); msg += " transmission channels (slots) from slot #"; msg += std::to_string(first_slot); msg += " to sender physical address (PE) "; msg+= src->name(); SC_REPORT_INFO("KisTA",msg.c_str()); #endif }
void sc_trace_file_base::set_time_unit( double v, sc_time_unit tu ) { if( initialized_ ) { std::stringstream ss; ss << filename_ << "\n" "\tTimescale unit cannot be changed once tracing has begun.\n" "\tTo change the scale, create a new trace file."; SC_REPORT_ERROR( SC_ID_TRACING_ALREADY_INITIALIZED_ , ss.str().c_str() ); return; } switch ( tu ) { case SC_FS: v = v * 1e-15; break; case SC_PS: v = v * 1e-12; break; case SC_NS: v = v * 1e-9; break; case SC_US: v = v * 1e-6; break; case SC_MS: v = v * 1e-3; break; case SC_SEC: break; default: { std::stringstream ss; ss << "unknown time unit:" << tu << " (" << filename_ << ")"; SC_REPORT_WARNING( SC_ID_TRACING_TIMESCALE_UNIT_ , ss.str().c_str() ); } } timescale_set_by_user = true; timescale_unit = v; // EMIT ADVISORY MESSAGE ABOUT CHANGE IN TIME SCALE: { std::stringstream ss; ss << sc_time( timescale_unit, SC_SEC ) << " (" << filename_ << ")"; SC_REPORT_INFO( SC_ID_TRACING_TIMESCALE_UNIT_, ss.str().c_str() ); } }