Docsity

Combinational Logic using Hardware description Language | ECE 368, Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download Combinational Logic using Hardware description Language | ECE 368 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

ECE 368: CAD Based Logic Design

Lecture Notes # 1

Introduction: Combinational Logic and Its DescriptionUsing Hardware Description Languages (HDLs)

S^ HANTANU

D^ UTT

Department of Electrical and Computer Engineering

University of Illinois, Chicago Phone: (312) 355-1314;

e-mail: [email protected] URL: http://www.ece.uic.edu/

˜dutt

Shantanu Dutt^

1

Application of Logic Circuits–The Big Picture

Besides, computers, logic circuits find the bulk of their application as theembedded systems or brains of an enormous variety of pruducts. In such sys-tems they are generally used as controllers

of a larger (non-logic–eg., analog,

electro-mechanical) system

Larger (possiblynon-digital) system

Logic Circuit(Digital Circuit)nk

ml

A/D Sensors^

D/A Actuators Control

n1 n

m1m

Signals

Shantanu Dutt^

2

Application of Logic Circuits (contd.)

^ Logic Circuits are used to realize functions of the type:^ If input

condition

C holds^1

then^

do output

action

A^1 else^ if input

condition

C holds^2

then do output

action

A^2

... Or have loopings in these constructs. E.g., RepeatIf input

condition

C holds^1

then^

do output

action

A^1 else^ if input

condition

C holds^2

then do output

action

A^2

... Until^

condition

C^0 

^ In short, any function that can be specified by a “program” can be im-plemented by a combination of combinational circuits, sequential circuitsand memory (besides the memory inherent in sequential circuits)

4

Conditions

C can be of the type: i^

-^ The temp. 70 degrees F –^ The time 12:30 pm –^ Value of variables

AA 12

^ Actions

A^ can be of the type: i^ – Turn the furnace on – Tape the program on channel 7 – Turn on the light Shantanu Dutt^

5

Introduction: The Role of Logic (contd.)

^ Defn.^ A

logic function f

A^ A ^12

^ A , where n^ 

A ^ A^1

are^ logic vari-n

ables^ that can take 1/0 values, is one which has either 1 or 0 values as itsoutput depending on the input combination of its 1/0 values Fact: Any logic function can be represented by a combination of AND,OR, NOT operators on the input variables Fact: Any logic function can also be represented by a

Truth Table

(TT)

^ A^ Truth Table

is a tabular representation of a logic function (or operation) where the output value (1/0) is indicated for each input 1/0 combination.Examples for the AND, OR, NOT functions: Defn^ A^ logic circuit

is a circuit that realizes a logic function

f^ A ^1

^ An 

”electrically”. It does so by electrically representing 1’s and 0’s as voltagelevels, and manipulating them to produce 1 or 0 at the output as requiredby function

f^. Shantanu Dutt^

7

A B^ A^ AND

B^ A B

A^ OR^ B

A^ NOT(A)

^ More Examples: A generic 2-input function^ A

Af^1 2

A^ A^12 

There are a total of 2

2 combinations of 2 inputs (i/p)–so the TT has 4 rows – Each output (o/p) of a row can have 2 pos-sible values (1/0)–so there are 2

4 16 pos-

sible combinations of values for a 4-rowTT – Each of these 16 combinations is a distinctTT–thus there are 16 different 2-i/p func-tions

Shantanu Dutt^

8

A Simple Design Problem

Problem: Design a logic circuit that allows a light bulb to be controlled bytoggling any one of the two provided switches

s^ s.^12

+5v +5v

S1LogicCircuitS S1 S

Bulb ZSW AC Power 10

A Design Problem (Contd.)

Design Steps:1. Encode the input(s) and output(s) of the logic circuit as logic variables sothat^ C

and^ A^ are

logic expressions Input Encoding

Switch^ s

is pushed 1

logic input

s^11

Switch^ s

is not pushed 1

logic input

s^01

Similarly for switch

s and logic input variable^2

s^2

(In this case we are using the same name for both the input sensor and thecorresponding single input variable–this may not always be the case) Imp.^ Note

:^ The term

s 1 can be more simply represented as the 1

logic expression

s ;^ the term^1

s 0 can be more simply represented as 1

NOT^ s^1 

