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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [src/] [OrpsocMain.cpp] - Diff between revs 49 and 51

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

Rev 49 Rev 51
Line 43... Line 43...
 
 
#include "OrpsocMain.h"
#include "OrpsocMain.h"
 
 
#include "Vorpsoc_top.h"
#include "Vorpsoc_top.h"
#include "OrpsocAccess.h"
#include "OrpsocAccess.h"
 
#include "MemoryLoad.h"
 
 
//#if VM_TRACE
 
//#include <systemc.h>
 
#include <SpTraceVcdC.h>
#include <SpTraceVcdC.h>
//#endif
 
 
 
//#include "TraceSC.h"
//#include "TraceSC.h"
#include "ResetSC.h"
#include "ResetSC.h"
#include "Or1200MonitorSC.h"
#include "Or1200MonitorSC.h"
#include "UartSC.h"
#include "UartSC.h"
Line 105... Line 103...
  SpTraceVcdCFile *spTraceFile;
  SpTraceVcdCFile *spTraceFile;
 
 
  int time_val;
  int time_val;
  int cmdline_name_found=0;
  int cmdline_name_found=0;
 
 
 
  // Executable app load variables
 
  int do_program_file_load = 0; // Default: we don't require a file, we use the VMEM
 
  char* program_file; // Old char* style for program name
 
 
  // Verilator accessor
  // Verilator accessor
  OrpsocAccess    *accessor;
  OrpsocAccess    *accessor;
 
 
  // Modules
  // Modules
  Vorpsoc_top *orpsoc;          // Verilated ORPSoC
  Vorpsoc_top *orpsoc;          // Verilated ORPSoC
  //TraceSC          *trace;            // Drive VCD
 
 
  MemoryLoad *memoryload;       // Memory loader
 
 
  ResetSC          *reset;              // Generate a RESET signal
  ResetSC          *reset;              // Generate a RESET signal
  Or1200MonitorSC  *monitor;            // Handle l.nop x instructions
  Or1200MonitorSC  *monitor;            // Handle l.nop x instructions
  UartSC          *uart;                // Handle UART signals
  UartSC          *uart;                // Handle UART signals
 
 
  // Instantiate the Verilator model, VCD trace handler and accessor
  // Instantiate the Verilator model, VCD trace handler and accessor
  orpsoc     = new Vorpsoc_top ("orpsoc");
  orpsoc     = new Vorpsoc_top ("orpsoc");
  //trace      = new TraceSC ("trace", orpsoc, argc, argv);
 
  accessor   = new OrpsocAccess (orpsoc);
  accessor   = new OrpsocAccess (orpsoc);
 
 
 
  memoryload = new MemoryLoad (accessor);
 
 
  // Instantiate the SystemC modules
  // Instantiate the SystemC modules
  reset         = new ResetSC ("reset", BENCH_RESET_TIME);
  reset         = new ResetSC ("reset", BENCH_RESET_TIME);
  monitor       = new Or1200MonitorSC ("monitor", accessor, argc, argv);
  monitor       = new Or1200MonitorSC ("monitor", accessor, memoryload, argc, argv);
  uart          = new UartSC("uart"); // TODO: Probalby some sort of param
  uart          = new UartSC("uart"); // TODO: Probalby some sort of param
 
 
 
 
  // Parse command line options
  // Parse command line options
  // Default is for VCD generation OFF, only turned on if specified on command line
  // Default is for VCD generation OFF, only turned on if specified on command line
  dump_start_delay = 0;
  dump_start_delay = 0;
  dump_stop_set = 0;
  dump_stop_set = 0;
  dumping_now = 0;
  dumping_now = 0;
 
 
 
 
  // Search through the command line parameters for  options
  // Search through the command line parameters for  options
 
 
  if (argc > 1)
  if (argc > 1)
    {
    {
      for(int i=1; i<argc; i++)
      for(int i=1; i<argc; i++)
        {
        {
          if ((strcmp(argv[i], "-d")==0) ||
          if ((strcmp(argv[i], "-d")==0) ||
Line 158... Line 160...
                    (strcmp(argv[i], "--endtime")==0) )
                    (strcmp(argv[i], "--endtime")==0) )
            {
            {
              time_val = atoi(argv[i+1]);
              time_val = atoi(argv[i+1]);
              sc_time opt_end_time(time_val,TIMESCALE_UNIT);
              sc_time opt_end_time(time_val,TIMESCALE_UNIT);
              finish_time = opt_end_time;
              finish_time = opt_end_time;
              //if (DEBUG_TRACESC) cout << "* Commmand line opt: Sim. will end at " << finish_time.to_string() << endl;
 
              finish_time_set = 1;
              finish_time_set = 1;
            }
            }
          //#if VM_TRACE  
          else if ( (strcmp(argv[i], "-f")==0) ||
 
                    (strcmp(argv[i], "--program")==0) )
 
            {
 
              do_program_file_load = 1; // Enable program loading - will be done after sim init
 
              program_file = argv[i+1]; // Old char* style for program name
 
            }
          else if ( (strcmp(argv[i], "-s")==0) ||
          else if ( (strcmp(argv[i], "-s")==0) ||
                    (strcmp(argv[i], "--vcdstart")==0) )
                    (strcmp(argv[i], "--vcdstart")==0) )
            {
            {
              time_val = atoi(argv[i+1]);
              time_val = atoi(argv[i+1]);
              sc_time dump_start_time(time_val,TIMESCALE_UNIT);
              sc_time dump_start_time(time_val,TIMESCALE_UNIT);
              dump_start = dump_start_time;
              dump_start = dump_start_time;
              //if (DEBUG_TRACESC) cout << "* Commmand line opt: Dump start time set at " << dump_start.to_string() << endl;
 
              dump_start_delay = 1;
              dump_start_delay = 1;
              dumping_now = 0;
              dumping_now = 0;
            }
            }
          else if ( (strcmp(argv[i], "-t")==0) ||
          else if ( (strcmp(argv[i], "-t")==0) ||
                    (strcmp(argv[i], "--vcdstop")==0) )
                    (strcmp(argv[i], "--vcdstop")==0) )
            {
            {
              time_val = atoi(argv[i+1]);
              time_val = atoi(argv[i+1]);
              sc_time dump_stop_time(time_val,TIMESCALE_UNIT);
              sc_time dump_stop_time(time_val,TIMESCALE_UNIT);
              dump_stop = dump_stop_time;
              dump_stop = dump_stop_time;
              //if (DEBUG_TRACESC) cout << "* Commmand line opt: Dump stop time set at " << dump_stop.to_string() << endl;
 
              dump_stop_set = 1;
              dump_stop_set = 1;
            }
            }
          /* Depth setting of VCD doesn't appear to work, I think it's set during verilator script compile time */
          /* Depth setting of VCD doesn't appear to work,
 
             I think it's set during verilator script
 
             compile time */
          /*      else if ( (strcmp(argv[i], "-p")==0) ||
          /*      else if ( (strcmp(argv[i], "-p")==0) ||
                    (strcmp(argv[i], "--vcddepth")==0) )
                    (strcmp(argv[i], "--vcddepth")==0) )
            {
            {
              dump_depth = atoi(argv[i+1]);
              dump_depth = atoi(argv[i+1]);
              //if (DEBUG_TRACESC) cout << "* Commmand line opt: Dump depth set to " << dump_depth << endl;
 
              }*/
              }*/
          else if ( (strcmp(argv[i], "-h")==0) ||
          else if ( (strcmp(argv[i], "-h")==0) ||
                    (strcmp(argv[i], "--help")==0) )
                    (strcmp(argv[i], "--help")==0) )
            {
            {
              printf("\n  ORPSoC Cycle Accurate model usage:\n");
              printf("\n  ORPSoC Cycle Accurate model usage:\n");
              printf("  %s [-vh] [-d <file>] [-e <time>] [-s <time>] [-t <time>]",argv[0]);
              printf("  %s [-vh] [-f <file] [-d <file>] [-e <time>] [-s <time>] [-t <time>]",argv[0]);
              monitor->printSwitches();
              monitor->printSwitches();
              printf("\n\n");
              printf("\n\n");
              printf("  -h, --help\t\tPrint this help message\n");
              printf("  -h, --help\t\tPrint this help message\n");
              printf("  -e, --endtime\t\tStop the sim at this time (ns)\n");
              printf("  -e, --endtime\t\tStop the sim at this time (ns)\n");
 
              printf("  -f, --program\t\tLoad program from an OR32 ELF\n");
              printf("  -v, --vcdon\t\tEnable VCD generation\n");
              printf("  -v, --vcdon\t\tEnable VCD generation\n");
              printf("  -d, --vcdfile\t\tEnable and specify target VCD file name\n");
              printf("  -d, --vcdfile\t\tEnable and specify target VCD file name\n");
 
 
              printf("  -s, --vcdstart\tEnable and delay VCD generation until this time (ns)\n");
              printf("  -s, --vcdstart\tEnable and delay VCD generation until this time (ns)\n");
              printf("  -t, --vcdstop\t\tEnable and terminate VCD generation at this time (ns)\n");
              printf("  -t, --vcdstop\t\tEnable and terminate VCD generation at this time (ns)\n");
Line 305... Line 311...
  printf("* Beginning test\n");
  printf("* Beginning test\n");
 
 
  // Init the UART function
  // Init the UART function
  uart->initUart(25000000, 115200);
  uart->initUart(25000000, 115200);
 
 
 
  if (do_program_file_load) // Did the user specify a file to load?
 
    {
 
      cout << "* Loading program from " << program_file << endl;
 
      if (memoryload->loadcode(program_file,0,0) < 0)
 
        {
 
          cout << "* Error: executable file " << program_file << " not loaded" << endl;
 
        }
 
    }
 
  else // Load SRAM from VMEM file
 
    {
 
      accessor->do_ram_readmemh();
 
    }
 
 
  SIM_RUNNING = 1;
  SIM_RUNNING = 1;
 
 
  // First check how we should run the sim.
  // First check how we should run the sim.
  if (VCD_enabled || finish_time_set)
  if (VCD_enabled || finish_time_set)
    { // We'll run sim with step
    { // We'll run sim with step

powered by: WebSVN 2.1.0

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