SlideShare a Scribd company logo
Electronic System Level(ESL) 
Design and SystemC Begin 
2014 
NCKU CSIE 
林英超蘇文鈺林敬倫
Outline 
• Electronic System Level (ESL) Design Basics 
• Hardware architecture 
• SoC Design Flow (系統晶片設計流程) 
• SystemC background 
• SystemC Syntax by Example 
– ex1: Counter 
– ex2: Traffic Light 
– ex3: Simple Bus
Why learn ESL 
• if you are an undergraduate student, and/or 
• if you are a C.S. student, and/or 
• if you still do not know in which areas you are 
really interested, 
• when you still do not know what ESL is?
Because 
• This is one of the best ways to start your 
learning of C++, 
• This is the best way for a C.S. student to study 
SoC design, 
• This is the biggest advantage C.S. students can 
take over E.E. students in SoC related areas, 
• This is one of the best ways to learn lots of 
tools and languages in HW/SW designs.
What is ESL? 
• ESL = Electronic System Level 
• ESL doesn’t specify which levels of design should 
be employed. It focuses on the concepts of 
designing a system, instead of specific 
components. 
• Then, what is Electronic System Level design flow? 
• Design, debug, verify the system using ESL 
methodologies, languages, tools and CONCEPTS.
What does level mean? 
• In HW design, level means the degree of the 
design details, or the level of abstraction, of the 
model of the target design. For example, 
– Transistor level 
– Gate level 
– Register transfer level (RTL) 
– Transaction level 
– Behavior level 
– Architecture level 
– Algorithmic level 
– …. And so on.
Before the answer is made 
• Let’s ask “Why ESL design flow is needed?” 
– Huge system 
– Extraordinarily high complexity 
– Design reuse 
– Slow simulation speed 
– Difficulty in integration 
– Mixed/multiple disciplines 
– HW/SW co-design/co-simulation/co-…. 
– And so on. 
– Most importantly, time-to-market
Design Complexity from Different Design 
Generation 
David C. Black 
Jack Donovan
These are not reasons 
• They are just problems. Imagine 
– You have a system with 10 processor cores, each 
having its own memory system. There are shared 
memory spaces for the cores. 20 different peripherals 
to control. There are 20 programmers using 8 different 
languages to develop 30 different applications on this 
system which needs to support 2 different OS. And the 
biggest problem is 
• To cope with these problems, what do we need?
We need 
• A super fast simulator 
• A simulator supports mixed abstraction level 
designs 
• An integrated HW/SW co-development 
environment 
• A super fast simulation environment 
• … and so on. 
• To do this, what are the first few steps?
Hareware? FPGA? MCU? 
• Microcontroller: 
– CPU, Memory, …, etc. 
– Software program 
• (.C->.asm->.out) 
• FPGA: 
– Verlog code, VHDL code. 
– Hardware program 
• (.v->.bit)
傳統系統(System-on-a-Board) V.S.系統晶片(System-on-a-Chip) 
印刷電路板(System-on-a-Board) 
CPU 
IO Bridge 
MPEG 
Decoder 
SDRAM 
Disk 
Video 
Encoder 
20 cm 
系統晶片(System-on-a-Chip) 
CPU 
IO Bridge 
MPEG 
Decoder 
SDRAM 
Disk 
Video 
Encoder 
2 cm
傳統系統開發流程 
系統規格 
系統架構 
硬體開發 
系統雛形 
軟體開發 
系統整合 
產品
理想系統開發流程 
系統規格 
系統架構 
硬體開發系統整合 
軟體開發 
產品 
OPENESL : ESL design hardware 
CoWare : ESL design hardware 
FPGA : Hardware circuit design and verify
傳統硬體開發方法 
• 硬體描述語言 
– VHDL, Verilog 
– RTL (Register Transfer Level) 
• Simulation(模擬) 
– 非常慢 
– Linux開機= 109小時
硬體設計抽象化 
Algorithm 
Architecture 
RTL 
Gate 
Transistor 
Synthesis 
(合成) 
Abstraction 
(抽象) 
High Level 
Low Level
PRODUCT DESIGN 
DEVELOPMENT FLOW
Detailed Flow: Early stage 交互驗證 
TLM/ESL Modeling stage 
Final Integration Stage 
Three stage pipeline design: 
A. SW model: high abstraction level 
model 
B. TLM model:very close to 
architecture 
C. HW model :HDL
Verification and Debugging
Why SystemC? 
• 標準語法(IEEE Standard 1666) 
– 模擬系統 
– 更高抽象化 
– 既有的C++開發環境 
– 硬體合成 
SystemC Doesn’t Speedup Simulation, 
High Level does!!
SystemC Use Case 
• 硬體工程師 
– 硬體描述語言(HDL) 
– 更高階、更抽象描述硬體 
• 系統工程師 
– System Virtual Platform (系統虛擬平台) 
• Architecture Analysis (架構分析) 
• Performance Exploration (效能評估) 
• System Verification (系統驗證) 
• 軟體工程師 
– 早期開發環境 
– 更多硬體資訊
SystemC Background 
• C++ 
– 物件導向程式語言(Object-Oriented) 
• 類別(Class) 
• 純虛擬函式(pure-virtual-function) 
• 硬體 
– 元件(Component) 
• 模組(Module) 
• 介面(Interface)
SystemC Library 
Data types 
Application 
Written by the end user 
SystemC verification library, bus models, TLM interface 
4-valued logic type 
4-valued logic vectors 
Bit vectors 
Arbitrary-precision integers 
Fixed-point types 
Core Language 
Module 
Ports 
Processes 
Interfaces 
Channels 
Events 
Methodology- and technology-specific libraies 
Predefined channels 
Signals, clock, FIFO, 
Mutext, semaphore 
Utilities 
Vector, strings, 
traceing 
Programming Language C++
Module (模組) 
• A Module 
– A CPU 
– A Gate 
• With 
– Port (埠口) 
– Process (排程) 
– Sub-module (子模組) 
Top Module 
Module 1 Module 1 
Process Port Port Process Port Port
Outline 
• Background 
– Hardware architecture 
– SoC Design Flow (系統晶片設計流程) 
– SystemC background 
• SystemC Syntax by Example 
– ex1: Counter 
– ex2: Traffic Light 
– ex3: Simple Bus
Example 1 – 
Counter (計數器)
#include “counter.h” 
counter::process_func() 
{ 
val = 0; 
while(1) 
{ 
wait(); 
val = val+1; 
} 
} 
#include <systemc.h> 
SC_MODULE(counter) 
{ 
// port- declarstions; 
sc_in_clk clk; 
sc_out<int> val; 
// process declarations; 
void process_func(); 
// module constructor; 
SC_CTOR(counter) { 
SC_CTHREAD(process_func, clk.pos()); 
} 
}; 
Module Syntax (語法) 
“counter.h” “counter.cpp”
Run Simulation 
#include “counter.h” 
int sc_main(int argc, char* argv[]) 
{ 
// signal declaration 
sc_clock clk(“clk”, 1, SC_NS, 0.5); 
sc_signal<int> val; 
// module declaration 
counter counter0(“counter0”); 
// signal connection 
counter0.clk(clk); 
counter0.val(val); 
// run simulation 
sc_start(100, SC_NS); 
return 0; 
} 
“main.cpp”
Outline 
• Background 
– Hardware architecture 
– SoC Design Flow (系統晶片設計流程) 
– SystemC background 
• SystemC Syntax by Example 
– ex1: Counter 
– ex2: Traffic Light 
– ex3: Simple Bus
Example 2 – 
Traffic Light (紅綠燈)
Finite State Mache (有限狀態機) 
void fsm::cthread_func() 
{ 
while(1) { 
// red 
red=true, green=false, yellow=false; 
wait(10); 
// green 
red=false, green=true, yellow=false; 
wait(10); 
// yellow 
red=false, green=false, yellow=true; 
wait(2); 
} 
}
SC_METHOD 
“light.h” “light.cpp” 
#include <systemc.h> 
SC_MODULE(light) 
{ 
// port declarations 
sc_in<bool> on; 
// process declarations 
void method_func(); 
// contructor 
SC_CTOR(light) { 
SC_METHOD(method_func); 
sensitive << on; 
} 
}; 
#include “light.h” 
void light::method_func() 
{ 
if(on) { 
printf(“%6lld ps: %sn”,  
sc_time_stamp().value(), 
name()) 
} 
}
紅綠燈 
red 
green 
cthread on 
yellow 
clk 
on method 
on 
light “red” 
light “green” 
method 
light “yellow” 
red 
green 
yellow method 
fsm“fsm”
執行結果 
0 ps: red 
10000 ps: green 
20000 ps: yellow 
22000 ps: red 
32000 ps: green 
42000 ps: yellow 
44000 ps: red 
54000 ps: green 
64000 ps: yellow 
66000 ps: red 
76000 ps: green 
86000 ps: yellow 
88000 ps: red
Process In SystemC 
• Methods 
• Threads 
• Clocked Threads
Methods 
• Methods behaves like a function 
• Sensitive list signals which trigger a process 
can be a signal or local variable or port.
Threads 
• Thread Process can be suspended. 
• The Thread Process can contain wait() functions that 
suspend process execution until an event occurs on 
one of the signals the process is sensitive to. 
• The process will continue to execute until the next 
wait()
Clocked Threads 
• SC_CTHREAD can have only one bit wide ports 
as trigger.
Outline 
• Background 
– Hardware architecture 
– SoC Design Flow (系統晶片設計流程) 
– SystemC background 
• SystemC Syntax by Example 
– ex1: Counter 
– ex2: Traffic Light 
– ex3: Simple Bus
Example 3 – 
Simple Bus (匯流排)
Interface 
“bus_if.h: 
#include <systemc.h> 
class bus_if: public sc_interface { 
public: 
virtual void write(unsigned addr, int data) = 0; 
virtual void read(unsigned addr, int& data) = 0; 
};
Slave – RAM 
#include “bus_if.h” 
class ram: 
public bus_if, 
public sc_module { 
public: 
// interface function 
void write(unsigned addr, int data); 
void read(unsigned addr, int&data); 
// constructor 
ram(sc_module_name); 
// destructor 
~ram(); 
private: 
// memory contents 
int* pMem; 
}; 
“ram.h” 
“ram.cpp” 
#include “ram.h” 
ram::ram(sc_module_name nm) 
: sc_module(nm) 
{ 
pMem = new int[16]; 
} 
ram::~ram() 
{ 
delete[] pMem; 
} 
void ram::write(unsigned addr, int data) 
{ 
pMem[addr] = data; 
} 
void ram::read(unsigned addr, int& data) 
{ 
data = pMem[addr] 
}
Slave – ROM 
#include “bus_if.h” 
class rom: 
public bus_if, 
public sc_module { 
public: 
// interface function 
void write(unsigned addr, int data); 
void read(unsigned addr, int&data); 
// constructor 
rom(sc_module_name); 
// destructor 
~rom(); 
private: 
// memory contents 
int* pMem; 
}; 
#include “rom.h” 
rom::rom(sc_module_name nm) 
: sc_module(nm) 
{ 
pMem = new int[16]; 
for(int i=0; i<16; i++) pMem[i] = i; 
} 
rom::~ram() 
{ 
delete[] pMem; 
} 
void rom::write(unsigned addr, int data) 
{ 
assert(0); 
} 
void rom::read(unsigned addr, int& data) 
{ 
data = pMem[addr]; 
} 
“rom.h” 
“rom.cpp”
Master 
#include “bus_if.h” 
class cpu: public sc_module { 
public: 
// port declaration 
sc_in_clk clk; 
sc_port<bus_if> mem_port; 
// process declaration 
void cthread_func(); 
// constructor 
cpu(sc_module_name nm); 
}; 
“cpu.h” 
#include “cpu.h” 
cpu::cpu(sc_module_name nm) 
: sc_module(nm) 
{ 
SC_HAS_PROCESS(cpu); 
SC_CTHREAD(cthread_func, clk.pos); 
} 
void cpu::cthread_func() 
{ 
while(1) 
{ 
int data; 
for(int i=0; i<16; i++) { 
mem_port->read(i, data); 
mem_port->write(i+16, data); 
} 
sc_stop(); 
} 
“cpu.cpp” }
Bus 
cpu 
bus 
rom ram 
master 
slave 
rom 
ram 
0x00 
0x0f 
0x10 
0x1f 
Memory 
Map
Bus 
#include “bus_if.h” 
class bus: 
public bus_if, 
public sc_module { 
public: 
// port declaration 
sc_port<bus_if> rom_port; 
sc_port<bus_if> ram_port; 
// interface function 
void write(unsigned addr, int data); 
void read(unsigned addr, int&data); 
// constructor 
bus(sc_module_name); 
}; 
#include “bus.h” 
bus::bus(sc_module_name nm) 
: sc_module(nm) 
{ 
} 
void bus::write(unsigned addr, int data) 
{ 
if(addr < 16) 
rom_port->write(addr, data); 
else 
rqm_port->write(addr, data); 
} 
void bus::read(unsigned addr, int& data) 
{ 
if(addr < 16) 
rom_port->read(addr, data); 
else 
ram_port->read(addr, data); 
} 
“bus.h” 
“bus.cpp”
• www.doulos.com/knowhow/systemc/ 
• www.asic-world.com/systemc/ 
• www.systemc.org/
TOOLS
Commercial tool: SOC Designer 
Work Space 
Cache Profiling window 
Waveform Viewer 
Memory maps 
Assembly code window
Commercial tool: CoWare
Open Source: GreenSoc (not so open) 
User IP 1 GreenBus I/F 
GreenScript 
SystemC 
User IP 2 
User IP 3 
Config User I/F 
GreenBus I/F 
GreenBus I/F 
Config User I/F 
Config User I/F 
Config PlugIn 
GreenAV PlugIn 
Specific PlugIn 
GreenControl Core 
GreenAV User I/F 
Specific User I/F 
ESL 
Tools
SCREAM Lab OpenESL
SCREAM Lab OpenESL
FPGA tool: 
Berkeley BEE2
FPGA tool: NCKU Multicore
FPGA tool: SMIMS
LAB 1 
SystemC 環境建構及範例程式運行
安裝說明 
• 請參閱doc檔。 
• 環境統一使用Linux。
專案說明 
• 其中包含三個檔案main.cpp hello_module.h 
hello_module.cpp 
• 可將main.cpp視同電路板,在上面做接線等 
等的動作。 
• hello_module是一個具有process的硬體元件。
Main.cpp 
將所需元件的.h檔和systemC.h引入 
Sc_main是systemC程式的進入點 
宣告一組clk的訊號週期為10ns 
宣告一組hello_module的元件 
將clk接上module的clk訊號上 
開始進行模擬模擬1000ns內的硬體 
運作
Hello_module.h 
宣告一組元件定義hello_module 
宣告hello_module的訊號線clk 
宣告hello_module的運作函式 
hello_module的建構子 
整組元件具有process(method) 
process執行的函式Method_func 
Process會經由clk正緣觸發
Hello_module.cpp 
運作函式本體 
訊號有產生改變才執行 
印出模擬時間 
印出hello word!
執行結果

