SystemC_1-1.ppt

Download Report

Transcript SystemC_1-1.ppt

Introduction to
SystemC
Part of
HW/SW Codesign of Embedded
Systems Course (CE 40-226)
Winter-Spring 2001
Codesign of Embedded Systems
1
Today programme

Introduction to SystemC




History
Highlights
Design Methodology
A simple SystemC program
Winter-Spring 2001
Codesign of Embedded Systems
2
VSIA SLD
Data Types
Spec (draft)
SystemC History
Synopsys
Synopsys
ATG
“Scenic”
UC
Irvine
1996
Synopsys
SystemC
v0.90
Sep. 99
“Fridge”
Frontier Design
A/RT Library
1991
imec
1992
Winter-Spring 2001
CoWare
“N2C”
1997
Fixed Point
Types
Abstract
Protocols
Codesign of Embedded Systems
SystemC
v1.0
Apr. 00
SystemC
v1.1
Jun. 00
3
SystemC Highlights

Features as a codesign language






Modules
Processes
Ports
Signals
Rich set of port and
signal types
Rich set of data types
Winter-Spring 2001






Clocks
Cycle-based simulation
Multiple abstraction
levels
Communication protocols
Debugging support
Waveform tracing
Codesign of Embedded Systems
4
Current
System Design Methodology
C/C++
System Level Model
Refine
Analysis
Manual Conversion
VHDL/Verilog
Simulation
Results
Synthesis
Rest of Process
Winter-Spring 2001
Codesign of Embedded Systems
5
Current System Design
Methodology (cont’d)

Problems



Errors in manual conversion from C to HDL
Disconnect between system model and
HDL model
Multiple system tests
Winter-Spring 2001
Codesign of Embedded Systems
6
SystemC Design Methodology
SystemC Model
Simulation
Refinement
Synthesis
Rest of Process
Winter-Spring 2001
Codesign of Embedded Systems
7
SystemC Design Methodology
(cont’d)

Advantages




Refinement methodology
Written in a single language
Higher productivity
Reusable testbenches
Winter-Spring 2001
Codesign of Embedded Systems
8
SystemC programming model

Mod 1
Mod 2

A set of modules
interacting through
signals.
Module functionality
is described by
Mod 3
Winter-Spring 2001
processes.
Codesign of Embedded Systems
9
SystemC programming model
(cont’d)

System (program) debug/validation

Testbench


Normal C++ IDE facilities


Simulation, Waveform view of signals
Watch, Evaluate, Breakpoint, ...
sc_main() function




instantiates all modules
initializes clocks
initializes output waveform files
starts simulation kernel
Winter-Spring 2001
Codesign of Embedded Systems
10
A Simple Example:
Defining a Module

a
b
c
d
Complex-number Multiplier
(a+bi)*(c+di) = (ac-bd)+(ad+bc)i
e
Complex
Multiplier
f
(cmplx_mult)
Winter-Spring 2001
SC_MODULE(cmplx_mult) {
sc_in<int> a,b;
sc_in<int> c,d;
sc_out<int> e,f;
...
}
Codesign of Embedded Systems
11
A Simple Example:
Defining a Module (cont’d)
SC_MODULE(cmplx_mult) {
sc_in<int> a,b;
sc_in<int> c,d;
void cmplx_mult::calc()
{
e = a*c-b*d;
f = a*d+b*c;
sc_out<int> e,f;
void calc();
}
SC_CTOR(cmplx_mult) {
SC_METHOD(calc);
sensitive<<a<<b<<c<<d;
}
}
Winter-Spring 2001
Codesign of Embedded Systems
12
Completing the Design
M1
a
b
M2
input_gen
c
d
Complex
Multiplier
e
f
M3
display
Clk.signal()
clk
Winter-Spring 2001
Codesign of Embedded Systems
13
Completing the Design:
input_gen module
SC_MODULE(input_gen) {
sc_in<bool> clk;
sc_out<int> a,b;
sc_out<int> c,d;
void input_gen::generate()
{
int a_val=0, c_val=0;
while (true) {
a = a_val++;
wait();
c = (c_val+=2);
wait();
}
void generate();
SC_CTOR(input_gen) {
SC_THREAD(generate);
sensitive_pos(clk);
}
}
}
Winter-Spring 2001
Codesign of Embedded Systems
14
Completing the Design:
display module
SC_MODULE(display) {
sc_in<int> e,f;
void display::show()
{
void show();
cout<<e<<‘+’<<f<<“i\n”;
SC_CTOR(display) {
SC_METHOD(show);
sensitive<<e<<f;
}
}
}
Winter-Spring 2001
Codesign of Embedded Systems
15
Putting it all together:
sc_main function
#include <systemc.h>
M2.a(a); M2.b(b);
M2.c(c); M2.d(d);
M2.e(e); M2.f(f);
int sc_main()
{
M3.e(e); M3.f(f);
input_gen M1(“I_G”);
cmplx_mult M2(“C_M”);
display
M3(“D”);
sc_signal<int> a,b,c,d,e,f;
sc_clock clk(“clk”,20,0.5);
sc_start(100);
return 0;
}
M1.clk(clk.signal());
M1.a(a); M1.b(b);
M1.c(c); M1.d(d);
Winter-Spring 2001
Codesign of Embedded Systems
16
What we learned today




What’s SystemC
SystemC advantages
SystemC programming model
Writing programs in SystemC
Winter-Spring 2001
Codesign of Embedded Systems
17
Complementary notes:
Assignments

Send your assignments to
[email protected]


Today is due date for Assignment 2
Take Assignmentak 3
Due date: Sat. Farvardin 25th
Winter-Spring 2001
Codesign of Embedded Systems
18
Complementary notes:
SystemC Installation

Refer to http://ce.sharif.edu/~ce226


Under “References” tab, find SystemC 1.0
user’s guide and installation files, and
SystemC_Win utility
We start by SystemC 1.0, later will cover
1.1 and talk about 2.0
Winter-Spring 2001
Codesign of Embedded Systems
19