or ¯ s^1 Output Encoding

Turn the (electro-mechanical) switch SW on

logic output

Z 1

Turn the (electro-mechanical) switch SW off

logic output

Z 0

Shantanu Dutt^

11

ssZ^1 2 0 0 00 1 11 0 11 1

-^ Each row in a TT corresponds to an

AND term

or^ prod-

uct term^

or^ minterm

of the input variables

-^ In the product term an i/p variable

X^ occurs as ¯

X^ if it

is 0 in that row otherwise as

X

-^ The^ output

column

is^ the^

OR^ of^

all^ the^

prod-

uct^ terms

(rows)^

for^ which

it^ is^ a

1–thus^

Z

¯ sAND s^1

OR^ s 2 1  AND^ ¯ s 2 

-^ More compactly,

Z ¯ ss^1

s ¯ s 2 1 2  , product form re- 

places AND and plus (+) form replaces OR This iscalled a^ canonical

sum-of-product (SOP) expression.

Shantanu Dutt^

UIC^13

13

  1. Minimize the logic expression(s) using various methods like algebraicmanipulation, K-Maps, Quine-McCluskey and Petrick’s algorithm. Theabove expression for

Z^ is already in minimized form.

  1. Implement the logic expression(s) using “switches” or “gates” (or some othertechnologies like PLA, multiplexers, ROMs–will do later)

S2 S S1S2 NOT gate

AND gate S2S1 S2S1^ OR gateS1S

+S1S2Z=

Shantanu Dutt^

14

Purpose of Hardware Description Language (HDL) Q. What is the purpose of describing a digital circuit or system in thismanner?Ans.– Ease of specifying the design of large circuits/systems using well un-derstood programming language and algorithmic constructs.Note: Did you know that any algorithm that can be mapped to a pro-gram (in say C++) can also be mapped to hardware that then directlyimplements the algorithm?

This is because a program is ultimately

executed by a hardware–a computer, and a direct mapping of the algo-rithm to hardware executes that algorithm by mimicking the computerexecution (as a byproduct of the mapping, for e.g., id there is an ADDoperation to be performed the computer will process it via a generalpurpose ADD instruction while the specialised hardware will processit by sourcing the relevant operands to the inputs of an adder via con-trol signals from a controller). Shantanu Dutt^

16

Hardware Synthesis – Example 1

Computer Code Generation

Unit (FSM)

ldc lda ldb CPU

Mux3_select b^

Mux c ADDER Mux a Hardware SynthesisMux^ Mux2_selectMux1_select

Execution in a CPU

Control

Read Bus A^ Read Bus B

Mux Register File

Write Bus

Conrtol signals Conrtol signals Programming language statementa := b + c; Load r5 bLoad r7 cADD r2 r5 r7(r2 <- r5 + r7)Store r2 aReg_r/w Reg_addr Alu_oper_select

Mux_selectr

32 r5 r7^3232 ADD^ ALU Shantanu Dutt^

17

Purpose of HDL (contd.)

  • Simulating and testing designs for correctness before actual implemen-tation/fabrication.– Automatic synthesis of large designs specified behaviorally or algo-rithmically using CAD tools:^ ^ can also verify each transformation (algorithm

circuit (netlist)

chip layout) using verification tools reduces human error increases design productivity can lead to more innovative designs as it frees the designer fromwell-known nitty-gritty details of circuit design (e.g., design oifa fast adder) allowing the designer to explore alternative de-signs/algorithms at a higher level Shantanu Dutt^

UIC^19

19

Describing Combinational Ckts and Data Paths (Contd.)

S1S2 NOT gate

AND gate X OR gateY Sbar2Sbar

+S2S1 S1S2Z=

^ First the

entity^ description specifying input/output signals: entity ckt1 isport( s s :^ in^ bit; 12

Z :^ out^ bit);

  • i/o signals of type

bit^ can only take on ‘0’ and ‘1’ values end entity

ckt1; (1) Behavioral: Just specify the o/p function’s conditions for being 1 and 0:^ architecture

behav1^ of

ckt1^ is begin sw-controller:

process

is begin if^ s^0

and s 2 1 then^ Z

elsif s 1 1 and^ s^2

^0 then

Z 1;

else^ Z

20