More Related Content

What's hot

(S.C.E.T) Appliction of pll fm demodulation fsk demodulation
(S.C.E.T) Appliction of pll fm demodulation fsk demodulation(S.C.E.T) Appliction of pll fm demodulation fsk demodulation
(S.C.E.T) Appliction of pll fm demodulation fsk demodulationChirag vasava
 
Real Time Operating System
Real Time Operating SystemReal Time Operating System
Real Time Operating Systemvivek223
 
SOC Interconnects: AMBA & CoreConnect
SOC Interconnects: AMBA  & CoreConnectSOC Interconnects: AMBA  & CoreConnect
SOC Interconnects: AMBA & CoreConnectA B Shinde
 
Rtos concepts
Rtos conceptsRtos concepts
Rtos conceptsanishgoel
 
Fundamentals of HDL (first 4 chapters only) - Godse
Fundamentals of HDL (first 4 chapters only) - GodseFundamentals of HDL (first 4 chapters only) - Godse
Fundamentals of HDL (first 4 chapters only) - GodseHammam
 
301378156 design-of-sram-in-verilog
301378156 design-of-sram-in-verilog301378156 design-of-sram-in-verilog
301378156 design-of-sram-in-verilogSrinivas Naidu
 
Controller area network (CAN bus) ppt
Controller area network (CAN bus) pptController area network (CAN bus) ppt
Controller area network (CAN bus) pptRaziuddin Khazi
 
