If you are running on the MPhil linux machines, then set up roughly as follows
SYSCDIR=/usr/groups/han/clteach/systemc/systemc-2.3.0 LDFLAGS= -L$(SYSCDIR)/lib-linux -lsystemc SOCDAM=/usr/groups/han/clteach/socdam CXXFLAGS=-Wno-deprecated -I$(SYSCDIR)/include -I$(SYSCDIR)/include/tlm_core/tlm_2
export SYSCDIR=/usr/groups/han/clteach/systemc/systemc-2.3.0 export LDFLAGS= -L$SYSCDIR/lib-linux -lsystemc export SOCDAM=/usr/groups/han/clteach/socdam export CXXFLAGS=-Wno-deprecated -I$SYSCDIR/include -I$SYSCDIR/include/tlm_core/tlm_2
Try this source file hworld1.cpp.
g++ $(CXXFLAGS) hworld1.cpp $(LDFLAGS) ./a.out
If you have enabled vcd tracing, output will be written to a vcd trace file.
This can be viewed using gtkwave.
Start gtkwave from the command line. Browse one level down in the signal
hierarchy and drag the signals of interest to the signals box.
Full src file hworld2.cpp.
Illustrating the sc_uint fixed-field operators.
SC_MODULE(fivebitcounter) { sc_in <bool> clk, reset, load; sc_out <sc_uint<5> > q; sc_out <sc_uint<5> > parallelin; SC_CTOR(fivebitcounter) { void clkme(); SC_METHOD(clkme); sensitive << clk.pos() << reset.pos(); } void clkme() { if (reset.read()) q = 0; else if (load.read()) q = parallelin.read(); else { int nv = q.read() + 1; printf("Five pending set to %i\n", nv); q = nv; } } };Console output log: note the 32 becomes a zero when stored in the field.
Five pending set to 31 Toggle at 4200 ns Toggle at 4250 ns Five pending set to 32 Toggle at 4300 ns Toggle at 4350 ns Five pending set to 1 Toggle at 4400 ns
END