EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

Similar documents
EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 17 - Sequential Circuits 3 (Counters)

EECS150 - Digital Design Lecture 23 - FSMs & Counters

EECS150 - Digital Design Lecture 16 Counters. Announcements

EECS150 - Digital Design Lecture 25 Shifters and Counters. Recap

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec09 Counters Outline.

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec 09 Counters Outline.

EECS150 - Digital Design Lecture 24 - Arithmetic Blocks, Part 2 + Shifters

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

Professor Fearing EECS150/Problem Set Solution Fall 2013 Due at 10 am, Thu. Oct. 3 (homework box under stairs)

ECE 341. Lecture # 3

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

CHW 261: Logic Design

Models for representing sequential circuits

Example: vending machine

EECS150 - Digital Design Lecture 23 - FFs revisited, FIFOs, ECCs, LSFRs. Cross-coupled NOR gates

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Design at the Register Transfer Level

LOGIC CIRCUITS. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

Introduction EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 6: Sequential Logic 3 Registers & Counters 5/9/2010

Lecture 10: Synchronous Sequential Circuits Design

EECS150 - Digital Design Lecture 21 - Design Blocks

Sample Test Paper - I

Logic Design II (17.342) Spring Lecture Outline

Chapter 7. Sequential Circuits Registers, Counters, RAM

Digital Fundamentals

課程名稱 : 數位邏輯設計 P-1/ /6/11

Digital Circuits ECS 371

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

Counters. We ll look at different kinds of counters and discuss how to build them

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Logic and Computer Design Fundamentals. Chapter 8 Sequencing and Control

Chapter 6. Synchronous Sequential Circuits

10/12/2016. An FSM with No Inputs Moves from State to State. ECE 120: Introduction to Computing. Eventually, the States Form a Loop

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

EECS150 - Digital Design Lecture 15 SIFT2 + FSM. Recap and Outline

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

CprE 281: Digital Logic

EXPERIMENT Bit Binary Sequential Multiplier

ELCT201: DIGITAL LOGIC DESIGN

Design of Sequential Circuits

Synchronous Sequential Circuit Design. Digital Computer Design

Digital Electronics Circuits 2017


COE 202: Digital Logic Design Sequential Circuits Part 4. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

PGT104 Digital Electronics. PGT104 Digital Electronics

Philadelphia University Student Name: Student Number:

FSM model for sequential circuits

Philadelphia University Student Name: Student Number:

Roger L. Tokheim. Chapter 8 Counters Glencoe/McGraw-Hill

Present Next state Output state w = 0 w = 1 z A A B 0 B A C 0 C A C 1

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

ECE 448 Lecture 6. Finite State Machines. State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code. George Mason University

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Lecture 7: Logic design. Combinational logic circuits

Unit 7 Sequential Circuits (Flip Flop, Registers)

Digital Fundamentals

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

CPE100: Digital Logic Design I

Preparation of Examination Questions and Exercises: Solutions

Fundamentals of Digital Design

CSC 322: Computer Organization Lab

Appendix A: Digital Logic. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V. Heuring

Fundamentals of Boolean Algebra

Digital Logic Appendix A

WORKBOOK. Try Yourself Questions. Electrical Engineering Digital Electronics. Detailed Explanations of

Decoding A Counter. svbitec.wordpress.com 1

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

DE58/DC58 LOGIC DESIGN DEC 2014

SIR C.R.REDDY COLLEGE OF ENGINEERING ELURU DIGITAL INTEGRATED CIRCUITS (DIC) LABORATORY MANUAL III / IV B.E. (ECE) : I - SEMESTER

EE 209 Logic Cumulative Exam Name:

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Reg. No. Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER Second Semester. Computer Science and Engineering

Design of Datapath Controllers

Digital Electronics Sequential Logic

CPE100: Digital Logic Design I

7 Multipliers and their VHDL representation

(Boolean Algebra, combinational circuits) (Binary Codes and -arithmetics)

Adders allow computers to add numbers 2-bit ripple-carry adder

Analysis of clocked sequential networks

