SystemC Tutorial. John Moondanos. Strategic CAD Labs, INTEL Corp. & GSRC Visiting Fellow, UC Berkeley



Similar documents
A Hardware and Software Monitor for High-Level System-on-Chip Verification

System Architecture Performance Modeling with SystemC

System-On Chip Modeling and Design A case study on MP3 Decoder

Seamless Hardware/Software Performance Co-Monitoring in a Codesign Simulation Environment with RTOS Support

Early Hardware/Software Integration Using SystemC 2.0

Discrete event modeling: VHDL

Tasks Schedule Analysis in RTAI/Linux-GPL

Codesign: The World Of Practice

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

Electronic system-level development: Finding the right mix of solutions for the right mix of engineers.

Modeling a GPS Receiver Using SystemC

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

The Advanced JTAG Bridge. Nathan Yawn 05/12/09

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

Testing & Verification of Digital Circuits ECE/CS 5745/6745. Hardware Verification using Symbolic Computation

MASTER'S THESIS. A JPEG Encoder in SystemC

TLM-2.0 in Action: An Example-based Approach to Transaction-level Modeling and the New World of Model Interoperability

VHDL Test Bench Tutorial

INTRODUCTION TO DIGITAL SYSTEMS. IMPLEMENTATION: MODULES (ICs) AND NETWORKS IMPLEMENTATION OF ALGORITHMS IN HARDWARE

Digital Systems Design! Lecture 1 - Introduction!!

Life Cycle of a Memory Request. Ring Example: 2 requests for lock 17

Architectures and Platforms

Computer Engineering: Incoming MS Student Orientation Requirements & Course Overview

Embedded Systems. 6. Real-Time Operating Systems

A Verilog HDL Test Bench Primer Application Note

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

Freescale Semiconductor, I

Monitors, Java, Threads and Processes

System Software Integration: An Expansive View. Overview

GEDAE TM - A Graphical Programming and Autocode Generation Tool for Signal Processor Applications

Von der Hardware zur Software in FPGAs mit Embedded Prozessoren. Alexander Hahn Senior Field Application Engineer Lattice Semiconductor

Computer Organization and Components

Multiprocessor System-on-Chip

YAML: A Tool for Hardware Design Visualization and Capture

SystemC - NS-2 Co-simulation using HSN

Eingebettete Systeme. 4: Entwurfsmethodik, HW/SW Co-Design. Technische Informatik T T T

EE361: Digital Computer Organization Course Syllabus

ESE566 REPORT3. Design Methodologies for Core-based System-on-Chip HUA TANG OVIDIU CARNU

Principles and characteristics of distributed systems and environments

Outline. Introduction. Multiprocessor Systems on Chip. A MPSoC Example: Nexperia DVP. A New Paradigm: Network on Chip

A SystemC Transaction Level Model for the MIPS R3000 Processor

National CR16C Family On-Chip Emulation. Contents. Technical Notes V

EC313 - VHDL State Machine Example

Real-Time Component Software. slide credits: H. Kopetz, P. Puschner

Embedded Software development Process and Tools:

7a. System-on-chip design and prototyping platforms

Product Development Flow Including Model- Based Design and System-Level Functional Verification

Chapter 6 Concurrent Programming

FSMD and Gezel. Jan Madsen

Mutual Exclusion using Monitors

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

Operating Systems. Lecture 03. February 11, 2013

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

Rapid System Prototyping with FPGAs

Example-driven Interconnect Synthesis for Heterogeneous Coarse-Grain Reconfigurable Logic

EEM870 Embedded System and Experiment Lecture 1: SoC Design Overview

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Model-based system-on-chip design on Altera and Xilinx platforms

LogiCORE IP AXI Performance Monitor v2.00.a

Design Cycle for Microprocessors

Design and Implementation of an On-Chip timing based Permutation Network for Multiprocessor system on Chip

Quartus II Software Design Series : Foundation. Digitale Signalverarbeitung mit FPGA. Digitale Signalverarbeitung mit FPGA (DSF) Quartus II 1

SDLC Controller. Documentation. Design File Formats. Verification