UVM: Basic Sequences
UVM: Basic SequencesUVM: Basic Sequences
UVM: Basic SequencesArrow Devices
 
Real time operating system
Real time operating systemReal time operating system
Real time operating systemKhuram Shahzad
 
Cyclic Redundancy Check
Cyclic Redundancy CheckCyclic Redundancy Check
Cyclic Redundancy CheckRajan Shah
 
Embedded system Design
Embedded system DesignEmbedded system Design
Embedded system DesignAJAL A J
 

What's hot (20)

Real Time Operating System
Real Time Operating SystemReal Time Operating System
Real Time Operating System
 
Real-Time Operating Systems
Real-Time Operating SystemsReal-Time Operating Systems
Real-Time Operating Systems
 
(S.C.E.T) Appliction of pll fm demodulation fsk demodulation
(S.C.E.T) Appliction of pll fm demodulation fsk demodulation(S.C.E.T) Appliction of pll fm demodulation fsk demodulation
(S.C.E.T) Appliction of pll fm demodulation fsk demodulation
 
LFSR
LFSRLFSR
LFSR
 
Real Time Operating System
Real Time Operating SystemReal Time Operating System
Real Time Operating System
 
SOC Interconnects: AMBA & CoreConnect
SOC Interconnects: AMBA  & CoreConnectSOC Interconnects: AMBA  & CoreConnect
SOC Interconnects: AMBA & CoreConnect
 
