Register Transfer Level (RTL) Design based on Vahid chap. 5

Similar documents
CSE140: Design of Sequential Logic

Review for Final Exam

ALU, Latches and Flip-Flops

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

CSE140: Digital Logic Design Registers and Counters

Stop Watch (System Controller Approach)

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

Adders, subtractors comparators, multipliers and other ALU elements

CSE140L: Components and Design Techniques for Digital Systems Lab. FSMs. Instructor: Mohsen Imani. Slides from Tajana Simunic Rosing

CSE 140 Midterm 3 version A Tajana Simunic Rosing Spring 2015

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

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

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

CSE 140 Midterm 2 Tajana Simunic Rosing. Spring 2008

Logic Design II (17.342) Spring Lecture Outline

Finite State Machine (FSM)

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

CprE 281: Digital Logic

Looking at a two binary digit sum shows what we need to extend addition to multiple binary digits.

Adders, subtractors comparators, multipliers and other ALU elements

From Sequential Circuits to Real Computers

From Sequential Circuits to Real Computers

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

Menu. Excitation Tables (Bonus Slide) EEL3701 EEL3701. Registers, RALU, Asynch, Synch

Chapter 8. Low-Power VLSI Design Methodology

Homework #4. CSE 140 Summer Session Instructor: Mohsen Imani. Only a subset of questions will be graded

State and Finite State Machines

14.1. Unit 14. State Machine Design

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

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

Latches. October 13, 2003 Latches 1

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

EEE2135 Digital Logic Design

EXPERIMENT Bit Binary Sequential Multiplier

Chapter 5: Register-Transfer Level (RTL) Design

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

Combinational vs. Sequential. Summary of Combinational Logic. Combinational device/circuit: any circuit built using the basic gates Expressed as

Synchronous Sequential Circuit Design

EECS150 - Digital Design Lecture 23 - FSMs & Counters

Design of Sequential Circuits

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

Figure 4.9 MARIE s Datapath

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

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

Models for representing sequential circuits

Lecture 7: Logic design. Combinational logic circuits

Digital Electronics. Part A

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

State & Finite State Machines

Design at the Register Transfer Level

CSE140: Components and Design Techniques for Digital Systems. Decoders, adders, comparators, multipliers and other ALU elements. Tajana Simunic Rosing

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

LECTURE 28. Analyzing digital computation at a very low level! The Latch Pipelined Datapath Control Signals Concept of State

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

ALU A functional unit

Table of Content. Chapter 11 Dedicated Microprocessors Page 1 of 25

Laboratory Exercise #11 A Simple Digital Combination Lock

Example: vending machine

Name: ID# a) Complete the state transition table for the aforementioned circuit

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

Lecture 14 Finite state machines

Register Transfer Level

Logic and Computer Design Fundamentals. Chapter 8 Sequencing and Control

NTE74HC299 Integrated Circuit TTL High Speed CMOS, 8 Bit Universal Shift Register with 3 State Output

Digital Integrated Circuits A Design Perspective. Arithmetic Circuits. Jan M. Rabaey Anantha Chandrakasan Borivoje Nikolic.

7 Multipliers and their VHDL representation

Chapter 7. Sequential Circuits Registers, Counters, RAM

COE 328 Final Exam 2008

Lecture 13: Sequential Circuits, FSM

Digital Integrated Circuits A Design Perspective. Arithmetic Circuits. Jan M. Rabaey Anantha Chandrakasan Borivoje Nikolic.

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

Mark Redekopp, All rights reserved. Lecture 1 Slides. Intro Number Systems Logic Functions

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

Lecture 13: Sequential Circuits, FSM

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

Motors Automation Energy Transmission & Distribution Coatings. Servo Drive SCA06 V1.5X. Addendum to the Programming Manual SCA06 V1.

Lecture 4 Modeling, Analysis and Simulation in Logic Design. Dr. Yinong Chen

Laboratory Exercise #8 Introduction to Sequential Logic

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

Computer Engineering Department. CC 311- Computer Architecture. Chapter 4. The Processor: Datapath and Control. Single Cycle

Introduction to Computer Engineering. CS/ECE 252, Fall 2012 Prof. Guri Sohi Computer Sciences Department University of Wisconsin Madison

Lecture 10: Synchronous Sequential Circuits Design

Sequential Logic. Handouts: Lecture Slides Spring /27/01. L06 Sequential Logic 1

VELA. Getting started with the VELA Versatile Laboratory Aid. Paul Vernon