S.Y. Diploma : Sem. III [DE/ED/EI/EJ/EN/ET/EV/EX/IC/IE/IS/IU/MU] Principles of Digital Techniques

ELEN Electronique numérique

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

Chapter #7: Sequential Logic Case Studies Contemporary Logic Design

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

CHW 261: Logic Design

Shift Register Counters

Finite State Machine (FSM)

Spiral 2-1. Datapath Components: Counters Adders Design Example: Crosswalk Controller

( c) Give logic symbol, Truth table and circuit diagram for a clocked SR flip-flop. A combinational circuit is defined by the function

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

CprE 281: Digital Logic

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

CS221: Digital Design. Dr. A. Sahu. Indian Institute of Technology Guwahati

Transcription:

EECS50 - Digital Design Lecture - Shifters & Counters February 24, 2003 John Wawrzynek Spring 2005 EECS50 - Lec-counters Page Register Summary All registers (this semester) based on Flip-flops: q 3 q 2 q q 0 reset D Q D Q D Q D Q S R S R S R S R 0 0 0 0 d 3 d 2 d d 0 Load-enable is a popular option: q 3 q 2 q q 0 reset load D Q D Q D Q D Q S R S R S R S R 0 0 0 0 0 0 0 0 Xilinx flip-flops employ a clock enable (CE) for same purpose. d 3 d 2 d d 0 Spring 2005 EECS50 - Lec-counters Page 2

Plain shift register: Shift Registers Shifter with shift-enable input Verilog: assign OUT = Q[0]; always @ (posedge clk) if (shiftenable) Q <= {IN; Q[3:]}; else Q <= Q; FPGA FFs have clock-enable (CE), therefore muxes are not needed. Spring 2005 EECS50 - Lec-counters Page 3 Parallel load shift register: Shift-registers Parallel-to-serial converter Also, works as Serial-to-parallel converter, if q values are connected out. Spring 2005 EECS50 - Lec-counters Page 4 2

Universal Shift-register Spring 2005 EECS50 - Lec-counters Page 5 Counters Special sequential circuits (FSMs) that repeatedly sequence through a set of outputs. Examples: binary counter: 000, 00, 00, 0, 00, 0, 0,, 000, 00, gray code counter: 000, 00, 0, 00, 0,, 0, 00, 000, 00, 0, one-hot counter: 000, 000, 000, 000, 000, 000, BCD counter: 0000, 000, 000,, 00, 0000, 000 pseudo-random sequence generators: 0, 0, 00,, 0, 0, 00,... Moore machines with ring structure in State Transition Diagram: S3 S0 S2 S Spring 2005 EECS50 - Lec-counters Page 6 3

