Upload
curtis-hodges
View
226
Download
0
Embed Size (px)
Citation preview
From Scenic to SystemC
Mehrdad Abutalebi
Outline
Introducing Scenic
Scenic Implementation
Modeling Reactivity
A Simple example
From Scenic to SystemC
Introducing Scenic
Introduced in 1997 by Stan Liao, Steve Tjiang, Rajesh GuptaAn Efficient Implementation of Reactivity
for Modeling Hardware in the Scenic Design Environment
Based on the researches on UC Irvine and Synopsys
Scenic Implementation
Modeling Reactivity Concurrency Signals and Events Waiting and Watching
Modeling Structures and Data Types Ports as C++ references to Signals std_ulogic
Simulation of Reactive Systems Process Driven (a type of Cycle Simulation)
Modeling Reactivity
ConcurrencyCan be modeled with program threads Implementing sc_process class for
encapsulating process behaviorUse virtual function for describing process
behaviorSub typing sc_process and overwrite
entry() virtual function
Modeling Reactivity
Signals and EventsProcesses use signals and events to
communicate rather than using semaphores and critical regions as software synchronization threads
Use templates of C++ for implementing signals
Modeling Reactivity
Waiting and watchingWait refers to a blocking action that can be
associated to an event “wait_until(expression)”
Watch refers to a non-blocking action that runs in parallel with a specified behavior “do p watching s”
Modeling Reactivity
WaitingA waiting process suspends itself until
some event occurs.Uses delay-evaluate lambda expressions
to avoid unnecessary context switching
WatchingUses C++ exception handling mechanism,
try, catch, throw
Modeling Structures and Data Types
Structural descriptionComponent instances and their
interconnections through port and port mapModeling ports as C++ references to
Signals
Data Types Implementing std_ulogic and
std_ulogic_vector
Simulation of Reactive Systems
Using process driven simulation
For synchronous systems check the events during clock changes
To reduce context switching checks on signal changes and condition are performed in scheduler
A Simple Exampleclass Counter : public sc_process {
const sc_signal<std_ulogic>& reset;sc_signal<std_ulogic>& iszero;int count;
public:Counter( sc_clock_edge& EDGE,
const sc_signal<std_ulogic>& ENABLE,sc_signal<std_ulogic>& ISZERO ): sc_process(EDGE), enable(ENABLE),reset(REST)
{count = 15; // initializationwatching( reset == ‘1’ );
}void entry();
};
A Simple Examplevoid Counter::entry()
{
try {
if (count == 0) {
write( iszero, ’1’ );
count = 15;
}
else {
write( iszero, ’0’ );
count--;
}
next();
}
catch(sc_user &) {
if( reset.read() == ‘1’ ) count = 0;
}
}
SystemC 0.9
Introduction of three types of processessc_sync: (SC_CTHREAD)synchronous
thread processsame as sc_process in Scenic
sc_async: (SC_METHOD) asynchronous function process
sc_aproc: (SC_THREAD) asynchronous thread process
Rich set of signal types and data types
SystemC 1.0
Implementing sc_module for class hierarchy sc-module as a container class for processes and
also other modules
Fixed points data types
Implementing sc_port<> sc_in<>, sc_out, sc_inout<>
Simplified syntax by implementing Macros and auxiliary operators