EECS150 - Digital Design Lecture 25 Shifters and Counters. Recap

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

EECS150 - Digital Design Lecture 16 Counters. Announcements

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 23 - FSMs & Counters

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

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

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

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

EECS150 - Digital Design Lecture 21 - Design Blocks

ECE 341. Lecture # 3

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

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

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

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

CHW 261: Logic Design

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

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

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

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

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

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

Philadelphia University Student Name: Student Number:

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Lecture 7: Logic design. Combinational logic circuits

Sample Test Paper - I

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

Synchronous Sequential Circuit Design. Digital Computer Design

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

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

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

CS61C : Machine Structures

Lecture 10: Synchronous Sequential Circuits Design

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

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

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

Digital Circuits ECS 371

For smaller NRE cost For faster time to market For smaller high-volume manufacturing cost For higher performance

Logic Design II (17.342) Spring Lecture Outline

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

CS61C : Machine Structures

Digital Fundamentals

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

EECS150 - Digital Design Lecture 22 - Arithmetic Blocks, Part 1

ELCT201: DIGITAL LOGIC DESIGN

Philadelphia University Student Name: Student Number:

CPE100: Digital Logic Design I

EECS150 - Digital Design Lecture 26 Faults and Error Correction. Recap

Chapter 7. Sequential Circuits Registers, Counters, RAM

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

CprE 281: Digital Logic

Chapter #7: Sequential Logic Case Studies Contemporary Logic Design

Fundamentals of Digital Design

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

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

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

DE58/DC58 LOGIC DESIGN DEC 2014

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

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

Adders, subtractors comparators, multipliers and other ALU elements

Design of Sequential Circuits

CPE100: Digital Logic Design I

Digital Fundamentals

Homework Assignment #1 Solutions EE 477 Spring 2017 Professor Parker

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

CSC 322: Computer Organization Lab

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

Models for representing sequential circuits

Fundamentals of Boolean Algebra

CSE370 HW6 Solutions (Winter 2010)

State and Finite State Machines

Sequential Logic Worksheet

Digital Electronics Sequential Logic

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

Digital Electronics Circuits 2017

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

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

Different encodings generate different circuits

PGT104 Digital Electronics. PGT104 Digital Electronics

ELEN Electronique numérique

Unit 7 Sequential Circuits (Flip Flop, Registers)

Design at the Register Transfer Level

Written exam with solutions IE Digital Design Friday 21/

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

Adders, subtractors comparators, multipliers and other ALU elements

04. What is the Mod number of the counter circuit shown below? Assume initially reset.

CHW 261: Logic Design

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

Digital Logic Appendix A

Logic and Computer Design Fundamentals. Chapter 8 Sequencing and Control

ELCT201: DIGITAL LOGIC DESIGN

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6201 DIGITAL PRINCIPLES AND SYSTEM DESIGN

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive

Time Allowed 3:00 hrs. April, pages

CSE140: Components and Design Techniques for Digital Systems. Midterm Information. Instructor: Mohsen Imani. Sources: TSR, Katz, Boriello & Vahid

Lecture 14: State Tables, Diagrams, Latches, and Flip Flop

Chapter 6. Synchronous Sequential Circuits

Shift Register Counters

Transcription:

EECS150 - Digital Design Lecture 25 Shifters and Counters Nov. 21, 2013 Prof. Ronald Fearing Electrical Engineering and Computer Sciences University of California, Berkeley (slides courtesy of Prof. John Wawrzynek) http://www-inst.eecs.berkeley.edu/~cs150 1 Carry Look-ahead Adder Recap Carry save adder a 0 b0 s 0 a 1 b1 s 1 c 1 p,g c 0 c 2 P,G c 0 a 2 b 2 s 2 a 3 b3 s 3 c 3 c 4 c 0 P,G a 4 b4 s 4 a 5 b5 s 5 c 5 c 6 c 0 c 8 a 6 b6 s 6 a 7 b7 s 7 c 7 constant coefficient multiplication 2 1

Recap: multiply using carry save addition Fast carrypropagate adder 3 Recap Constant Coefficient Multiplication (KCM) Binary multiplier: Y = 231*X = (2 7 + 2 6 + 2 5 + 2 2 + 2 1 +2 0 )*X CSD helps, but the multipliers are limited to shifts followed by adds. CSD multiplier: Y = 231*X = (2 8-2 5 + 2 3-2 0 )*X How about shift/add/shift/add? KCM multiplier: Y = 231*X = 7*33*X = (2 3-2 0 )*(2 5 + 2 0 )*X No simple algorithm exists to determine the optimal KCM representation. Most use exhaustive search method. Fall 2013 EECS150 - Lec22-CLAdder-mult Page 4 2

