SystemCoDesigner: Performance Modeling Tutorial

Size: px
Start display at page:

Download "SystemCoDesigner: Performance Modeling Tutorial"

Transcription

1 SystemCoDesigner: Performance Modeling Tutorial Martin Streubühr Sebastian Graf Hardware/Software Co-Design Department of Computer Science University of Erlangen-Nuremberg Germany Version 1.4 Christian Haubelt Joachim Falk

2 Outline Introduction Installation Remarks Virtual Processing Components Configuration API Remarks Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 2

3 Introduction

4 Introduction SysteMoC and Virtual Processing Components are the two modeling approaches used in SystemCoDesigner SysteMoC allows for functional modeling and simulation Virtual Processing Components (VPC) allow for performance modeling and simulation Together, SysteMoC and Virtual Processing Components allow for combined functional and performance simulation Both, SysteMoC and Virtual Processing Components are implemented as individual libraries on top of SystemC Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 4

5 Introduction A Virtual Processing Component is an abstraction of a resource... models resource contention, scheduling, and arbitration A Virtual Processing Component is not an Instruction Set Simulator... is not an RTL simulator But, a Virtual Processing Component allows to model a Processor or a HW component... allows to model a communication resource Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 5

6 SysteMoC out Source CPU queue Bus in Mem Sink SysteMoC VPC A functional model in SysteMoC is given by a set of actors (e.g., Source and Sink)... a set of communication queues connecting actors Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 6

7 Virtual Processing Components out Source CPU queue Bus in Mem Sink SysteMoC VPC An architecture model in VPC is given by a set of components (e.g., CPU, Bus, and Mem )... a mapping of actors and queues to the set of components Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 7

8 Installation Remarks

9 Installation Remarks Requirements VPC requirements: A SysteMoC library compiled with VPC support The application needs to be linked with the VPC library library dependencies: CoSupport library (included in the SysteMoC source distribution) Xerces-C++ XML Parser, (Version 2.8.0) Boost C++ library, (Version 1.35) SystemC library, (Version 2.2.0) note: Boost, SystemC, and CoSupport are required for SysteMoC Xerces-C++ is required by the VPC library Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 9

10 Linux: From Source Code > cd systemoc - top/ > ls Support SystemC - VPC SysteMoC Testcases Examples configure... > mkdir obj > cd obj >../ configure -C > make > ( sudo make install) The source code distribution includes the subdirectories SysteMoC, Support, SystemC-VPC, and some Testcases and Examples Create an obj directory and change the working directory Run the configure script from the source directory Compile the software (and optionally install it) Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 10

11 Virtual Processing Components

12 Functional Model SysteMoC Recap out Source CPU queue Bus in Mem Sink SysteMoC VPC Write a functional model in SysteMoC Two actors, Source and Sink, are connected via a FIFO queue cf. SystemCoDesigner: System Programming Tutorial Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 12

13 Functional Model // file vpc_source_sink. cpp #include < iostream > #include < systemoc / smoc_moc.hpp > static const std :: string MESSAGE = " Hello SysteMoC!"; class Source : public smoc_actor { public: smoc_port_out <char> out; Source( sc_module_name name) : smoc_actor ( name, start), count (0), size(message.size ()), message(message) { start = GUARD( Source :: hastoken ) >> out (1) >> CALL(Source :: src) >> start; } The Source actor has an output port with data type char A single FSM transition is used to produce one data token per actor firing Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 13

14 Functional Model // file vpc_source_sink. cpp cont d private: smoc_firing_state start; // states unsigned int count, size; // variables ( functional state) const std :: string message; // bool hastoken () const { return count < size; } // guard void src () { std :: cerr << this-> name () << " " << sc_time_stamp () << "\tsend: \ " << message[count] << "\ " << std :: endl; out [0] = message[ count ++]; } // action }; A function src() is used to produce data tokens A guard hastoken() is used to check if the transition can be fired Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 14

15 Functional Model // file vpc_source_sink. cpp cont d class Sink : public smoc_actor { public: smoc_port_in <char> in; Sink( sc_module_name name) // actor constructor : smoc_actor ( name, start) { start = in (1) >> CALL( Sink :: sink) >> start; } private: smoc_firing_state start; void sink () { std :: cout << this-> name () << " " << sc_time_stamp () << "\trecv: \ " << in [0] << "\ " << std :: endl; } }; The Sink actor receives and consumes the data token this->name() returns the entire hierarchical name of the actor Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 15

16 Functional Model // file vpc_source_sink. cpp cont d class NetworkGraph : public smoc_graph { public: NetworkGraph ( sc_module_name name) : smoc_graph (name), source("source"), sink("sink") { smoc_fifo <char> fifo(" queue", 4); fifo.connect(source.out).connect(sink.in); // connect } private: Source source; // actors Sink sink; }; int sc_main(int argc, char ** argv){ NetworkGraph top(" top"); // create network graph smoc_scheduler_top sched( top); sc_start (); // start simulation ( SystemC) return 0; } Source and Sink are connected via a queue (queue size = 4) VPC usage is easier with (unique) symbolic queue names actors Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 16

17 Functional Model Hierarchical Names // file vpc_source_sink. cpp cont d class NetworkGraph : public smoc_graph { public: NetworkGraph ( sc_module_name name) : smoc_graph (name), source("source"), sink("sink") { smoc_fifo <char> fifo(" queue", 4); fifo.connect(source.out).connect(sink.in); // connect } private: Source source; // actors Sink sink; }; int sc_main(int argc, char ** argv){ NetworkGraph top(" top"); // create network graph smoc_scheduler_top sched( top); sc_start (); // start simulation ( SystemC) return 0; } Actors have hierarchical names reproducing the nesting of graphs E.g. actors top.source and top.sink are used by the graph top actors Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 17

18 Functional Model >./vpc -src -sink SystemC Dec :19:05 Copyright (c) by all Contributors ALL RIGHTS RESERVED top.source 0 s send: H top.sink 0 s recv: H top.source 0 s send: e top.sink 0 s recv: e top.source 0 s send: l top.sink 0 s recv: l top.source 0 s send: l top.sink 0 s recv: l top.source 0 s send: o top.sink 0 s recv: o... [ VPC] overall simulated time: 0 s Compile source code and run functional simulation No timing is simulated in the functional model Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 18

