CprE 588 Embedded Computer Systems Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #10 – Introduction.

Slides:



Advertisements
Similar presentations
Network II.5 simulator ..
Advertisements

Simulation executable (simv)
Combinational Logic.
High Level Languages: A Comparison By Joel Best. 2 Sources The Challenges of Synthesizing Hardware from C-Like Languages  by Stephen A. Edwards High-Level.
Simulation Verification of Different Constraints in System Level Design in SystemC Piyush Ranjan Satapathy CS220 Class Project Presentation.
Why Behavioral Wait statement Signal Timing Examples of Behavioral Descriptions –ROM.
Copyright © 2001 Stephen A. Edwards All rights reserved SystemC Prof. Stephen A. Edwards.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Copyright © 2001 Stephen A. Edwards All rights reserved Review for Final Prof. Stephen A. Edwards.
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
Chapter 5. SystemC 1.0 Main Purpose  Model RTL Instruments  Support diverse data type  Execute concurrently by using METHODs.
Copyright © 2001 Stephen A. Edwards All rights reserved SystemC Prof. Stephen A. Edwards.
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 14: SystemC (2/3) Prof. Sherief Reda Division of.
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 13: SystemC (1/3) Prof. Sherief Reda Division of.
Digital System Design EEE344 Lecture 3 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
C++ fundamentals.
Design Synopsys System Verilog API Donations to Accellera João Geada.
Overview Logistics Last lecture Today HW5 due today
Introduction to VHDL (part 2)
SystemC: Introduction. SystemC  A C++ based class library and design environment for system-level design.  Suitable for functional description that.
From Scenic to SystemC Mehrdad Abutalebi. Outline Introducing Scenic Scenic Implementation Modeling Reactivity A Simple example From Scenic to SystemC.
By: R Jayampathi Sampath
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
SystemC Tutorial Author: Silvio Veloso
CPE 626 The SystemC Language Aleksandar Milenkovic Web:
1 Freeha Azmat Saba Zia Dec 02, Agenda Installation Introduction From Verilog to SystemC Counter as an Example Complete SystemC Modeling 2.
Design & Co-design of Embedded Systems Combinational Logic in SystemC Maziar Goudarzi.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Modules and Processes in SystemC A Presentation by: Najmeh Fakhraie Mozhgan Nazarian-Naeini Hardware-Software Codesign Spring 2006.
Winter-Spring 2001Codesign of Embedded Systems1 Reactivity, Ports, and Signals in SystemC Part of HW/SW Codesign of Embedded Systems Course (CE )
1 IMEC / KHBO June 2004 Micro-electronics SystemC Dorine Gevaert.
1 Very Large Scale Integration II - VLSI II SystemC Gürer Özbek ITU VLSI Laboratories Istanbul Technical University.
Winter-Spring 2001Codesign of Embedded Systems1 Introduction to System-Level Modeling in SystemC 2.0 Part of HW/SW Codesign of Embedded Systems Course.
CSC321 Concurrent Programming: §5 Monitors 1 Section 5 Monitors.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
Modern VLSI Design 4e: Chapter 8 Copyright  2008 Wayne Wolf Topics VHDL register-transfer modeling: –basics using traffic light controller; –synthesis.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
CprE 588 Embedded Computer Systems Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #5 – System-Level.
Ch.2 Part E: VHDL, SystemC EECE **** Embedded System Design.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
CPE 626 The SystemC Language Aleksandar Milenkovic Web:
Way beyond fast © 2002 Axis Systems, Inc. CONFIDENTIAL Axis Common Transaction Interface (CTI) Architecture Highlights 9/11/2003 Ching-Ping Chou Axis Systems,
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
CPE 626 The SystemC Language Aleksandar Milenkovic Web:
IAY 0600 Digital Systems Design Event-Driven Simulation VHDL Discussion Alexander Sudnitson Tallinn University of Technology.
55:032 - Intro. to Digital DesignPage 1 VHDL and Processes Defining Sequential Circuit Behavior.
CIS 4930/6930 System-on-Chip Design Transaction-Level Modeling with SystemC Dr. Hao Zheng Comp. Sci & Eng. U of South Florida.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
1 of 14 Ivan Ukhov Embedded Systems Laboratory Department of Computer and Information Science Linköping University TDDI08: Embedded Systems Design Introduction.
Design & Co-design of Embedded Systems Introduction to System-Level Modeling in SystemC 2.0 Maziar Goudarzi.
CIS 4930/6930 System-on-Chip Design Introduction to SystemC Hao Zheng Computer Science & Engineering U of South Florida.
IAY 0600 Digitaalsüsteemide disain
Behavioral Style Combinational Design with VHDL
2. Specification and Modeling
Timing Model Start Simulation Delay Update Signals Execute Processes
Behavioral Style Combinational Design with VHDL
IAY 0600 Digital Systems Design
Tsao, Lin-wei Li, Han-lin Hu, Sun-Bo
SystemC for SoC Designs
Design Flow System Level
ECE 434 Advanced Digital System L08
SystemC Scheduler Dynamic sensitivity.
IAS 0600 Digital Systems Design
IAS 0600 Digital Systems Design
CSE 153 Design of Operating Systems Winter 19
Introduction to System-Level Modeling in SystemC 2.0
COE 202 Introduction to Verilog
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