Real-Time Operating Systems.

Chapter 13: Verification

Real Time Programming: Concepts

CprE 588 Embedded Computer Systems Homework #1 Assigned: February 5 Due: February 15

Xenomai: integration and qualification of a real time operating system ARMadeus Systems

Course Development of Programming for General-Purpose Multicore Processors

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Performance Optimising Hardware Synthesis of Shared Objects

Eli Levi Eli Levi holds B.Sc.EE from the Technion.Working as field application engineer for Systematics, Specializing in HDL design with MATLAB and

Systems on Chip Design

A Framework for Automatic Generation of Configuration Files for a Custom Hardware/Software RTOS

Chapter 3 Operating-System Structures

MPSoC Virtual Platforms

RTAI. Antonio Barbalace (modified by M.Moro 2011) RTAI

CGI-based applications for distributed embedded systems for monitoring temperature and humidity

Digital Circuit Design Using Xilinx ISE Tools

The Microsoft Windows Hypervisor High Level Architecture

USB 3.0 Connectivity using the Cypress EZ-USB FX3 Controller

Testing of Digital System-on- Chip (SoC)

PyMTL and Pydgin Tutorial. Python Frameworks for Highly Productive Computer Architecture Research

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Vivado Design Suite Tutorial

Chapter 2 Ensuring RTL Intent

AXI Performance Monitor v5.0

Using SystemVerilog Assertions for Creating Property-Based Checkers

ModelSim-Altera Software Simulation User Guide

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

Tensilica Software Development Toolkit (SDK)

Multi-Threading Performance on Commodity Multi-Core Processors

ELEC 5260/6260/6266 Embedded Computing Systems

IEC The Fast Guide to Open Control Software

Transcription:

SystemC Tutorial John Moondanos Strategic CAD Labs, INTEL Corp. & GSRC Visiting Fellow, UC Berkeley

SystemC Introduction Why not leverage experience of C/C++ developers for H/W & System Level Design? But C/C++ have no notion of time No event sequencing Concurrency But H/W is inherently concurrent H/W Data Types No Z value for tri-state buses

SystemC is C++ Class Library use for Cycle-Accurate model for Software Algorithm Hardware Architecture Interface of SoC (System-on-Chip) System-level designs Executable Specification www.systemc.org

SystemC Environment

SystemC History SystemC 1.0 Provide VHDL like capabilities Simulation kernel Fixed point arithmetic data types Signals (communication channels) Modules Break down designs into smaller parts

SystemC History SystemC 2.0 Complete library rewrite to upgrade into true SLDL Events as primitive behavior triggers Channels, Interfaces and Ports Much more powerful modeling for Transaction Level Future SystemC 3.0 Modeling of OSs Support of embedded S/W models

Objectives of SystemC 2.0 Primary goal: Enable System-Level Modeling Systems include hardware and software Challenge: Wide range of design models of computation Wide range of design abstraction levels Wide range of design methodologies

SystemC 2.0 Objectives (cont) SystemC 2.0 Introduces a small but very general purpose modeling foundation => Core Language Support for other models of computation, methodologies, etc They are built on top of the core language, hence are separate from it Even SystemC 1.0 Signals are built on top of this core in SystemC 2.0 Other library models are provided: FIFO, Timers,...

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

SystemC Language Architecture Core System

SystemC vs. Metropolis Constructs to model system architecture Hardware timing Concurrency Structure Adding these constructs to C SystemC C++ Class library Standard C/C++ Compiler : bcc, msvc, gcc, etc Metropolis New keywords & Syntax Translator for SystemC Many More features

System Design Methodology Current Manual Conversion from C to HDL Creates Errors Disconnect Between System Model and HDL Model Multiple System Tests SystemC (Executable-Specification) Refinement Methodology Written in a Single Language

Modeling Terms (I) Untimed Functional (UTF) Refers to model I/F and functionality No time used for regulating the execution Execution & data transport in 0 time Timed Functional (TF) Refers to both model I/F and functionality Time is used for the execution Latencies are modeled Data Transport takes time

