hardware/software codesign with systemc

11
HM-ES-th1 Les 4 Hardware/Software Codesign with SystemC

Upload: chipo

Post on 10-Jan-2016

31 views

Category:

Documents


1 download

DESCRIPTION

Hardware/Software Codesign with SystemC. HM-ES-th1 Les 4. SystemC Hiërarchie. Een module kan (sub)modules bevatten. i n port. module. channel. submodule. submodule. out port. Verbindingen tussen modules. Verbindingen tussen hiërarchische niveaus: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Hardware/Software Codesign with SystemC

HM-ES-th1 Les 4

Hardware/Software Codesign with SystemC

Page 2: Hardware/Software Codesign with SystemC

SystemC HiërarchieEen module kan (sub)modules bevatten

2

in port

out port

module

submodule

channel

submodule

Page 3: Hardware/Software Codesign with SystemC

Verbindingen tussen modulesVerbindingen tussen hiërarchische niveaus:

Input van module (rechtstreeks) verbonden met input van submodule.

Output van submodule (rechtstreeks) verbonden met output van module.

Verbindingen binnen een hierarchische niveau:Output van een module (via een channel) verbonden met de

input van een andere module (op hetzelfde niveau).

3

Page 4: Hardware/Software Codesign with SystemC

2 bit full adderSchema (opgebouwd uit twee 1 bit full adders).

4

A0

S0

Adder2Bits

carry

adder0A B Cin

S Coutadder1

A B Cin

S Cout

B0 Cin A1 B1

S1 Cout

Page 5: Hardware/Software Codesign with SystemC

2 bit full adderSC_MODULE(Adder2Bits) { sc_in<sc_logic> A0, B0, A1, B1, Cin; sc_out<sc_logic> S0, S1, Cout; SC_CTOR(Adder2Bits): adder0("adder0"), adder1("adder1") { adder0.A(A0); adder0.B(B0); adder0.Cin(Cin); adder0.S(S0); adder0.Cout(carry); adder1.Cin(carry); adder1.A(A1); adder1.B(B1); adder1.S(S1); adder1.Cout(Cout); }private: Adder adder0, adder1; sc_signal<sc_logic> carry;}; 5

Page 6: Hardware/Software Codesign with SystemC

2 bit full adder (alternatief)SC_MODULE(Adder2Bits) { sc_in<sc_logic> A0, B0, A1, B1, Cin; sc_out<sc_logic> S0, S1, Cout; SC_CTOR(Adder2Bits) { SC_METHOD(add); sensitive << A0 << B0 << A1 << B1 << Cin; }private: void add() { sc_uint<3> a = 0, b = 0, c = 0; a[1] = A1.read().to_bool(); a[0] = A0.read().to_bool(); b[1] = B1.read().to_bool(); b[0] = B0.read().to_bool(); c[0] = Cin.read().to_bool(); sc_uint<3> s = a + b + c; S0.write(sc_logic(s[0].to_bool())); S1.write(sc_logic(s[1].to_bool())); Cout.write(sc_logic(s[2].to_bool())); }}; 6

Page 7: Hardware/Software Codesign with SystemC

De 2 bit full adder opgebouwd met twee 1 bit full adders noemen we een structural model.

De 2 bit full adder waarvan het gedrag wordt beschreven zonder gebruik te maken van submodules noemen we een behavioral model.

7

Page 8: Hardware/Software Codesign with SystemC

ModulesModules are the basic building blocks for partitioning a

designA module is a structural entity, which can contain

processes, ports, channels, member functions not registered as processes and instances of other modules

A module is the foundation of structural hierarchyModules allow designers to hide internal data

representation and algorithms from other modulesDesigners are forced to use public interfaces to other

modules, thus making the entire system easier to change and maintain reusability = lower design time

8

Page 9: Hardware/Software Codesign with SystemC

ProcessesProcesses are small pieces of code that run

concurrently with other processes.Functionality is described in processes. Processes must be contained within a module.They are registered as processes with the SystemC

kernel, using a process declaration in the module constructor.

Processes accept no arguments and produce no output

9

Page 10: Hardware/Software Codesign with SystemC

SystemC in UML

10

1

10..*

has top level channels

2

1

connects within one level

0..*0..*

0..* submodules

1..*

has top level modules

has connection points

connects one level up/down in hierarchy

0..*

0..*behaviour is defined by

sensitive to

channel

SystemC model

sc module

T:typenamesc signal

T:typenamesc in

+read():T

T:typenamesc out

+write(:T):void

module

port

process

Page 11: Hardware/Software Codesign with SystemC

Fixed point getallenEen fixed point getal heeft een bepaald aantal bits voor

de decimale punt en een bepaald aantal bits na de decimale punt.

Fixed point getallen kunnen in een integer worden opgeslagen. De programmeur moet dan wel zelf onthouden waar de decimale punt staat.

Rekenen met fixed point getallen:Optellen en aftrekken niets bijzonders.Vermenigvuldigen resultaat naar rechts schuiven zodat

decimale punt weer goed staat.Delen resultaat naar links schuiven zodat decimale punt

weer goed staat. 11