Professional Documents
Culture Documents
04 - SystemC
04 - SystemC
System C
2
1
System C – Concepts (1)
3
2
Why not simply C++ (1)
5
3
System C (library C++)
7
System C
8
History:
Version 1.0
Circa 2000
Basic Definition of the Language
Interconnect Model: VHDL signal semantics
Most Suitable for RTL modeling
Version 2.0
Circa 2002
Interconnect Model: channel
Suitable for System Level Modeling for
Hardware/Software Co-Design
João Leonardo Fragoso
4
System C
9
System C
10
tools:
EVE: Zebu- Hardware assisted co-modelling product
Forte: Synthesizer, ECS, Gigascale - high level synthesis, library
and full system verification environement
Future Design Automation: High Level Behavioral Synthesis
IKOS - Vstation co-modelling
Innoveda/summit - Visual Elite System Level Design - definition
and verification
LisaTEK - Embedded Processor Tool Suite
Mentor Graphics- Seamless C-bridge
5
System C
11
tools:
Synopsys: Cocentric serie - fied point designer, system C compiler,
Co-simulator, Synthesis of HW.
Tension: Converts Verilog to SystemC
TNI-Valiosys: simulation backplane and VHDL2SC
TOPS-SLD: TS-SLD - integrate into LSI design flow
Verisity: Specman - supports SystemC
Veritools: SuperC - Accelerated Co-simulation
Xilinx: FPGA system C flow
System C
12
Summary of tools:
3 Commercial SystemC simulators
4 Co-simulators
4 Links to Emulation
6 Synthesis tool
4 HDL to SystemC converter
2 SystemC extended libraries
3 Analysis, display, verification and checkers
6 System Level Modelling and Design Tools
6
System C
13
Types:
Includes all normal C++ data types:
bool,char,int,short,long,unsigned, float, double, and long
double and associated operators.
SystemC defines additional data types of the form sc_xx,
where xx denotes a specific type.
User defined types supported
7
System C types (2)
15
Initialization
Staticvariables can be initialized in the constructor
signals initialized only by assignment statements
8
System C
17
System C
18
Ports(sc_in<>,sc_out<>,sc_inout<>)
Modules have ports
Portshave types
A process can be made sensitive to ports/signals
sc_in<porttype>//input port of type porttype
sc_out<porttype>//output port of type porttype
sc_inout<porttype>//inout port of type porttype
sc_in<sc_logic> a[32];
Port read/write operations
Read and write using read() and write() method
9
System C
19
Arrays
supported but no direct assignment (like
C)
System C
20
10
System C
21
Clocks
Defined and started in two ways
sc_clock clock(“my clock”, 20, SC_NS); sc_start(200,SC_NS);
sc_initialize();
for (int i = 0; i <= 200; i++){
clock = 1;
sc_cycle(10,SC_NS);
clock = 0;
sc_cycle(10,SC_NS); }
System C
22
Reactivity
Waiting (wait(), wait_until(...) )
Watching (watching(...))
11
System C
23
Processes
Three process types
type 1: method
activated by signals in a "sensitivity list" and then runs to
completion
inactive until signals in sensitivity list are reactivated
System C
24
// dff.h
#include "systemc.h"
SC_MODULE(dff) {
sc_in<bool> din;
sc_in<bool> clock;
sc_out<bool> dout;
void doit();
SC_CTOR(dff) { // constructor
SC_METHOD(doit);
sensitive_pos << clock; // sensitivity list
}
};
// dff.cc
#include "systemc.h"
#include "dff.h"
void dff::doit() {
dout = din;
}
João Leonardo Fragoso
12
System C
25
System C
26
#include "systemc.h"
SC_MODULE(traff) {
// input ports
sc_in<bool> roadsensor;
sc_in<bool> clock;
// output ports
Traff.h sc_out<bool> NSred;
sc_out<bool> NSyellow;
sc_out<bool> NSgreen;
sc_out<bool> EWred;
sc_out<bool> EWyellow;
sc_out<bool> EWgreen;
void control_lights();
int i;
SC_CTOR(traff) { // constructor
SC_THREAD(control_lights); // Thread
Process
sensitive_pos << clock;
13
Traff.cc
System C
27
#include "systemc.h"
#include "traff.h"
void traff::control_lights() {
NSred = false;
NSyellow = false;
NSgreen = true;
EWred = true;
EWyellow = false;
EWgreen = false;
while (true) {
while (roadsensor.delayed() == false)
wait();
NSgreen = false; // road sensor triggered
NSyellow = true; // set NS to yellow
NSred = false;
for (i=0; i<5; i++)
System C
28
14
System C
29
System C
30
15
System C
31
System C
32
};
16
System C
33
System C
34
Example
17
System C
35
Example
18