Modeling Terms (II) Bus Cycle Accurate (BCA) Refers to model I/F, not functionality Timing is cycle accurate, tied to some global clock Does not infer pin level detail Transactions for data transport Pin Cycle Accurate (PCA) Refers to model I/F not model functionality Timing is cycle accurate Accuracy of the I/F at the pin Level Register Transfer (RT) Accurate Refers to model functionality Everything fully timed Complete detailed Description, every bus, every bit is modeled

Model Types (1) System Architectural Executable specification for H/W & S/W Architecture Exploration, algorithm determination & proof I/Fs are UTF with no pin detail for modeling communication protocols Functionality UTF, sequential since it s untimed System Performance Timed executable specification for bith H/W & S/W Used for time budgeting Concurrent behavior modeled Transaction Level (TLM) Typically describe H/W only Model I/Fs are TF, functionality TF as well (either not cycle accurate) Data Transfers & system Behavior modeled as transactions

Model Types (2) Functional Model Above TLM, i.e. System Architectural & System Performance System Level Above RTL Behavioral Synthesis Architectural Analysis & Implementation I/F cycle accurate with pin level detail Functionality TF and not cycle accurate Bus Functional Model (BFM) Used for simulation (mainly of processors) Not meant for synthesis I/F pin cycle accurate Transactions for functionality Register Transfer Level (RTL) Verilog, VHDL Gate Level not good in SystemC

Current Methodology C/C++ System Level Model - Manual Conversion Creates Errors - Disconnect Between System Model and HDL Model - Multiple System Tests Refine Analysis VHDL/Verilog Result Simulation Synthesis

SystemC Methodology

Using Executable Specifications Ensure COMPLETENESS of Specification Create a program that Behave the same way as the system UNAMBIGUOUS Interpretation of the Specification Validate system functionality before implementation Create early model and Validate system performance Refine and Test the implementation of the Specification

SystemC and User Module User Module User Module #1 #1 User Module User Module #2 #2... User Module User Module #N #N Event & Signal I/F C++ Class Library Event s Hardware Simulation Kernel (Event Scheduler) SystemC SystemC Executable Specification Executable Specification

SystemC Highlights (1) SystemC 2.0 introduces general-purpose Events Flexible, low-level synchronization primitive Used to construct other forms of synchronization Channels A container class for communication and synchronization They implement one or more interfaces Interfaces Specify a set of access methods to the channel 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-based models)

SystemC Highlights (2) Support Hardware-Software Co-Design All constructs are in a C++ environment Modules Container class includes hierarchical Modules and Processes Processes Describe functionality Almost all SLDL have been developed based on some underlying model of network of processes Ports Single-directional(in, out), Bi-directional mode

A system in SystemC

A system in SystemC

SystemC Highlights (3) Constructs in a C++ environment (continued) Clocks Special signal, Timekeeper of simulation and Multiple clocks, with arbitrary phase relationship Event Driven simulation High-SpeedEvent Driven simulation kernel Multiple abstraction levels Untimed from high-level functional model to detailed clock cycle accuracy RTL model Communication Protocols Debugging Supports Run-Time error check Waveform Tracing Supports VCD, WIF, ISBD

Data Types SystemC supports Native C/C++ Types SystemC Types SystemC Types Data type for system modeling 2 value ( 0, 1 ) logic/logic vector 4 value ( 0, 1, Z, X ) logic/logic vector Arbitrary sized integer (Signed/Unsigned) Fixed Point types (Templated/Untemplated)

Communication and Synchronization (cont d) Module1 Interfaces Channel Module2 Events Ports to Interfaces

A Communication Modeling Example: FIFO Producer Write Interface FIFO Consumer Read Interface

FIFO Example: Declaration of Interfaces class write_if : public sc_interface { public: virtual void write(char) = 0; virtual void reset() = 0; p FIFO c }; class read_if : public sc_interface { public: virtual void read(char&) = 0; virtual int num_available() = 0; };

Declaration of FIFO channel p FIFO c 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: fifo() : num_elements(0), first(0); void write(char c) { if (fifo_full()) wait(read_event); } data[ <you calculate> ] = 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();