Rtos concepts
Rtos conceptsRtos concepts
Rtos concepts
 
Fundamentals of HDL (first 4 chapters only) - Godse
Fundamentals of HDL (first 4 chapters only) - GodseFundamentals of HDL (first 4 chapters only) - Godse
Fundamentals of HDL (first 4 chapters only) - Godse
 
DSP Processor.pptx
DSP Processor.pptxDSP Processor.pptx
DSP Processor.pptx
 
RTOS - Real Time Operating Systems
RTOS - Real Time Operating SystemsRTOS - Real Time Operating Systems
RTOS - Real Time Operating Systems
 
RTOS
RTOSRTOS
RTOS
 
Uvm dac2011 final_color
Uvm dac2011 final_colorUvm dac2011 final_color
Uvm dac2011 final_color
 
Vlsi ieee projects
Vlsi ieee projectsVlsi ieee projects
Vlsi ieee projects
 
Multiplexing
MultiplexingMultiplexing
Multiplexing
 
301378156 design-of-sram-in-verilog
301378156 design-of-sram-in-verilog301378156 design-of-sram-in-verilog
301378156 design-of-sram-in-verilog
 
Controller area network (CAN bus) ppt
Controller area network (CAN bus) pptController area network (CAN bus) ppt
Controller area network (CAN bus) ppt
 
UVM: Basic Sequences
UVM: Basic SequencesUVM: Basic Sequences
UVM: Basic Sequences
 
Real time operating system
Real time operating systemReal time operating system
Real time operating system
 