19 Functional Model When compiled with VPC, the SysteMoC functional simulation forwards actor execution and communication events to the VPC library A performance simulation for those events will take place if an architecture model is given to the VPC simulation The architecture model is given by an XML configuration file A pure functional simulation without timing is performed if no architecture model is given Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 19

20 Architecture Model <?xml version=" 1.0"? > <!DOCTYPE vpcconfiguration SYSTEM " vpc. dtd" > < vpcconfiguration > < resources >... </ resources > <mappings >... </ mappings > <topology >... </ topology > </ vpcconfiguration > Write a VPC configuration (XML file src-snk.vpc.xml).vpc.xml is the preferred file name suffix The document type definition is given in the file (vpc.dtd) Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 20

21 Architecture Model <?xml version=" 1.0"? > <!DOCTYPE vpcconfiguration SYSTEM " vpc. dtd" > < vpcconfiguration > < resources >... </ resources > <mappings >... </ mappings > <topology >... </ topology > </ vpcconfiguration > <vpcconfiguration> is the XML root element of a VPC configuration It contains the elements <resources>, <mappings>, and <topology> Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 21

22 Architecture Model < resources > <component name="cpu" scheduler ="FCFS"> < attribute type =" transfer_delay " value =" 20 ns" / > </ component > <component name="bus" scheduler ="FCFS"> < attribute type =" transfer_delay " value =" 80 ns" / > </ component > <component name="mem" scheduler ="FCFS"> < attribute type =" transfer_delay " value =" 20 ns" / > </ component > </ resources > The <resources> element contains nested <component> elements An element <component> defines a (Virtual Processing) Component Each Component has a name and a scheduler given by the XML attributes name and scheduler Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 22

23 Architecture Model Attributes < resources > <component name="cpu" scheduler ="FCFS"> < attribute type =" transfer_delay " value =" 20 ns" / > </ component > <component name="bus" scheduler ="FCFS"> < attribute type =" transfer_delay " value =" 80 ns" / > </ component > <component name="mem" scheduler ="FCFS"> < attribute type =" transfer_delay " value =" 20 ns" / > </ component > </ resources > Components may have attributes (nested <attribute> elements) An attributes is defined by a type and a value (<attribute type="..."value="..."/>) E.g., an attribute transfer_delay refers to the communication time required for one token, if the communication route includes this component (cf. route) Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 23

24 Architecture Model Mappings <mappings > <mapping source="top.source" target="cpu"> <timing dii="10 us" latency="10 us" /> <timing fname=" Source::src " dii="10 us" latency="10 us" /> </mapping > <mapping source="top.sink" target="cpu"> <timing delay="10 us" /> <timing fname=" Sink::sink " delay="10 us" /> </mapping > </ mappings > mapping elements are nested inside the mappings element Used to define the mapping of actors to components The attribute source defines the entire hierarchical actor name The attribute target defines the Component name (cf. <component>) Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 24

25 Architecture Model Timing <mappings > <mapping source="top.source" target="cpu"> <timing dii="10 us" latency="10 us" /> <timing fname=" Source::src " dii="10 us" latency="10 us" /> </mapping > <mapping source="top.sink" target="cpu"> <timing delay="10 us" /> <timing fname=" Sink::sink " delay="10 us" /> </mapping > </ mappings > A timing element defines the execution times for a mapping The execution time is given either By a dii and latency attribute Or by a delay attribute Thereby delay="x" is a short cut for dii="x"latency="x" dii and latency are constraint to: (0 < dii lat) (0 = dii = lat) Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 25

26 Architecture Model Timing <mappings > <mapping source="top.source" target="cpu"> <timing dii="10 us" latency="10 us" /> <timing fname=" Source::src " dii="10 us" latency="10 us" /> </mapping > <mapping source="top.sink" target="cpu"> <timing delay="10 us" /> <timing fname=" Sink::sink " delay="10 us" /> </mapping > </ mappings > The attribute fname is optional, The default timing of an actor is given without fname Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 26

27 Architecture Model Timing <mappings > <mapping source="top.source" target="cpu"> <timing dii="10 us" latency="10 us" /> <timing fname=" Source::src " dii="10 us" latency="10 us" /> </mapping > <mapping source="top.sink" target="cpu"> <timing delay="10 us" /> <timing fname=" Sink::sink " delay="10 us" /> </mapping > </ mappings > With fname individual timings are specified for the given function names (names given by SysteMoC s CALL(...) and GUARD(...) macros, cf. SystemCoDesigner: System Programming Tutorial ) The execution time (dii and latency) of a transition is the sum of function times for all guards and actions referred by this transition. Timing is simulated only if the transition is executed, i.e., the guards evaluate to true. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 27

28 Architecture Model Topology <topology > <route source="top.source" destination ="queue"> <hop name="cpu"> </hop > <hop name="bus"> </hop > <hop name="mem"> </hop > </route > <route source="queue" destination ="top.sink"> <hop name="mem"> </hop > <hop name="bus"> </hop > <hop name="cpu"> </hop > </route > </ topology > The <topology> section defines the multi-hop communication routes The <topology> is defined by nested <route> elements For each connection between an actor and a channel a <route> may be defined Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 28

29 Architecture Model Route <topology > <route source="top.source" destination ="queue"> <hop name="cpu"> </hop > <hop name="bus"> </hop > <hop name="mem"> </hop > </route > <route source="queue" destination ="top.sink"> <hop name="mem"> </hop > <hop name="bus"> </hop > <hop name="cpu"> </hop > </route > </ topology > A <route> is defined by nested <hop> elements A route has a source and a target attribute Source and target form a pair (actor, channel) or (channel, actor) Suggestion: use symbolic queue names in the SysteMoC model Else: queue names are concatenations of connected actor names Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 29

30 Architecture Model Hops out Source CPU queue Bus in Mem Sink SysteMoC VPC The <hop> elements of a route refer to Components (by name) E.g., the route for actor Source writing the queue involves the hops CPU, Bus, and Mem Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 30

31 Performance Simulation > setenv VPCCONFIGURATION src - snk. vpc. xml >./vpc -src -sink SystemC Dec :19:05 Copyright (c) by all Contributors ALL RIGHTS RESERVED top. Source 0 s send: H top. Source 10 us send: e top. Sink ns recv: H top. Source ns send: l top. Source ns send: l top. Sink ns recv: e top. Source ns send: o top. Sink ns recv: l... [ VPC] overall simulated time: ns Set environment variable VPCCONFIGURATION to the configuration file and run simulation Timing is simulated and VPC reports overall simulation time Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 31

