Professional Documents
Culture Documents
Deian Tabakov
Rice University
Houston, TX
Introduction
The brave new world
Time-to-market : This years gadgets must replace last years
Shorter design cycles
Find and fix most bugs early
Early prototyping and design exploration
Design software and hardware in parallel
Complexity : Designing in the age of the iPhone
Moores Law
SoC: Hardware + software on a single die
Concurrent systems
IP development, reuse, exchange
Specifying systems
Deian Tabakov
Introduction to SystemC
2/29
Introduction
Deian Tabakov
Introduction to SystemC
3/29
Introduction
Deian Tabakov
Introduction to SystemC
3/29
Introduction
SystemC in a nutshell
A system-level modeling language
Several levels of abstraction (from purely functional to cycle
accurate pin-accurate)
Special attention to systems with embedded software
Deian Tabakov
Introduction to SystemC
4/29
Introduction
SystemC in a nutshell
A system-level modeling language
Several levels of abstraction (from purely functional to cycle
accurate pin-accurate)
Special attention to systems with embedded software
Deian Tabakov
Introduction to SystemC
4/29
Introduction
SystemC in a nutshell
A system-level modeling language
Several levels of abstraction (from purely functional to cycle
accurate pin-accurate)
Special attention to systems with embedded software
Deian Tabakov
Introduction to SystemC
4/29
Deian Tabakov
Introduction to SystemC
5/29
void do_it() {
// a C++ function
F.write( !(A.read() && B.read()) );
}
SC_CTOR(nand) {
SC_METHOD(do_it);
sensitive << A << B;
}
};
Deian Tabakov
Introduction to SystemC
6/29
Deian Tabakov
Introduction to SystemC
7/29
Introduction to SystemC
8/29
Deian Tabakov
Introduction to SystemC
9/29
Introduction to SystemC
10/29
Introduction to SystemC
11/29
mon Monitor1("Monitor");
Monitor1.A(ASig);
Monitor1.B(BSig);
Monitor1.F(FSig);
Monitor1.Clk(TestClk);
exor DUV("exor");
DUV.A(ASig);
DUV.B(BSig);
DUV.F(FSig);
sc_start();
return 0;
// run forever
}
Deian Tabakov
Introduction to SystemC
12/29
Deian Tabakov
Introduction to SystemC
13/29
Fundamentals of SystemC
Modules: the building blocks of SystemC models
Hierarchy
Abstraction
IP reuse
sc_signal
sc_in
SC_METHOD
sc_in
SC_THREAD
SC_MODULE
SC_MODULE
(Child Module)
(Child Modules)
sc_out
module memory
(local variables)
sc_inout
Helper Method
sc_out
Helper Method
Figure: SC MODULE
Deian Tabakov
Introduction to SystemC
14/29
Fundamentals of SystemC
Modules: the building blocks of SystemC models
Example (Structure of a module)
SC_MODULE(Module_name) {
// Declare ports, internal data, etc.
// Declare and/or define module functions
SC_CTOR(Module_name) {
// Body of the constructor
// Process declarations and sensitivities
SC_METHOD(function1);
sensitive << input1 << input2;
SC_THREAD(function2);
sensitive << input1 << clk;
}
};
Deian Tabakov
Introduction to SystemC
15/29
Fundamentals of SystemC
SC METHODs
Execute their body from beginning to end
Simulate faster
Do not keep implicit state of execution
Deian Tabakov
Introduction to SystemC
16/29
Fundamentals of SystemC
Data types
Four-valued logic types (01XZ)
Arbitrary-precision integers
Time
SC SEC, SC MS, SC US, SC NS, etc.
sc time t1(42, SC NS) creates a time object representing
42 nanoseconds
Integer-valued model of time
Deian Tabakov
Introduction to SystemC
17/29
Deian Tabakov
Introduction to SystemC
18/29
ports
MODULE 2
MODULE 1
signals
MODULE 3
channels
Deian Tabakov
Introduction to SystemC
19/29
Deian Tabakov
Introduction to SystemC
20/29
Deian Tabakov
Introduction to SystemC
20/29
Deian Tabakov
Introduction to SystemC
20/29
Introduction to SystemC
20/29
Channels
Channels implement interfaces
One channel can implement multiple interfaces
Many channels can implement the same interface
Example (exor.h)
SC MODULE(exor) {
sc in<bool> A, B;
sc out<bool> F;
nand n1, n2, n3, n4;
sc signal<bool> S1, S2, S3;
...
For example, sc signal<T> implements two interfaces:
sc signal in if<T> and sc signal inout if<T>
Deian Tabakov
Introduction to SystemC
21/29
Events
Deian Tabakov
Introduction to SystemC
22/29
Simulation Semantics
Deian Tabakov
Introduction to SystemC
23/29
Simulation Semantics
Simulating parallel execution sequentially
1
Initialize
Mark all processes runnable (or pending, or eligible)
Each SC METHOD will be executed once
Each SC THREAD will be executed until the first synch point
Deian Tabakov
Introduction to SystemC
24/29
Simulation Semantics
Simulating parallel execution sequentially
1
2
Initialize
Evaluate
Select an eligible process and run it
If the process uses immediate notification, other processes may
become eligible too (This is bad practice!)
Continue selecting eligible processes until none are left
Deian Tabakov
Introduction to SystemC
24/29
Simulation Semantics
Simulating parallel execution sequentially
1
Initialize
Evaluate
Update
Deian Tabakov
Introduction to SystemC
24/29
Simulation Semantics
Simulating parallel execution sequentially
1
Initialize
Evaluate
Update
Deian Tabakov
Introduction to SystemC
24/29
Simulation Semantics
Simulating parallel execution sequentially
1
Initialize
Evaluate
Update
Deian Tabakov
Introduction to SystemC
24/29
Simulation Semantics
Simulating parallel execution sequentially
1
Initialize
Evaluate
Update
Deian Tabakov
Introduction to SystemC
24/29
Simulation Semantics
Simulating parallel execution sequentially
1
Initialize
Evaluate
Update
Deian Tabakov
Introduction to SystemC
24/29
Simulation Semantics
Algorithm (Simulation Semantics)
Declare all processes runnable
//
While exists a runnable process do {
//
While exists a runnable process do {
//
/** Simulation time does not advance **/
Run all runnable processes
//
Run all pending update requests
//
Execute all pending delta notifications //
}
initialization
simulation loop
delta cycle
evaluation phase
update phase
delta phase
Deian Tabakov
Introduction to SystemC
25/29
Time
0 s
10 ns
20 ns
30 ns
Deian Tabakov
Introduction to SystemC
26/29
Simulation Semantics
Example (main.cc)
#include "stim.h"
#include "exor.h"
#include "mon.h"
int sc main(int argc, char* argv[]) {
sc signal<bool> ASig, BSig, FSig;
sc clock TestClk("TestClock", 10, SC NS, 0.5);
...
Deian Tabakov
Introduction to SystemC
27/29
Simulation Semantics
Example (main.cc)
#include "stim.h"
#include "exor.h"
#include "mon.h"
int sc main(int argc, char* argv[]) {
sc signal<bool> ASig, BSig, FSig;
sc clock TestClk("TestClock", 10, SC NS, 0.5, 1, SC NS);
...
Deian Tabakov
Introduction to SystemC
27/29
Simulation Semantics
Example (main.cc)
#include "stim.h"
#include "exor.h"
#include "mon.h"
int sc main(int argc, char* argv[]) {
sc signal<bool> ASig, BSig, FSig;
sc clock TestClk("TestClock", 10, SC NS, 0.5, 1, SC NS);
...
Introduction to SystemC
27/29
Summary
Deian Tabakov
Introduction to SystemC
28/29
Buzzwords
EDA Electronic Design Automation
SoC System-on-chip
TLM Transaction-Level Model(ing)
PV Programmers View
PVt Programmers View with Time
HDL Hardware Description Language
RTL Register Transfer Level
ASIC Application-Specific Integrated Circuit
IP Intellectual Property
DSP Digital Signal Processing
DUV Design Under Verification
Deian Tabakov
Introduction to SystemC
29/29