Cyclic Redundancy Check
Cyclic Redundancy CheckCyclic Redundancy Check
Cyclic Redundancy Check
 
Embedded system Design
Embedded system DesignEmbedded system Design
Embedded system Design
 

Viewers also liked

Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010敬倫 林
 
C++ process new
C++ process newC++ process new
C++ process new敬倫 林
 
Systemc overview 2010
Systemc overview 2010Systemc overview 2010
Systemc overview 2010敬倫 林
 
Thread and method_2010
Thread and method_2010Thread and method_2010
Thread and method_2010敬倫 林
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -evechiportal
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Srinivasan Venkataramanan
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveAmiq Consulting
 
SystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessSystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessDVClub
 
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0Robert O. Peruzzi, PhD, PE, DFE
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usageParth Pandya
 
UVM Update: Register Package
UVM Update: Register PackageUVM Update: Register Package
UVM Update: Register PackageDVClub
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialSystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialAmiq Consulting
 
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCDesign and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCRabindranath Tagore University, Bhopal
 

Viewers also liked (20)

SystemC Ports
SystemC PortsSystemC Ports
SystemC Ports
 
Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010
 
C++ process new
C++ process newC++ process new
C++ process new
 
Systemc overview 2010
Systemc overview 2010Systemc overview 2010
Systemc overview 2010
 
Channel 2010
Channel 2010Channel 2010
Channel 2010
 
Thread and method_2010
Thread and method_2010Thread and method_2010
Thread and method_2010
 
MixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLiveMixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLive
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with Octave
 
SystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessSystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification Process
 
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usage
 
UVM Update: Register Package
UVM Update: Register PackageUVM Update: Register Package
UVM Update: Register Package
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialSystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
 
stack
stackstack
stack
 
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCDesign and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
 
Queue
QueueQueue
Queue
 
Tree
TreeTree
Tree
 
Queue
QueueQueue
Queue
 

Similar to Week1 Electronic System-level ESL Design and SystemC Begin

Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
 
Megamodeling of Complex, Distributed, Heterogeneous CPS Systems
Megamodeling of Complex, Distributed, Heterogeneous CPS SystemsMegamodeling of Complex, Distributed, Heterogeneous CPS Systems
Megamodeling of Complex, Distributed, Heterogeneous CPS SystemsEugenio Villar
 
Early Software Development through Palladium Emulation
Early Software Development through Palladium EmulationEarly Software Development through Palladium Emulation
Early Software Development through Palladium EmulationRaghav Nayak
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfSamHoney6
 
What Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versaWhat Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versaBrendan Gregg
 
Open Source Systems Performance
Open Source Systems PerformanceOpen Source Systems Performance
Open Source Systems PerformanceBrendan Gregg
 
Linux Performance Tools 2014
Linux Performance Tools 2014Linux Performance Tools 2014
Linux Performance Tools 2014Brendan Gregg
 
Introduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationIntroduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationDr. Balaji Ganesh Rajagopal
 
Presentation on Behavioral Synthesis & SystemC
Presentation on Behavioral Synthesis & SystemCPresentation on Behavioral Synthesis & SystemC
Presentation on Behavioral Synthesis & SystemCMukit Ahmed Chowdhury
 
Cockatrice: A Hardware Design Environment with Elixir
Cockatrice: A Hardware Design Environment with ElixirCockatrice: A Hardware Design Environment with Elixir
Cockatrice: A Hardware Design Environment with ElixirHideki Takase
 
ParallelLogicToEventDrivenFirmware_Doin
ParallelLogicToEventDrivenFirmware_DoinParallelLogicToEventDrivenFirmware_Doin
ParallelLogicToEventDrivenFirmware_DoinJonny Doin
 
Performance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTracePerformance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTraceGraeme Jenkinson
 

Similar to Week1 Electronic System-level ESL Design and SystemC Begin (20)

Virtual platform
Virtual platformVirtual platform
Virtual platform
 
Megamodeling of Complex, Distributed, Heterogeneous CPS Systems
Megamodeling of Complex, Distributed, Heterogeneous CPS SystemsMegamodeling of Complex, Distributed, Heterogeneous CPS Systems
Megamodeling of Complex, Distributed, Heterogeneous CPS Systems
 
Early Software Development through Palladium Emulation
Early Software Development through Palladium EmulationEarly Software Development through Palladium Emulation
Early Software Development through Palladium Emulation
 
Os lectures
Os lecturesOs lectures
Os lectures
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
 
What Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versaWhat Linux can learn from Solaris performance and vice-versa
What Linux can learn from Solaris performance and vice-versa
 
Onnc intro
Onnc introOnnc intro
Onnc intro
 
Java Memory Model
Java Memory ModelJava Memory Model
Java Memory Model
 
Open Source Systems Performance
Open Source Systems PerformanceOpen Source Systems Performance
Open Source Systems Performance
 
SDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLSSDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLS
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
Linux Performance Tools 2014
Linux Performance Tools 2014Linux Performance Tools 2014
Linux Performance Tools 2014
 
Introduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationIntroduction to Computer Architecture and Organization
Introduction to Computer Architecture and Organization
 
x86
x86x86
x86
 
Digital_system_design_A (1).ppt
Digital_system_design_A (1).pptDigital_system_design_A (1).ppt
Digital_system_design_A (1).ppt
 
Presentation on Behavioral Synthesis & SystemC
Presentation on Behavioral Synthesis & SystemCPresentation on Behavioral Synthesis & SystemC
Presentation on Behavioral Synthesis & SystemC
 
Vhdl new
Vhdl newVhdl new
Vhdl new
 
Cockatrice: A Hardware Design Environment with Elixir
Cockatrice: A Hardware Design Environment with ElixirCockatrice: A Hardware Design Environment with Elixir
Cockatrice: A Hardware Design Environment with Elixir
 
ParallelLogicToEventDrivenFirmware_Doin
ParallelLogicToEventDrivenFirmware_DoinParallelLogicToEventDrivenFirmware_Doin
ParallelLogicToEventDrivenFirmware_Doin
 
Performance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTracePerformance analysis and troubleshooting using DTrace
Performance analysis and troubleshooting using DTrace
 

Recently uploaded

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandIES VE
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)Max Lee
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Gáspár Nagy
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfVictor Lopez
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignNeo4j
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdfkalichargn70th171
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationHelp Desk Migration
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfMeon Technology
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with StrimziStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzisteffenkarlsson2
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockSkilrock Technologies
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems ApproachNeo4j
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfkalichargn70th171
 
How To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdfHow To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdfayushiqss
 

Recently uploaded (20)

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by Design
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with StrimziStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by Skilrock
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
How To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdfHow To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdf
 

