Systemc Examples
Systemc Examples
Cpr E 588
RTL Model
Clk
DUT Simulation
Simulation Clock, Stimulus, Monitoring
Hierarchy
sc_signal: evaluate – update.
XOR
NAND
ASig FSig
NAND NAND
BSig
NAND
SC_MODULE(nand2)
{
sc_in<bool> A, B;
sc_out<bool> F; STIM XOR MON
SC_CTOR(nand2) { sc_signal:
SC_METHOD(do_nand2); evaluate/update channel, like a
sensitive << A << B; signal in VHDL or reg in Verilog
} The value do not changes (see
example)
};
Static ‘sensitivity’: defined at
registration, the only sensitivity
allowed for SC_METHOD
STIM
SC_MODULE(stim)
{
sc_out<bool> A, B;
sc_in<bool> clk;
void StimGen() {
A.write(false);
STIM XOR MON
B.write(false);
wait();
A.write(false);
B.write(true); Clk: special kind of signal.
wait(); sc_clock
A.write(true); TestClk("TestClock", 10,
B.write(false); SC_NS, 0.5, 1, SC_NS);
wait();
A.write(true);
B.write(true);
Clock drives the stimulus,
wait(); static sensitivity.
sc_stop(); Stimulus drives the rest of
}
the simulation.
SC_CTOR(stim) {
SC_THREAD(StimGen); Clocked SC_THREAD
sensitive << clk.pos();
}
};
STIM
SC_MODULE(mon)
{
sc_in<bool> A, B, F;
sc_in<bool> Clk;
SC_CTOR(mon) {
SC_THREAD(monitor);
sensitive << Clk.pos();
}
};
FIFO Communication (TLM)
Link_10
Link_01
0 1
Link_03
Ring
Link_30
Network
3 2