OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [src/] [Or1200MonitorSC.cpp] - Diff between revs 397 and 435

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 397 Rev 435
Line 69... Line 69...
  bool rsp_server_enabled = false;
  bool rsp_server_enabled = false;
  wait_for_stall_cmd_response = false; // Default
  wait_for_stall_cmd_response = false; // Default
  insn_count = insn_count_rst = 0;
  insn_count = insn_count_rst = 0;
  cycle_count = cycle_count_rst = 0;
  cycle_count = cycle_count_rst = 0;
 
 
  exit_perf_summary_enabled = true; // Simulation exit performance summary is 
  quiet = false;
                                    // on by default. Turn off with "-q" on the 
 
                                    // cmd line
 
  monitor_for_crash = false;
  monitor_for_crash = false;
  lookslikewevecrashed_count = crash_monitor_buffer_head = 0;
  lookslikewevecrashed_count = crash_monitor_buffer_head = 0;
 
 
  bus_trans_log_enabled = bus_trans_log_name_provided =
  bus_trans_log_enabled = bus_trans_log_name_provided =
    bus_trans_log_start_delay_enable = false; // Default
    bus_trans_log_start_delay_enable = false; // Default
Line 128... Line 126...
              monitor_for_crash = true;
              monitor_for_crash = true;
            }
            }
          else if ((strcmp(argv[i], "-q")==0) ||
          else if ((strcmp(argv[i], "-q")==0) ||
                   (strcmp(argv[i], "--quiet")==0))
                   (strcmp(argv[i], "--quiet")==0))
            {
            {
              exit_perf_summary_enabled = false;
              quiet = true;
            }
            }
          else if ((strcmp(argv[i], "-p")==0) ||
          else if ((strcmp(argv[i], "-p")==0) ||
                   (strcmp(argv[i], "--profile")==0))
                   (strcmp(argv[i], "--profile")==0))
            {
            {
              profiling_enabled = true;
              profiling_enabled = true;
Line 425... Line 423...
      // Do something if we have l.nop
      // Do something if we have l.nop
      switch (current_WbInsn)
      switch (current_WbInsn)
        {
        {
        case NOP_EXIT:
        case NOP_EXIT:
          r3 = accessor->getGpr (3);
          r3 = accessor->getGpr (3);
 
          if (!quiet)
 
            {
          ts = sc_time_stamp().to_seconds() * 1000000000.0;
          ts = sc_time_stamp().to_seconds() * 1000000000.0;
          std::cout << std::fixed << std::setprecision (2) << ts;
          std::cout << std::fixed << std::setprecision (2) << ts;
          std::cout << " ns: Exiting (" << r3 << ")" << std::endl;
          std::cout << " ns: Exiting (" << r3 << ")" << std::endl;
          perfSummary();
          perfSummary();
 
            }
          if (logging_enabled) statusFile.close();
          if (logging_enabled) statusFile.close();
          if (profiling_enabled) profileFile.close();
          if (profiling_enabled) profileFile.close();
          if (bus_trans_log_enabled) busTransLog.close();
          if (bus_trans_log_enabled) busTransLog.close();
          memdump();
          memdump();
          SIM_RUNNING=0;
          SIM_RUNNING=0;
          sc_stop();
          sc_stop();
          break;
          break;
 
 
        case NOP_REPORT:
        case NOP_REPORT:
 
          if (!quiet)
 
            {
          ts = sc_time_stamp().to_seconds() * 1000000000.0;
          ts = sc_time_stamp().to_seconds() * 1000000000.0;
          r3 = accessor->getGpr (3);
          r3 = accessor->getGpr (3);
          std::cout << std::fixed << std::setprecision (2) << ts;
          std::cout << std::fixed << std::setprecision (2) << ts;
          std::cout << " ns: report (" << hex << r3 << ")" << std::endl;
          std::cout << " ns: report (" << hex << r3 << ")" << std::endl;
 
            }
          break;
          break;
 
 
        case NOP_PRINTF:
        case NOP_PRINTF:
          ts = sc_time_stamp().to_seconds() * 1000000000.0;
          ts = sc_time_stamp().to_seconds() * 1000000000.0;
          std::cout << std::fixed << std::setprecision (2) << ts;
          std::cout << std::fixed << std::setprecision (2) << ts;
Line 455... Line 459...
 
 
        case NOP_PUTC:
        case NOP_PUTC:
          r3 = accessor->getGpr (3);
          r3 = accessor->getGpr (3);
          std::cout << (char)r3 << std::flush;
          std::cout << (char)r3 << std::flush;
          break;
          break;
 
 
        case NOP_CNT_RESET:
        case NOP_CNT_RESET:
 
          if (!quiet)
 
            {
          std::cout << "****************** counters reset ******************" << endl;
          std::cout << "****************** counters reset ******************" << endl;
          std::cout << "since last reset: cycles " << cycle_count - cycle_count_rst << ", insn #" << insn_count - insn_count_rst << endl;
          std::cout << "since last reset: cycles " << cycle_count - cycle_count_rst << ", insn #" << insn_count - insn_count_rst << endl;
          std::cout << "****************** counters reset ******************" << endl;
          std::cout << "****************** counters reset ******************" << endl;
          cycle_count_rst = cycle_count;
          cycle_count_rst = cycle_count;
          insn_count_rst = insn_count;
          insn_count_rst = insn_count;
          /* 3 separate counters we'll use for various things */
          /* 3 separate counters we'll use for various things */
 
            }
        case NOP_CNT_RESET1:
        case NOP_CNT_RESET1:
 
          if (!quiet)
 
            {
          std::cout << "**** counter1 cycles: " << std::setfill('0') << std::setw(10) << cycle_count - cycles_1 << " resetting ********" << endl;
          std::cout << "**** counter1 cycles: " << std::setfill('0') << std::setw(10) << cycle_count - cycles_1 << " resetting ********" << endl;
          cycles_1 = cycle_count;
          cycles_1 = cycle_count;
 
            }
          break;
          break;
        case NOP_CNT_RESET2:
        case NOP_CNT_RESET2:
 
          if (!quiet)
 
            {
          std::cout << "**** counter2 cycles: " << std::setfill('0') << std::setw(10) << cycle_count - cycles_2 << " resetting ********" << endl;
          std::cout << "**** counter2 cycles: " << std::setfill('0') << std::setw(10) << cycle_count - cycles_2 << " resetting ********" << endl;
          cycles_2 = cycle_count;
          cycles_2 = cycle_count;
 
            }
          break;
          break;
        case NOP_CNT_RESET3:
        case NOP_CNT_RESET3:
 
          if (!quiet)
 
            {
          std::cout << "**** counter3 cycles: " << std::setfill('0') << std::setw(10) << cycle_count - cycles_3 << " resetting ********" << endl;
          std::cout << "**** counter3 cycles: " << std::setfill('0') << std::setw(10) << cycle_count - cycles_3 << " resetting ********" << endl;
          cycles_3 = cycle_count;
          cycles_3 = cycle_count;
 
            }
          break;
          break;
        default:
        default:
          break;
          break;
        }
        }
 
 
Line 784... Line 801...
 
 
//! Function to calculate the number of instructions performed and the time taken
//! Function to calculate the number of instructions performed and the time taken
void
void
Or1200MonitorSC::perfSummary()
Or1200MonitorSC::perfSummary()
{
{
  if (exit_perf_summary_enabled)
  if (!quiet)
    {
    {
      double ts;
      double ts;
      ts = sc_time_stamp().to_seconds() * 1000000000.0;
      ts = sc_time_stamp().to_seconds() * 1000000000.0;
      int cycles = ts / (BENCH_CLK_HALFPERIOD*2); // Number of clock cycles we had
      int cycles = ts / (BENCH_CLK_HALFPERIOD*2); // Number of clock cycles we had
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.