Declaration of FIFO channel (cont d) p FIFO c void reset() { num_elements = first = 0; } int num_available() { return num_elements; } }; // end of class declarations

FIFO Example (cont d) Any channel must be derived from sc_channel class be derived from one (or more) classes derived from sc_interface provide implementations for all pure virtual functions defined in its parent interfaces

FIFO Example (cont d) Note the following wait() call wait(sc_event) => dynamic sensitivity wait(time) wait(time_out, sc_event) Events are the fundamental synchronization primitive have no type, no value always cause sensitive processes to be resumed can be specified to occur: immediately/ one delta-step later/ some specific time later

Completing the Comm. Modeling Example p FIFO c SC_MODULE(producer) { public: sc_port<write_if> out; SC_MODULE(consumer) { public: sc_port<read_if> in; SC_CTOR(producer) { SC_THREAD(main); } SC_CTOR(consumer) { SC_THREAD(main); } }; void main() { char c; while (true) { out.write(c); if( ) out.reset(); } } }; void main() { char c; while (true) { in.read(c); cout<< in.num_available(); } }

Completing the Comm. Modeling Example (cont d) SC_MODULE(top) { public: fifo afifo; producer *pproducer; consumer *pconsumer; p FIFO c SC_CTOR(top) { pproducer=new producer( Producer ); pproducer->out(afifo); }; pconsumer=new consumer( Consumer ); pconsumer->in(afifo);

Completing the Comm. Modeling Example (cont d) Note: Producer module sc_port<write_if> out; Producer can only call member functions of write_if interface Consumer module sc_port<read_if> in; Consumer can only call member functions of read_if interface Producer and consumer are unaware of how the channel works just aware of their respective interfaces Channel implementation is hidden from communicating modules

Completing the Comm. Modeling Example (cont d) Advantages of separating communication from functionality Trying different communication modules Refine the FIFO into a software implementation Using queuing mechanisms of the underlying RTOS Refine the FIFO into a hardware implementation Channels can contain other channels and modules Instantiate the hw FIFO module within FIFO channel Implement read and write interface methods to properly work with the hw FIFO Refine read and write interface methods by inlining them into producer and consumer codes

SystemC refinement

SystemC Channel Replacement

SystemC Adapter Insertion

SystemC Adapter Merge

SystemC scheduler Like most modeling languages SystemC has a simulation kernel, too Event Based Simulation for modeling concurrency Processes executed & their outputs updated based on events Processes are scheduled based on their sensitivity to events Similarity with key VHDL simulation kernel aspects is evident

Which process should go first? Does it actually matter? On sc_signals follows VHDL paradigm Process execution and signal update done in 2 phases, order of processes does not matter Concept of delta cycles Simulation is deterministic But SystemC can model concurrency, time & communication in other ways as well SystemC & VHDL Similarities SC_THREAD(proc_1); sensitive << Trig.pos( ); SC_THREAD(proc_2); sensitive << Trig.pos( );

SystemC & non Determinism Delta Cycle = Evaluation Phase + Update Phase Presence of 2 phases guarantees determinism But for modeling S/W we need nondeterminism Employ the notify( ) method of an sc_event (see previous producer/consumer example)

SystemC Scheduler & Events notify() with no arguments Called Immediate Notification Processes sensitive to this event will run in current evaluation phase notify(0) Processes sensitive to this event will run in evaluation phase of next delta cycle notify(t) with t>0 Processes sensitive to this event will run during the evaluation phase of some future simulator time

SystemC Simulator Kernel 1. Init: execute all processes in unspecified order 2. Evaluate: Select a ready to run process & resume its execution. May result in more processes ready for execution due to Immediate Notification 3. Repeat 2 until no more processes to run 4. Update Phase 5. If 2 or 4 resulted in delta event notifications, go back to 2 6. No more events, simulation is finished for current time 7. Advance to next simulation time that has pending events. If none, exit 8. Go back to step 2

Metropolis vs. SystemC Metro more general model of computation Different operational & denotational semantics Metro Formal Semantics & tools Metro Quantity Managers For performance analysis For modeling of Operating Systems

References www.doulos.com www.forteds.com