Exemplo n.º 1
0
uvm_phase_controller::uvm_phase_controller() 
{
    sc_time max_time; // the time at which sc_start() returns
    sc_time smallest_time = sc_get_time_resolution();


    m_stop_mode  = UVM_SC_STOP;
    m_stop_reason= UVM_STOP_REASON_DURATION_COMPLETE;


    max_time = SC_MAX_TIME;

    // TODO - Do we need to reduce the time here?  Post run is run after sc_stop anyway...
    // Original comment:
    // make the UVM timeouts be slightly less than when sc_start() returns
    // such that UVM is able to end the run phase
    m_global_timeout = max_time - smallest_time;
    m_duration = SC_MAX_TIME; 


    // Setup default common & uvm schedules (always present)
    m_pcommon_schedule = get_uvm_common_schedule();
    m_schedules.push_back(m_pcommon_schedule);

    m_puvm_schedule    = get_uvm_schedule();
    m_schedules.push_back(m_puvm_schedule);

}
Exemplo n.º 2
0
int
sc_main( int, char*[] )
{
    sc_set_time_resolution( 10, SC_NS );
    cout << sc_get_time_resolution() << endl;
    cout << sc_get_default_time_unit() << endl;

    return 0;
}
Exemplo n.º 3
0
bool
sc_trace_file_base::initialize()
{
    if( initialized_ )
      return false;

    initialized_ = true;

    if( !tracing_initialized_ ) {
        tracing_initialized_ = true;
        bool running_regression = ( getenv( "SYSTEMC_REGRESSION" ) != NULL );

        // hide some messages during regression
        if( running_regression ) {
          sc_report_handler::set_actions( SC_ID_TRACING_TIMESCALE_DEFAULT_
                                        , SC_INFO,    SC_DO_NOTHING );
          sc_report_handler::set_actions( SC_ID_TRACING_VCD_DUPLICATE_TIME_
                                        , SC_WARNING, SC_DO_NOTHING );
        }
    }

    // open trace file
    if(!fp) open_fp();

    // setup timescale
    if( !timescale_set_by_user )
    {
        timescale_unit = sc_get_time_resolution().to_seconds();

        std::stringstream ss;
        ss << sc_get_time_resolution() << " (" << filename_ << ")";
        SC_REPORT_INFO( SC_ID_TRACING_TIMESCALE_DEFAULT_
                      , ss.str().c_str() );
    }

    // initialize derived tracing implementation class (VCD/WIF)
    do_initialize();

    return initialized_;
}
Exemplo n.º 4
0
TraceSC::TraceSC (sc_core::sc_module_name  name,
		  Vorpsoc_top        *_traceTarget,
		  int argc,
		  char              *argv[]) :
  sc_module (name),
  traceTarget (_traceTarget)
{
#if VM_TRACE

  // Setup the name of the VCD dump file

  char* dumpName;
  char* dumpSuffix = "-vlt.vcd\0";
  char* dumpNameDefault = "vlt-dump.vcd\0";
  // We will be passed the current test-name when we're called
  if (argc > 1)
    {
      // Assume test name is first thing
      int testname_argv_index = 1;
      // Take the second argument as the test name and we'll 
      // concatendate "-vlt.vcd" on the end
      dumpName = (char*) malloc((strlen(argv[testname_argv_index] + 
					      strlen(dumpSuffix))*sizeof(char)));
      // Copy in the test name
      strcpy(dumpName, argv[testname_argv_index]);
      // Now add on the suffix
      strcat(dumpName, dumpSuffix);
      
      printf("VCD dumpfile: %s\n", dumpName);
    }
  else
    dumpName = dumpNameDefault;

  Verilated::traceEverOn (true);
  cout << "Enabling VCD trace" << endl;

  // Establish a new trace with its correct time resolution, and trace to
  // great depth.
  spTraceFile = new SpTraceVcdCFile ();
  setSpTimeResolution (sc_get_time_resolution ());
  traceTarget->trace (spTraceFile, 99);
  spTraceFile->open (dumpName);

  // Method to drive the dump on each clock edge
  SC_METHOD (driveTrace);
  sensitive << clk;
  
#endif
    
}	// TraceSC ()
Exemplo n.º 5
0
int sc_main (int argc, char *argv[] )
{
    sc_report_handler::set_actions("/IEEE_Std_1666/deprecated", SC_DO_NOTHING);

    sc_set_time_resolution(1,SC_NS);

    TLL6219::bootConfig bc = TLL6219::BCONF_LINUX;

    int i;
    for(i=1; i < argc; i++) {
        if (strcmp(argv[i], "u") == 0) {
          bc = TLL6219::BCONF_UBOOT;
        } else if (strcmp(argv[i], "l") == 0) {
          bc = TLL6219::BCONF_LINUX;
        } else if (strcmp(argv[i], "b") == 0) {
          bc = TLL6219::BCONF_BAREMETAL;
        } else {
          cout << "Usage: TLL_tlm2.0.exe [u|l|b]" << endl;
          cout << "       u = U-Boot: l = Linux:  b = Bare metal" << endl;
          exit(0);
          break;
        }
    }

    // Ignore some of the Warning messages
    icmIgnoreMessage ("ICM_NPF");

    cout << "Constructing." << endl;
    TLL5000 top("top", bc);

    cout << "default time resolution = " << sc_get_time_resolution() << endl;

    // start the simulation
    cout << "Starting sc_main." << endl;
    sc_start();

    cout << "Finished sc_main." << endl;
    return 0;                             // return okay status
}
Exemplo n.º 6
0
int sc_main (int argc, char *argv[]) {
  sc_signal<bool> clk, reset, clear;

  wait();
  wait (clk.posedge_event());
  wait (reset.negedge_event());

  // negedge_event() and posedge_event() methods can
  // be applied to a signal or a port to identify the
  // specific event.
  wait (clk.posedge_event() | reset.negedge_event() | clear.value_changed_event());

  // A value_changed_event() method is true when any
  // value change occu
  sc_signal<sc_uint<4> > ready;
  sc_signal<bool> data;

  wait (clk.value_changed_event() & data.posedge_event() & ready.value_changed_event());

  // The events can span over multiple simulation 
  // cycles. For example, if clk changes at 5ns, 
  // a positive edge on data occurs at 8ns and ready
  // changes at 10ns, then the wait is triggered at
  // time 10ns.

  wait (20, SC_NS); 

  // does NOT work with sc_bit or sc_logic:
  sc_signal<bool> speed_ctrl;

  wait (10, SC_NS, speed_ctrl.posedge_event());

  // Waits for positive edge to occur on speed_ctrl
  // for 10ns and then times out.
  wait (SC_ZERO_TIME);
  wait (0, SC_NS);

  sc_signal<sc_logic> sac;
  // sc_in<sc_logic> sync_reset;
  sc_signal<sc_logic> sync_reset;

  wait (sac.posedge_event());
  wait (sync_reset.negedge_event());

  sc_event write_back;

  // sensitive << write_back;
  wait (write_back);

  write_back.notify();
  write_back.notify (20, SC_NS);
  write_back.notify(SC_ZERO_TIME);

  // Trigger event in next delta cycle.
  write_back.cancel(); // Cancels a delayed notification.

  sc_out<bool> out_port;

  out_port.initialize(0);

  sc_time t_res;

  t_res = sc_get_time_resolution();
  cout << "The time resolution is " << sc_get_time_resolution() << endl;

  double time_in_dbl;
  sc_time time_res = sc_get_time_resolution();
  sc_time curr_time = sc_time_stamp();

  time_in_dbl = curr_time / time_res;
  cout << "Time as a double value is " << time_in_dbl << endl;

  time_in_dbl = sc_simulation_time();
  cout << "Time is " << time_in_dbl;

  sc_set_default_time_unit (100, SC_PS);
  sc_time t_unit (10, SC_NS);

  // NOT WORKING:
  // sc_set_default_time_unit (t_unit);
  sc_set_default_time_unit (100, SC_PS);

  sc_time tf_unit;

  tf_unit = sc_get_default_time_unit();

  // Wake up SC_METHOD process after 10ns:
  next_trigger (10, SC_NS);

  // Wake up SC_METHOD process on a rising edge 
  // of reset:
  next_trigger (reset.posedge_event());

  return 0;
}