CprE 588 Embedded Computer Systems Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #10 – Introduction to SystemC

Lect-10.2CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Outline D. Black, J. Donovan, B. Bunton, and A. Keist, SystemC: From the Ground Up, Springer, Introduction and Overview Language Features Simple Module Design Some System-Level Design

Lect-10.3CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 SystemC A C++ based class library and design environment for system-level design Suitable for functional description that might eventually be implemented as either HW or SW Open standard Language definition is publicly available Libraries are freely distributed Synthesis tools are an expensive commercial product

Lect-10.4CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 C++ Language Standard Core Language Module Ports Processes Events Interfaces Channels Event-driven simulation kernel Data types Bits and bit-vectors Arbitrary precision integers Fixed-point numbers 4-valued logic types, logic-vectors C++ user defined types Elementary Channels Signal, Timer, Mutex, Semaphore, FIFO, etc Channels for MoCs Kahn process networks, SDF, etc Methodology-specific Channels Master/Slave library Language Architecture (v2.0)

Lect-10.5CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Glossary Module Basic building block for structural partitioning Contains ports, processes, data Other modules Process Basic specification mechanism for functional description Three types sc_method : sensitive to some ports/signals, no wait statements sc_thread: sensitive to some ports/signals with wait statements sc_cthread: sensitive to only clock

Lect-10.6CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Modules Hierarchical entity Similar to VHDL’s entity Actually a C++ class definition Simulation involves Creating objects of this class They connect themselves together Processes in these objects (methods) are called by the scheduler to perform the simulation

Lect-10.7CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Module Example SC_MODULE(mymod) { /* port definitions */ /* signal definitions */ /* clock definitions */ /* storage and state variables */ /* process definitions */ SC_CTOR(mymod) { /* Instances of processes and modules */ } };

Lect-10.8CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Ports Define the interface to each module Channels through which data is communicated Port consists of a direction inputsc_in outputsc_out bidirectionalsc_inout Can be any C++ or SystemC type

Lect-10.9CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Port Example SC_MODULE(mymod) { sc_in load, read; sc_inout data; sc_out full; /* rest of the module */ };

Lect-10.10CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Signals Convey information between modules within a module Directionless: module ports define direction of data transfer Type may be any C++ or built-in type

Lect-10.11CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Signal Example SC_MODULE(mymod) { /* port definitions */ sc_signal > s1, s2; sc_signal reset; /* … */ SC_CTOR(mymod) { /* Instances of modules that connect to the signals */ } };

Lect-10.12CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Instances of Modules Connect instance’s ports to signals Each instance is a pointer to an object in the module SC_MODULE(mod1) { … }; SC_MODULE(mod2) { … }; SC_MODULE(foo) { mod1* m1; mod2* m2; sc_signal a, b, c; SC_CTOR(foo) { m1 = new mod1(“i1”); (*m1)(a, b, c); m2 = new mod2(“i2”); (*m2)(c, b); } };

Lect-10.13CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Processes Only thing in SystemC that actually does anything Procedural code with the ability to suspend and resume Methods of each module class Like Verilog’s initial blocks

Lect-10.14CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Three Types of Processes METHOD Models combinational logic THREAD Models testbenches CTHREAD Models synchronous FSMs

Lect-10.15CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 METHOD Processes Triggered in response to changes on inputs Cannot store control state between invocations Designed to model blocks of combinational logic

Lect-10.16CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 METHOD Processes Process is simply a method of this class Instance of this process created and made sensitive to an input SC_MODULE(onemethod) { sc_in in; sc_out out; void inverter(); SC_CTOR(onemethod) { SC_METHOD(inverter); sensitive(in); } };

Lect-10.17CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Invoked once every time input “in” changes Should not save state between invocations Runs to completion: should not contain infinite loops Not preempted void onemethod::inverter() { bool internal; internal = in; out = ~internal; } METHOD Processes Read a value from the port Write a value to an output port

Lect-10.18CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 THREAD Processes Triggered in response to changes on inputs Can suspend itself and be reactivated Method calls wait to relinquish control Scheduler runs it again later Designed to model just about anything

Lect-10.19CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 SC_MODULE(onemethod) { sc_in in; sc_out out; void toggler(); SC_CTOR(onemethod) { SC_THREAD(toggler); sensitive << in; } }; THREAD Processes Process is simply a method of this class Instance of this process created alternate sensitivity list notation

