Intro To SystemC1
Intro To SystemC1
Deian Tabakov
Rice University
Houston, TX
SystemC in a nutshell
A “system-level” modeling language
Several levels of abstraction (from purely functional to cycle
accurate pin-accurate)
Special attention to systems with embedded software
SystemC in a nutshell
A “system-level” modeling language
Several levels of abstraction (from purely functional to cycle
accurate pin-accurate)
Special attention to systems with embedded software
A library of C++ templates and classes for modeling
concurrent systems
Hardware-oriented data types
Communication mechanism
Concurrency model
SystemC in a nutshell
A “system-level” modeling language
Several levels of abstraction (from purely functional to cycle
accurate pin-accurate)
Special attention to systems with embedded software
A library of C++ templates and classes for modeling
concurrent systems
Hardware-oriented data types
Communication mechanism
Concurrency model
An event-driven simulation kernel for executing models
Available for free (Windows + Linux)
Example (nand.h)
#include "systemc.h"
n3(S1);
n3(B);
n3(S3);
void StimGen() {
A.write(false);
B.write(false);
wait(); // wait for the next clock tick
A.write(false);
B.write(true);
wait(); // wait for the next clock tick
...
sc_stop(); // notify kernel to stop simulation
}
SC_CTOR(stim) {
SC_THREAD(StimGen);
sensitive << Clk.pos();
}
};
Deian Tabakov Introduction to SystemC 10/29
Modeling an EXOR gate
Example (mon.h)
#include "systemc.h"
SC_MODULE(mon) {
sc_in<bool> A, B, F;
sc_in_clk Clk;
void Monitor() {
while(1) {
wait();
cout << sc_time_stamp() << "\t" << A.read()
<< " " << B.read() << " " << F.read() << endl;
}
}
SC_CTOR(mon) {
SC_THREAD(Monitor);
sensitive << Clk.pos();
sc_signal
SC_MODULE
sc_in SC_METHOD SC_MODULE
(Child Module) sc_out
(Child Modules)
sc_in SC_THREAD
module memory
(local variables)
Helper Method
sc_inout
Helper Method sc_out
Figure: SC MODULE
SC_CTOR(Module_name) {
// Body of the constructor
SC_THREAD(function2);
sensitive << input1 << clk;
}
};
Deian Tabakov Introduction to SystemC 15/29
Fundamentals of SystemC
Data types
Four-valued logic types (01XZ)
Arbitrary-precision integers
Time
SC SEC, SC MS, SC US, SC NS, etc.
sc time t1(42, SC NS) creates a time object representing
42 nanoseconds
Integer-valued model of time
ports
MODULE 2
MODULE 1
signals
MODULE 3
channels
Example (exor.h)
SC MODULE(exor) {
sc in<bool> A, B;
sc out<bool> F;
nand n1, n2, n3, n4;
sc signal<bool> S1, S2, S3;
...
For example, sc signal<T> implements two interfaces:
sc signal in if<T> and sc signal inout if<T>
#>