Week1 Electronic System-level ESL Design and SystemC Begin

  • 1. Electronic System Level(ESL) Design and SystemC Begin 2014 NCKU CSIE 林英超蘇文鈺林敬倫
  • 2. Outline • Electronic System Level (ESL) Design Basics • Hardware architecture • SoC Design Flow (系統晶片設計流程) • SystemC background • SystemC Syntax by Example – ex1: Counter – ex2: Traffic Light – ex3: Simple Bus
  • 3. Why learn ESL • if you are an undergraduate student, and/or • if you are a C.S. student, and/or • if you still do not know in which areas you are really interested, • when you still do not know what ESL is?
  • 4. Because • This is one of the best ways to start your learning of C++, • This is the best way for a C.S. student to study SoC design, • This is the biggest advantage C.S. students can take over E.E. students in SoC related areas, • This is one of the best ways to learn lots of tools and languages in HW/SW designs.
  • 5. What is ESL? • ESL = Electronic System Level • ESL doesn’t specify which levels of design should be employed. It focuses on the concepts of designing a system, instead of specific components. • Then, what is Electronic System Level design flow? • Design, debug, verify the system using ESL methodologies, languages, tools and CONCEPTS.
  • 6. What does level mean? • In HW design, level means the degree of the design details, or the level of abstraction, of the model of the target design. For example, – Transistor level – Gate level – Register transfer level (RTL) – Transaction level – Behavior level – Architecture level – Algorithmic level – …. And so on.
  • 7. Before the answer is made • Let’s ask “Why ESL design flow is needed?” – Huge system – Extraordinarily high complexity – Design reuse – Slow simulation speed – Difficulty in integration – Mixed/multiple disciplines – HW/SW co-design/co-simulation/co-…. – And so on. – Most importantly, time-to-market
  • 8. Design Complexity from Different Design Generation David C. Black Jack Donovan
  • 9. These are not reasons • They are just problems. Imagine – You have a system with 10 processor cores, each having its own memory system. There are shared memory spaces for the cores. 20 different peripherals to control. There are 20 programmers using 8 different languages to develop 30 different applications on this system which needs to support 2 different OS. And the biggest problem is • To cope with these problems, what do we need?
  • 10. We need • A super fast simulator • A simulator supports mixed abstraction level designs • An integrated HW/SW co-development environment • A super fast simulation environment • … and so on. • To do this, what are the first few steps?
  • 11. Hareware? FPGA? MCU? • Microcontroller: – CPU, Memory, …, etc. – Software program • (.C->.asm->.out) • FPGA: – Verlog code, VHDL code. – Hardware program • (.v->.bit)
  • 12. 傳統系統(System-on-a-Board) V.S.系統晶片(System-on-a-Chip) 印刷電路板(System-on-a-Board) CPU IO Bridge MPEG Decoder SDRAM Disk Video Encoder 20 cm 系統晶片(System-on-a-Chip) CPU IO Bridge MPEG Decoder SDRAM Disk Video Encoder 2 cm
  • 13. 傳統系統開發流程 系統規格 系統架構 硬體開發 系統雛形 軟體開發 系統整合 產品
  • 14. 理想系統開發流程 系統規格 系統架構 硬體開發系統整合 軟體開發 產品 OPENESL : ESL design hardware CoWare : ESL design hardware FPGA : Hardware circuit design and verify
  • 15. 傳統硬體開發方法 • 硬體描述語言 – VHDL, Verilog – RTL (Register Transfer Level) • Simulation(模擬) – 非常慢 – Linux開機= 109小時
  • 16. 硬體設計抽象化 Algorithm Architecture RTL Gate Transistor Synthesis (合成) Abstraction (抽象) High Level Low Level
  • 18. Detailed Flow: Early stage 交互驗證 TLM/ESL Modeling stage Final Integration Stage Three stage pipeline design: A. SW model: high abstraction level model B. TLM model:very close to architecture C. HW model :HDL
  • 20. Why SystemC? • 標準語法(IEEE Standard 1666) – 模擬系統 – 更高抽象化 – 既有的C++開發環境 – 硬體合成 SystemC Doesn’t Speedup Simulation, High Level does!!
  • 21. SystemC Use Case • 硬體工程師 – 硬體描述語言(HDL) – 更高階、更抽象描述硬體 • 系統工程師 – System Virtual Platform (系統虛擬平台) • Architecture Analysis (架構分析) • Performance Exploration (效能評估) • System Verification (系統驗證) • 軟體工程師 – 早期開發環境 – 更多硬體資訊
  • 22. SystemC Background • C++ – 物件導向程式語言(Object-Oriented) • 類別(Class) • 純虛擬函式(pure-virtual-function) • 硬體 – 元件(Component) • 模組(Module) • 介面(Interface)
  • 23. SystemC Library Data types Application Written by the end user SystemC verification library, bus models, TLM interface 4-valued logic type 4-valued logic vectors Bit vectors Arbitrary-precision integers Fixed-point types Core Language Module Ports Processes Interfaces Channels Events Methodology- and technology-specific libraies Predefined channels Signals, clock, FIFO, Mutext, semaphore Utilities Vector, strings, traceing Programming Language C++
  • 24. Module (模組) • A Module – A CPU – A Gate • With – Port (埠口) – Process (排程) – Sub-module (子模組) Top Module Module 1 Module 1 Process Port Port Process Port Port
  • 25. Outline • Background – Hardware architecture – SoC Design Flow (系統晶片設計流程) – SystemC background • SystemC Syntax by Example – ex1: Counter – ex2: Traffic Light – ex3: Simple Bus
  • 26. Example 1 – Counter (計數器)
  • 27. #include “counter.h” counter::process_func() { val = 0; while(1) { wait(); val = val+1; } } #include <systemc.h> SC_MODULE(counter) { // port- declarstions; sc_in_clk clk; sc_out<int> val; // process declarations; void process_func(); // module constructor; SC_CTOR(counter) { SC_CTHREAD(process_func, clk.pos()); } }; Module Syntax (語法) “counter.h” “counter.cpp”
  • 28. Run Simulation #include “counter.h” int sc_main(int argc, char* argv[]) { // signal declaration sc_clock clk(“clk”, 1, SC_NS, 0.5); sc_signal<int> val; // module declaration counter counter0(“counter0”); // signal connection counter0.clk(clk); counter0.val(val); // run simulation sc_start(100, SC_NS); return 0; } “main.cpp”
  • 29. Outline • Background – Hardware architecture – SoC Design Flow (系統晶片設計流程) – SystemC background • SystemC Syntax by Example – ex1: Counter – ex2: Traffic Light – ex3: Simple Bus
  • 30. Example 2 – Traffic Light (紅綠燈)
  • 31. Finite State Mache (有限狀態機) void fsm::cthread_func() { while(1) { // red red=true, green=false, yellow=false; wait(10); // green red=false, green=true, yellow=false; wait(10); // yellow red=false, green=false, yellow=true; wait(2); } }
  • 32. SC_METHOD “light.h” “light.cpp” #include <systemc.h> SC_MODULE(light) { // port declarations sc_in<bool> on; // process declarations void method_func(); // contructor SC_CTOR(light) { SC_METHOD(method_func); sensitive << on; } }; #include “light.h” void light::method_func() { if(on) { printf(“%6lld ps: %sn”, sc_time_stamp().value(), name()) } }
  • 33. 紅綠燈 red green cthread on yellow clk on method on light “red” light “green” method light “yellow” red green yellow method fsm“fsm”
  • 34. 執行結果 0 ps: red 10000 ps: green 20000 ps: yellow 22000 ps: red 32000 ps: green 42000 ps: yellow 44000 ps: red 54000 ps: green 64000 ps: yellow 66000 ps: red 76000 ps: green 86000 ps: yellow 88000 ps: red
  • 35. Process In SystemC • Methods • Threads • Clocked Threads
  • 36. Methods • Methods behaves like a function • Sensitive list signals which trigger a process can be a signal or local variable or port.
  • 37. Threads • Thread Process can be suspended. • The Thread Process can contain wait() functions that suspend process execution until an event occurs on one of the signals the process is sensitive to. • The process will continue to execute until the next wait()
  • 38. Clocked Threads • SC_CTHREAD can have only one bit wide ports as trigger.
  • 39. Outline • Background – Hardware architecture – SoC Design Flow (系統晶片設計流程) – SystemC background • SystemC Syntax by Example – ex1: Counter – ex2: Traffic Light – ex3: Simple Bus
  • 40. Example 3 – Simple Bus (匯流排)
  • 41. Interface “bus_if.h: #include <systemc.h> class bus_if: public sc_interface { public: virtual void write(unsigned addr, int data) = 0; virtual void read(unsigned addr, int& data) = 0; };
  • 42. Slave – RAM #include “bus_if.h” class ram: public bus_if, public sc_module { public: // interface function void write(unsigned addr, int data); void read(unsigned addr, int&data); // constructor ram(sc_module_name); // destructor ~ram(); private: // memory contents int* pMem; }; “ram.h” “ram.cpp” #include “ram.h” ram::ram(sc_module_name nm) : sc_module(nm) { pMem = new int[16]; } ram::~ram() { delete[] pMem; } void ram::write(unsigned addr, int data) { pMem[addr] = data; } void ram::read(unsigned addr, int& data) { data = pMem[addr] }
  • 43. Slave – ROM #include “bus_if.h” class rom: public bus_if, public sc_module { public: // interface function void write(unsigned addr, int data); void read(unsigned addr, int&data); // constructor rom(sc_module_name); // destructor ~rom(); private: // memory contents int* pMem; }; #include “rom.h” rom::rom(sc_module_name nm) : sc_module(nm) { pMem = new int[16]; for(int i=0; i<16; i++) pMem[i] = i; } rom::~ram() { delete[] pMem; } void rom::write(unsigned addr, int data) { assert(0); } void rom::read(unsigned addr, int& data) { data = pMem[addr]; } “rom.h” “rom.cpp”
  • 44. Master #include “bus_if.h” class cpu: public sc_module { public: // port declaration sc_in_clk clk; sc_port<bus_if> mem_port; // process declaration void cthread_func(); // constructor cpu(sc_module_name nm); }; “cpu.h” #include “cpu.h” cpu::cpu(sc_module_name nm) : sc_module(nm) { SC_HAS_PROCESS(cpu); SC_CTHREAD(cthread_func, clk.pos); } void cpu::cthread_func() { while(1) { int data; for(int i=0; i<16; i++) { mem_port->read(i, data); mem_port->write(i+16, data); } sc_stop(); } “cpu.cpp” }
  • 45. Bus cpu bus rom ram master slave rom ram 0x00 0x0f 0x10 0x1f Memory Map
  • 46. Bus #include “bus_if.h” class bus: public bus_if, public sc_module { public: // port declaration sc_port<bus_if> rom_port; sc_port<bus_if> ram_port; // interface function void write(unsigned addr, int data); void read(unsigned addr, int&data); // constructor bus(sc_module_name); }; #include “bus.h” bus::bus(sc_module_name nm) : sc_module(nm) { } void bus::write(unsigned addr, int data) { if(addr < 16) rom_port->write(addr, data); else rqm_port->write(addr, data); } void bus::read(unsigned addr, int& data) { if(addr < 16) rom_port->read(addr, data); else ram_port->read(addr, data); } “bus.h” “bus.cpp”
  • 47. • www.doulos.com/knowhow/systemc/ • www.asic-world.com/systemc/ • www.systemc.org/
  • 48. TOOLS
  • 49. Commercial tool: SOC Designer Work Space Cache Profiling window Waveform Viewer Memory maps Assembly code window
  • 51. Open Source: GreenSoc (not so open) User IP 1 GreenBus I/F GreenScript SystemC User IP 2 User IP 3 Config User I/F GreenBus I/F GreenBus I/F Config User I/F Config User I/F Config PlugIn GreenAV PlugIn Specific PlugIn GreenControl Core GreenAV User I/F Specific User I/F ESL Tools
  • 55. FPGA tool: NCKU Multicore
  • 57. LAB 1 SystemC 環境建構及範例程式運行
  • 58. 安裝說明 • 請參閱doc檔。 • 環境統一使用Linux。
  • 59. 專案說明 • 其中包含三個檔案main.cpp hello_module.h hello_module.cpp • 可將main.cpp視同電路板,在上面做接線等 等的動作。 • hello_module是一個具有process的硬體元件。
  • 60. Main.cpp 將所需元件的.h檔和systemC.h引入 Sc_main是systemC程式的進入點 宣告一組clk的訊號週期為10ns 宣告一組hello_module的元件 將clk接上module的clk訊號上 開始進行模擬模擬1000ns內的硬體 運作
  • 61. Hello_module.h 宣告一組元件定義hello_module 宣告hello_module的訊號線clk 宣告hello_module的運作函式 hello_module的建構子 整組元件具有process(method) process執行的函式Method_func Process會經由clk正緣觸發