Lect-10.20CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Reawakened whenever an input changes State saved between invocations Infinite loops should contain a wait() void onemethod::toggler() { bool last = false; for (;;) { last = in; out = last; wait(); last = ~in; out = last; wait(); } THREAD Processes Relinquish control until the next change of a signal on the sensitivity list for this process

Lect-10.21CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 CTHREAD Processes Triggered in response to a single clock edge Can suspend itself and be reactivated Method calls wait to relinquish control Scheduler runs it again later Designed to model clocked digital hardware

Lect-10.22CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 CTHREAD Processes Instance of this process created and relevant clock edge assigned SC_MODULE(onemethod) { sc_in_clk clock; sc_in trigger, in; sc_out out; void toggler(); SC_CTOR(onemethod) { SC_CTHREAD(toggler, clock.pos()); } };

Lect-10.23CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Reawakened at the edge of the clock State saved between invocations Infinite loops should contain a wait() void onemethod::toggler() { bool last = false; for (;;) { wait_until(trigger.delayed() == true); last = in; out = last; wait(); last = ~in; out = last; wait(); } CTHREAD Processes Relinquish control until the next clock cycle Relinquish control until the next clock cycle in which the trigger input is 1

Lect-10.24CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 A CTHREAD for Complex Multiply struct complex_mult : sc_module { sc_in a, b, c, d; sc_out x, y; sc_in_clk clock; void do_mult() { for (;;) { x = a * c - b * d; wait(); y = a * d + b * c; wait(); } SC_CTOR(complex_mult) { SC_CTHREAD(do_mult, clock.pos()); } };

Lect-10.25CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Watching Process will be restarted from the beginning when reset is true A CTHREAD process can be given reset-like behavior Limited version of Esterel’s abort SC_MODULE(onemethod) { sc_in_clk clock; sc_in reset, in; void toggler(); SC_CTOR(onemethod) { SC_CTHREAD(toggler, clock.pos()); watching(reset.delayed() == true); } };

Lect-10.26CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 SystemC Types SystemC programs may use any C++ type along with any of the built-in ones for modeling systems

Lect-10.27CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 SystemC Built-in Types sc_bit, sc_logic Two- and four-valued single bit sc_int, sc_unint 1 to 64-bit signed and unsigned integers sc_bigint, sc_biguint arbitrary (fixed) width signed and unsigned integers sc_bv, sc_lv arbitrary width two- and four-valued vectors sc_fixed, sc_ufixed signed and unsigned fixed point numbers

Lect-10.28CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Clocks The only thing in SystemC that has a notion of real time Only interesting part is relative sequencing among multiple clocks Triggers SC_CTHREAD processes or others if they decided to become sensitive to clocks

Lect-10.29CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 SystemC 1.0 Scheduler Assign clocks new values Repeat until stable Update the outputs of triggered SC_CTHREAD processes Run all SC_METHOD and SC_THREAD processes whose inputs have changed Execute all triggered SC_CTHREAD methods. Their outputs are saved until next time

Lect-10.30CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Delayed assignment and delta cycles Just like VHDL and Verilog Essential to properly model hardware signal assignments Each assignment to a signal won’t be seen by other processes until the next delta cycle Delta cycles don’t increase user-visible time Multiple delta cycles may occur SystemC 1.0 Scheduler (cont.)

Lect-10.31CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Objectives of SystemC 2.0 Primary goal: Enable System-Level Modeling Systems include hardware, software, or both Challenges: Wide range of design models of computation Wide range of design abstraction levels Wide range of design methodologies

Lect-10.32CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Objectives of SystemC 2.0 (cont’d) Solution in SystemC 2.0 Introduces a small but very general purpose modeling foundation => Core Language Elementary channels Other library models provided (FIFO, Timers,...) Even SystemC 1.0 Signals Support for various models of computation, methodologies, etc. Built on top of the core language, hence are separate from it

Lect-10.33CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Communication and Synchronization SystemC 1.0 Modules and Processes are still useful in system design But communication and synchronization mechanisms in SystemC 1.0 (Signals) are restrictive for system- level modeling Communication using queues Synchronization (access to shared data) using mutexes

Lect-10.34CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Communication and Synchronization SystemC 2.0 introduces general-purpose Channel A container for communication and synchronization They implement one or more interfaces Interface Specify a set of access methods to the channel But it does not implement those methods Event Flexible, low-level synchronization primitive Used to construct other forms of synchronization

Lect-10.35CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Communication and Synchronization Other comm. & sync. models can be built based on the above primitives Examples HW-signals, queues (FIFO, LIFO, message queues, etc) semaphores, memories and busses (both at RTL and transaction-level models)

Lect-10.36CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Communication and Synchronization Channel Module1Module2 Events Interfaces Ports to Interfaces

Lect-10.37CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Modeling Example FIFO ProducerConsumer Write Interface Read Interface Problem definition: FIFO communication channel with blocking read and write operations

Lect-10.38CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Example (cont) class write_if : public sc_interface { public: virtual void write(char) = 0; virtual void reset() = 0; }; class read_if : public sc_interface { public: virtual void read(char&) = 0; virtual int num_available() = 0; }; FIFO pc

Lect-10.39CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Example (cont.) class fifo: public sc_channel, public write_if, public read_if { private: enum e {max_elements=10}; char data[max_elements]; int num_elements, first; sc_event write_event, read_event; bool fifo_empty() {…}; bool fifo_full() {…}; public: SC_CTOR(fifo) { num_elements = first=0; } void write(char c) { if ( fifo_full() ) wait(read_event); data[ ]=c; ++num_elements; write_event.notify(); } void read(char &c) { if( fifo_empty() ) wait(write_event); c = data[first]; --num_elements; first = ; read_event.notify(); } FIFO pc

Lect-10.40CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Example (cont.) void reset() { num_elements = first = 0; } int num_available() { return num_elements; } };// end of class declarations FIFO pc

Lect-10.41CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Example (cont.) All channels must be derived from sc_channel class SystemC internals (kernel\sc_module.h) typedef sc_module sc_channel; be derived from one (or more) classes derived from sc_interface provide implementations for all pure virtual functions defined in its parent interfaces

Lect-10.42CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Example (cont.) Note the following extensions beyond SystemC 1.0 wait() call with arguments => dynamic sensitivity wait(sc_event) wait(time) // e.g. wait(200, SC_NS); wait(time_out, sc_event) //wait(2, SC_PS, e); Events are the fundamental synch. primitive in SystemC 2.0 Unlike signals, have no type and no value always cause sensitive processes to be resumed can be specified to occur: immediately/ one delta-step later/ some specific time later

Lect-10.43CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 The wait() Function // wait for 200 ns. sc_time t(200, SC_NS); wait( t ); // wait on event e1, timeout after 200 ns. wait( t, e1 ); // wait on events e1, e2, or e3, timeout after 200 ns. wait( t, e1 | e2 | e3 ); // wait on events e1, e2, and e3, timeout after 200 ns. wait( t, e1 & e2 & e3 ); // wait one delta cycle. wait( SC_ZERO_TIME );

Lect-10.44CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Possible calls to notify(): sc_event my_event; my_event.notify(); // notify immediately my_event.notify( SC_ZERO_TIME ); // notify next delta cycle my_event.notify( 10, SC_NS ); // notify in 10 ns sc_time t( 10, SC_NS ); my_event.notify( t ); // same The notify() Method of sc_event

Lect-10.45CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Example (cont.) SC_MODULE(producer) { public: sc_port out; SC_CTOR(producer) { SC_THREAD(main); } void main() { char c; while (true) { out->write(c); if(…) out->reset(); } } }; SC_MODULE(consumer) { public: sc_port in; SC_CTOR(consumer) { SC_THREAD(main); } void main() { char c; while (true) { in->read(c); cout num_available(); } } }; FIFO pc

Lect-10.46CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Example (cont.) SC_MODULE(top) { public: fifo *afifo; producer *pproducer; consumer *pconsumer; SC_CTOR(top) { afifo = new fifo(“Fifo”); pproducer=new producer(“Producer”); pproducer->out(afifo); pconsumer=new consumer(“Consumer”); pconsumer->in(afifo); }; FIFO pc

Lect-10.47CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 FIFO Example (cont.) Note: Producer module sc_port out; Producer can only call member functions of write_if interface Consumer module sc_port in; Consumer can only call member functions of read_if interface e.g., Cannot call reset() method of write_if Producer and consumer are unaware of how the channel works just aware of their respective interfaces Channel implementation is hidden from communicating modules

Lect-10.48CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Expected to be SystemC 3.0 Support for RTOS modeling New features in the core language Fork and join threads + dynamic thread creation Interrupt or abort a thread and its children Specification and checking of timing constraints Abstract RTOS modeling and scheduler modeling Expected to be SystemC 4.0 New features in the core language Support for analog mixed signal modeling Future Evolution of SystemC

Lect-10.49CprE 588 – Embedded Computer SystemsMar 31-Apr 2, 2009 Extensions as libraries on top of the core language Standardized channels for various MOC (e.g. static dataflow and Kahn process networks) Testbench development Libraries to facilitate development of testbenches Data structures that aid stimulus generation and response checking Functions that help generate randomized stimulus, etc. System level modeling guidelines Library code that helps users create models following the guidelines Interfacing to other simulators Standard APIs for interfacing SystemC with other simulators, emulators, etc. Future Evolution of SystemC (cont.)