What are they used? Counters are commonly used in hardware designs because most (if not all) computations that we put into hardware include iteration (looping). Examples: Shift-and-add multiplication scheme. Bit serial communication circuits (must count one words worth of serial bits. Other uses for counter: Clock divider circuits 6MHz 64 Systematic inspection of data-structures Example: Network packet parser/filter control. Counters simplify controller design by: providing a specific number of cycles of action, sometimes used in with a decoder to generate a sequence of control signals. Think about using a counter when many FSM states with few branches. Spring 2005 EECS50 - Lec-counters Page 7 A Standard High-level Organization Controller accepts external and control input, generates control and external output and sequences the movement of data in the datapath. Datapath is responsible for data manipulation. Usually includes a limited amount of storage. Memory optional block used for long term storage of data structures. Standard model for CPUs, micro-controllers, many other digital sub-systems. (Remember MIPS processor from 6C) Controllers are the most common use of FSMs. Spring 2005 EECS50 - Lec-counters Page 8 4

Multiplication a 3 a 2 a a 0 Multiplicand b 3 b 2 b b 0 Multiplier X a 3 b 0 a 2 b 0 a b 0 a 0 b 0 a 3 b a 2 b a b a 0 b Partial a 3 b 2 a 2 b 2 a b 2 a 0 b 2 products a 3 b 3 a 2 b 3 a b 3 a 0 b 3... a b 0 +a 0 b a 0 b 0 Product Many different circuits exist for multiplication. Each one has a different balance between speed (performance) and amount of logic (cost). Spring 2005 EECS50 - Lec-counters Page 9 Controller using Counters Example, Bit-serial multiplier (n 2 cycles, one bit of result per n cycles): Control Algorithm: repeat n cycles { // outer (i) loop repeat n cycles{ // inner (j) loop shifta, selectsum, shifthi } Note: The occurrence of a control shiftb, shifthi, shiftlow, reset signal x means x=. The absence } of x means x=0. Spring 2005 EECS50 - Lec-counters Page 0 5

Controller using Counters State Transition Diagram: Assume presence of two binary counters. An i counter for the outer loop and j counter for inner loop. START IDLE CE i,ce j RST i START CE CLK RST counter TC TC is asserted when the counter reaches it maximum count value. CE is count enable. The counter increments its value on the rising edge of the clock if CE is asserted. TC i OUTER <outer contol> CE i,ce j RST j TC i INNER <inner contol> CE i,ce j TC j TC j Spring 2005 EECS50 - Lec-counters Page Controller using Counters Controller circuit implementation: Outputs: CE i = q 2 START IDLE S R q 0 CE j = q RST i = q 0 RST j = q 2 TCi TCj INNER S R OUTER S R q q 2 Global reset shifta = q shiftb = q 2 shiftlow = q 2 shifthi = q + q 2 reset = q 2 selectsum = q Spring 2005 EECS50 - Lec-counters Page 2 6

How do we design counters? For binary counters (most common case) incrementer circuit would work: + register In Verilog, a counter is specified as: x = x+; This does not imply an adder An incrementer is simpler than an adder And a counter is simpler yet. In general, the best way to understand counter design is to think of them as FSMs, and follow general procedure, however some special cases can be optimized. Spring 2005 EECS50 - Lec-counters Page 3 Binary Counter Design: Start with 3-bit version and generalize: Synchronous Counters All outputs change with clock edge. c b a c + b + a + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a + b + c + a + = a b + = a b cb a 00 0 0 0 0 0 0 0 c + = a c + abc + b c = c(a +b ) + c (ab) = c(ab) + c (ab) = c ab a b c Spring 2005 EECS50 - Lec-counters Page 4 7

Synchronous Counters How do we extend to n-bits? Extrapolate c + : d + = d abc, e + = e abcd a + b + c + d + a b c Has difficulty scaling (AND gate inputs grow with n) d CE a + b + c + d + TC a b c d CE is count enable, allows external control of counting, TC is terminal count, is asserted on highest value, allows cascading, external sensing of occurrence of max value. Spring 2005 EECS50 - Lec-counters Page 5 Synchronous Counters CE a + b + c + d + TC How does this one scale? Delay grows α n a b c Generation of TC signals very similar to generation of carry signals in adder. Parallel Prefix circuit reduces delay: d log 2 n log 2 n Spring 2005 EECS50 - Lec-counters Page 6 8

Up-Down Counter c b a c + b + a + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Down-count Spring 2005 EECS50 - Lec-counters Page 7 Odd Counts Extra combinational logic can be added to terminate count before max value is reached: Example: count to 2 Alternative: load 4 4-bit binary counter TC Spring 2005 EECS50 - Lec-counters Page 8 9

Ring Counters one-hot counters 000, 000, 000, 000, 000, q 3 q 2 q What are these good for? q 0 reset D Q D Q D Q D Q S R S R S R S R 0 0 0 0 Self-starting version: q 3 q 2 q q 0 D Q D Q D Q D Q Spring 2005 EECS50 - Lec-counters Page 9 Johnson Counter Spring 2005 EECS50 - Lec-counters Page 20 0

Ripple counters A 3 A 2 A A 0 0000 000 000 00 000 00 00 0 000 00 00 0 00 0 0 time Each stage is 2 of previous. Look at output waveforms: CLK A 0 A A 2 A 3 Often called asynchronous counters. A T flip-flop is a toggle flip-flop. Flips it state on cycles when T=. Spring 2005 EECS50 - Lec-counters Page 2