ECE 545—Digital System Design with VHDL Lecture 3

Slides:



Advertisements
Similar presentations
Basics Combinational Circuits Sequential Circuits
Advertisements

컴퓨터구조론 교수 채수환. 교재 Computer Systems Organization & Architecture John D. Carpinelli, 2001, Addison Wesley.
التصميم المنطقي Second Course
Circuits require memory to store intermediate data
ECE 331 – Digital System Design Flip-Flops and Registers (Lecture #18) The slides included herein were taken from the materials accompanying Fundamentals.
1 Chapter 4 Combinational and Sequential Circuit.
1 Digital Logic
Overview Logic Combinational Logic Sequential Logic Storage Devices SR Flip-Flops D Flip Flops JK Flip Flops Registers Addressing Computer Memory.
11/16/2004EE 42 fall 2004 lecture 331 Lecture #33: Some example circuits Last lecture: –Edge triggers –Registers This lecture: –Example circuits –shift.
Chapter 7 - Part 2 1 CPEN Digital System Design Chapter 7 – Registers and Register Transfers Part 2 – Counters, Register Cells, Buses, & Serial Operations.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448.
16/07/2015CSE1303 Part B lecture notes 1 Hardware Implementation Lecture B17 Lecture notes section B17.
CS 105 Digital Logic Design
Sequential Circuits Chapter 4 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S.
ECE 301 – Digital Electronics Flip-Flops and Registers (Lecture #15)
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Building Functions.
Introduction to Digital Logic Design Appendix A of CO&A Dr. Farag
Some Useful Circuits Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University.
COE 202: Digital Logic Design Sequential Circuits Part 1
Combinational Circuits Chapter 3 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer, 2003.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
+ CS 325: CS Hardware and Software Organization and Architecture Combinational Circuits 1.
SUPLEMENTARY CHAPTER 1: An Introduction to Digital Logic The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
Digital Logic Basics Chapter 2 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer, 
MSI Devices M. Mano & C. Kime: Logic and Computer Design Fundamentals (Chapter 5) Dr. Costas Kyriacou and Dr. Konstantinos Tatas ACOE161 - Digital Logic.
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Basic Logic Gates.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
1 Boolean Algebra & Logic Gates. 2 Objectives Understand the relationship between Boolean logic and digital computer circuits. Learn how to design simple.
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Combinational vs.
Digital Logic Design Review Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office: Ahmad Almulhem, KFUPM 2010.
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
SEQUENTIAL CIRCUITS Component Design and Use. Register with Parallel Load  Register: Group of Flip-Flops  Ex: D Flip-Flops  Holds a Word of Data 
Chapter 3 Digital Logic Structures. 3-2 Combinational vs. Sequential Combinational Circuit always gives the same output for a given set of inputs  ex:
CS 105 DIGITAL LOGIC DESIGN Chapter 4 Combinational Logic 1.
Computer Architecture and Organization Unit -1. Digital Logic Circuits – Logic Gates – Boolean Algebra – Map Simplification – Combinational Circuits –
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Transistor: Building.
Digital System Design using VHDL
1 ECE 545—Digital System Design with VHDL Lecture 1 Digital Logic Refresher Part A – Combinational Logic Building Blocks.
Introduction to Computing Systems and Programming Digital Logic Structures.
How does the CPU work? CPU’s program counter (PC) register has address i of the first instruction Control circuits “fetch” the contents of the location.
ECE 545—Digital System Design with VHDL Lecture 1
Digital Logic Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals.
Chapter 3 Digital Logic Structures
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Lecture 3 Boolean Algebra and Digital Logic Lecture Duration: 2 Hours.
4–1. BSCS 5 th Semester Introduction Logic diagram: a graphical representation of a circuit –Each type of gate is represented by a specific graphical.
COMBINATIONAL AND SEQUENTIAL CIRCUITS Guided By: Prof. P. B. Swadas Prepared By: BIRLA VISHVAKARMA MAHAVDYALAYA.
Chapter 3 Boolean Algebra and Digital Logic T103: Computer architecture, logic and information processing.
DIGITAL LOGIC CIRCUITS
Instructor: Alexander Stoytchev
Basics of digital systems
DIGITAL LOGIC CIRCUITS
Basics of Digital Logic Design Presentation D
ECE 434 Advanced Digital System L03
Reading: Hambley Chapters
ECE Digital logic Lecture 16: Synchronous Sequential Logic
Lecture 3 Boolean Algebra and Digital Logic Lecture Duration: 2 Hours
Basics Combinational Circuits Sequential Circuits
Basics Combinational Circuits Sequential Circuits Ahmad Jawdat
CPE/EE 422/522 Advanced Logic Design L02
5. Combinational circuits
ECE434a Advanced Digital Systems L02
Week 7: Gates and Circuits: PART II
ECE 545—Digital System Design with VHDL Lecture 1
13 Digital Logic Circuits.
Logic Circuits I Lecture 3.
Flip-Flops.
Digital Circuits and Logic
SEQUENTIAL CIRCUITS __________________________________________________
Presentation transcript:

ECE 545—Digital System Design with VHDL Lecture 3 Digital Logic Review

Lecture Roadmap – Combinational Logic Basic Logic Review Basic Gates DeMorgan’s Law Combinational Logic Blocks Multiplexers Decoders, Demultiplexers Encoders, Priority Encoders Half Adders, Full Adders Multi-Bit Combinational Logic Blocks Multi-bit multiplexers Multi-bit adders Comparators

Lecture Roadmap – Sequential Logic Sequential Logic Building Blocks Latches, Flip-Flops Sequential Logic Circuits Registers, Shift Registers, Counters Memory (RAM, ROM)

Textbook References Combinational Logic Review Sequential Logic Review Stephen Brown and Zvonko Vranesic, Fundamentals of Digital Logic with VHDL Design, 2nd or 3rd Edition Chapter 2 Introduction to Logic Circuits (2.1-2.8 only) Chapter 6 Combinational-Circuit Building Blocks (6.1-6.5 only) OR your undergraduate digital logic textbook (chapters on combinational logic) Sequential Logic Review Chapter 7 Flip-flops, Registers, Counters, and a Simple Processors (7.3-7.4, 7.8-7.11 only) OR your undergraduate digital logic textbook (chapters on sequential logic)

Basic Logic Review some slides modified from: S. Dandamudi, “Fundamentals of Computer Organization and Design”

Basic Concepts Simple logic gates AND  0 if one or more inputs is 0 OR  1 if one or more inputs is 1 NOT NAND = AND + NOT 1 if one or more inputs is 0 NOR = OR + NOT 0 if one or more input is 1 XOR implements exclusive-OR function NAND and NOR gates require fewer transistors than AND and OR in standard CMOS Functionality can be expressed by a truth table A truth table lists output for each possible input combination

Basic Logic Gates

Number of Functions Number of functions With N logical variables, we can define 22N functions Some of them are useful AND, NAND, NOR, XOR, … Some are not useful: Output is always 1 Output is always 0 “Number of functions” definition is useful in proving completeness property

Complete Set of Gates Complete sets A set of gates is complete if we can implement any logical function using only the type of gates in the set Some example complete sets {AND, OR, NOT} Not a minimal complete set {AND, NOT} {OR, NOT} {NAND} {NOR} Minimal complete set A complete set with no redundant elements.

NAND as a Complete Set Proving NAND gate is universal

Logic Functions Logical functions can be expressed in several ways: Truth table Logical expressions Graphical form HDL code Example: Majority function Output is one whenever majority of inputs is 1 We use 3-input majority function

Logic Functions (cont’d) Truth table A B C F 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 Logical expression form F = A B + B C + A C Graphical schematic form

Boolean Algebra Boolean identities Name AND version OR version Identity x.1 = x x + 0 = x Complement x. x’ = 0 x + x’ = 1 Commutative x.y = y.x x + y = y + x Distribution x. (y+z) = xy+xz x + (y. z) = (x+y) (x+z) Idempotent x.x = x x + x = x Null x.0 = 0 x + 1 = 1

Boolean Algebra (cont’d) Boolean identities (cont’d) Name AND version OR version Involution x = (x’)’ --- Absorption x. (x+y) = x x + (x.y) = x Associative x.(y. z) = (x. y).z x + (y + z) = (x + y) + z de Morgan (x. y)’ = x’ + y’ (x + y)’ = x’ . y’ (de Morgan’s law in particular is very useful)

Majority Function Using Other Gates Using NAND gates Get an equivalent expression A B + C D = (A B + C D)’’ Using de Morgan’s law A B + C D = ( (A B)’ . (C D)’)’ Can be generalized Example: Majority function A B + B C + AC = ((A B)’ . (B C)’ . (AC)’)’

Majority Function Using Other Gates (cont'd)

Combinational Logic Building Blocks Some slides modified from: S. Dandamudi, “Fundamentals of Computer Organization and Design” S. Brown and Z. Vranesic, "Fundamentals of Digital Logic"

Multiplexers multiplexer n binary inputs (binary input = 1-bit input) log2n selection inputs n inputs 1 output multiplexer n binary inputs (binary input = 1-bit input) log2n binary selection inputs 1 binary output Function: one of n inputs is placed onto output Called n-to-1 multiplexer

2-to-1 Multiplexer w s w f s s f w w f w 1 w (a) Graphical symbol w f w 1 1 1 w 1 (a) Graphical symbol (b) Truth table w w s f s w w 1 f 1 (c) Sum-of-products circuit (d) Circuit with transmission gates Source: Brown and Vranesic

4-to-1 Multiplexer s s s s f w w w f 1 w w 1 w w 1 1 w s 1 s s f 1 w 00 w w 1 01 f 1 w 1 w 2 10 1 w w 2 3 11 1 1 w 3 (a) Graphic symbol (b) Truth table s w s 1 w 1 f w 2 w 3 Source: Brown and Vranesic (c) Circuit

Decoders Decoder n binary inputs 2n binary outputs w 2 n – 1 n-1 n n inputs 2 w outputs y Enable En Decoder n binary inputs 2n binary outputs Function: decode encoded information If enable=1, one output is asserted high, the other outputs are asserted low If enable=0, all outputs asserted low Often, enable pin is not needed (i.e. the decoder is always enabled) Called n-to-2n decoder Can consider n binary inputs as a single n-bit input Can consider 2n binary outputs as a single 2n-bit output Decoders are often used for RAM/ROM addressing

2-to-4 Decoder En w w y y y y w y 1 1 w y 1 1 1 y 1 1 1 y 1 1 1 1 En - 3 2 1 w y 1 1 1 3 w y 1 1 1 2 y 1 1 1 1 y 1 1 1 1 En - - (a) Truth table (b) Graphical symbol w y w 1 y 1 y 2 y 3 En Source: Brown and Vranesic (c) Logic circuit

Demultiplexers Demultiplexer Closely related to decoder log2n selection inputs 1 input n outputs Demultiplexer 1 binary input n binary outputs log2n binary selection inputs Function: places input onto one of n outputs, with the remaining outputs asserted low Called 1-to-n demultiplexer Closely related to decoder Can build 1-to-n demultiplexer from log2n-to-n decoder by using the decoder's enable signal as the demultiplexer's input signal, and using decoder's input signals as the demultiplexer's selection input signals.

1-to-4 Demultiplexer

Encoders w 2 n – 1 y n – 1 2 n n inputs outputs y w Encoder 2n binary inputs n binary outputs Function: encodes information into an n-bit code Called 2n-to-n encoder Can consider 2n binary inputs as a single 2n-bit input Can consider n binary output as a single n-bit output Encoders only work when exactly one binary input is equal to 1

4-to-2 Encoder (a) Truth table (b) Circuit w w w w y y 1 1 1 1 1 1 1 1 3 2 1 1 1 1 1 1 1 1 1 1 (a) Truth table w w 1 y w 2 y w 1 3 (b) Circuit

Priority Encoders w y 2 n inputs outputs y w z "valid" output – 1 y n – 1 2 n n inputs outputs y w z "valid" output Priority Encoder 2n binary inputs n binary outputs 1 binary "valid" output Function: encodes information into an n-bit code based on priority of inputs Called 2n-to-n priority encoder Priority encoder allows for multiple inputs to have a value of '1', as it encodes the input with the highest priority (MSB = highest priority, LSB = lowest priority) "valid" output indicates when priority encoder output is valid Priority encoder is more common than an encoder

4-to-2 Priority Encoder w w w w y y z - - 1 1 1 - 1 1 1 - - 1 1 1 - - 3 2 1 1 - - 1 1 1 - 1 1 1 - - 1 1 1 - - - 1 1 1

Single-Bit Adders Half-adder Full-adder Adds two binary (i.e. 1-bit) inputs A and B Produces a sum and carryout Problem: Cannot use it alone to build larger adders Full-adder Adds three binary (i.e. 1-bit) inputs A, B, and carryin Like half-adder, produces a sum and carryout Allows building M-bit adders (M > 1) Simple technique Connect Cout of one adder to Cin of the next These are called ripple-carry adders Shown in next section

Single-Bit Adders (cont’d)

Multi-Bit Combinational Logic Building Blocks

Multi-bit 4-to-1 Multiplexer s s 1 s s f 1 w 00 w w 1 01 w f 1 1 w 2 10 1 w w 2 3 11 8 1 1 w 3 8 (a) Graphic symbol (b) Truth table When drawing schematics, can draw multi-bit multiplexers Example: 4-to-1 (8 bit) multiplexer 4 inputs (each 8 bits) 1 output (8 bits) 2 selection bits Can also have multi-bit 2-to-1 muxes, 16-to-1 muxes, etc.

4-to-1 (8-bit) Multiplexer s s 1 w0(7) 00 w1(7) 01 f(7) w2(7) 10 w3(7) 11 A 4-to-1 (8-bit) multiplexer is composed of eight 4-to-1 (1-bit) multiplexers s s s 1 s 1 w0(6) 00 w w1(6) 00 = 01 w f(6) 1 01 w2(6) f 10 w 2 10 w3(6) 11 w 3 11 8 8 s s 1 w0(0) 00 w1(0) 01 f(0) w2(0) 10 w3(0) 11

16-bit Unsigned Adder 16 16 X Y Cout Cin S 16

Multi-Bit Ripple-Carry Adder A 16-bit ripple-carry adder is composed of 16 (1-bit) full adders Inputs: 16-bit A, 16-bit B, 1-bit carryin (set to zero in the figure below) Outputs: 16-bit sum R, 1-bit overflow Other multi-bit adder structures can be studied in ECE 645—Computer Arithmetic Called a ripple-carry adder because carry ripples from one full-adder to the next. Critical path is 16 full-adders.

Comparator Used two compare two M-bit numbers and produce a flag (M >1) Inputs: M-bit input A, M-bit input B Output: 1-bit output flag 1 indicates condition is met 0 indicates condition is not met Can compare: >, >=, <, <=, =, etc. A > B? A M 1 if A > B 0 if A <= B B M

Example: 4-bit comparator (A = B) 1 if A = B 0 if A != B B 4

(b) Equivalent circuit Tri-state Buffer e x f e = 0 (a) A tri-state buffer x f e x f e = 1 x f Z 1 Z 1 (b) Equivalent circuit 1 1 1 (c) Truth table

Four types of Tri-state Buffers

Sequential Logic Building Blocks some slides modified from: Brown and Vranesic, “Fundamentals of Digital Logic with VHDL Design, 2nd Edition” S. Dandamudi, “Fundamentals of Computer Organization and Design”

Introduction to Sequential Logic Output depends on current as well as past inputs Depends on the history Have “memory” property Sequential circuit consists of Combinational circuit Feedback circuit Past input is encoded into a set of state variables Uses feedback (to feed the state variables) Simple feedback Uses flip flops

Introduction (cont’d) Main components of a typical synchronous sequential circuit (synchronous = uses a clock to keep circuits in lock step) INPUT COMBINATIONAL LOGIC OUTPUT NEXT STATE S(t+1) PRESENT STATE S(t) STATE-HOLDING ELEMENTS (i.e. FLIP-FLOPS) CLOCK

State-Holding Memory Elements Latch versus Flip Flop Latches are level-sensitive: whenever clock is high, latch is transparent Flip-flops are edge-sensitive: data passes through (i.e. data is sampled) only on a rising (or falling) edge of the clock Latches cheaper to implement than flip-flops Flip-flops are easier to design with than latches In this course, primarily use D flip-flops

D Latch vs. D Flip-Flop D CLK Q D CLK Q Latch transparent when clock is high D CLK D Q CLK Q “Samples” D on rising edge of clock

D Flip-Flop with Asynchronous Preset and Clear Bubble on the symbol means “active-low” When preset = 0, preset Q to 1 When preset = 1, do nothing When clear = 0, clear Q to 0 When clear = 1, do nothing “Preset” and “Clear” also known as “Set” and “Reset” respectively In this circuit, preset and clear are asynchronous Q changes immediately when preset or clear are active, regardless of clock (a) Circuit Preset D Q Q Clear (b) Graphical symbol

D Flip-Flop with Synchronous Clear CLK CLEAR Q (asynchronous clear) Q (synchronous clear) Asynchronous active-low clear: Q immediately clears to 0 Synchronous active-low clear: Q clears to 0 on rising-edge of clock

Sequential Logic Circuits some slides modified from: Brown and Vranesic, “Fundamentals of Digital Logic with VHDL Design, 2nd Edition” S. Dandamudi, “Fundamentals of Computer Organization and Design”

Register D(3) Q(3) D Q CLK D(2) Q(2) D Q CLK D(1) Q(1) D Q CLK D(0) Q(0) D Q CLK In typical nomenclature, a register is a name for a collection of flip-flops used to hold a bus (i.e. std_logic_vector)

Shift Register (a) Circuit (b) A sample sequence D Q Clk Sin t = 1 2 3 4 5 6 7 = (b) A sample sequence (a) Circuit SHIFT REGISTER Clk Sin Q

Parallel Access Shift Register clock SHIFT REGISTER serial_in 4 4 parallel_in output shift/load

Synchronous Up Counter enable load carry D0 Q0 D1 Q1 D2 Q2 D3 Q3 clock Enable (synchronous): when high enables the counter, when low counter holds its value Load (synchronous) : when load = 1, load the desired value into the counter Output carry: indicates when the counter “rolls over” D3 downto D0, Q3 downto Q0 is how to interpret MSB to LSB

Memories some slides modified from: Brown and Vranesic, “Fundamentals of Digital Logic with VHDL Design, 2nd Edition” S. Dandamudi, “Fundamentals of Computer Organization and Design”

Random Access Memory (RAM) More efficient than registers for storing large amounts of data Can read and write to RAM Addressable memory Can be synchronous (with clock) or asynchronous (no clock) SRAM dimensions are: (number of words) x (bits per word) SRAM Address is m bits, data is n bits 2m x n-bit RAM Example: address is 5 bits, data is 8 bits 32 x 8-bit RAM Write Data_in and address are stable Assert write signal (then de-assert) Read Address is stable Assert read signal Data_out is valid data in (n) data out (n) RAM address (m) write read

Random Access Memory (RAM)

Read Only Memory (ROM) Similar to RAM except read only Addressable memory Can be synchronous (with clock) or asynchronous (no clock) ROM data out (n) address (m) read

Read-Only Memory (ROM)