ACS SystemC Examples: First Experiment (Hello World)

Setup Shell Env Vars

If you are running on the MPhil linux machines, then set up roughly as follows

    LDFLAGS= -L$(SYSCDIR)/lib-linux -lsystemc
    CXXFLAGS=-Wno-deprecated -I$(SYSCDIR)/include -I$(SYSCDIR)/include/tlm_core/tlm_2

the above is in the format for inclusion in a Makefile whereas a shell setup (in .bashrc) would be:
    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

Experiment 1

Try this source file hworld1.cpp.

        g++ $(CXXFLAGS) hworld1.cpp $(LDFLAGS)

Viewing Trace Files

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.

Experiment 2 : hworld2.cpp

Full src file hworld2.cpp.

Illustrating the sc_uint fixed-field operators.

  sc_in <bool> clk, reset, load;
  sc_out <sc_uint<5> > q;
  sc_out <sc_uint<5> > parallelin;

    void clkme();
    SC_METHOD(clkme); sensitive << clk.pos() << reset.pos();

  void clkme()
    if ( q = 0;
    else if ( q =;
        int nv = + 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