32 Performance Simulation Simulation Trace $ timescale 1 ns $end $ scope module sc $ end $ var wire 8 aaa msg_top. Source_2_queue [7:0] $ end $ var wire 8 aab msg_queue_2_top. Sink [7:0] $ end $upscope $end $ enddefinitions $ end $ dumpvars b aaa b aab $end #10020 b aaa The simulation is traced in Value Change Dump files A VCD file is created for each component (cf. <resource>) VCD files can be visualized, e.g., using GTKWave or Modelsim Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 32

33 Performance Simulation Simulation Trace Signal values represent ASCII coded characters (radix = ASCII) Each signal represents a task (an actor or a communication message) Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 33

34 Performance Simulation Simulation Trace "R" or "r" means a task is executed (running) "W" or "w" means a task is ready for execution but preempted (waiting) "B" or "b" means a task is blocked during communication Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 34

35 Performance Simulation Simulation Trace VCD traces have a major disadvantage: successive phases with identical signal values corespond to no signal change (no event) they are not included in the VCD file and not shown by any viewer VPC switches between lower and upper case letters ("R"/"r") to avoid identical valued successive phases Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 35

36 Reference Manual Scheduler <component name="cpu" scheduler ="PS">... <mapping source="top.sink" target="cpu"> < attribute type =" priority " value ="1" / > VPC includes several different schedulers Most scheduler require additional attributes assigned to mappings and/or to components E.g., a priority scheduler requires priority values assigned to mappings <component name="cpu" scheduler ="RR"> <attribute type=" timeslice " value="10 ns" />... <mapping source="top.sink" target="cpu"> The round robin scheduler requires a timeslice attribute assigned to the component Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 36

37 Reference Manual Scheduler Scheduler Required Attributes XML name Component Mapping First Come First Served FCFS Priority Scheduler PSNOPRE priority Preemptive Priority Scheduler PS priority Round Robin RR timeslice priority Time Division Multiple Access TDMA * FlexRay FlexRay * * TDMA and FleyRay scheduler require complex attribute structures Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 37

38 Reference Manual Hop <route source="top.source" destination ="queue"> <hop name="cpu"> </hop > <hop name="bus"> <timing dii="1000 us" latency="1000 us" /> < /hop > <hop name="mem"> </hop > </route > Per default the timing of a hop is defined by the components attribute transfer_delay A nested <timing> element may be used to override the default Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 38

39 Configuration API

40 Overview The API allows the configuration of the architecture model and mappings to be programmed in C++. Using the API may be used instead of a XML configuration file. Note: Mixing both, API and XML configuration, is not possible. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 40

41 Example API Header #include < systemoc / smoc_moc.hpp > #ifdef SYSTEMOC_ENABLE_VPC #include < vpc_api.hpp > #endif // SYSTEMOC_ENABLE_VPC class Source: public smoc_actor... class Sink: public smoc_actor... Using the configuration API requires to include the vpc_api.hpp header. Guarding configuration code using the preprocessor guard SYSTEMOC_ENABLE_VPC is recommended and allows to compile the code in absence of the VPC library for functional simulation. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 41

