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

Subversion Repositories tv80

[/] [tv80/] [trunk/] [sc_env/] [sc_env_top.cpp] - Diff between revs 94 and 95

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

Rev 94 Rev 95
Line 2... Line 2...
#include "systemperl.h"
#include "systemperl.h"
#include "env_memory.h"
#include "env_memory.h"
#include "tv_responder.h"
#include "tv_responder.h"
#include "Vtv80s.h"
#include "Vtv80s.h"
#include "SpTraceVcd.h"
#include "SpTraceVcd.h"
 
#include <unistd.h>
 
 
 
extern char *optarg;
 
extern int optind, opterr, optopt;
 
 
int sc_main(int argc, char *argv[])
int sc_main(int argc, char *argv[])
{
{
        sc_clock clk("clk125", 8, SC_NS, 0.5, 0.0, SC_NS);
        bool dumping = false;
 
        bool memfile = false;
 
        int index;
 
        char *dumpfile_name;
 
        char *mem_src_name;
 
        SpTraceFile *tfp;
 
 
 
        while ( (index = getopt(argc, argv, "d:i:")) != -1) {
 
                printf ("DEBUG: getopt optind=%d index=%d char=%c\n", optind, index, (char) index);
 
                if  (index == 'd') {
 
                        dumpfile_name = new char(strlen(optarg)+1);
 
                        strcpy (dumpfile_name, optarg);
 
                        dumping = true;
 
                        printf ("VCD dump enabled to %s\n", dumpfile_name);
 
                } else if (index == 'i') {
 
                        mem_src_name = new char(strlen(optarg)+1);
 
                        strcpy (mem_src_name, optarg);
 
                        memfile = true;
 
                }
 
        }
 
        sc_clock clk("clk125", 8, SC_NS, 0.5);
 
 
        sc_signal<bool> reset_n;
        sc_signal<bool> reset_n;
        sc_signal<bool> wait_n;
        sc_signal<bool> wait_n;
        sc_signal<bool> int_n;
        sc_signal<bool> int_n;
        sc_signal<bool> nmi_n;
        sc_signal<bool> nmi_n;
Line 93... Line 117...
    sc_trace (trace_file, halt_n, "halt_n");
    sc_trace (trace_file, halt_n, "halt_n");
    sc_trace (trace_file, busak_n, "busak_n");
    sc_trace (trace_file, busak_n, "busak_n");
    sc_trace (trace_file, di, "di");
    sc_trace (trace_file, di, "di");
    sc_trace (trace_file, dout, "dout");
    sc_trace (trace_file, dout, "dout");
    sc_trace (trace_file, addr, "addr");
    sc_trace (trace_file, addr, "addr");
 
 
    // Start Verilator traces
 
    Verilated::traceEverOn(true);
 
    SpTraceFile *tfp = new SpTraceFile;
 
    tv80s.trace (tfp, 99);
 
    tfp->open ("tv80.vcd");
 
    */
    */
 
 
 
    // Start Verilator traces
 
    if (dumping) {
 
        Verilated::traceEverOn(true);
 
        tfp = new SpTraceFile;
 
        tv80s.trace (tfp, 99);
 
        tfp->open (dumpfile_name);
 
    }
 
 
        // check for command line argument
        // check for command line argument
        if (argc > 1) {
        if (memfile) {
                env_memory0.load_ihex (argv[1]);
                printf ("Loading IHEX file %s\n", mem_src_name);
 
                env_memory0.load_ihex (mem_src_name);
        }
        }
 
 
        // set reset to 0 before sim start
        // set reset to 0 before sim start
        reset_n.write (0);
        reset_n.write (0);
 
 
    sc_start();
    sc_start();
    /*
    /*
    sc_close_vcd_trace_file (trace_file);
    sc_close_vcd_trace_file (trace_file);
    tfp->close();
 
    */
    */
 
    if (dumping)
 
        tfp->close();
 
 
    return 0;
    return 0;
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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