DOC PREVIEW
UA ECE 274A - RTL Design

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1ECE 274 - Digital LogicLecture 14 Lecture 14 – RTL Design Four Step RTL Design Method2RTL Design Method5.23Step 1: Create a High-Level State Machine Let’s consider each step of the RTL design process in more detail Step 1 Soda dispenser example Not an FSM because: Multi-bit (data) inputs aand s Local register tot Data operations tot=0, tot<s, tot=tot+a. Useful high-level state machine: Data types beyond just bits Local registers Arithmetic equations/expressionsInputs:c (bit),a (8 bits), s (8 bits)Outputs: d (bit)Localregisters:tot (8 bits)WaitDispInitd=0tot=0c’(tot<s)d=1ctot=tot+ac’(tot<s)’4Step 1 Example: Laser-Based Distance Measurer Example of how to create a high-level state machine to describe desired processor behavior Laser-based distance measurement – pulse laser, measure time T to sense reflection Laser light travels at speed of light, 3*108m/sec  Distance is thus D = T sec * 3*108m/sec / 2Object ofinterestD2D =T sec∗3⋅108m/secsensorlaserT (in seconds)5Step 1 Example: Laser-Based Distance Measurer Laser-based Distance Measurer Used in adaptive cruise control systems for automobiles Maintain particular “safe” distance between car in front May need to decrease cruise speed Need to measure the distance to the car in front6Step 1 Example: Laser-Based Distance Measurer Inputs/outputs B: bit input, from button to begin measurement L: bit output, activates laser S: bit input, senses laser reflection L: 16-bit output, displays computed distance sensorlaserT (in seconds)Laser-baseddistancemeasurer16from buttonto displaySLDBto laserfrom sensor7Step 1 Example: Laser-Based Distance Measurer Step 1: Create high-level state machine Begin by declaring inputs and outputs Create initial state, name it S0 Initialize laser to off (L=0) Initialize displayed distance to 0 (D=0)Laser-baseddistancemeasurer16from buttonto displaySLDBto laserfrom sensorInputs :B, S(1 bit each)Outputs : L (bit), D (16 bits)S0?L = 0 (laser off )D = 0 (distance = 0)a8Step 1 Example: Laser-Based Distance Measurer Add another state, call S1, that waits for a button press B’ – stay in S1, keep waiting B – go to a new state S2Laser-baseddistancemeasurer16from buttonto displaySLDBto laserfrom sensorInputs: B, S(1 bit each)Outputs:L (bit), D (16 bits)S0L = 0D = 0S1?B‘(button not pressed)B(buttonpressed)S0Q: What should S2 do? A: Turn on the laseraa9Step 1 Example: Laser-Based Distance Measurer Add a state S2 that turns on the laser (L=1) Then turn off laser (L=0) in a state S3Laser-baseddistancemeasurer16from buttonto displaySLDBto laserfrom sensorInputs:B, S(1 bit each)Outputs:L (bit), D (16 bits)S0S1 S2L = 0D = 0L = 1(laser on)S3L = 0(laser off)B‘BaQ: What do next? A: Start timer, wait to sense reflectiona10Step 1 Example: Laser-Based Distance Measurer Stay in S3 until sense reflection (S) To measure time, count cycles for which we are in S3 To count, declare local register Dctr Increment Dctr each cycle in S3 Initialize Dctr to 0 in S1. S2 would have been O.K. tooLaser-baseddistancemeasurer16from buttonto displaySLDBto laserfrom sensorInputs:B, S(1 bit each) Outputs:L (bit), D (16 bits)LocalRegisters:Dctr (16 bits)S0S1 S2 S3L = 0D = 0L = 1 L = 0Dctr = Dctr + 1(count cycles)Dctr = 0(resetcyclecount)B‘BS'(noreflection)S(reflection)?a11Step 1 Example: Laser-Based Distance Measurer Once reflection detected (S), go to new state S4 Calculate distance  Assuming clock frequency is 3x108, Dctr holds number of meters, so D=Dctr/2 After S4, go back to S1 to wait for button againLaser-baseddistancemeasurer16from buttonto displaySLDBto laserfrom sensorInputs: B, S(1 bit each) Outputs: L (bit), D (16 bits)LocalRegisters: Dctr (16 bits)S0S1 S2 S3L = 0D = 0L = 1 L=0Dctr = Dctr+1Dctr = 0B‘S‘BSD =Dctr/2(calculate D)S4a12Step 2: Create a Datapath Datapath must Implement data storage Implement data computations Look at high-level state machine, do three substeps (a) Make data inputs/outputs be datapathinputs/outputs (b) Instantiate declared registers into the datapath (also instantiate a register for each data output) (c) Examine every state and transition, and instantiate datapath components and connections to implement any data computationsInstantiate: to introduce a new component into a design.13Step 2 Example: Laser-Based Distance Measurer(a) Make data inputs/outputs be datapathinputs/outputs(b) Instantiate declared registers into the datapath(also instantiate a register for each data output)(c) Examine every state and transition, and instantiate datapathcomponents and connections to implement any data computationsDatapathDreg_clrDctr_clrDctr_cntDreg_ldInputs: B, S(1 bit each) Outputs:L (bit), D (16 bits)LocalRegisters:Dctr (16 bits)S0S1 S2 S3L = 0D = 0L = 1 L=0Dct r = Dctr+ 1Dctr = 0B‘S‘BSD =Dctr/2(calculate D)S4loadQIDreg: 16-bitregisterQDctr: 16-bitup-counter16Dclearclearcounta14Step 2 Example: Laser-Based Distance Measurer(c) (continued) Examine every state and transition, and instantiate datapathcomponents and connections to implement any data computationsInputs: B, S(1 bit each) Outputs:L (bit), D (16 bits)LocalRegisters:Dctr (16 bits)S0S1 S2 S3L = 0D = 0L = 1 L=0Dct r = Dctr+ 1Dctr = 0B‘S‘BSD =Dctr/2(calculate D)S4clearcountclearloadQQIDctr: 16-bitup-counterDreg: 16-bitregister16DDatapathDreg_clrDctr_clrDctr_cntDreg_ld1616>>1a15Step 2 Example Showing Mux Use Introduce mux when one component input can come from more than one sourceT0T1R = E + FR = R + GE, F, G, R (16 bits)Lo c a lr eg i st e r s:(a)EFGAB+Radd_A_s0add_B_s02⋅1 2⋅1(d)××aEFGAB+R(b)EFGAB+R(c)16Step 3: Connecting the Datapath to a Controller Laser-based distance measurer example Easy – just connect all control signals between controller and datapath300 MHz ClockDBLS16to displayfrom but tonControllerto laserfrom sensorDatapathDreg_clrDreg_ldDctr_clrDctr_cntclearcountclearloadQQIDctr: 16-bitup-counterDreg: 16-bitregister16DDatapathDreg_clrDct r_ clrDctr_ cntDreg_ld17Step 4: Deriving the Controller’s FSM FSM has same structure as high-level state machine Inputs/outputs all bits now Replace data operations by bit operations using datapath300 MHz ClockDBLS16to disp layfrom buttonCont r o l l e rto lase rfrom sensorDatapathDreg_clrDreg_ldDct r _ c l rDct r _ cntInputs: B, SOutputs: L, Dreg_clr, Dreg_ld,Dctr_clr,Dctr_cntDreg_clr = 1Dreg_ld =


View Full Document

UA ECE 274A - RTL Design

Download RTL Design
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view RTL Design and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view RTL Design 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?