ip core design - lecture 7 - introduction to...
TRANSCRIPT
![Page 1: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/1.jpg)
IP Core Design
Lecture 7Introduction to SystemC
Juinn-Dar Huang, Ph.D.Assistant Professor
September 2004
Courtecy: Cadence Design, Inc.
![Page 2: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/2.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
1copyright © 2004
Outlines
– SystemC applications– SystemC language– SystemC data types– SystemC processes– Simulation control
![Page 3: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/3.jpg)
SystemC Applications
![Page 4: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/4.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
3copyright © 2004
Nature of SystemC
• SystemC is actually a C++ class library– enable H/W models at different levels of abstraction– support various development processes– focus on system-level design, modeling and verification
• Goal– provide a unified environment for architects, verification
engineers and implementation engineers
![Page 5: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/5.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
4copyright © 2004
Different Levels of Abstraction (1/3)Concept
Abstraction
Algorithm Selection/Performance Analysis
Architecture Selection/Finite Wordlength
Effects Analysis
Architecture MappingHW/SW Mapping
HW/RTL SW/C
SystemCSPW,
COSSAP
Matlab
HDL
C/C++
Not Easy
![Page 6: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/6.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
5copyright © 2004
Different Levels of Abstraction (2/3)
![Page 7: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/7.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
6copyright © 2004
Different Levels of Abstraction (3/3)
To be available in v3.x
Available in v2.x
Available in v1.x
![Page 8: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/8.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
7copyright © 2004
Heterogeneous Environment
Functional System Specification(HW, SW, environment) in C/C++
DigitalHW Block
DesignSW Block Design
AMSHW Block
Design
System Architecture
Het
erog
eneo
usM
ultil
evel
Ver
ifica
tion
![Page 9: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/9.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
8copyright © 2004
What is SystemC?•Open source C++ class library and event-driven simulator
SystemC 1.0
RTL level of abstraction
Separates function from communication with concepts of ports, signals, data types
SystemC 3.0
Focus on software and scheduler modeling
SystemC 2.0
System Level modeling on top of 1.0
Addition of communication and synchronization in the form of channels, interfaces, and events
Oct 2001
SystemCVerificationStandard (SCV)
Transaction-based verification
Randomization
Constraint solver
Oct 2002Mar 2000
![Page 10: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/10.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
9copyright © 2004
SystemC 2.0 Language Architecture (1/2)
C++ Language Standard
Core LanguageModulesPortsProcessesEventsInterfacesChannelsEvent-driven Simulation Kernel
Data-Types
4-valued logic types (01zx)4-valued logic vectorsBits and bit-vectorsArbitrary-precision integersFixed-point numbersC++ user-defined types
Elementary ChannelsSignal, Timer, Mutex, Semaphore, FIFO, etc.
Standard Channels for Various Models of Computation (MOCs)Kahn Process NetworksStatic Dataflow, etc.
Methodology Specific Channels
Master/Slave Library, etc.
![Page 11: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/11.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
10copyright © 2004
SystemC 2.0 Language Architecture (2/2)
1.0
2.0
3.0
![Page 12: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/12.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
11copyright © 2004
SystemC’s Target
![Page 13: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/13.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
12copyright © 2004
SystemC Cannot Cover All
![Page 14: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/14.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
13copyright © 2004
SystemC’s Target Applications
![Page 15: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/15.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
14copyright © 2004
SystemC Does Not Try …
• SystemC is NOT– replacement of HDL and associated simulation tools
• especially gate-level modeling
– replacement of domain-specific tools• such as Matlab, COSSAP, SPW, …
– next generation HDL• SystemVerilog, Verilog-200X
![Page 16: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/16.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
15copyright © 2004
SystemC Simulation Environment
![Page 17: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/17.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
16copyright © 2004
SystemC Resources (1/2)– WWW resources
• The Open SystemC Initiative (OSCI)http://www.systemc.org/
– Books• System Design with SystemC
Kluwer Academic Publisher ISBN 1-402070721• SystemC: Methodologies and Applications
Kluwer Academic Publisher ISBN 1-402074794• A SystemC Primer
Star Galaxy Publishing ISBN 0-965039188
![Page 18: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/18.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
17copyright © 2004
SystemC Resources (2/2)
• Documentations• SystemC Version 2.0 User’s Guide (update for 2.0.1)
UserGuide20.pdf• Functional Specification for SystemC 2.0 (update for SystemC 2.0.1)
FuncSpec20.pdf
• Examples• examples/systemc/ directory
simple_fifo, simple_perf, simple_bus, rsa, risc_cpu, pkt_switch, pipe, forkjoin, fir, fft…
![Page 19: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/19.jpg)
SystemC Language
![Page 20: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/20.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
19copyright © 2004
Modules and HierarchyPort
![Page 21: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/21.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
20copyright © 2004
Processes
![Page 22: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/22.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
21copyright © 2004
Ports and Channels
![Page 23: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/23.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
22copyright © 2004
Example – Adder with Register (1/3)
+a
b
clk
Adder Register
temp c
![Page 24: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/24.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
23copyright © 2004
Example – Adder with Register (2/3)
#include “systemc.h”
SC_MODULE(adder_reg) {// input portsc_in<sc_int<8> > a; sc_in<sc_int<8> > b; // output port sc_out<sc_int<9> > c; // clocksc_in<bool> clk;
// Internal signalsc_signal<sc_int<9> > temp;
// Adder processvoid prc_add();
// Register update processvoid prc_reg();
// ConstructorSC_CTOR(adder_reg) {SC_METHOD(prc_add);sensitive << a << b;SC_METHOD(prc_reg);sensitive_pos << clk;
}};
adder_reg.h
![Page 25: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/25.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
24copyright © 2004
Example – Adder with Register (3/3)
#include “adder_reg.h”
// Adder processvoid adder_reg::prc_add() {temp = a + b;
}
// Register update processvoid adder_reg::prc_reg() {c = temp;
}
adder_reg.cpp
![Page 26: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/26.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
25copyright © 2004
Hierarchical Coding (1/3)
// adder.h#include “systemc.h”
SC_MODULE(adder) {// input portsc_in<sc_int<8> > a; sc_in<sc_int<8> > b; // output port sc_out<sc_int<9> > c;
// Adder processvoid prc_add();
// ConstructorSC_CTOR(adder) {SC_METHOD(prc_add);sensitive << a << b;
}};
// adder.cpp#include “adder.h”// Adder processvoid adder::prc_add() {c = a + b;
}
Return to SC_METHOD
![Page 27: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/27.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
26copyright © 2004
Hierarchical Coding (2/3)
// reg.h#include “systemc.h”
SC_MODULE(reg) {// input portsc_in<sc_int<9> > in; // output port sc_out<sc_int<9> > out; // clocksc_in<bool> clk;
// Register update processvoid prc_reg();
// ConstructorSC_CTOR(reg) {SC_METHOD(prc_reg);sensitive_pos << clk;
}};
// reg.cpp#include “reg.h”// Register update processvoid reg::prc_reg() {out = in;
}
![Page 28: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/28.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
27copyright © 2004
Hierarchical Coding (3/3)
#include “systemc.h”#include “adder.h”#include “reg.h”
SC_MODULE(adder_reg) {sc_in<sc_int<8> > a; sc_in<sc_int<8> > b; sc_out<sc_int<9> > c; sc_in<bool> clk;
// Instantiated objectsadder add1;reg reg1;
// Internal signalsc_signal<sc_int<9> > temp;// sc_signal is a SystemC// built-in channel
// ConstructorSC_CTOR(adder_reg): add1(“add1”), reg1(“reg1”){
// port bindingadd1(a, b, temp); // pos
reg1.in(temp); // namereg1.out(c); // namereg1.clk(clk); // name
}};
adder_reg.h
![Page 29: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/29.jpg)
SystemC Data Types
![Page 30: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/30.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
29copyright © 2004
SystemC Data Types
![Page 31: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/31.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
30copyright © 2004
Bit Types
![Page 32: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/32.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
31copyright © 2004
Integer Types
![Page 33: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/33.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
32copyright © 2004
sc_int<n>
![Page 34: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/34.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
33copyright © 2004
sc_int<n> and sc_uint<n>
![Page 35: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/35.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
34copyright © 2004
Arbitrary Sized Integer Types
![Page 36: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/36.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
35copyright © 2004
Arbitrary Sized Vector Types (1/2)
![Page 37: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/37.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
36copyright © 2004
Arbitrary Sized Vector Types (2/2)
![Page 38: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/38.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
37copyright © 2004
sc_bv<n> and sc_lv<n>
![Page 39: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/39.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
38copyright © 2004
Impact on Simulation Performance
Faster
Native (built-in) C++ data typeNative (built-in) C++ data type
Fixed precision integer data typeFixed precision integer data type
Arbitrary precision integer data typeArbitrary precision integer data typesc_big(u)int<n>sc_big(u)int<n>
sc_bv<n>sc_bv<n>Slower
sc_lv<n>sc_lv<n>
![Page 40: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/40.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
39copyright © 2004
SystemC Data Types
Type Description Remarkssc_bit 2 value single bitsc_logic 4 value single bitsc_int<n> n bit signed integersc_uint<n> n bit unsigned integersc_bigint<n> arbitrary sized signed integersc_biguint<n> arbitrary sized unsigned integersc__bv<n> arbitrary sized 2 value vectorsc_lv<n> arbitrary sized 4 value vectorsc_fixed<> templated signed fixed pointsc_ufixed<> templated unsigned fixed pointsc_fix untemplated signed fixed pointsc_ufix untemplated unsigned fixed point
O < n <= 512
0 < n <= 64
More com
plex
Faster
![Page 41: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/41.jpg)
Processes
![Page 42: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/42.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
41copyright © 2004
SystemC Processes
• Processes describe the functionality and allow concurrency
• Processes are not hierarchical– it’s illegal to call another process within a process
• Two kinds of processes– Method process: SC_METHOD– Thread process: SC_THREAD
![Page 43: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/43.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
42copyright © 2004
SC_METHOD
• Execute from the head to the end at every activation of sensitized signals
• Return the control to the simulation kernel once the execution is completed
• Cannot call wait() in a SC_METHOD process
Example
![Page 44: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/44.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
43copyright © 2004
SC_THREAD
• Similar to SC_METHOD– registration way, sensitivity list specification, …
• It usually call wait()• When the execution encounters a wait()
statement, the process is suspended• It resumes from the suspend only if the process
detects activations of sensitized signals• SC_THREAD simulates much slower than
SC_METHOD
![Page 45: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/45.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
44copyright © 2004
SC_THREAD ExampleSC_MODULE(tb) {// ...bool clk; // 50% duty cyclebool biased_clk;// H-H-L, 67% duty cuclevoid prc_clk_gen();// ...SC_CTOR(tb) {// ...SC_THREAD(prc_clk_gen);sensitive_pos << clk;
// ...}// ...
};
void tb::prc_clk_gen() {while(true){ // infinite loopbiased_clk = true;wait();biased_clk = true;wait();biasd_clk = false; wait();
}}
![Page 46: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/46.jpg)
Simulation Control
![Page 47: IP Core Design - Lecture 7 - Introduction to SystemCtwins.ee.nctu.edu.tw/courses/ip_core_04/handout_pdf/07_Introduction_to_SystemC.pdfIP Core Design Lecture 7 Introduction to SystemC](https://reader031.vdocument.in/reader031/viewer/2022011815/5e5e5fa8cb98bd459449ac57/html5/thumbnails/47.jpg)
Introduction to SystemC
Juinn-Dar H
uang jdhuang@m
ail.nctu.edu.tw
46copyright © 2004
Simulation Topmonitor u_mon(“u_mon”);u_mon(in1, in2, in3, out1);
sc_trace_file * tf =sc_create_vcd_trace_file(“a”);sc_trace(tf, out1, “out1”);
sc_start(100, SC_NS);// sc_start(-1); forever// sc_stop(); terminate
sc_close_vcd_trace_file(tf);
return 0;}
#include “systemc.h”#include “duv.h”#include “driver.h”#include “monitor.h”
int sc_main(int argc,char *argv[]) {
sc_signal<bool> in1, in2, in3,out1;
duv u_duv(“u_duv”);u_duv(in1, in2, in3, out1);
driver u_driver(“u_driver”);u_driver(in1, in2, in3);