410 likes | 749 Views
An Introduction to SystemC. By: Mohammad Agahian & Mohammad T. Karami HW/SW Co-design University of Tehran. Introduction. Introduction. Introduction. Why not leverage experience of C/C++ developers for H/W & System Level Design? C/C++ have no : notion of time
E N D
An Introduction to SystemC By: Mohammad Agahian & Mohammad T. Karami HW/SW Co-design University of Tehran
Introduction • Why not leverage experience of C/C++ developers for H/W & System Level Design? • 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
Introduction • SystemC is a library of C++ classes, global functions, data types and a simulation kernel that can be used for creating cycle-accurate simulators of hardware architecture.
Introduction • C++ Class Library (systemc) use for : • Hardware Architecture • Interface of SoC(System-on-Chip) • System-level designs • Executable Specification
Introduction • An executable specification is essentially a C++ program that exhibits the same behavior as the system when executed. • The SystemC library is Open Source and can be downloaded from the following address: www.systemc.org
Development • SystemC1.0 • Provide VHDL like capabilities • Simulation kernel • Fixed point arithmetic data types • Signals (communication channels) • Modules • Break down designs into smaller parts • SystemC2.0 • Complete library rewrite to upgrade into true SLDL • Events as primitive behavior triggers • Channels, Interfaces and Ports • Future SystemC3.0 • Modeling of OSs • Support of embedded S/W models
SystemC 2.0 • 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
Starting Point • Every C/C++ program has a main() function. When the SystemC library is used the main() function is not used. Instead the function sc_main() is the entry point of the application. • This is because the main() function is defined into the library so that when the program starts initialization of the simulation kernel and the structures this requires to be performed, before execution of the application code. • In the sc_main() function the structural elements of the system are created and connected throughout the system hierarchy. • Access to all SystemC classes and functions is provided in a single header file named “systemc.h”. • A SystemC system consists of a set of one or more modules.
The module’s constructor • The SC_CTOR statement is also a macro used for the constructor of the class. • The code which starts with the statement SC_CTOR is the code of the constructor of the module.
The module’s constructor • an example: SC_MODULE(RAM) { sc_in<bool> doOp; . . void execute() { . . . } SC_CTOR(RAM) { SC_METHOD(execute); sensitive(doOp); dont_initialize(); for(int i=0;i<MEM_SIZE;i++) memData[i]=0; } }; // End of module RAM.
The module’s constructor • Processes have a list of events of which they are sensitive. • sensitive(rwb) creates that list for the process registered by the previous SC_METHOD statement. • It specifies that this process will execute when an event is triggered by the rwb port. • Ports trigger events owned by the channel they are connected to. • when the value of the port itself changes or the value of another port also connected to the same channel changes.
The module’s constructor • In simple terms when the rwb port changes the func1 member function will run. SC_CTOR(RAM) { SC_METHOD(func1); sensitive(rwb); }