%HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief...
Transcript of %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief...
![Page 1: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/1.jpg)
$Q�,QWURGXFWLRQ�WR�6\VWHP& ����[
%HUQKDUG�1LHPDQQ)UDXQKRIHU�,QVWLWXWH�IRU,QWHJUDWHG�&LUFXLWV
IISFraunhofer Institut
Integrierte Schaltungen
h�'I(�**4�" �����
![Page 2: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/2.jpg)
2IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
2EMHFWLYHV
½This tutorial offers½ A short motivation for C based design flow½ A brief introduction to the most important SystemC 1.0.x
language elements½ A very short overview on refinement for synthesis½ A simple example program
½This tutorial does not½ provide a complete treatment of the SystemC language½ cover system level modeling with SystemC 2.0
![Page 3: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/3.jpg)
3IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
SystemC Introduction1
TopicUnit
Language Elements of SystemC 2
SystemC and Synthesis3
Simple Example4
Resources5
![Page 4: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/4.jpg)
4IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
+'/�%DVHG�)ORZ
Problems:Written specifications are incomplete and inconsistentTranslation to HDL is time consuming and error prone
C/C++C/C++
1. Conceptualize2. Simulate in C++3. Write specification document
4. Hand over specification document HDLHDL
5. Understand6. (Re)Implement in HDL7. (Re)Verify8. Synthesize from HDL
![Page 5: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/5.jpg)
5IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
C/C++C/C++
&���%DVHG�)ORZ
1. Conceptualize2. Simulate in C++3. Write specification document
4. Hand over • Executable specification• Testbench• Written specification
C/C++C/C++C/C++
5. Understand6. Refine in C++7. Verify reusing testbenches8. Synthesize from C++
![Page 6: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/6.jpg)
6IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
&DQ�&���EH�XVHG�DV�LV"
½SystemC supports½ Hardware style communication
½ Signals, protocols, etc.½ Notion of time
½ Time sequenced operations.½ Concurrency
½ Hardware and systems are inherently concurrent, i.e. they operate inparallel.
½ Reactivity½ Hardware is inherently reactive, it responds to stimuli and is in
constant interaction with its environment, which requires handling ofexceptions.
½ Hardware data types½ Bit type, bit-vector type, multi-valued logic type, signed and unsigned
integer types and fixed-point types.½ Integrated Simulation Kernel
½All these features are not supported by C++ as is
![Page 7: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/7.jpg)
7IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6\VWHP&�'HVLJQ�)ORZ
UTFUTF
TFTF
Partition
BehavioralBehavioral
RTLRTLabstract
RTOS
abstractRTOS
targetcode
targetcode NetlistNetlist
Refine
Refine
Refine
Refine
½ System/ Architectural Level½not synthesizable½event driven½abstract communication½abstract data types
½ Behavioral Level½synthesizable ½clocked½I/O cycle accurate½algorithmic description
½ RT Level½synthesizable ½clocked½FSM½data path
Software Hardware
![Page 8: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/8.jpg)
8IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
'HYHORSLQJ�6\VWHP&���$Q�2YHUYLHZ
class libraryand
simulation kernel source files for systemand testbenches
your standardC/C++ development
environment
compiler
linker
debugger
libraries
header files
„e xecutable
specif icatio n“
......
.
....
executable = simulator
sim.x
ASIC
IP-Core
Interface
DSP
make
![Page 9: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/9.jpg)
9IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
Module
0RGHO�6WUXFWXUH���6\VWHP�/HYHO
Algorithm
Channel (implements I/F)Channel (implements I/F)
InterfaceInterface
Port (accesses a channel’s I/F)Port (accesses a channel’s I/F)
Process (reads data from input portsand writes data to output ports)Process (reads data from input portsand writes data to output ports)
SystemC 2.x
o Moduleo Porto Interfaceo Channelo Process
![Page 10: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/10.jpg)
10IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGHO�6WUXFWXUH���,PSOHPHQWDWLRQ�/HYHO
Algorithm
Hardware signalHardware signalSpecial ports to access the hardware signalSpecial ports to access the hardware signal
Process (reads data from input portsand writes data to output ports)Process (reads data from input portsand writes data to output ports)
Module
SystemC 1.0.x
o Moduleo Special Portso Hardware Signalo Process
![Page 11: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/11.jpg)
11IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
%DVLF�6\VWHP�6WUXFWXUH
main.cppmain.cpp
stimgen.cppstimgen.cpp
stimgen.hstimgen.h
algo.cppalgo.cpp
algo.halgo.h
monitor.cppmonitor.cpp
monitor.hmonitor.h
DUT
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
in1 in2
out
Algorithm
DUT
![Page 12: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/12.jpg)
12IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
&RPSDULVRQ�6\VWHP&�����[���9+'/
VHDL SystemC
½ Hierarchy entity module
½ Connection port port
½ Communication signal signal
½ Functionality process process
½ Test Bench object orientation
½ System Level channel, interface, event
abstract data types
½ I/O simple file I/O C++ I/O capabilities
![Page 13: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/13.jpg)
13IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
SystemC Introduction1
TopicUnit
Language Elements of SystemC 2
SystemC and Synthesis3
Simple Example4
Resources5
![Page 14: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/14.jpg)
14IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
TopicUnit
Language Elements of SystemC2
Data Types2.1
Processes2.2
Hierarchy2.3
Modules, Ports and Signals2.1
![Page 15: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/15.jpg)
15IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
'DWD�7\SHV�2YHUYLHZ
½ C++ built in data types may be used but are not adequate tomodel Hardware.
½ long, int, short, char, unsigned long, unsigned int,unsigned short, unsigned char, float, double, long double,and bool.
½ SystemCTM provides other types that are needed for Systemmodeling.
½ Scalar boolean types: sc_logic, sc_bit½ Vector boolean types: sc_bv<length>, sc_lv<length>½ Integer types: sc_int<length>, sc_uint<length>,
sc_bigint<length>, sc_biguint<length>½ Fixed point types: sc_fixed, sc_ufixed
![Page 16: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/16.jpg)
16IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
Hint: You may use a profiling tool, which tells you, how muchtime you spent in which function call, to control simulationspeed.
:KHQ�WR�XVH�ZKLFK�'DWD�7\SHV����
To get fast simulations, you have to choose the right data type
½use builtin C/C++ data types as much as possible½use sc_int/sc_uint
½ integer with up to 64 bits½ model arithmetic and logic operations
½use sc_bit/sc_bv½ arbitrary length bit vector½ model logic operations on bit vectors½ two valued logic
½use sc_logic/sc_lv½ 4 valued logic vectors½ model tri-state behavior
Fastest
Slowest
![Page 17: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/17.jpg)
17IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
Hint: You may use a profiling tool, which tells you, how muchtime you spent in which function call, to control simulationspeed.
:KHQ�WR�XVH�ZKLFK�'DWD�7\SHV����
To get fast simulations, you have to choose the right data type
½use sc_bigint/sc_biguint½ integer with arbitrary length½ use to model arithmetic operations on large bit vectors½ ineffective for logic operations
½use sc_fixed/sc_ufixed½ arbitrary precision fixed point½ use to model fixed point artihmetic½ ineffective for logic operations
Fastest
Slowest
![Page 18: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/18.jpg)
18IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
VFBLQW��VFBXLQW��VFBELJLQW��VFBELJXLQW�6\QWD[Syntax: sc_int<length> variable_name ;
sc_uint<length> variable_name ;sc_bigint<length> variable_name ;sc_biguint<length> variable_name ;length:
½ Specifies the number of elements in the array½ Must be greater than 0½ Must be compile time constant
½ Use [] to bit select and range() to part select.½ Rightmost is LSB(0), Leftmost is MSB (n-1)
Syntax: sc_int<length> variable_name ;
sc_uint<length> variable_name ;sc_bigint<length> variable_name ;sc_biguint<length> variable_name ;length:
½ Specifies the number of elements in the array½ Must be greater than 0½ Must be compile time constant
½ Use [] to bit select and range() to part select.½ Rightmost is LSB(0), Leftmost is MSB (n-1)
sc_int<5> a; // a is a 5-bit signed integersc_uint<44> b; // b is a 44-bit unsigned integersc_bigint<5> c;c = 13; // c gets 01101, c[4] = 0, c[3] = 1, …, a[0] = 1bool d;d = c[4]; // d gets 0d = c[3]; // d gets 1sc_bigint<3> e;
e = c.range(3, 1); // e gets 110 - interpreted as -2
sc_int<5> a; // a is a 5-bit signed integersc_uint<44> b; // b is a 44-bit unsigned integersc_bigint<5> c;c = 13; // c gets 01101, c[4] = 0, c[3] = 1, …, a[0] = 1bool d;d = c[4]; // d gets 0d = c[3]; // d gets 1sc_bigint<3> e;
e = c.range(3, 1); // e gets 110 - interpreted as -2
![Page 19: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/19.jpg)
19IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
TopicUnit
Language Elements of SystemC2
Data Types2.1
Processes2.2
Hierarchy2.3
Modules, Ports and Signals2.1
![Page 20: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/20.jpg)
20IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGXOH½ A module is a container. It is the
basic building block of SystemC½ Similar to VHDL “entity”
½ Module interface in the header file(ending .h)
½ Module functionality in theimplementation file (ending .cpp)
½ Module contains:½ Ports½ Internal signal variables½ Internal data variables½ Processes of different types½ Other methods½ Instances of other modules½ Constructor
main.cppmain.cpp
stimgen.cppstimgen.cpp
stimgen.hstimgen.h
algo.cppalgo.cpp
algo.halgo.h
monitor.cppmonitor.cpp
monitor.hmonitor.h
DUT
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
![Page 21: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/21.jpg)
21IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGXOH�6\QWD[
Syntax:
SC_MODULE(module_name){
// body of module
};
Syntax:
SC_MODULE(module_name){
// body of module
};
EXAMPLE:
SC_MODULE(my_module) {
// body of module
};
EXAMPLE:
SC_MODULE(my_module) {
// body of module
};
Code in header file:my_module.h
Code in header file:my_module.h
Note: SC_MODULE is a macro forstruct module_name : sc_module
Note the semicolon at theend of the module definition
Note the semicolon at theend of the module definition
SC_MODULE{ o Portso Signalso Variableso Constructoro Processeso Modules};
![Page 22: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/22.jpg)
22IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
%DVLF�0RGHOLQJ�6WUXFWXUH
Module
Instance
Module
InstanceModule
Instance
Module
Instance
ProcessProcess
Other
Method
Other
Method
Signal connecting modules (declared inmodule)Signal connecting modules (declared inmodule)
Ports bound directly toeach other (no signal)Ports bound directly toeach other (no signal)
PortsPorts
Process can read/writeports and signalsProcess can read/writeports and signals
Other methods canread/write ports and signalsOther methods canread/write ports and signals
MODULE
SC_MODULE{ o Portso Signalso Variableso Constructoro Processeso Modules};
![Page 23: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/23.jpg)
23IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
3RUWV���2YHUYLHZ½ Ports are the external interface of a module
½ Pass information to and from a module½ There are three different kinds of ports
½ input½ output½ inout
½ Ports are always bound to signals½ exception: port-to-port binding (explained later)
½ Ports are members of the module½ Each port has a data type
½ passed as template parameter
DUTin1
in2out
ResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
SC_MODULE{ ã Portso Signalso Variableso Constructoro Processeso Modules};
![Page 24: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/24.jpg)
24IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
3RUWV���'HFODUDWLRQ
½ Ports have to be declared inside a module½ The direction of the port is specified by the port type
½ input: sc_in<>½ output: sc_out<>½ inout: sc_inout<>
½ The data type is passed as template parameter
Declaration as data members of the module:SC_MODULE(my_mod) {
sc_in<t_data> port_name;sc_out<t_data> port_name;sc_inout<t_data> port_name;
};
t_data:½ data type of the port
Declaration as data members of the module:SC_MODULE(my_mod) {
sc_in<t_data> port_name;sc_out<t_data> port_name;sc_inout<t_data> port_name;
};
t_data:½ data type of the port
SC_MODULE{ ã Portso Signalso Variableso Constructoro Processeso Modules};
![Page 25: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/25.jpg)
25IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LJQDOV���2YHUYLHZ½ Signals are used for communication
½ Exchange of data in a concurrent execution semantics½ between modules½ between processes
½ There is only one kind of signal½ Signals always carry a value½ Signals need not necessarily be bound to ports
½ may also be used for communication between processes
½ Signals may be½ members of a module (used for internal communication)½ used at top-level to connect the modules
½ Each signal has a data type½ passed as template parameter
SC_MODULE{ o Portsã Signalso Variableso Constructoro Processeso Modules};
DUTin1
in2out
ResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
![Page 26: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/26.jpg)
26IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LJQDOV���'HFODUDWLRQ
½ Signals are declared inside a module or at top level½ There is only one type of signal
½ sc_signal<>
½ The data type is passed as template parameter
Declaration as data members of the module:SC_MODULE(my_mod) {
sc_signal<t_data> signal_name;};
t_data:½ data type of the signal
Declaration as data members of the module:SC_MODULE(my_mod) {
sc_signal<t_data> signal_name;};
t_data:½ data type of the signal
SC_MODULE{ o Portsã Signalso Variableso Constructoro Processeso Modules};
![Page 27: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/27.jpg)
27IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
3RUWV�DQG�6LJQDOV���([DPSOH
SC_MODULE(module_name) {// portssc_in<int> a;sc_out<bool> b;sc_inout<sc_bit> c;
// signalssc_signal<int> d;sc_signal<char> e;sc_signal<sc_int<10> > f;
// rest};
SC_MODULE(module_name) {// portssc_in<int> a;sc_out<bool> b;sc_inout<sc_bit> c;
// signalssc_signal<int> d;sc_signal<char> e;sc_signal<sc_int<10> > f;
// rest};
½ Declaring ports and signals within a module½ ports and signals are data members of the module½ good style to declare
½ ports at the beginning of the module½ signals after port declaration
Note: a space isrequired by the C++compiler
Note: a space isrequired by the C++compiler
SC_MODULE{ ã Portsã Signalso Variableso Constructoro Processeso Modules};
![Page 28: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/28.jpg)
28IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
recommendedrecommended
3RUWV�DQG�6LJQDOV���5HDG�DQG�:ULWH½To read a value from a port or signal
½ use assignment½ use the .read() method (recommended)
½To write a value to a port or signal½ use assignment½ use the .write() method (recommended)
½The usage of .read() and .write() avoids implicit type conversion,which is a source of many compile time errors
sc_signal<int> sig;
int a;
...
a = sig;
sig = 10;
sc_signal<int> sig;
int a;
...
a = sig;
sig = 10;
sc_signal<int> sig;
int a;
...
a = sig.read();
sig.write(10);
sc_signal<int> sig;
int a;
...
a = sig.read();
sig.write(10);
SC_MODULE{ ã Portsã Signalso Variableso Constructoro Processeso Modules};
![Page 29: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/29.jpg)
29IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
�'DWD�9DULDEOHV
Example:
SC_MODULE(count) {
// ports & signals not shown
int count_val; // internal data stroage
sc_int<8> mem[512] // array of sc_int
// Body of module not shown
};
Example:
SC_MODULE(count) {
// ports & signals not shown
int count_val; // internal data stroage
sc_int<8> mem[512] // array of sc_int
// Body of module not shown
};
½ Data variables are member variables of a module½ any legal C/C++ and SystemC/user defined data type½ internal to the module½ should not be used outside of the module½ useful to store the internal state of a module
½ e.g. usage as memory
SC_MODULE{ o Portso Signalsã Variableso Constructoro Processeso Modules};
![Page 30: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/30.jpg)
30IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGXOH�&RQVWUXFWRU
½ Each module has a constructor½ Called at the instantiation of the module
½ initialize internal data structure (e.g. check port-signalbinding)
½ initialize all data members of the module to a known state
½ Instance name passed as argument½ useful for debugging/error reporting
½ Processes are registered inside the constructor (morelater)
½ Sub-modules are instanciated inside the constructor(more later)
SC_MODULE{ o Portso Signalso Variablesã Constructoro Processeso Modules};
![Page 31: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/31.jpg)
31IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGXOH�&RQVWUXFWRU���([DPSOH
Example:
SC_MODULE (my_module) {// Ports, internal signals, processes, other methods// ConstructorSC_CTOR(my_module) {// process registration & declarations of sensitivity lists// module instantiations & port connection declarations
}};
Example:
SC_MODULE (my_module) {// Ports, internal signals, processes, other methods// ConstructorSC_CTOR(my_module) {// process registration & declarations of sensitivity lists// module instantiations & port connection declarations
}};
Note: SC_CTOR is a macro fortypedef name SC_CURRENT_USER_MODULE; \name(sc_module_name)
Code in header file:
module_name.h
Code in header file:
module_name.h
SC_MODULE{ o Portso Signalso Variablesã Constructoro Processeso Modules};
![Page 32: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/32.jpg)
32IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
TopicUnit
Language Elements of SystemC2
Data Types2.1
Processes2.2
Hierarchy2.3
Modules, Ports and Signals2.1
![Page 33: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/33.jpg)
33IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
3URFHVV�3URSHUWLHV����
½ Functionality of a SystemC model is described in processes.
½ Processes are member functions of a module. They are registeredto the SystemC simulation kernel.
½ Processes are called by the simulation kernel, whenever a signal intheir sensitivity list is changing.
½ Some processes execute when called and return control to the callingfunction (behave like a function).
½ Some processes are called once, and then can suspend themselvesand resume execution later (behave like threads).
½ Processes are not hierarchical½ Cannot have a process inside another process (use module for
hierarchical design)
SC_MODULE{ o Portso Signalso Variableso Constructorã Processeso Modules};
![Page 34: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/34.jpg)
34IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
3URFHVV�3URSHUWLHV����
½ Processes use signals to communicate with each other.½ Don’t use global variables - may cause order dependencies in
code (very bad).
½ Processes use timing control statements to implementsynchronization and writing of signals in processes (explainedlater).
½ Process and signal updates follow the evaluate-updatesemantics of SystemC.
½ Processes are registered to the simulation kernel within themodule’s constructor.
SC_MODULE{ o Portso Signalso Variableso Constructorã Processeso Modules};
![Page 35: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/35.jpg)
35IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6\VWHP&�3URFHVVHV
½SC_METHOD (sc_async_fprocess)½process executes everything and wakes up at next event½good for modeling combinational logic½synchronous logic is sensitive to clock edge
½SC_THREAD (sc_async_tprocess)½execution is suspended on wait() until next event
½SC_CTHREAD (sc_sync_tprocess)½execution is suspended on wait() until next active clock edge½within one process can be only registers sensitive to one clock
edge
SC_MODULE{ o Portso Signalso Variableso Constructorã Processeso Modules};
![Page 36: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/36.jpg)
36IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$V\QF��)XQFWLRQ�3URFHVV�&KDUDFWHULVWLFV
½Asynchronous Function Process SC_METHOD:½ Is sensitive to a set of signals
½ This set is called sensitivity list½ May be sensitive to any change on a signal½ May be sensitive to the positive or negative edge of a boolean
signal
½ Is invoked whenever any of the inputs it is sensitive to changes.½ Once an asynchronous function process is invoked:
½ Entire body of the block is executed.½ Instructions are executed infinitely fast (in terms of internal simulation
time).½ Instructions are executed in order.
Processes
ã SC_METHODo SC_THREADo SC_CTHREAD
![Page 37: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/37.jpg)
37IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$V\QFKURQRXV�)XQFWLRQ�3URFHVV�8VDJH
½Asynchronous Function Process SC_METHOD:½ Model combinational logic
½ multiplexing, bit extraction, bit manipulation, arith. operations...
½ Model sequential logic½ use a SC_METHOD process sensitive to only on clock edge to update the
registers½ use another SC_METHOD process sensitive to all values to be read within
this process to calculate new values
½ Monitor signals as part of a testbench
½ Use for RT level modeling
½ Model event driven systems (architectural level)
Processes
ã SC_METHODo SC_THREADo SC_CTHREAD
![Page 38: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/38.jpg)
38IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
'HILQLQJ�WKH�6HQVLWLYLW\�/LVW�RI�D�3URFHVV
½To define the sensitivity list for any process type use½ sensitive with the () operator
½ takes a single port or signal as an argument½ e.g. sensitive(sig1); sensitive(sig2); sensitive(sig3);
½ sensitive with stream notation (operator <<)½ takes an arbitrary number of arguments½ e.g. sensitive << sig1 << sig2 << sig3;
½ sensitive_pos with either () or << operator½ defines sensitivity to positive edge of boolean signal or clock½ e.g. sensitive_pos << clk;
½ sensitive_neg with either () or << operator½ defines sensitivity to negative edge of boolean signal or clock½ e.g. sensitive_neg << clk;
Processes
ã SC_METHODã SC_THREADo SC_CTHREAD
![Page 39: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/39.jpg)
39IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6&B0(7+2'
SC_MODULE( my_module ) { sc_in_clk clk; sc_in<bool> reset_n;
sc_in<int> in1; sc_in<int> in2;
sc_out<int> out1; sc_out<int> out2;
sc_signal<int> sig1; sc_signal<int> sig2;
int _internal;
void proc1();
SC_CTOR( my_module ) { SC_METHOD( proc1 ); sensitive << in1 << sig1; }};
void my_module::proc1(){ int inc = 5; inc++;
sig2 = in1.read() + sig1 + inc;}
State of internal variables not preserved=> expression evaluates tosig2 = in1+sig1+6each time the process is executed.
State of internal variables not preserved=> expression evaluates tosig2 = in1+sig1+6each time the process is executed.
Processes
ã SC_METHODo SC_THREADo SC_CTHREAD
![Page 40: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/40.jpg)
40IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$V\QF��7KUHDG�3URFHVV�&KDUDFWHULVWLFV
½Asynchronous Thread Process SC_THREAD:½ Is sensitive to a set of signals
½ This set is called sensitivity list½ May be sensitive to any change on a signal½ May be sensitive to the positive or negative edge of a boolean signal
½ Is reactivated whenever any of the inputs it is sensitive to changes.½ Once an asynchronous thread process is reactivated:
½ Instructions are executed infinitely fast (in terms of internal simulationtime) until the next occurrence of a wait() statement.
½ Instructions are executed in order.½ The next time the process is reactivated execution will continue after thewait() statement.
Processes
o SC_METHODã SC_THREADo SC_CTHREAD
![Page 41: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/41.jpg)
41IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$V\QFKURQRXV�7KUHDG�3URFHVV�8VDJH
½Asynchronous Thread Process SC_THREAD:½ May be used to model synchronous AND asynchronous behavior
(even in the same process).
½ Most useful at higher levels of abstraction (esp. with SystemC 2.0)
½ Has to be replaced by asynchronous function or synchronous threadprocess during refinement.
½ May be used in test benches.
Processes
o SC_METHODã SC_THREADo SC_CTHREAD
![Page 42: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/42.jpg)
42IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
7LPLQJ�&RQWURO�6WDWHPHQWV
½ Implement synchronization and writing of signals in processes.½ wait() suspends execution of the process until the process is
invoked again.
½ If no timing control statement used:½ Process executes in zero time.½ Outputs are never visible.
½ To write to an output signal, a process needs to invoke a timingcontrol statement.
½ Multiple interacting synchronous processes must have at leastone timing control statement in every path.
Processes
o SC_METHODã SC_THREADã SC_CTHREAD
![Page 43: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/43.jpg)
43IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
7KUHDG�3URFHVVHV��ZDLW���)XQFWLRQ½ wait() may be used in both SC_THREAD and SC_CTHREAD processes
but NOT in an SC_METHOD process (block).
½ wait() suspends execution of the process until the process isinvoked again.
½ wait(<pos_int>) may be used to wait for a certain number ofcycles (SC_CTHREAD only).
½ In Synchronous process (SC_CTHREAD)½ Statements before the wait() are executed in one cycle.½ Statements after the wait() are executed the next cycle.
½ In Asynchronous process (SC_THREAD)½ Statements before the wait() are executed in last event.½ Statements after the wait() are executed the next event.
Examples:wait() ; // waits 1 cycle in synchronous processwait(4); // waits 4 cycles in synchronous processwait(4) ; //ERROR!! in Asynchronous process
Examples:wait() ; // waits 1 cycle in synchronous processwait(4); // waits 4 cycles in synchronous processwait(4) ; //ERROR!! in Asynchronous process
Processes
o SC_METHODã SC_THREADã SC_CTHREAD
![Page 44: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/44.jpg)
44IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6&B7+5($'
SC_MODULE( my_module ) { sc_in_clk clk; sc_in<bool> reset_n;
sc_in<int> in1; sc_in<int> in2;
sc_out<int> out1; sc_out<int> out2;
sc_signal<int> sig1; sc_signal<int> sig2;
int _internal;
void proc2();
SC_CTOR( my_module ) { SC_THREAD( proc2 ); sensitive << in2 << sig2; }};
void my_module::proc2(){ // start-up functionality goes here int inc = 1;
while(1) { out1.write(in2.read() + sig2 + inc); ++inc; wait(); }}
State of internal variables is preserved =>the value of inc is incremented by oneeach time the process is reactivated.
State of internal variables is preserved =>the value of inc is incremented by oneeach time the process is reactivated.
Processes
o SC_METHODã SC_THREADo SC_CTHREAD
![Page 45: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/45.jpg)
45IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6\QF��7KUHDG�3URFHVVHV�&KDUDFWHULVWLFV����
½Synchronous process SC_CTHREAD:½ Sensitive only to one edge of one and only one clock
½ Called the active edge
½ Special case of a SC_THREAD process½ Cannot use multiple clocks with a synchronous process
½ Triggered only at active edge of its clock½ Therefore inputs are sampled only at the active edge.
½ It is not triggered if inputs other than the clock change.
½ Models the behavior of unregistered inputs and registered outputs
Processes
o SC_METHODo SC_THREADã SC_CTHREAD
![Page 46: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/46.jpg)
46IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6\QF��7KUHDG�3URFHVVHV�&KDUDFWHULVWLFV����
½Synchronous process SC_CTHREAD:½ Once invoked the statements execute until a wait()
statement is encountered.½ At the wait()statement, the process execution is suspended½ At the next execution, process execution starts from the
statement after the wait()statement½ Local variables defined in the process function are saved
each time the process is suspended.
Tip: Use wait(<pos_int>); to wait for multiple clock cycles.
Processes
o SC_METHODo SC_THREADã SC_CTHREAD
![Page 47: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/47.jpg)
47IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6\QFKURQRXV�7KUHDG�3URFHVV���,�2�7LPLQJ
1 35
13 18
14
in1
in2
out
clock
in2
in1
out
while (true) { out = in1 + in2; wait( );}
in1
in2
out
Processes
o SC_METHODo SC_THREADã SC_CTHREAD
1 35
13 18
in1
in2
out
clock
14 53
SystemC 1.0.x SystemC 2.0
![Page 48: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/48.jpg)
48IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6\QFKURQRXV�7KUHDG�3URFHVV�8VDJH
½Synchronous Thread Process SC_CTHREAD:½ Useful for high level synthesis.
½ Modeling of synchronous systems.
½ Modeling of sequential logic.
½ Models the behavior of a block with unregistered inputs andregistered outputs.
½ Useful for modeling drivers in test benches.
Processes
o SC_METHODo SC_THREADã SC_CTHREAD
![Page 49: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/49.jpg)
49IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6&B&7+5($'
SC_MODULE( my_module ) { sc_in_clk clk; sc_in<bool> reset_n;
sc_in<int> in1; sc_in<int> in2;
sc_out<int> out1; sc_out<int> out2;
sc_signal<int> sig1; sc_signal<int> sig2;
int _internal;
void proc3();
SC_CTOR( my_module ) { SC_CTHREAD( proc3, clk.pos() ); }};
void my_module::proc3(){ // start-up functionality goes here int inc = 1;
while(1) { out2.write(inc); sig2 = sig2 + inc; ++inc; wait(); }}
State of internal variables is preserved =>the value of inc is incremented by at eachpositive clock edge.
State of internal variables is preserved =>the value of inc is incremented by at eachpositive clock edge.
Processes
o SC_METHODo SC_THREADã SC_CTHREAD
![Page 50: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/50.jpg)
50IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
TopicUnit
Language Elements of SystemC2
Data Types2.1
Processes2.2
Hierarchy2.3
Modules, Ports and Signals2.1
![Page 51: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/51.jpg)
51IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGHOLQJ�+LHUDUFK\���2YHUYLHZ
½Systems are modeled hierarchically½ SystemC has to provide a mechanism for hierarchy
½Solution½ Modules may contain instances of other modules
in sub_a
top
sub_b
top
sub_a sub_b
SC_MODULE{ o Portso Signalso Variableso Constructoro Processesã Modules};
a_in a_out outb_in b_outsig
![Page 52: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/52.jpg)
52IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGHOLQJ�+LHUDUFK\���'HILQH�,QWHUQDO�6LJQDOVSC_MODULE{ o Portso Signalso Variableso Constructoro Processesã Modules};
SC_MODULE(top){ sc_in<int> in; sc_out<int> out;
sc_signal<int> sig;
sub_a* inst1; sub_b* inst2; ....};
SC_MODULE(top){ sc_in<int> in; sc_out<int> out;
sc_signal<int> sig;
sub_a* inst1; sub_b* inst2; ....};
½ Define member variablesfor all the internal signalsthat are needed to connectthe child module’s ports toeach other.
½ Note: a port of the parentmodule is directly bound toa port of the child module(no signal needed).
½ Define member variablesfor all the internal signalsthat are needed to connectthe child module’s ports toeach other.
½ Note: a port of the parentmodule is directly bound toa port of the child module(no signal needed).
in sub_a
top
sub_ba_in a_out outb_in b_outsig
![Page 53: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/53.jpg)
53IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGHOLQJ�+LHUDUFK\���'HILQH�3RLQWHUVSC_MODULE{ o Portso Signalso Variableso Constructoro Processesã Modules};
SC_MODULE(top){ sc_in<int> in; sc_out<int> out;
sc_signal<int> sig;
sub_a* inst1; sub_b* inst2; ....};
SC_MODULE(top){ sc_in<int> in; sc_out<int> out;
sc_signal<int> sig;
sub_a* inst1; sub_b* inst2; ....};
½ Define member variablesthat are pointers to thechild module’s class for allinstances
½ Define member variablesthat are pointers to thechild module’s class for allinstances
in sub_a
top
sub_ba_in a_out outb_in b_outsig
![Page 54: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/54.jpg)
54IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGHOLQJ�+LHUDUFK\���&UHDWH�,QVWDQFHVSC_MODULE{ o Portso Signalso Variableso Constructoro Processesã Modules};
SC_CTOR {inst1 = new sub_a("inst_1");inst2 = new sub_b("inst_2");
(*inst1).a_out(sig);(*inst1).a_in(in);
(*inst2)(sig, b_out);}
SC_CTOR {inst1 = new sub_a("inst_1");inst2 = new sub_b("inst_2");
(*inst1).a_out(sig);(*inst1).a_in(in);
(*inst2)(sig, b_out);}
½ Create the child moduleinstances within the parentmodule’s constructor usingthe C++ keyword new.
½ An arbitrary name is givento the module instances. Itis good practice to use thename of the instancevariable.
½ Create the child moduleinstances within the parentmodule’s constructor usingthe C++ keyword new.
½ An arbitrary name is givento the module instances. Itis good practice to use thename of the instancevariable.
in sub_a
top
sub_ba_in a_out outb_in b_outsig
![Page 55: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/55.jpg)
55IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
0RGHOLQJ�+LHUDUFK\���&RQQHFW�3RUWV�DQG�6LJQDOVSC_MODULE{ o Portso Signalso Variableso Constructoro Processesã Modules};
SC_CTOR {inst1 = new sub_a("inst_1");inst2 = new sub_b("inst_2");
(*inst1).a_out(sig);(*inst1).a_in(in);
(*inst2)(sig, b_out);}
SC_CTOR {inst1 = new sub_a("inst_1");inst2 = new sub_b("inst_2");
(*inst1).a_out(sig);(*inst1).a_in(in);
(*inst2)(sig, b_out);}
½ Connect ports of childmodules to one another withinternal signals.
½ Connect ports of the parentmodule to ports of the childmodule using direct port-to-port connection. A signalMUST NOT be used.
½ Connect ports of childmodules to one another withinternal signals.
½ Connect ports of the parentmodule to ports of the childmodule using direct port-to-port connection. A signalMUST NOT be used.
in sub_a
top
sub_ba_in a_out outb_in b_outsig
½ Mapping by name isrecommended.
½ Mapping by position may alsobe used.
½ Mapping by name isrecommended.
½ Mapping by position may alsobe used.
![Page 56: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/56.jpg)
56IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
Why C-based Design Flow1
TopicUnit
Language Elements of SystemC 2
SystemC and Synthesis3
Simple Example4
Resources5
![Page 57: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/57.jpg)
57IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6\VWHP&�'HVLJQ�)ORZ
UTFUTF
TFTF
Partition
BehavioralBehavioral
RTLRTLabstract
RTOS
abstractRTOS
targetcode
targetcode NetlistNetlist
Refine
Refine
Refine
Refine
½ System/ Architectural Level½not synthesizable½event driven½abstract communication½abstract data types
½ Behavioral Level½synthesizable ½clocked½I/O cycle accurate½algorithmic description
½ RT Level½synthesizable½clocked½FSM½data path
Software Hardware
![Page 58: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/58.jpg)
58IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$YDLODEOH�)XQFWLRQDOLW\�DQG�7RROV
½ System/Architectural Level½ channels, interfaces, events, master-slave comm. library (all beta)
½ Behavioral½ synthesis to netlist
½ RTL½ synthesis to netlist
½ Software½ abstract RTOS (not yet available)
![Page 59: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/59.jpg)
59IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
5HILQHPHQW�IRU�6\QWKHVLV
½Refine Structure½ use signals for I/F½ partition into synthesizable blocks½ restrict to synthesizable language subset
½Refine Control½ specify throughput/latency½ specify I/O protocol
½Refine Data½ restrict to physically meaningful data
types (no abstract data)½ specify bit width
Functional Description
Implementable Description
Structure Control Data
![Page 60: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/60.jpg)
60IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
%HKDYLRUDO�0RGHOLQJ���6\VWHP
CPU
Memory
I/O Board Disk
BusArbiter
algorithmicClk
drivenBus IF
algorithmicClk
drivenBus IF
ClkdrivenBus IF
ClkdrivenBus IF
algorithmicClk
drivenBus IFalgorithmic
![Page 61: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/61.jpg)
61IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
%HKDYLRUDO�0RGHOLQJ���0RGXOH
SC_MODULE(fir) {sc_in_clk clk;sc_in<bool> reset;sc_in<T_DATA> in;sc_in<bool> in_data_valid;sc_out<T_DATA> out;sc_out<bool> out_data_valid;...SC_CTOR(fir) {
SC_CTHREAD(fir_process, clk.pos());...
}};
½Interface cycle accurate½ ports and signals½ synthesizable data types½ introduction of a clock
½Rest of module½ algorithmic½ clocked (SC_CTHREAD)½ restriction to synthesizable SystemC
subset
½Behavioral Code may utilize½ functions to reduce code complexity½ loops½ conditional statements½ no abstract data types for
ports/signals½ only synthesizable subset of
SystemC
![Page 62: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/62.jpg)
62IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
57�/HYHO�0RGHOLQJ���6\VWHP
CPU
Memory
I/O Board Disk
BusArbiter
CLKdriven
CLKdriven
CLKdriven
![Page 63: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/63.jpg)
63IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
57�/HYHO�0RGHOLQJ���0RGXOH
SC_MODULE(fir) {sc_in_clk clk;sc_in<bool> reset;sc_in<T_DATA> in;sc_in<bool> in_data_valid;sc_out<T_DATA> out;sc_out<bool> out_data_valid;...sc_signal<T_STATE> state_curr, state_nxt;...SC_CTOR(fir) {
SC_METHOD(fir);sensitive << state_curr << in;SC_METHOD(fsm);sensitive << state_curr << data_valid;SC_METHOD(reg);sensitive_pos << clk;sensitive << reset;...
}};
½Interface cycle accurate½ ports and signals½ synthesizable data types½ introduction of a clock
½Rest of module½ cycle accurate½ sequential and combinational logic
(SC_METHOD)½ restriction to synthesizable SystemC
subset
½RTL Code may utilize½ functions to reduce code complexity½ loops½ conditional statements½ no abstract data types for
ports/signals½ only synthesizable subset of
SystemC
![Page 64: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/64.jpg)
64IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
Why C-based Design Flow1
TopicUnit
Language Elements of SystemC 2
SystemC and Synthesis3
Simple Example4
Resources5
![Page 65: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/65.jpg)
65IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LPSOH�([DPSOH���2YHUYLHZ
main.cppmain.cpp
stimgen.cppstimgen.cpp
stimgen.hstimgen.h
adder.cppadder.cpp
adder.hadder.h
monitor.cppmonitor.cpp
monitor.hmonitor.h
Adder
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
+
in1 in2
out
![Page 66: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/66.jpg)
66IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LPSOH�([DPSOH���6LPXODWLRQ�0RGHO
// header file adder.htypedef int T_ADD;
SC_MODULE(adder) {// Input portssc_port<sc_fifo_in_if<T_ADD> > in1;sc_port<sc_fifo_in_if<T_ADD> > in2;
// Output portssc_port<sc_fifo_out_if<T_ADD> > in2;
// ConstructorSC_CTOR(adder){SC_THREAD(main);
}
// Functionality of the processvoid main();
};
// header file adder.htypedef int T_ADD;
SC_MODULE(adder) {// Input portssc_port<sc_fifo_in_if<T_ADD> > in1;sc_port<sc_fifo_in_if<T_ADD> > in2;
// Output portssc_port<sc_fifo_out_if<T_ADD> > in2;
// ConstructorSC_CTOR(adder){SC_THREAD(main);
}
// Functionality of the processvoid main();
};
main.cppmain.cpp
stimgen.cppstimgen.cpp adder.cppadder.cpp
adder.hadder.h
monitor.cppmonitor.cpp
monitor.hmonitor.hstimgen.hstimgen.h
Adder
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
![Page 67: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/67.jpg)
67IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LPSOH�([DPSOH���6LPXODWLRQ�0RGHO
// Implementation file adder.cpp#include “systemc.h”#include “adder.h”
void adder::main(){
while (true) {out->write(in1->read() + in2->read());// assign a run-time to processwait(10, SC_NS);
}}
// Implementation file adder.cpp#include “systemc.h”#include “adder.h”
void adder::main(){
while (true) {out->write(in1->read() + in2->read());// assign a run-time to processwait(10, SC_NS);
}}
main.cppmain.cpp
stimgen.cppstimgen.cpp adder.cppadder.cpp
adder.hadder.h
monitor.cppmonitor.cpp
monitor.hmonitor.hstimgen.hstimgen.h
Adder
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
![Page 68: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/68.jpg)
68IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LPSOH�([DPSOH���%HKDYLRUDO�/HYHO
// header file adder.h
typedef sc_int<8> T_ADD;
SC_MODULE(adder) {// Clock introducedsc_in_clk clk;// Input portssc_in<T_ADD> in1;sc_in<T_ADD> in2;// Output portsc_out<T_ADD> out;
// ConstructorSC_CTOR(adder){
SC_CTHREAD(main, clk.pos());}
// Functionality of the processvoid main();
};
main.cppmain.cpp
stimgen.cppstimgen.cpp adder.cppadder.cpp
adder.hadder.h
monitor.cppmonitor.cpp
monitor.hmonitor.hstimgen.hstimgen.h
Adder
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
![Page 69: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/69.jpg)
69IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LPSOH�([DPSOH���%HKDYLRUDO�/HYHO
// Implementation file adder.cc#include “systemc.h”#include “adder.h”
void adder::main(){
// initializationT_ADD __in1 = 0;T_ADD __in2 = 0;T_ADD __out = 0;
out.write(__out);wait();
// infinite loopwhile(1) {
__in1 = in1.read();__in2 = in2.read();__out = __in1 + __in2;out.write(__out);wait();
}}
main.cppmain.cpp
stimgen.cppstimgen.cpp adder.cppadder.cpp
adder.hadder.h
monitor.cppmonitor.cpp
monitor.hmonitor.hstimgen.hstimgen.h
Adder
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
![Page 70: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/70.jpg)
70IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LPSOH�([DPSOH���57�/HYHO
// header file adder.h
typedef sc_int<8> T_ADD;
SC_MODULE(adder) {// Clock introducedsc_in_clk clk;// Input portssc_in<T_ADD> in1;sc_in<T_ADD> in2;// Output portsc_out<T_ADD> out;
// internal signalsc_signal<T_ADD> sum;
// ConstructorSC_CTOR(adder){
SC_METHOD(add);sensitive << in1 << in2;SC_METHOD(reg);sensitive_pos << clk;
}
// Functionality of the processvoid add();void reg();
};
main.cppmain.cpp
stimgen.cppstimgen.cpp adder.cppadder.cpp
adder.hadder.h
monitor.cppmonitor.cpp
monitor.hmonitor.hstimgen.hstimgen.h
Adder
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
![Page 71: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/71.jpg)
71IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LPSOH�([DPSOH���57�/HYHO
// Implementation file adder.cc#include “systemc.h”#include “adder.h”
void adder::add(){
T_ADD __in1 = in1.read();T_ADD __in2 = in2.read();
sum.write( __in1 + __in2 );}
void adder::reg(){
out.write( sum );}
main.cppmain.cpp
stimgen.cppstimgen.cpp adder.cppadder.cpp
adder.hadder.h
monitor.cppmonitor.cpp
monitor.hmonitor.hstimgen.hstimgen.h
Adder
in1
in2
outResponseMonitorre
StimulusGenerator
a1
a2
main.cpp
clk
![Page 72: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/72.jpg)
72IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6LPSOH�([DPSOH���6FUHHQVKRW
![Page 73: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/73.jpg)
73IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
$JHQGD
Why C-based Design Flow1
TopicUnit
Language Elements of SystemC 2
SystemC and Synthesis3
Simple Example4
Resources5
![Page 74: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/74.jpg)
74IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
6\VWHP&�:HE�6LWH
www.systemc.org½download½news½forum (mailing list)½FAQs
![Page 75: %HUQKDUG1LHPDQQ )UDXQKRIHU,QVWLWXWHIRU …heco/courses/ProcDesign/systemc_1_tutorial.pdf‰ A brief introduction to the most important SystemC 1.0.x language elements ‰ A very short](https://reader031.fdocuments.in/reader031/viewer/2022011816/5e76981a9c152b54f4141692/html5/thumbnails/75.jpg)
75IIS
Fraunhofer InstitutIntegrierte Schaltungenh�'I(�**4�" �����
7UDLQLQJ�LQ�(XURSH
½ For SystemC training in Munich, Erlangen, or on-sitelook at:
½http://www.iis.fhg.de/kursbuch/kurse/systemc.html
½ Next scheduled training: Nov 21-23 in Munich,Germany
Covers SystemC 2.0