Design Codesign of Embedded Systems Combinational Logic in

Design & Co-design of Embedded Systems Combinational Logic in System. C Maziar Goudarzi 2005 Design & Co-design of Embedded Systems

Today Program z Describing Combinational Logic for Simulation z Synthesizable Subset for Combinational Logic Chapter 5 of: J. Bhasker, “A System. C Primer”, Star Galaxy Publishing, 2002. 2005 Design & Co-design of Embedded Systems 2

Recommendations on Data Types z For one bit, use bool z For vectors and unsigned arithmetic, use sc_uint<> z For signed arithmetic use sc_int<> z If vector size>64, use sc_biguint<> or sc_bigint<> z For loop indices use int (do not rely on its size, however) z Use sc_logic and sc_lv<> only for four-valued logic z Use resolved types only when resolution is required (i. e. , multiple drivers on a port or signal) 2005 Design & Co-design of Embedded Systems 3

Combinational Logic z. Logic circuit whose output is a function of its inputs sampled only at that same time in 1 in 2 in 3 2005 Combinational Logic Design & Co-design of Embedded Systems outt = f(in 1 t, in 2 t, in 3 t) 4

Simulating Combinational Logic in System. C z Using SC_METHOD process SC_MODULE(not_gate) { sc_in<bool> in; sc_out<bool> out; void proc() { out=!in. read(); } SC_CTOR(not_gate) { SC_METHOD(proc); sensitive<<in; } }; z Note: y All inputs must appear in the sensitivity list y What happens if they don’t? 2005 Design & Co-design of Embedded Systems 5

Simulating Combinational Logic in System. C (cont’d) z Using SC_THREAD process SC_MODULE(not_gate) { sc_in<bool> in; sc_out<bool> out; void proc() { while(1) { out=!in. read(); wait(); } } SC_CTOR(not_gate) { SC_THREAD(proc); sensitive<<in; } }; z How about SC_CTHREAD? Can it be used for combinational logic? 2005 Design & Co-design of Embedded Systems 6

Logical Operators 2005 Design & Co-design of Embedded Systems 7

Logical Operators on Vectors 2005 Design & Co-design of Embedded Systems 8

Arithmetic Operators 2005 Design & Co-design of Embedded Systems 9

Other Operators z. Signed Arithmetic z. Relational Operators 2005 Design & Co-design of Embedded Systems 10

Other Operators (cont’d) z. Vectors and Ranges y. Constant index y. Non-constant index 2005 Design & Co-design of Embedded Systems 11

What we learned today z. How to describe combinational logic y. For simulation y. For synthesis x. Synthesis semantics of various C++ constructs 2005 Design & Co-design of Embedded Systems 12

Assignments z Assignment 3: y Is put on the course web-page x Exercises of Chapter 4 of “System. C Primer” book x Synthesize your models using the available tool y Due date: x Two weeks from now: Tuesday, Aban 24 th 2005 Design & Co-design of Embedded Systems 13
- Slides: 13