FSM model for sequential circuits

ww.padasalai.net

Computers also need devices capable of Storing data and information Performing mathematical operations on such data

EECS150 - Digital Design Lecture 25 Shifters and Counters. Recap

Sequential Logic Worksheet

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

Sequential Circuit Design

64K x 18 Synchronous Burst RAM Pipelined Output

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

IMPERIAL COLLEGE OF SCIENCE, TECHNOLOGY AND MEDICINE UNIVERSITY OF LONDON DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING EXAMINATIONS 2005

EET 310 Flip-Flops 11/17/2011 1

Fundamentals of Boolean Algebra

CPE100: Digital Logic Design I

Fundamentals of Computer Systems

Transcription:

CSE4: Components and Design Techniques for Digital Systems Register Transfer Level (RTL) Design based on Vahid chap. 5 Tajana Simunic Rosing

RTL Design Method

RTL Design example: Laser-Based Distance Measurer T (in seconds) laser sensor D 2D = T sec * 3* m/sec Object of interest Laser-based distance measurement pulse laser, measure time T to sense reflection Laser light travels at speed of light, 3* m/sec Distance is thus D = T sec * 3* m/sec / 2

Step 4: Deriving the Controller s FSM B f r om but t on C o n t r oller D r eg_clr L t o laser f r om sensor S Inputs: B, S ( bit each) Outputs: L (bit), D (6 bits) Local Registers: Dctr (6 bits) D r eg_ld B S D c tr_clr D a tap a th t o displ a y D 6 D c tr_c n t 3 H M z Clock FSM has same structure as highlevel state machine Inputs/outputs all bits now Replace data operations by bit operations using datapath S S S2 S3 B S L = Dctr = L = L= D = Dctr = Dctr + Inputs: B, S Outputs: L, Dreg_clr, Dreg_ld, Dctr_clr, Dctr_cnt B S B S S S2 S3 L = L = Dreg_clr = L = Dreg_clr = L = Dreg_ld = Dreg_ld = Dctr_clr = Dctr_clr = Dctr_cnt = Dctr_cnt = (clear count) (laser on) Dreg_clr = Dreg_ld = Dctr_clr = Dctr_cnt = (laser off) (clear D reg) Dreg_clr = Dreg_ld = Dctr_clr = Dctr_cnt = (laser off) (count up) S S4 S4 D = Dctr / 2 (calculate D) L = Dreg_clr = Dreg_ld = Dctr_clr = Dctr_cnt = (load D reg with Dctr/2) (stop counting)

RTL Design Method Example Soda dispenser c: bit input, when coin deposited a: -bit input having value of deposited coin s: -bit input having cost of a soda d: bit output, processor sets to when total value of deposited coins equals or exceeds cost of a soda c d 5 s a Soda dispenser processor 25 25 tot: 5 25

Step : Capture High-Level State Machine Declare local register tot Init state: Set d=, tot= Wait state: wait for coin If see coin, go to Add state Add state: Update total value: tot = tot + a Remember, a is present coin s value Go back to Wait state In Wait state, if tot >= s, go to Disp(ense) state Disp state: Set d= (dispense soda) Return to Init state Not an FSM because: Multi-bit (data) inputs a and s Local register tot Data operations tot=, tot<s, tot=tot+a. Useful high-level state machine: Data types beyond just bits Local registers Arithmetic equations/expressions Inputs: c (bit), a ( bits), s ( bits) Outputs: d (bit) Local registers: tot ( bits) I nit d= tot= c d Wait c s a Soda dispenser processor Add c *(tot<s) c *(tot<s) tot=tot+a Disp d=

Step 2: Create Datapath I nputs : c (bit), a( bits), s ( bits) O utputs : d (bit) L ocal r e g is t ers : t ot ( bits) Need tot register Need -bit comparator to compare s and a Need -bit adder to perform tot = tot + a Connect everything Create control input/outputs tot_ld tot_clr tot_lt_s s ld clr Datapath -bit < tot -bit adder a I nit d= t ot= W ait c ( t ot<s) c A dd t ot= t ot+a c *( t ot<s) Disp d=

Step 3: Connect Datapath to a Controller s a Controller s inputs External input c (coin detected) Input from datapath comparator s c output, which we named tot_lt_s Controller s outputs External output d (dispense soda) Outputs to datapath to load and clear the tot register d Controller tot_ld tot_clr tot_lt_s s a Datapath t ot_ld t ot_clr t ot_lt_s D a tap a th ld clr -bit < t ot -bit adder

