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

Subversion Repositories ecpu_alu

[/] [ecpu_alu/] [trunk/] [alu/] [systemc/] [gen_systemc.sh] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 leonous
cat <<EOF >sc_main.cpp
2
  #include "scv.h"
3
  #include "Valu_tb.h"
4
  #include "Valu_tb_alu_tb.h"
5
  int sc_main(int argc, char **argv) {
6
 
7
     sc_clock clk ("clk",10, 0.5, 3, true);
8
     sc_uint<16> anint;
9
     scv_smart_ptr<int> aptr ("aptr");
10
     aptr->keep_only(0, ((1<<16)-1));
11
     aptr->next();
12
     Valu_tb* top;
13
     top = new Valu_tb("top");   // SP_CELL (top, Vour);
14
     cout << "anint = " << anint<<endl;
15
     cout << "A=" << top->v->A << endl;
16
     cout << "Aptr=" << *aptr << endl;
17
     top->systemc_clk(clk);
18
 
19
  // Create trace file
20
  sc_trace_file *tf = sc_create_vcd_trace_file("tracefile");
21
  // Trace signals
22
  sc_trace(tf, top->systemc_clk, "top_systemc_clk");
23
  sc_trace(tf, top->v->A, "top_v_A");
24
  sc_trace(tf, top->v->B, "top_v_B");
25
  sc_trace(tf, top->v->Y, "top_v_Y");
26
 
27
     while (!Verilated::gotFinish()) { sc_start(1, SC_NS); }
28
     exit(0);
29
  }
30
EOF
31
cat <<EOF >verilog_sc.h
32
#include <cstdlib>
33
class verilog_sc {
34
public:
35
    // CONSTRUCTORS
36
    verilog_sc() {}
37
    ~verilog_sc() {}
38
    // METHODS
39
    // This function will be called from a instance created in Verilog
40
    inline uint32_t randomit() {
41
     return random() % (1 << 16);
42
    }
43
};
44
EOF
45
 
46
EXTRA_OPTS=$*
47
 
48
 verilator -sc \
49
-I$ALU_RTL \
50
-I/usr/local/scv/include \
51
-I/usr/local/scv/lib-linux \
52
-y $ALU_COMPONENTS/adder \
53
-v $ALU_COMPONENTS/barrel_shifter/simple/barrel_shifter_simple.temp.v \
54
-y $ALU_RTL \
55
-Wno-COMBDLY \
56
-Wno-UNOPTFLAT \
57
-Wno-WIDTH \
58
-Wno-STMTDLY \
59
$EXTRA_OPTS \
60
./alu_tb.v  \
61
--public \
62
--exe \
63
sc_main.cpp &> log
64
mv sc_main.cpp verilog_sc.h obj_dir/.

powered by: WebSVN 2.1.0

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