14
From Scenic to SystemC Mehrdad Abutalebi

From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

Embed Size (px)

Citation preview

Page 1: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

From Scenic to SystemC

Mehrdad Abutalebi

Page 2: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

Outline

Introducing Scenic

Scenic Implementation

Modeling Reactivity

A Simple example

From Scenic to SystemC

Page 3: 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

Page 4: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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)

Page 5: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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

Page 6: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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

Page 7: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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”

Page 8: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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

Page 9: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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

Page 10: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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

Page 11: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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();

};

Page 12: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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;

}

}

Page 13: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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

Page 14: From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC

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