Controller Datapath Same states and arcs as high-level state machine But set/read datapath control signals for all datapath operations and conditions Step 4 Derive the Controller s FSM c d Inputs: : c, tot_lt_s (bit) Outputs: d, tot_ld, tot_clr (bit) I nit d= tot_clr= Controller W ait c d c Add tot_ld= c * tot_lt_s Disp d= tot_ld tot_clr tot_lt_s tot_ld s a tot_clr tot_lt_s tot_ld tot_clr tot_lt_s s ld clr tpt -bit < Datapath -bit adder a

Disp Add Wait Init Completing the Design Implement the FSM as a state register and logic s s c tot_lt_s n n d tot_ld tot_clr c d Inputs: : c, tot_lt_s (bit) Outputs: d, tot_ld, tot_clr (bit) I nit d= tot_clr= W ait c Add tot_ld= c * tot_lt_s Disp tot_ld tot_clr tot_lt_s Controller d=

RTL Design Example: Bus Interface Example: Bus interface Master processor can read register from any peripheral Each register has unique 4-bit address Assume register/periph. Sets rd=, A=address Appropriate peripheral places register data on 32-bit D lines Periph s address provided on Faddr inputs (maybe from DIP switches, or another register) Master processor 32 r d D 4 A Per Per Per5 to/from processor bus r d D A Bus interface Q Main part Peripheral 32 4 32 Faddr 4

Step : Create FSM Inputs: rd (bit); Q (32 bits); A, Faddr (4 bits) Outputs: D (32 bits) Local register: Q (32 bits) rd ((A = Faddr) and rd ) WaitMyAddress (A = Faddr) D = Z and rd Q = Q SendData D = Q rd Step : Create high-level state machine State WaitMyAddress Output nothing ( Z ) on D, store peripheral s register value Q into local register Q Wait until this peripheral s address is seen (A=Faddr) and rd= State SendData Output Q onto D, wait for rd= (meaning main processor is done reading the D lines)

Step 2: Create a datapath Inputs: rd (bit); Q (32 bits); A, Faddr (4 bits) Outputs: D (32 bits) Local register: Q (32 bits) rd WaitMyAddress D = Z Q = Q ((A = Faddr) and rd) (A = Faddr) and rd SendData D = Q rd Q_ld A_eq_ F addr A F addr Q 4 4 32 ld Q = (4-bit) 32 Step 2: Create a datapath (a) Datapath inputs/outputs (b) Instantiate declared registers (c) Instantiate datapath components and connections D_en Bus interface Datapath 32 D

Step 3: Connect datapath to controller Step 4: Derive controller s FSM Inputs: rd (bit); Q (32 bits); A, Faddr (4 bits) Outputs: D (32 bits) Local register: Q (32 bits) rd Inputs: rd, A_eq_Faddr ((A = (bit) Faddr) Outputs: Q_ld, D_en and (bit) rd) rd WaitMyAddress r d SendData D = Z Q = Q W ait M y A dd r ess D_en = Q_ld = (A = Faddr) and ( A_eq_ rd F addr and r d) A_eq_ F addr and r d D = Q S endd a ta rd D_en = Q_ld = r d Q_ld A_eq_Faddr D_en A Faddr Q 4 4 32 = (4-bit) ld Q 32 32 Bus interface Datapath D

RTL Example: Video Compression Only difference: ball moving Frame Frame 2 Frame Frame 2 Digitized frame Digitized frame 2 Digitized frame Difference of 2 from Mbyte ( a ) Mbyte Mbyte Video is a series of frames (e.g., 3 per second) Most frames similar to previous frame Compression idea: just send difference from previous frame ( b ). Mbyte Just send difference

Video Compression Sum of Absolute Differences compare Frame Frame 2 Each is a pixel, assume represented as byte (actually, a color picture might have 3 bytes per pixel, for intensity of red, green, and blue components of pixel) If two frames are similar just send a difference instead Compare corresponding 6x6 blocks Treat 6x6 block as 256-byte array Compute the absolute value of the difference of each array item Sum the differences if above a threshold, send a complete frame for second frame Else send the difference

Video Compression Sum of Absolute Differences 256-byte array A SAD 256-byte array B sad integer go!(i<256) Want fast sum-of-absolute-differences (SAD) component When go=, sums the differences of element pairs in arrays A and B, outputs that sum