Outline Shifters Counters 5 Fixed Shifters / Rotators Logical Shift Rotate Arithmetic Shift 6 3

Variable Shifters / Rotators Example: X >> S, where S is unknown when we synthesize the circuit. Uses: shift instruction in processors (ARM includes a shift on every instruction), floating-point arithmetic, division/multiplication by powers of 2, etc. One way to build this is a simple shift-register: a) Load word, b) shift enable for S cycles, c) read word. Worst case delay O(N) not good for processor design. Can we do it in O(logN) time and fit it in one cycle? 7 Log Shifter / Rotator Log(N) stages, each shifts (or not) by a power of 2 places, S=[s 2 ;s 1 ;s 0 ]: Shift by N/2 Shift by 2 Shift by 1 8 4

LUT Mapping of Log shifter Efficient with 2to1 multiplexors, for instance, 3LUTs. Virtex5 has 6LUTs. Naturally makes 4to1 muxes: Reorganize shifter to use 4to1 muxes. Final stage uses F7 mux 9 Improved Shifter / Rotator How about this approach? Could it lead to even less delay? What is the delay of these big muxes? Look at transistor-level implementation? 10 5

Barrel Shifter Cost/delay? (don t forget the decoder) 11 Connection Matrix Generally useful structure: N 2 control points. What other interesting functions can it do? 12 6

Cross-bar Switch Nlog(N) control signals. Supports all interesting permutations All one-to-one and one-to-many connections. Commonly used in communication hardware (switches, routers). 13 Outline Shifters Counters 14 7

Counters Special sequential circuits (FSMs) that repeatedly sequence through a set of outputs. Examples: binary counter: 000, 001, 010, 011, 100, 101, 110, 111, 000, gray code counter: 000, 010, 110, 100, 101, 111, 011, 001, 000, 010, 110, one-hot counter: 0001, 0010, 0100, 1000, 0001, 0010, BCD counter: 0000, 0001, 0010,, 1001, 0000, 0001 pseudo-random sequence generators: 10, 01, 00, 11, 10, 01, 00,... Moore machines with ring structure in State Transition Diagram: S3 S0 S1 15 S2 What are they used for? 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 16MHz 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 with a decoder to generate a sequence of timed control signals. Consider using a counter when many FSM states with few branches. 16 8

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=1. The absence } of x means x=0. 17 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. q0 q1 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. q2 18 9

Controller using Counters Controller circuit implementation: Outputs: CE i = q 2 CE j = q 1 RST i = q 0 RST j = q 2 shifta = q 1 shiftb = q 2 shiftlow = q 2 shifthi = q 1 + q 2 reset = q 2 selectsum = q 1 19 How do we design counters? For binary counters (most common case) incrementer circuit would work: 1 + register In Verilog, a counter is specified as: x = x+1; This does not imply an adder An incrementer is simpler than an adder And a counter might be 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. 20 10

Synchronous Counters All outputs change with clock edge. Binary Counter Design: Start with 3-bit version and generalize: c b a c + b + a + 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 0 0 a + = a b + = a xor b c + = abc + a b c + ab c + a bc = a c + abc + b c = c(a +b ) + c (ab) = c(ab) + c (ab) = c xor ab 21 Synchronous Counters How do we extend to n-bits? Extrapolate c + : d + = d xor abc, e + = e xor abcd Has difficulty scaling (AND gate inputs grow with n) TC 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. 22 11

Synchronous Counters TC How does this one scale? Delay grows n Generation of TC signals very similar to generation of carry signals in adder. Parallel Prefix circuit reduces delay: log 2 n log 2 n 23 Up-Down Counter c b a c + b + a + 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 0 1 1 0 1 0 1 1 1 1 1 1 0 Down-count 24 12

Odd Counts Extra combinational logic can be added to terminate count before max value is reached: Example: count to 12 Alternative: 25 Ring Counters one-hot counters 0001, 0010, 0100, 1000, 0001, What are these good for? Self-starting version: 26 13

Johnson Counter 27 Asynchronous Ripple counters A 3 A 2 A 1 A 0 0000 0001 0010 0011 0100 time 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Usually forbidden in Synchronous Design Each stage is 2 of previous. Look at output waveforms: CLK A 0 A 1 A 2 A 3 Often called asynchronous counters. A T flip-flop is a toggle flip-flop. Flips state on cycles when T=1. 28 14

Summary Shifters Counters TC 29 15