42 Example Source Sink Example class NetworkGraph : public smoc_graph { public: NetworkGraph ( sc_module_name name) // network graph constructor : smoc_graph (name), source("src",this), sink("snk",this) { smoc_fifo <char> fifo(" queue", 42); fifo.connect(source.out).connect(sink.in); // connect actors #ifdef SYSTEMOC_ENABLE_VPC... #endif // SYSTEMOC_ENABLE_VPC }... The network of actors is composed by a network graph. Configuration code using the API mechanism is added to the network graph constructor. Placing the code in the constructor is not mandatory, but eases access to the actor member variables (e.g., source). Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 42

43 Example Error Reporting #ifdef SYSTEMOC_ENABLE_VPC try {... } catch ( std :: exception & e) { std :: cerr << " Caught exception wile configuring VPC :\ n" << e. what () << std :: endl; exit (-1); } #endif // SYSTEMOC_ENABLE_VPC The configuration API uses exceptions for error reporting. Therefore, the configuration code shall be placed in a try{} block. Note the preprocessor guard SYSTEMOC_ENABLE_VPC to enable compilation without VPC. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 43

44 Example Architecture Model try { // convenience namespace VC = SystemC_VPC :: Config; // create components VC:: Component :: Ptr cpu = VC:: createcomponent ("CPU", VC:: Scheduler :: StaticPriority_NP );... Here a namespace alias VC is used to ease access the SystemC_VPC::Config namespace. A function VC::createComponent is used to create a component. Here a component using a non-preemptive static priority scheduling policy is modeled. The VC::Component::Ptr CPA is a handle (smart pointer) to the modeled component. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 44

45 Example Task Mapping // mappings cpu ->addtask(source); cpu ->addtask(sink); // set priorities VC:: setpriority (source, 0); VC:: setpriority (sink, 1); The handle to the cpu is used to register the mapping of actors. Note: source and src are variables of type smoc_actor. Task priorities are configured using VC::setPriority. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 45

46 Example Timing Provider // timings VC:: DefaultTimingsProvider :: Ptr provider = cpu -> getdefaulttimingsprovider (); provider ->add(vc:: Timing("Source :: source", sc_time (10, SC_NS ), sc_time (10, SC_NS))); // dii, latency provider ->add(vc:: Timing("Sink :: sink", sc_time (10, SC_NS))); // delay provider ->add(vc:: Timing("Source :: source", sc_time (100, SC_NS))); provider ->add(vc:: Timing("Sink :: sink", sc_time (100, SC_NS))) ; Execution times for actors are configured via a TimingsProvider. A default provider is used to configure individual timings for individual actions of actors. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 46

47 Example Default Route // configure routing VC:: ignoremissingroutes (true); So far the architecture and the task mapping is configured only. The configuration of communication routes is still missing. Here the default behavior is changed to ignore missing routes for a first simulation without modeled communication routes. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 47

48 Example Simulation Output SystemC Jan :08:32 Copyright (c) by all Contributors ALL RIGHTS RESERVED Note: VCD trace timescale unit is set by user to e -09 sec. top. Source 0 s send: H top. Source 100 ns send: e top. Sink 100 ns recv: H... SystemC: simulation stopped by user. [ VPC] overall simulated time: 3 us Simulation output from the example configured without routes. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 48

49 Example Transfer Timing VC:: ignoremissingroutes (true); VC:: Component :: Ptr bus = VC:: createcomponent (" Bus"); VC:: Component :: Ptr mem = VC:: createcomponent (" Memory"); VC:: Timing transfer (sc_time (20, SC_NS), sc_time (20, SC_NS)); bus -> settransfertiming ( transfer ); mem -> settransfertiming ( transfer ); cpu -> settransfertiming ( transfer ); Additional components are created to model a bus and a memory. Components shall be configured with transfer timings. A transfer timing models the time required to transfer a single token via a component (one hop). Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 49

50 Example Multi-Hop Communication VC:: Route :: Ptr writeroute = VC:: createroute ( getleafport (& source.out)); VC:: Route :: Ptr readroute = VC:: createroute ( getleafport (& sink.in)); VC::createRoute is used to model a communication route for actor ports. Note: geleafport is used to access the actors port in case of hierarchically nesting graphs. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 50

51 Example Mult-Hop Communication writeroute ->addhop(cpu); writeroute -> addhop( bus). setpriority (0). settransfertiming ( VC:: Timing(sc_time (10, SC_NS), sc_time (20, SC_NS))); writeroute ->addhop(mem); readroute ->addhop(mem); readroute ->addhop(bus); readroute ->addhop(cpu); A sequence of components is configured to represent multi-hop communication routes. For simulation all delays occurring along a route plus additional scheduling and arbitration delays contribute to the overall communication delay. Note: It is possible to configure communication timings and message priorities individually per hop in a route. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 51

52 Example Simulation Output SystemC Jan :08:32 Copyright (c) by all Contributors ALL RIGHTS RESERVED Note: VCD trace timescale unit is set by user to e -09 sec. Note: VCD trace timescale unit is set by user to e -09 sec. Note: VCD trace timescale unit is set by user to e -09 sec. top. Source 0 s send: H top. Source 100 ns send: e top. Sink 150 ns recv: H... SystemC: simulation stopped by user. [ VPC] overall simulated time: 3720 ns Having a configured route in the examples causes different simulated times. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 52

53 API Reference Component Component :: Ptr createcomponent ( std :: string name, Scheduler :: Type scheduler = Scheduler :: FCFS); Create a component with default or explicitly given Scheduler. Component :: Ptr getcomponent ( std :: string name); Get an already created a component by name. bool hascomponent ( std :: string name); Check existence of a component by name. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 53

54 API Reference Component class Component { public: void setscheduler ( Scheduler :: Type scheduler ); Scheduler :: Type getscheduler () const; void settransfertiming ( Timing transfertiming ); Timing gettransfertiming () const; void addtask( ScheduledTask & actor); bool hastask( ScheduledTask * actor) const; void settimingsprovider ( TimingsProvider :: Ptr provider ); TimingsProvider :: Ptr gettimingsprovider (); DefaultTimingsProvider :: Ptr getdefaulttimingsprovider (); } The Component class (Component::Ptr) has various public member functions to get and set scheduler, transfer timings, mappings and timings provider. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 54

55 API Reference DefaultTimingsProvider class DefaultTimingsProvider { virtual void adddefaultactortiming ( std :: string timing); virtual void add( Timing timing); actorname, Timing } The easiest way to configure task execution times used the Component s DefaultTimingsProvider It allows to add timings to actors or to individual functions. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 55

56 API Reference Route Route :: Ptr createroute (const sc_port_base * leafptr, Route :: Type type = Route :: StaticRoute ); Create a route using a leaf port of an actor. class Route { public: bool gettracing () const; void settracing (bool tracing_ ); Hop & addhop( Component :: Ptr component ); void addtiming ( Component :: Ptr hop, Timing); } The Route class has public member functions to add hops, configure individual timings, and enable message tracing. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 56

57 API Reference Hops class Hop { public: Hop & setpriority ( size_t priority_ ); Hop & settransfertiming ( Timing transfertiming_ ); Component :: Ptr getcomponent () const; size_t getpriority () const; Timing gettransfertiming () const; The Hop class has public member to get and set individual message priorities and timings. Furthermore getting the referenced Component is possible. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 57

58 API Reference Configuration void setpriority ( ScheduledTask & actor, size_t priority ); The API allows to set task priorities. void ignoremissingroutes (bool ignore); If required, not configured (missing) route are ignored for simulation. Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 58

59 Remarks

60 Outline Introduction Installation Remarks Virtual Processing Components Configuration API Remarks Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 60

61 Contact Contact Persons: Christian Haubelt, Jürgen Teich Address: Hardware/Software Co-Design Department of Computer Science University of Erlangen-Nuremberg Cauerstr Erlangen, Germany Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 61

62 Credits SysteMoC Development Team: Joachim Falk, Jens Gladigau, Martin Streubühr, Christian Zebelein VPC Development Team: Martin Streubühr, Sebastian Graf SystemCoDesigner Contributors: Joachim Falk, Michael Glass, Jens Gladigau, Joachim Keinert, Martin Lukasiewycz, Felix Reimann, Thomas Schlichter, Thilo Streichert, Martin Streubühr, Christian Zebelein, Christian Haubelt, Jürgen Teich Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 62

63 Document Info Authors: Martin Streubühr, Sebastian Graf, Christian Haubelt Document Release: July 3, 2012 Version History: July 3, 2012: Version 1.4 May 26, 2011: Version 1.3 January 17, 2011: Version 1.2 September 9, 2010: Version 1.1 August 25, 2010: Version 1.0 Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 63

64 Index

65 Index <component>, 22, 23 fname, 26, 27 <hop>, 30 <hop>, 29, 38 <mapping>, 24 <mappings>, 24 <resources>, 21, 22 <route>, 28, 29 scheduler, 22, 36, 37 <timing>, <topology>, 28 <vpcconfiguration>, 21 Version 1.4 Martin Streubühr et al. FAU SystemCoDesigner: Performance Modeling Tutorial 65

SystemCoDesigner: System Programming Tutorial

SystemCoDesigner: System Programming Tutorial SystemCoDesigner: System Programming Tutorial Martin Streubühr Falk Christian Zebelein Hardware/Software Co-Design Department of Computer Science University of Erlangen-Nuremberg Germany Version 1.2 Christian

More information

SysteMoC. Verification and Refinement of Actor-Based Models of Computation

SysteMoC. Verification and Refinement of Actor-Based Models of Computation SysteMoC Verification and Refinement of Actor-Based Models of Computation Joachim Falk, Jens Gladigau, Christian Haubelt, Joachim Keinert, Martin Streubühr, and Jürgen Teich {falk, haubelt}@cs.fau.de Hardware-Software-Co-Design

More information

Automatic Generation of System-Level Virtual Prototypes from Streaming Application Models

Automatic Generation of System-Level Virtual Prototypes from Streaming Application Models Automatic Generation of System-Level Virtual Prototypes from Streaming Application Models Philipp Kutzer, Jens Gladigau, Christian Haubelt, and Jürgen Teich Hardware/Software Co-Design, Department of Computer

More information

COMP322 - Introduction to C++ Lecture 02 - Basics of C++

COMP322 - Introduction to C++ Lecture 02 - Basics of C++ COMP322 - Introduction to C++ Lecture 02 - Basics of C++ School of Computer Science 16 January 2012 C++ basics - Arithmetic operators Where possible, C++ will automatically convert among the basic types.

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

Interview Questions of C++

Interview Questions of C++ Interview Questions of C++ Q-1 What is the full form of OOPS? Ans: Object Oriented Programming System. Q-2 What is a class? Ans: Class is a blue print which reflects the entities attributes and actions.

More information

Linked List using a Sentinel

Linked List using a Sentinel Linked List using a Sentinel Linked List.h / Linked List.h Using a sentinel for search Created by Enoch Hwang on 2/1/10. Copyright 2010 La Sierra University. All rights reserved. / #include

More information

Parallel System Architectures 2016 Lab Assignment 1: Cache Coherency

Parallel System Architectures 2016 Lab Assignment 1: Cache Coherency Institute of Informatics Computer Systems Architecture Jun Xiao Simon Polstra Dr. Andy Pimentel September 1, 2016 Parallel System Architectures 2016 Lab Assignment 1: Cache Coherency Introduction In this

More information

Actor-oriented Modeling and Simulation of Cut-through Communication in Network Controllers

Actor-oriented Modeling and Simulation of Cut-through Communication in Network Controllers In Proceedings of Methoden und Beschreibungssprachen zur Modellierung und Verifikation von Schaltungen und Systemen (MBMV), Kaiserslautern, Germany, March 05-07, 2012 Actor-oriented Modeling and Simulation

More information

Throughput-optimizing Compilation of Dataflow Applications for Multi-Cores using Quasi-Static Scheduling

Throughput-optimizing Compilation of Dataflow Applications for Multi-Cores using Quasi-Static Scheduling Throughput-optimizing Compilation of Dataflow Applications for Multi-Cores using Quasi-Static Scheduling Tobias Schwarzer 1, Joachim Falk 1, Michael Glaß 1, Jürgen Teich 1, Christian Zebelein 2, Christian

More information

Program template-smart-pointers-again.cc

Program template-smart-pointers-again.cc 1 // Illustrate the smart pointer approach using Templates 2 // George F. Riley, Georgia Tech, Spring 2012 3 // This is nearly identical to the earlier handout on smart pointers 4 // but uses a different

More information

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers

More information

CS2141 Software Development using C/C++ C++ Basics

CS2141 Software Development using C/C++ C++ Basics CS2141 Software Development using C/C++ C++ Basics Integers Basic Types Can be short, long, or just plain int C++ does not define the size of them other than short

More information

Chapter 2. Procedural Programming

Chapter 2. Procedural Programming Chapter 2 Procedural Programming 2: Preview Basic concepts that are similar in both Java and C++, including: standard data types control structures I/O functions Dynamic memory management, and some basic

More information

Object-Oriented Programming, Iouliia Skliarova

Object-Oriented Programming, Iouliia Skliarova Object-Oriented Programming, Iouliia Skliarova CBook a = CBook("C++", 2014); CBook b = CBook("Physics", 1960); a.display(); b.display(); void CBook::Display() cout

More information

Lecture 10. Command line arguments Character handling library void* String manipulation (copying, searching, etc.)

Lecture 10. Command line arguments Character handling library void* String manipulation (copying, searching, etc.) Lecture 10 Class string Namespaces Preprocessor directives Macros Conditional compilation Command line arguments Character handling library void* TNCG18(C++): Lec 10 1 Class string Template class

More information

The following program computes a Calculus value, the "trapezoidal approximation of

The following program computes a Calculus value, the trapezoidal approximation of Multicore machines and shared memory Multicore CPUs have more than one core processor that can execute instructions at the same time. The cores share main memory. In the next few activities, we will learn

More information

C++ Namespaces, Exceptions

C++ Namespaces, Exceptions C++ Namespaces, Exceptions CSci 588: Data Structures, Algorithms and Software Design http://www.cplusplus.com/doc/tutorial/namespaces/ http://www.cplusplus.com/doc/tutorial/exceptions/ http://www.cplusplus.com/doc/tutorial/typecasting/

More information

Introducing C++ to Java Programmers

Introducing C++ to Java Programmers Introducing C++ to Java Programmers by Kip Irvine updated 2/27/2003 1 Philosophy of C++ Bjarne Stroustrup invented C++ in the early 1980's at Bell Laboratories First called "C with classes" Design Goals:

More information

Chapter 5 Scheduling

Chapter 5 Scheduling Chapter 5 Scheduling Images from Silberschatz Pacific University 1 Life time of a single process CPU usage/io bursts What would an IO bound process look like? What would a CPU bound process look like?

More information

Advanced Systems Programming

Advanced Systems Programming Advanced Systems Programming Introduction to C++ Martin Küttler September 19, 2017 1 / 18 About this presentation This presentation is not about learning programming or every C++ feature. It is a short

More information

Chapter 1 INTRODUCTION

Chapter 1 INTRODUCTION Chapter 1 INTRODUCTION A digital computer system consists of hardware and software: The hardware consists of the physical components of the system. The software is the collection of programs that a computer

More information

Algorithmic C synthesis (High-level synthesis)

Algorithmic C synthesis (High-level synthesis) Algorithmic C synthesis (High-level synthesis) Reminder System level design The complexity of digital systems grows exponentially because of technological improvements, and user demands. The design entries

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Chapter 6: CPU Scheduling

Chapter 6: CPU Scheduling Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne Histogram of CPU-burst Times 6.2 Silberschatz, Galvin and Gagne Alternating Sequence of CPU And I/O Bursts 6.3 Silberschatz, Galvin and Gagne CPU

More information

There are, of course, many other possible solutions and, if done correctly, those received full credit.

There are, of course, many other possible solutions and, if done correctly, those received full credit. Question 1. (20 points) STL. Complete the function ChangeWords below. This function has as inputs a vector of strings, and a map of key-value pairs. The function should return a new vector

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

A First Program - Greeting.cpp

A First Program - Greeting.cpp C++ Basics A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include using namespace std; int main() { cout

More information

CS 376b Computer Vision

CS 376b Computer Vision CS 376b Computer Vision 09 / 25 / 2014 Instructor: Michael Eckmann Today s Topics Questions? / Comments? Enhancing images / masks Cross correlation Convolution C++ Cross-correlation Cross-correlation involves

More information

System Level Modeling and Performance Simulation for Dynamic Reconfigurable Computing Systems in SystemC

System Level Modeling and Performance Simulation for Dynamic Reconfigurable Computing Systems in SystemC In Methoden und Beschreibungssprachen zur Modellierung und Verifikation von Schaltungen und Systemen. by Christian Haubelt, Jürgen Teich (Eds.). GI/ITG/GMM-Workshop, Shaker Verlag, Aachen, March 5-7, 2007

More information

SYSTEMCODESIGNER An Automatic ESL Synthesis Approach by Design Space Exploration and Behavioral Synthesis for Streaming Applications

SYSTEMCODESIGNER An Automatic ESL Synthesis Approach by Design Space Exploration and Behavioral Synthesis for Streaming Applications 1 SYSTEMCODESIGNER An Automatic ESL Synthesis Approach by Design Space Exploration and Behavioral Synthesis for Streaming Applications JOACHIM KEINERT, MARTIN STREUBŪHR, THOMAS SCHLICHTER, JOACHIM FALK,

More information

Semantics of C++ Hauptseminar im Wintersemester 2009/10 Templates

Semantics of C++ Hauptseminar im Wintersemester 2009/10 Templates Semantics of C++ Hauptseminar im Wintersemester 2009/10 Templates Sebastian Wild Technische Universität München 11.01.2010 Abstract In this work we will discuss about templates in C++, especially their

More information

Getting Started with TLM-2.0

Getting Started with TLM-2.0 Getting Started with TLM-2.0 A Series of Tutorials based on a set of Simple, Complete Examples John Aynsley, Doulos, June 2008 Tutorial 1 Sockets, Generic Payload, Blocking Transport Introduction The TLM-2.0

More information

CS101 Linux Shell Handout

CS101 Linux Shell Handout CS101 Linux Shell Handout Introduction This handout is meant to be used as a quick reference to get a beginner level hands on experience to using Linux based systems. We prepared this handout assuming

More information

Lecture 7. Log into Linux New documents posted to course webpage

Lecture 7. Log into Linux New documents posted to course webpage Lecture 7 Log into Linux New documents posted to course webpage Coding style guideline; part of project grade is following this Homework 4, due on Monday; this is a written assignment Project 1, due next

More information

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors CSC 330 OO Software Design 1 Abstract Base Classes class B { // base class virtual void m( ) =0; // pure virtual

More information

C++ Programming: make

C++ Programming: make C++ Programming: make Domingos Begalli Saddleback College, Computer Science CS1B, Spring 2018 1 / Domingos Begalli CS1B Spring 2018 C++ Introduction 1/16 16 automating the steps involved with compilation

More information

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures The main body and cout Agenda 1 Fundamental data types Declarations and definitions Control structures References, pass-by-value vs pass-by-references The main body and cout 2 C++ IS AN OO EXTENSION OF

More information

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE Abstract Base Classes POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors class B { // base class virtual void m( ) =0; // pure virtual function class D1 : public

More information

A brief introduction to C++

A brief introduction to C++ A brief introduction to C++ Rupert Nash r.nash@epcc.ed.ac.uk 13 June 2018 1 References Bjarne Stroustrup, Programming: Principles and Practice Using C++ (2nd Ed.). Assumes very little but it s long Bjarne

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

CS3157: Advanced Programming. Outline

CS3157: Advanced Programming. Outline CS3157: Advanced Programming Lecture #12 Apr 3 Shlomo Hershkop shlomo@cs.columbia.edu 1 Outline Intro CPP Boring stuff: Language basics: identifiers, data types, operators, type conversions, branching

More information

Due Date: See Blackboard

Due Date: See Blackboard Source File: ~/2315/04/lab04.(C CPP cpp c++ cc cxx cp) Input: Under control of main function Output: Under control of main function Value: 3 In this assignment create an IntegerSet class that will provide

More information

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja

More information

Input And Output of C++

Input And Output of C++ Input And Output of C++ Input And Output of C++ Seperating Lines of Output New lines in output Recall: "\n" "newline" A second method: object endl Examples: cout

More information

Round Robin (RR) ACSC 271 Operating Systems. RR Example. RR Scheduling. Lecture 9: Scheduling Algorithms

Round Robin (RR) ACSC 271 Operating Systems. RR Example. RR Scheduling. Lecture 9: Scheduling Algorithms Round Robin (RR) ACSC 271 Operating Systems Lecture 9: Scheduling Algorithms Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time has elapsed, the process

More information

A System-Level Synthesis Approach from Formal Application Models to Generic Bus-Based MPSoCs

A System-Level Synthesis Approach from Formal Application Models to Generic Bus-Based MPSoCs A System-Level Synthesis Approach from Formal Application s to Generic Bus-Based MPSoCs Jens Gladigau 1, Andreas Gerstlauer 2, Christian Haubelt 1, Martin Streubühr 1, and Jürgen Teich 1 1 Department of

More information

Module 7 b. -Namespaces -Exceptions handling

Module 7 b. -Namespaces -Exceptions handling Module 7 b -Namespaces -Exceptions handling C++ Namespace Often, a solution to a problem will have groups of related classes and other declarations, such as functions, types, and constants. C++provides

More information

Operating Systems 16 - CS 323 Assignment #2

Operating Systems 16 - CS 323 Assignment #2 Operating Systems 16 - CS 323 Assignment #2 Scheduler March 18, 2016 1 Objectives 1. Learn about scheduling in the Linux kernel 2. Understand the tradeoffs involved in scheduling 3. Work on the codebase

More information

The University of Nottingham

The University of Nottingham The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, AUTUMN SEMESTER 2009-2010 C/C++ for Java Programmers Time allowed TWO hours Candidates may complete the front cover of their answer

More information

Distributed Real-Time Control Systems. Lecture 17 C++ Programming Intro to C++ Objects and Classes

Distributed Real-Time Control Systems. Lecture 17 C++ Programming Intro to C++ Objects and Classes Distributed Real-Time Control Systems Lecture 17 C++ Programming Intro to C++ Objects and Classes 1 Bibliography Classical References Covers C++ 11 2 What is C++? A computer language with object oriented

More information

Program template-smart-pointers.cc

Program template-smart-pointers.cc 1 // Illustrate the smart pointer approach using Templates 2 // George F. Riley, Georgia Tech, Spring 2012 3 4 #include 5 #include 6 7 using namespace std; 8 9 // The Ptr class contains

More information

Due Date: See Blackboard

Due Date: See Blackboard Source File: ~/2315/45/lab45.(C CPP cpp c++ cc cxx cp) Input: under control of main function Output: under control of main function Value: 4 Integer data is usually represented in a single word on a computer.

More information

III. Classes (Chap. 3)

III. Classes (Chap. 3) III. Classes III-1 III. Classes (Chap. 3) As we have seen, C++ data types can be classified as: Fundamental (or simple or scalar): A data object of one of these types is a single object. int, double, char,

More information

File I/O Christian Schumacher, Info1 D-MAVT 2013

File I/O Christian Schumacher, Info1 D-MAVT 2013 File I/O Christian Schumacher, chschuma@inf.ethz.ch Info1 D-MAVT 2013 Input and Output in C++ Stream objects Formatted output Writing and reading files References General Remarks I/O operations are essential

More information

Due Date: See Blackboard

Due Date: See Blackboard Source File: ~/2305/lab06.(C CPP cpp c++ cc cxx cp) Input: Under control of main function Output: Under control of main function Value: 2 Extend the IntegerSet class from Lab 04 to provide the following

More information

CSE au Midterm Exam Nov. 2, 2018 Sample Solution

CSE au Midterm Exam Nov. 2, 2018 Sample Solution Question 1. (16 points) Build tools and make. We re building a C++ software back-end prototype for a new food web site. So far, we ve got the following source files with the code for two main programs

More information

Job Scheduling. CS170 Fall 2018

Job Scheduling. CS170 Fall 2018 Job Scheduling CS170 Fall 2018 What to Learn? Algorithms of job scheduling, which maximizes CPU utilization obtained with multiprogramming Select from ready processes and allocates the CPU to one of them

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 10 October 1, 2018 CPSC 427, Lecture 10, October 1, 2018 1/20 Brackets Example (continued from lecture 8) Stack class Brackets class Main

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

COMP322 - Introduction to C++ Lecture 01 - Introduction

COMP322 - Introduction to C++ Lecture 01 - Introduction COMP322 - Introduction to C++ Lecture 01 - Introduction Robert D. Vincent School of Computer Science 6 January 2010 What this course is Crash course in C++ Only 14 lectures Single-credit course What this

More information

ECE 2036 Lab 1: Introduction to Software Objects

ECE 2036 Lab 1: Introduction to Software Objects ECE 2036 Lab 1: Introduction to Software Objects Assigned: Aug 24/25 2015 Due: September 1, 2015 by 11:59 PM Reading: Deitel& Deitel Chapter 2-4 Student Name: Check Off/Score Part 1: Check Off/Score Part

More information

OBJECT ORIENTED PROGRAMMING USING C++

OBJECT ORIENTED PROGRAMMING USING C++ OBJECT ORIENTED PROGRAMMING USING C++ Chapter 17 - The Preprocessor Outline 17.1 Introduction 17.2 The #include Preprocessor Directive 17.3 The #define Preprocessor Directive: Symbolic Constants 17.4 The

More information

Exceptions, Case Study-Exception handling in C++.

Exceptions, Case Study-Exception handling in C++. PART III: Structuring of Computations- Structuring the computation, Expressions and statements, Conditional execution and iteration, Routines, Style issues: side effects and aliasing, Exceptions, Case

More information

Introduction to C++ (Extensions to C)

Introduction to C++ (Extensions to C) Introduction to C++ (Extensions to C) C is purely procedural, with no objects, classes or inheritance. C++ is a hybrid of C with OOP! The most significant extensions to C are: much stronger type checking.

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 7 September 21, 2016 CPSC 427, Lecture 7 1/21 Brackets Example (continued) Storage Management CPSC 427, Lecture 7 2/21 Brackets Example

More information

Course "Data Processing" Name: Master-1: Nuclear Energy Session /2018 Examen - Part A Page 1

Course Data Processing Name: Master-1: Nuclear Energy Session /2018 Examen - Part A Page 1 Examen - Part A Page 1 1. mydir directory contains three files: filea.txt fileb.txt filec.txt. How many files will be in the directory after performing the following operations: $ ls filea.txt fileb.txt

More information

Do not turn to the next page until the start of the exam.

Do not turn to the next page until the start of the exam. Introduction to Programming, PIC10A E. Ryu Fall 2017 Midterm Exam Friday, November 3, 2017 50 minutes, 11 questions, 100 points, 8 pages While we don t expect you will need more space than provided, you

More information

Guide for getting started with SystemC development

Guide for getting started with SystemC development Guide for getting started with SystemC development By Senior Consultant Kim Bjerge (kim.bjerge@teknologisk.dk) Copyright 2007 Danish Technological Institute Contents Preface...1 Getting started with SystemC

More information

C++_ MARKS 40 MIN

C++_ MARKS 40 MIN C++_16.9.2018 40 MARKS 40 MIN https://tinyurl.com/ya62ayzs 1) Declaration of a pointer more than once may cause A. Error B. Abort C. Trap D. Null 2Whice is not a correct variable type in C++? A. float

More information

More Group HW. #ifndef Stackh #define Stackh. #include <cstdlib> using namespace std;

More Group HW. #ifndef Stackh #define Stackh. #include <cstdlib> using namespace std; More Group HW The following code is contained in the file ex1stck.h. Fill in the blanks with the C++ statement(s) that will correctly finish the method. Each blank may be filled in with more than one statement.

More information

Chapter 5: CPU Scheduling

Chapter 5: CPU Scheduling Chapter 5: CPU Scheduling Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm Evaluation

More information

QUIZ. What are 3 differences between C and C++ const variables?

QUIZ. What are 3 differences between C and C++ const variables? QUIZ What are 3 differences between C and C++ const variables? Solution QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Solution The C/C++ preprocessor substitutes mechanically,

More information

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi Modern C++ for Computer Vision and Image Processing Igor Bogoslavskyi Outline Move semantics Classes Operator overloading Making your class copyable Making your class movable Rule of all or nothing Inheritance

More information

Scientific Computing

Scientific Computing Scientific Computing Martin Lotz School of Mathematics The University of Manchester Lecture 1, September 22, 2014 Outline Course Overview Programming Basics The C++ Programming Language Outline Course

More information

C++ Lab 03 - C++ Functions

C++ Lab 03 - C++ Functions C++ Lab 03 - C++ Functions 2.680 Unmanned Marine Vehicle Autonomy, Sensing and Communications Spring 2018 Michael Benjamin, mikerb@mit.edu Department of Mechanical Engineering Computer Science and Artificial

More information

Separate Compilation of Multi-File Programs

Separate Compilation of Multi-File Programs 1 About Compiling What most people mean by the phrase "compiling a program" is actually two separate steps in the creation of that program. The rst step is proper compilation. Compilation is the translation

More information

Discussion 1E. Jie(Jay) Wang Week 10 Dec.2

Discussion 1E. Jie(Jay) Wang Week 10 Dec.2 Discussion 1E Jie(Jay) Wang Week 10 Dec.2 Outline Dynamic memory allocation Class Final Review Dynamic Allocation of Memory Recall int len = 100; double arr[len]; // error! What if I need to compute the

More information

Chapter 5: CPU Scheduling. Operating System Concepts Essentials 8 th Edition

Chapter 5: CPU Scheduling. Operating System Concepts Essentials 8 th Edition Chapter 5: CPU Scheduling Silberschatz, Galvin and Gagne 2011 Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating

More information

Lecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8

Lecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8 Today... Java basics S. Bowers 1 of 8 Java main method (cont.) In Java, main looks like this: public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); Q: How

More information

Lecture 15a Persistent Memory & Shared Pointers

Lecture 15a Persistent Memory & Shared Pointers Lecture 15a Persistent Memory & Shared Pointers Dec. 5 th, 2017 Jack Applin, Guest Lecturer 2017-12-04 CS253 Fall 2017 Jack Applin & Bruce Draper 1 Announcements PA9 is due today Recitation : extra help

More information

BLM2031 Structured Programming. Zeyneb KURT

BLM2031 Structured Programming. Zeyneb KURT BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help

More information

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above

More information

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi Modern C++ for Computer Vision and Image Processing Igor Bogoslavskyi Outline Static variables and methods Representation of numbers in memory Raw C arrays Non-owning pointers in C++ Classes in memory

More information

Chapter 5 CPU scheduling

Chapter 5 CPU scheduling Chapter 5 CPU scheduling Contents Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling

More information

Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A

Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A Name: ID#: Section #: Day & Time: Instructor: Answer all questions as indicated. Closed book/closed

More information

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018 C++ Basics Lecture 2 COP 3014 Spring 2018 January 8, 2018 Structure of a C++ Program Sequence of statements, typically grouped into functions. function: a subprogram. a section of a program performing

More information

CSE 333 Midterm Exam July 24, Name UW ID#

CSE 333 Midterm Exam July 24, Name UW ID# Name UW ID# There are 6 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,

More information

C++ For Science and Engineering Lecture 12

C++ For Science and Engineering Lecture 12 C++ For Science and Engineering Lecture 12 John Chrispell Tulane University Monday September 20, 2010 Comparing C-Style strings Note the following listing dosn t do what you probably think it does (assuming

More information

4 th European SystemC Users Group Meeting

4 th European SystemC Users Group Meeting 4 th European SystemC Users Group Meeting http://www-ti.informatik.uni-tuebingen.de/systemc Copenhagen October 5 th, 2001, 1100-1600 SystemC 2.0 Tutorial Thorsten Grötker R & D Manager Synopsys, Inc. Motivation

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

CPU Scheduling (Part II)

CPU Scheduling (Part II) CPU Scheduling (Part II) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 1 / 58 Motivation Amir H. Payberah

More information

C++ Programming Assignment 3

C++ Programming Assignment 3 C++ Programming Assignment 3 Author: Ruimin Zhao Module: EEE 102 Lecturer: Date: Fei.Xue April/19/2015 Contents Contents ii 1 Question 1 1 1.1 Specification.................................... 1 1.2 Analysis......................................

More information

Programmazione. Prof. Marco Bertini

Programmazione. Prof. Marco Bertini Programmazione Prof. Marco Bertini marco.bertini@unifi.it http://www.micc.unifi.it/bertini/ Hello world : a review Some differences between C and C++ Let s review some differences between C and C++ looking

More information

REVIEW. The C++ Programming Language. CS 151 Review #2

REVIEW. The C++ Programming Language. CS 151 Review #2 REVIEW The C++ Programming Language Computer programming courses generally concentrate on program design that can be applied to any number of programming languages on the market. It is imperative, however,

More information

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things.

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things. A Appendix Grammar There is no worse danger for a teacher than to teach words instead of things. Marc Block Introduction keywords lexical conventions programs expressions statements declarations declarators

More information

Object-Oriented Programming (OOP) Fundamental Principles of OOP

Object-Oriented Programming (OOP) Fundamental Principles of OOP Object-Oriented Programming (OOP) O b j e c t O r i e n t e d P r o g r a m m i n g 1 Object-oriented programming is the successor of procedural programming. The problem with procedural programming is

More information

C++ basics Getting started with, and Data Types.

C++ basics Getting started with, and Data Types. C++ basics Getting started with, and Data Types pm_jat@daiict.ac.in Recap Last Lecture We talked about Variables - Variables, their binding to type, storage etc., Categorization based on storage binding

More information