Step : High-level FSM A B SAD sad Inputs: A, B (256 byte memory); go (bit) Outputs: sad (32 bits) Local registers: sum, sad_reg (32 bits); i (9 bits) go S: wait for go S: initialize sum and index S2: check if done (i>=256) S3: add difference to sum, increment index S4: done, write to output sad_reg (i<256) S S S2 S3 S4 go!go sum = i = i<256 sum=sum+abs(a[i]-b[i]) i=i+ sad_ r eg = sum a

Step 2: Create datapath Inputs: A, B (256 byte memory); go (bit) Outputs: sad (32 bits) Local registers: sum, sad_reg (32 bits); i (9 bits) (i<256) S S S2 S3!(i<256) (i_lt_256) S4 go!go sum = i = i<256 sum=sum+abs(a[i]-b[i]) i=i+ sad_ reg=sum i_lt_256 <256 i_inc i_clr sum_ld sum_clr sad_reg_ld sad_reg Datapath 32 AB_addr A_data B_data 9 i sum 32 abs 32 32 + sad

Step 3: Connect to controller Step 4: Replace high-level state machine by FSM go AB_ r d AB_addr A_data B_data? S go go sum= sum_clr= S i= i_clr= S2 i<256 i_lt_256 S3 sum=sum+abs(a[i]-b[i]) sum_ld=; AB_rd= i=i+ i_inc= S4 sad_reg=sum sad_reg_ld= Controller i_lt_256 <256 i_inc i_clr sum_ld sum_clr sad_reg_ld 9 i sum 32 abs 32 32 sad_reg 32 sad +

Data Dominated RTL Design Example: FIR Filter FIR filter Finite Impulse Response Simply a configurable weighted sum of past input values y(t) = c*x(t) + c*x(t-) + c2*x(t-2) Above known as 3 tap Tens of taps more common Very general filter User sets the constants (c, c, c2) to define specific filter X Y 2 digital filter 2 clk y(t) = c*x(t) + c*x(t-) + c2*x(t-2) RTL design Step : Create high-level state machine there is none Go straight to step 2

Step 2: Create datapath Begin by creating chain of xt registers to hold past values of X Instantiate registers for c, c, c2 Instantiate multipliers to compute c*x values Instantiate adders Add circuitry to allow loading of particular c register CL Ca Ca C e 3 2x4 2 3-tap FIR filter X clk 2 digital filter y(t) = c*x(t) + c*x(t-) + c2*x(t-2) 2 Y Step 3 & 4: Connect to controller, Create FSM No controller X clk x(t) c x(t-) c x(t-2) c2 xt xt xt2 * * + + * yreg Y

Comparing the FIR circuit to a software implementation Circuit Adder has 2-gate delay, multiplier has 2-gate delay Longest past goes through one multiplier and two adders 2 + 2 + 2 = 24-gate delay -tap filter, would have about a 34-gate delay: multiplier and 7 adders on longest path Software -tap filter: multiplications, additions. If 2 instructions per multiplication, 2 per addition. Say -gate delay per instruction. (*2 + *2)* = 4 gate delays CL Ca Ca C X clk e 3 2x4 2 x(t) y(t) = c*x(t) + c*x(t-) + c2*x(t-2) 3-tap FIR filter x(t-) x(t-2) c c c2 xt xt xt2 * * + + * yreg Y

Critical path analysis in more complex designs s a Combinational logic d c tot_ld t ot_clr ld clr tot tot_lt_s n ( c ) n tot_lt_s -bit < -bit adder clk s s State register Datapath ( b ) ( a )

Simple data encryption/decryption device B =, set offset O = I [:3] B= e=: encrypt mode: output J = I+O B= e=; decrypt mode: get I = J - O

Reaction timer On reset (rst) reaction timer waits for sec before turning on light (len=) Measures the length of time rtime (ms) until user presses button B If reaction slower than 2sec, output slow= and rtime=2

Fast sum of 6 32-bit registers

Hot water detector Output warning when average temp over the past 4 samples exceeds a user defined value; clr disables the system Inputs (32 bit): CT current temp; WT warning temp Output : W high if hot temperature; stays on until clr pressed again

Design from C code

Summary Datapath and Control Design RTL Design Steps. Define the high level state machine 2. Create datapath 3. Connect datapath with control 4. Implement the FSM Timing analysis critical path in more complex circuits Watch out for all possible long paths (e.g. datapath to FSM, FSM control logic, datapath logic etc)