Chapter 5: Register-Transfer Level (RTL) Design Transzfer .

2y ago
33 Views
2 Downloads
1.74 MB
89 Pages
Last View : 7d ago
Last Download : 3m ago
Upload by : Randy Pettway
Transcription

Digital DesignChapter 5:Register-Transfer Level(RTL) DesignRegiszter-Transzfer Szintű TervezésSlides to accompany the textbook Digital Design, with RTL Design, VHDL,and Verilog, 2nd Edition,by Frank Vahid, John Wiley and Sons Publishers, 2010.http://www.ddvahid.comCopyright 2010 Frank VahidInstructors of courses requiring Vahid's Digital Design textbook (published by John Wiley and Sons) have permission to modify and use these slides for customary course-related activities,subject to keeping this copyright notice in place and unmodified. These slides may be posted as unanimated pdf versions on publicly-accessible course websites. PowerPoint source (or pdfDigital2ewith animations)may Designnot be postedto publicly-accessible websites, but may be posted for students on internal protected sites or distributed directly to students by other electronic means.Copyright 20101Instructors may make printouts of the slides available to students for a reasonable photocopying charge, without incurring royalties. Any other use requires explicit permission. InstructorsFrank Vahidmay obtain PowerPointsource or obtain special use permissions from Wiley – see http://www.ddvahid.com for information.

5.1 Chpt 2– Capture Comb. behavior: Equations, truth tables– Convert to circuit: AND OR NOT Comb. logic Chpt 3Higher levelsBevezetésRegistertransferlevel (RTL)Logic level– Capture sequential behavior: FSMs– Convert to circuit: Register Comb. logic Controller Chpt 4– Datapath components, simple datapathsTransistor levelLevels of digitaldesign abstraction Chpt 5– Capture behavior: High-level state machine– Convert to circuit: Controller Datapath Processor– Known as “RTL” (register-transfer level) designDigital Design 2eCopyright 2010Frank VahidProcessors: Programmable(microprocessor) Custom2Note: Slides with animation are denoted with a small red "a" near the animated items

Y diagramVISELKEDÉSITARTOMÁNYRendszer szintSTRUKTURÁLISTARTOMÁNYAlgoritmus szintRT-szintRendszer leírásCPU, memóriaAlgoritmusProcesszor, alrendszerLogikai szintRegiszterátviteli szint.ALU, regiszter, MUXÁramköriLogikai egyenletekKapuáramkör, flip-flopAlgoritmusszint szTranzisztorDifferenciál egyenletekSokszög/sokszög pCPU, memóriaDigital Design 2eCopyright 2010Frank VahidFIZIKAI/GEOMETRIAITARTOMÁNY

5.2Komplex Állapotgépek (HLSMs) High Level State Machines - HLSM A rendszer viselkedése bonyolultés komplex logikai egyenletekkel,igazságtáblákkal vagy állapotgráfokkal írható le (FSM) Pl: Ital automata– c: 1 bites bemenet: pénzérmeérzékelő– a: 8-bites bemenet: érem értéke– s: 8-bites bemenet: ital ára– d: 1 bites kimenet, 1 amikor abedobott érmék összege mint azital ára FSM:– Nem kezel 8-bites be/kimeneteket– Nem tárol köztes eredményt– Nem végez aritmetikai műveletetDigital Design 2eCopyright 2010Frank VahidscdSodadispenserprocessors0 1 0 1 0cd0 1 0a50a 2525Soda tot:tot:dispenser25processor 50a4

HLSMss8 A komplex állapotgépek(HLSM) kibővítik az FSMleírását:– Több bites ki/bemenetekkel– Helyi tárolással– Arithmetic operations Jelölések– Számok:a Egy bites: '0' (aposztrof) Egész: 0 Több bites: “0000” (idéző jel)– for equal, : for assignment– Több bites kimeneteknélkötelezően a helyi tároló regiszter– // v. -- megjegyzésDigital Design 2eCopyright 2010Frank Vahidacd8SodadispenserprocessorInputs: c (bit), a (8 bits), s (8 bits)Outputs: d (bit) // '1' dispenses sodaLocal storage: tot (8 bits)cInitWaitd: '0'tot: 0c’*(tot s)’tot: tot ac'*(tot s)DispSodaDispenserd: '1'5

Példa: Ciklus számláló P A ciklusok számlálása (binárisan)mindaddig míg m 1 HLSM viselkedésének leírásamclkCountHighPreg32– Preg - regiszteres kimenet aktuális érték tárolásaCountHighBE:m (bit)KI:P (32 bit)Tárolás: PregCountHighS Clr // Clear Preg to 0sPreg : 0PCountHighBE:m (bit)KI:P (32 bit)Tárolás: PregS Clr // Clear Preg to 0sPreg : 0BE:m (bit)KI:P (32 bit)Tárolás: PregS Clr// Clear Preg to 0sPreg : 0a?m'S Wt// Wait for m '1'm'mm'?(a)Digital Design 2eCopyright 2010Frank Vahid(b)mS Wt// Wait for m '1'm// Increment PregS Inc Preg : Preg 1(c)Megjegyzés: A példa megvalósítható egy előre számlálóval. DE! a módszerenvan a hangsúly és nem mindig célravezető a számláló használata. Lásd a akövetkező példát!6

Példa: Lézeres távolságmérőT (in seconds)laserDObject ofinterestsensora2D T sec * 3*108 m/sec Lézeres távolságmérés – lézerfény impulzus kiküldése ésa visszaverődésig eltelt T idő mérése,– Lézer fény sebessége 3*108 m/sec– Mért távolság: D (T [sec] * 3*108 [m/sec]) / 2Digital Design 2eCopyright 2010Frank Vahid7

Példa: Lézeres távolságmérőT (in seconds)laserfrom buttonsensorBDto displayL16Laser-baseddistancemeasurerto laserSfrom sensor Bemenetek/Kimenetek––––B: bit bemenet, nyomógomb, mérés indításL: bit kimenet, lézer nyaláb indításS: bit bemenet, visszaverődés érzékelésD: 16-bites kimenet, a mért távolság kijelzéseDigital Design 2eCopyright 2010Frank Vahid8

Example: Laser-Based Distance Measurerfrom button BDistanceMeasurerInputs: B (bit), S (bit)Outputs : L (bit), D (16 bits)Local storage: Dreg(16)to displayDL16LaserbaseddistancemeasurerSto laserfrom sensor(required)aS0?(first state usuallyinitializes the system)L : '0' // laser offDreg : 0 // distance is 0 Declare inputs, outputs, and local storage– Dreg required for multi-bit output Create initial state, name it S0– Initialize laser to off (L: '0')– Initialize displayed distance to 0 (Dreg: 0)Digital Design 2eCopyright 2010Frank VahidRecall: '0' means single bit,0 means integer9

Example: Laser-Based Distance Measurerfrom button BDistanceMeasurer.B' // button not pressedto displayS0S1L : '0'Dreg : 0B// buttonpressedDL16LaserbaseddistancemeasurerSto laserfrom sensor? Add another state, S1, that waits for a button press– B' – stay in S1, keep waiting– B – go to a new state S2Q: What should S2 do?A: Turn on the laseraDigital Design 2eCopyright 2010Frank Vahid10

Example: Laser-Based Distance Measurerfrom button BDistanceMeasurer.S0L : '0'Dreg : 0B'to displayS1BS2S3L : '1'// laser onL : '0'// laser offDL16LaserbaseddistancemeasurerSto laserfrom sensor Add a state S2 that turns on the laser (L: '1') Then turn off laser (L: '0') in a state S3Q: What do next? A: Start timer, wait to sense reflectionaDigital Design 2eCopyright 2010Frank Vahid11

Example: Laser-Based Distance MeasurerBfrom buttonDistanceMeasurerInputs : B (bit), S (bit) Outputs : L (bit), D (16 bits)Local storage: Dreg, Dctr (16 bits)B'S' // no reflectionS0S1L : '0'Dreg : 0Dctr : 0// reset cyclecountBDto displayL16Laser-baseddistancemeasurerSto laserfrom sensorS // reflection?S2S3L : '1'L : '0'Dctr : Dctr 1// count cyclesa Stay in S3 until sense reflection (S) To measure time, count cycles while in S3– To count, declare local storage Dctr– Initialize Dctr to 0 in S1. In S2 would have been O.K. too. Don't forget to initialize local storage—common mistake– Increment Dctr each cycle in S3Digital Design 2eCopyright 2010Frank Vahid12

Example: Laser-Based Distance Measurerfrom buttonDistanceMeasurerInputs: B (bit), S (bit) Outputs: L (bit), D (16 bits)Local storage: Dreg, Dctr (16 bits)to displayB'BDS'S0S1L : '0'Dreg : 0Dctr : 0BS2L : '1'S3SLaserbased16distancemeasurerLto laserSfrom sensorS4Dreg : Dctr/2L : '0'Dctr : Dctr 1 // calculate Da Once reflection detected (S), go to new state S4– Calculate distance– Assuming clock frequency is 3x108, Dctr holds number of meters, soDreg: Dctr/2 After S4, go back to S1 to wait for button againDigital Design 2eCopyright 2010Frank Vahid13

HLSM Actions: Updates Occur Next Clock CycleS' Local storage updated on clock edges only– Enter state on clock edge– Storage writes in that state occur on next clock edge– Can think of as occurring on outgoing transitionsS3SDctr : Dctr 1S' / Dctr : Dctr 1 Thus, transition conditions use the OLD value,not the newly-written valueS3– Example:Inputs: B (bit)Outputs: P (bit) // if B, 2 cycles highLocal storage: Jreg (8 bits)B'!(Jreg 2)S0P : '0'Jreg : 1Digital Design 2eCopyright 2010Frank VahidJreg 2S1BP : '1'Jreg : Jreg 1(a)clkS0S1S1S01?21323S/Dctr : Dctr 1BJregP(b)14

5.3RTL Design Process Capture behavior Convert to circuit– Need target architecture– Datapath capable of HLSM'sdata operations– Controller to control datapathExternalcontrol.inputsExternal .controloutputsDPcontrolinputs.External ernal dataoutputsDigital Design 2eCopyright 2010Frank Vahid15

Ctrl/DP Example for EarlierCycles-High CounterCountHigh000.00001mABadd1S32CountHighmFirst clear Preg to 0sThen increment Preg for eachclock cycle that m is 1?Preg(a)Preg clrPreg ldP(c)WecreatedthisHLSMearlierm'S Wtm(b)Digital Design 2eCopyright 2010Frank ighm//Preg : 0S Clr Preg clr 1Preg ld 0m'm'//Increment PregS Inc Preg : Preg 1aCreate DPDP000.00001//Wait for m '1'mm'clr Ild PregQPCountHigh Inputs: m (bit)Outputs: P (32 bits)LocStr: Preg (32 bits)//Clear Preg to 0sS Clr Preg : 0am//Wait for m 1 Preg clrS Wt Preg clr 0Preg ld 0Preg ldmDP//Preg: Preg 1S Inc Preg clr 0Preg ld 1ABadd1S32clr Ild PregQaController(d)P3216

RTL Design ProcessDigital Design 2eCopyright 2010Frank Vahid17

Example: Soda Dispenser from Earliers Quick overview example.More details of each step to come.tot ldtot clrInputs: c (bit), a (8 bits), s (8 bits)Outputs: d (bit) // '1' dispenses sodaLocal storage: tot (8 bits)ldclrd: '0'tot: 0Waitc’*(tot s)’Digital Design 2eCopyright 2010Frank Vahid888-bitadder8-bit tot lt stot: tot a8Step 2Ac'*(tot s)d: '1'Step 1aDatapathDispSodaDispensertot8cInitas8a8ctot lddatot clrControllertot lt sDatapathStep 2B18

Example: Soda Dispenser Quick overview example.More details of each step to come.s8a8ctot lddtot clrInputs: c (bit), a (8 bits), s (8 bits)Outputs: d (bit) // '1' dispenses sodaLocal storage: tot (8 bits)Controllertot lt sDatapathStep 2BcInitd: '0'tot: 0Waitc’*(tot s)’tot: tot ac'*(tot s)Inputs : c, tot lt s (bit)Outputs : d, tot ld , tot clr (bit)cdInitWaitd 0tot clr 1c' *tot lt s’DispSodaDispenserd: '1'Step 1Digital Design 2eCopyright 2010Frank Vahidtot ldcAddtot clrtot ld 1tot lt sc *tot lt sDispControllerd 1Step 2C19

Example: Soda Dispenser Quick overview example.More details of each step to come.Inputs : c, tot lt s (bit)Outputs : d, tot ld , tot clr (bit)WaitAddDispc00100000011tot clrs0000tot lds1000tot lt d000110111110001100101010110100001tot ldcAddtot clrtot ld 1tot lt sdInitWaitd 0tot clr 1c *tot lt s c *tot lt sDispd 1ControllerStep 2CUse controller design process(Ch3) to complete the designaDigital Design 2eCopyright 2010Frank Vahid20

RTL Design Process—Step 2A: Create a datapath Sub-steps– HLSM data inputs/outputs Datapath inputs/outputs.– HLSM local storage item Instantiated register "Instantiate": Add new component ("instance") to design– Each HLSM state action and transition condition data computation Datapath components and connections Also instantiate multiplexors as needed Need component library from which to chooseclr Ild regQABaddSABcmplt eq gtclk and clr 1: Q 0clk and ld 1: Q Ielse Q stays sameS A B(unsigned)A B: lt 1A B: eq 1A B: gt 1Digital Design 2eCopyright 2010Frank VahidIshift L/R QshiftL1: 1shiftL2: 2shiftR1: 1.I1 I0mux2x1s0 Qs0 0: Q I0s0 1: Q I121

Step 2A: Create a Datapath—Simple ExamplesXYZXXYZXPreg X Y ZPreg Preg XPregPregPregregQPPPQ(a)XYDPDPclr Ild PregQPDigital Design 2eCopyright 2010Frank VahidYZA Badd1SABadd2S0 clr I1 ld PregQ0 clr I1 ld regQQPQXABadd1S01(d)YZABadd1SABadd2SXDPX Y01(c)XABadd1SABadd2SX Y ZP(b)Zk 0: Preg Y Zk 1: Preg X YPregkPreg X Y; regQ Y ZZYclr Ild PregQPI1 I0mux2x1s0 QkaDP0 clr I1 ld PregQP22

Laser-Based Distance Measurer—Step 2A: Create aDatapathDistanceMeasurerInputs: B (bit), S (bit) Outputs: L (bit), D (16 bits)Local storage: Dreg, Dctr (16 bits)B'S'S0S1L : '0'Dreg : 0Dctr : 0BS2L : '1'S3SS4L : '0'Dreg : Dctr/2Dctr : Dctr 1 // calculate D1a HLSM data I/O DP I/OHLSM local storage regHLSM state action andtransition condition datacomputation Datapathcomponents and connectionsDreg clrDreg ldDctr clrDctr ldDatapath16ABAdd1: add(16)S1616IShr1: shiftR1(16)Q16Iclrld Dctr: reg(16)QclrldIDreg: reg(16)Q16DDigital Design 2eCopyright 2010Frank Vahid23

Laser-Based Distance Measurer—Step 2B: Connectingthe Datapath to a Controllerfrom buttonLBto laserControllerfrom sensorSDreg clrDreg ldDctr clrDatapathDctr ldDto display16300 MHz ClockDigital Design 2eCopyright 2010Frank Vahida24

Laser-Based Distance Measurer—Step 2C: Derive theController FSMHLSM1DistanceMeasurerInputs: B (bit), S (bit) Outputs: L (bit), D (16 bits)Local storage: Dreg, Dctr (16 bits)B'Dreg clrDreg ldS'S0S1L : '0'Dreg : 0Dctr : 0B FSM has samestates,transitions, andcontrol I/O Achieve eachHLSM dataoperation usingdatapath controlsignals in FSMDigital Design 2eCopyright 2010Frank VahidS2Dctr clrDctr ldS3L : '1'SABAdd1: add(16)S1616Iclrld Dctr: reg(16)S4IShr1: shiftR1(16)Q16clrldQIDreg: reg(16)Q16DL : '0'Dreg : Dctr/2Dctr : Dctr 1 // calculate DInputs: B, SControllerDatapath16Outputs: L, Dreg clr, Dreg ld, Dctr clr, Dctr ldB S aS0S1L 0Dreg clr 1Dreg ld 0Dctr clr 0Dctr ld 0(laser off)(clear Dreg)L 0Dreg clr 0Dreg ld 0Dctr clr 1Dctr ld 0(clear count)BSS2S3L 1Dreg clr 0Dreg ld 0Dctr clr 0Dctr ld 0(laser on)L 0Dreg clr 0Dreg ld 0Dctr clr 0Dctr ld 1(laser off)(count up)S4L 0Dreg clr 0Dreg ld 1Dctr clr 0Dctr ld 0(load Dreg with Dctr/2)(stop counting)25

Laser-Based Distance Measurer—Step 2C: Derive theController FSMControllerInputs: B, SOutputs: L, Dreg clr, Dreg ld, Dctr clr, Dctr ldB S0S1L 0Dreg clr 1(laser off)(clear Dreg)Dctr clr 1(clear count) Same FSM, usingconvention ofunassignedoutputs implicitlyassigned 0Digital Design 2eCopyright 2010Frank VahidS BS2S3L 1(laser on)L 0Dctr ld 1(laser off)(count up)SS4Dreg ld 1Dctr ld 0(load Dreg with Dctr/2)(stop counting)Some assignments to 0 still shown, due totheir importance in understandingdesired controller behavior26

5.4More RTL Design Additional datapath components(signed)ABsubSS A-B(signed)Digital Design 2eCopyright 2010Frank VahidABmulPAabsQP A*BQ A (unsigned) (unsigned)clrinc upcntQclk and clr 1: Q 0clk and inc 1: Q Q 1else Q stays sameW dW aclk and W e 1:W eRF[W a] W dRF R e 1:R aR eR d RF[R a]R d27

RTL Design Involving Register File or Memory HLSM array: Ordered list of items– Ex: Local storage: A[4](8-bit) – 4 8-bit items– Accessed using notation "A[i]", i is index– A[0] : 9; A[1] : 8; A[2] : 7; A[3] : 22 Array contents now: 9, 8, 7, 22 X : A[1] will set X to 8 Note: First element's index is 0 Array can be mapped to instantiated register file or memoryDigital Design 2eCopyright 2010Frank Vahid28

ArrayEx Inputs: (none)Outputs: P (11 bits)Local storage: A[4](11 bits)Preg (11 bits)Init1 Preg : 0A[0] : 9Simple Array Examplea(A[0] 8)'Init2 A[1] : 121211A[0] 8A sOut1 Preg : A[1](a)A Wa0A Wa1A WeA Ra0A Ra1A ReArrayEx Inputs: A eq 8Outputs: A s, A Wa0, .Init1Preg clr 1A s 0A Wa1 0, A Wa1 0A We 1Init2A eq 811I1 I0Amuxs0 QW dW aW eARF[4](11)R aR eR d8ABAcmplt eq gtA eq 8(A eq 8)'Preg clrA s 1A Wa1 0, A Wa0 1A We 1A Ra1 0, A Ra0 0A Re 19Preg ldDP(b)clr Ild PregQP11Out1 Preg ld 1Digital Design 2eCopyright 2010Frank VahidController(c)a29

RTL Example: Video Compression – Sum of AbsoluteOnly difference: ball movingDifferencesFrame 1Frame 2Frame 1Frame 2DigitizedDigitizedDigitizedDifference offrame 1frame 2frame 12 from 11 Mbyte1 Mbyte1 Mbyte0.01 Mbyte(a)(b ) Video is a series of frames (e.g., 30 per second) Most frames similar to previous frameaJust senddifference– Compression idea: just send difference from previous frameDigital Design 2eCopyright 2010Frank Vahid30

RTL Example: Video Compression – Sum of AbsoluteDifferencescompareFrame 1Frame 2Each is a pixel, assumerepresented as 1 byte(actually, a color picturemight have 3 bytes perpixel, for intensity ofred, green, and bluecomponents of pixel) Need to quickly determine whether two frames are similarenough to just send difference for second frame– Compare corresponding 16x16 “blocks” Treat 16x16 block as 256-byte array– Compute the absolute value of the difference of each array item– Sum those differences – if above a threshold, send complete framefor second frame; if below, can use difference method (usinganother technique, not described)Digital Design 2eCopyright 2010Frank Vahid31

Array Example: Video ](8)BRF[256](8)Inputs: A, B [256](8 bits); go (bit)Outputs: sad (32 bits)Local storage: sum, sadreg (32 bits); i (9 bits)sad!goS0gogoS1sum : 0i : 0a S0: wait for goS1: initialize sum and indexS2: check if done ( (i 256)’ )S3: add difference to sum,increment index S4: done, write to output sad regDigital Design 2eCopyright 2010Frank Vahid(i 256)’S2i 256sum: sum abs(A[i]-B[i])S3i : i 1S4sadreg : sum(b)32

Inputs: A, B [256](8 bits); go (bit)Outputs: sad (32 bits)Local storage: sum, sadreg (32 bits); i (9 bits)S0!gogoS1sum : 0i : 0Array Example: VideoCompression—Sum-ofAbsolute Differences!(i 256)S2i 256sum: sum abs(A[i]-B[i])S3i : i 1S4sadreg : sumgoS0go(i 256)’ (i lt 256)S1i lt 256go sum 0 sum clr 1i 0 i clr 1Acmp Bi clrsum ldi 256 i lt 256sum sum abs(A[i]-B[i])S3sum ld 1; AB rd 1i i 1 i inc 1sum clrsad reg sumsadreg ld 1256A data B data898aAiB–8S2S4lti incControllerDigital Design 2eCopyright 2010Frank VahidAB addrAB rdsum32abs832 32sadreg ldsadreg clrDatapathsadreg 32sad33

Circuit vs. Microprocessor Circuit: Two states (S2 & S3) for each i, 256 i’s 512 clock cycles Microprocessor: Loop (for i 1 to 256), but for each i, must movememory to local registers, subtract, compute absolute value, add tosum, increment i – say 6 cycles per array item 256*6 1536 cycles Circuit is about 3 times (300%) faster (assuming equal cycle lengths) Later, we’ll see how to build SAD circuit that is much faster(i 256)’S2i 256sum: sum abs(A[i]-B[i])S3i: i 1Digital Design 2eCopyright 2010Frank Vahid34

Common RTL Design Pitfall Involving Storage Updates QuestionsLocal storage: R, Q (8 bits)– Value of Q after state A?– Final state is C or D?R 100ABR: 99Q: RR: R 1 Answers– Q is NOT 99 after state A– Q is 99 in state B, so final state is C– Storage update actions in stateoccur simultaneously on next clockedge Thus, order actions are written isirrelevant A's actions same if:– Q: R R: 99– R: 99 Q: RDigital Design 2eCopyright 2010Frank VahidC(R 100)'DR 100AB99100R?99100Q?clkCaor35

Common RTL Design Pitfall Involving Storage Updates New HLSMusing extrastate so read ofR occurs afterwrite of RLocal storage : R, Q (8 bits)R 100ABR: 99Q: RR: R 1Q: RB2C(R 100)'DR 100 (R 100)'Digital Design 2eCopyright 2010Frank VahidclkABB2DR99?10099100100Q?999936

RTL Design Involving a Timer Commonly need explicit time intervalsL– Ex: Repeatedly blink LED on 1 second, off 1 second Pre-instantiate timer that HLSM can then useBlinkLedBlinkLedT MT ldT enloadenableOutputs: L (bit)32T Q'M32-bit1-microsecQ timer TT QLTimer: TT Q'T QT QInitOffOnL: '0'T: 1000000T en: '0'L: '0'T en: '1'L: '1'T en: '1'(a)(b)Pre-instantiated timerHLSM making use of timeraDigital Design 2eCopyright 2010Frank Vahida37

Button Debouncing Press button– Ideally, output changes to 1– Actually, output bouncesbuttonB Due to mechanical reasons Like ball bouncing when dropped tofloor01Ideal: B Digital circuit can convert actualsignal closer to ideal signalActual: BbounceInputs: Bin (bit) Outputs: Bout (bit)Timer: TButtonDebouncerBin'T Q'BinDigital Design 2eCopyright 2010Frank VahidBBinBin'T QInitWaitBinWait20Bout : '0'T: 20000T en: '0'Bout: '0'T en: '0'Bout: '1'T en: '1'WhileBinBout: '1'T en: '0'38a

Data Dominated RTL Design Example Data dominated design: Extensive DP,simple controller Control dominated design: Complexcontroller, simple DP Example: Filter– Converts digital input stream to newdigital output stream– Ex: Remove noiseYX12digital filter12clk 180, 180, 181, 180, 240, 180, 181 240 is probably noise, filter might replaceby 181– Simple filter: Output average of last Nvalues Small N: less filtering Large N: more filtering, but less sharpoutputDigital Design 2eCopyright 2010Frank Vahid39

Data Dominated RTL Design Example: FIR Filter FIR filter– “Finite Impulse Response”– Simply a configurable weightedsum of past input values– y(t) c0*x(t) c1*x(t-1) c2*x(t-2) Above known as “3 tap” Tens of taps more common Very general filter – User setsthe constants (c0, c1, c2) todefine specific filterYX1212clky(t) c0*x(t) c1*x(t-1) c2*x(t-2)Inputs: X (12 bits) Outputs: Y (12 bits)Local storage: xt0, xt1, xt2, c0, c1, c2 (12 bits);Yreg (12 bits)Init RTL design– Step 1: Create HLSM Very simple states/transitionsFIR filterDigital Design 2eCopyright 2010Frank Vahiddigital filterYreg : 0xt0 : 0xt1 : 0xt2 : 0c0 : 3c1 : 2c2 : 2FCYreg : c0*xt0 c1*xt1 c2*xt2xt0 : Xxt1 : xt0xt2 : xt1Assume constants set to 3, 2, and 240

FIRFilterInputs: X (12 bits) Outputs: Y (12 bits)Local storage: xt0, xt1, xt2, c0, c1, c2 (12 bits);Yreg (12 bits)InitFIR filterFCYreg : 0xt0 : 0xt1 : 0xt2 : 0c0 : 3c1 : 2c2 : 2Yreg : c0*xt0 c1*xt1 c2*xt2xt0 : Xxt1 : xt0xt2 : xt13xt0 clrc0xt0c2 ldc1xt1c2.X2c1 ld.xt0 ld– Set clr and ld lines appropriately2c0 ld Step 2A: Create datapath Step 2B: Connect Ctrlr/DP (asearlier examples) Step 2C: Derive FSMxt212clkx(t)*x(t-1) *x(t-2) *Yreg clrYreg ldYYregDatapath for 3-tap FIR filterDigital Design 2eCopyright 2010Frank Vahid1241

Circuit vs. Microprocessory(t) c0*x(t) c1*x(t-1) c2*x(t-2) Comparing the FIR circuit to microprocessor instructions– Microprocessor 100-tap filter: 100 multiplications, 100 additions. Say 2 instructionsper multiplication, 2 per addition. Say 10 ns per instruction. (100*2 100*2)*10 4000 ns– Circuit Assume adder has 2 ns delay, multiplier has 20 ns delay Longest path goes through one multiplier and two adders– 20 2 2 24 ns delay 100-tap filter, following design on previous slide, would have about a34 ns delay: 1 multiplier and 7 adders on longest path– Circuit is more than 100 times faster (4000/34). Wow.Digital Design 2eCopyright 2010Frank Vahid42

5.5Determining Clock Frequency Designers of digital circuitsoften want fastestperformanceclkab– Means want high clockfrequency Frequency limited by longestregister-to-register delay– Known as critical path– If clock is any faster, incorrectdata may be stored into register– Longest path on right is 2 ns2 nsdelay c Ignoring wire delays, andregister setup and hold times,for simplicityDigital Design 2eCopyright 2010Frank Vahid43

Critical Path Example shows four pathsDigital Design 2eCopyright 2010Frank Vahid *c5 nsdelay2 ns– 1 / 7 ns 142 MHzMax(2,7,7,5) 7 nsb7 ns Longest path is thus 7 ns Fastest frequency2 nsdelaya7 nsa to c through : 2 nsa to d through and *: 7 nsb to d through and *: 7 nsb to d through *: 5 ns2 ns––––da44

Critical Path Considering Wire Delays Real wires have delay too– Must include in critical path Example shows two pathsclkab– Each is 0.5 2 0.5 3 ns Wire delays may even be greater thanlogic delays!0.5 ns 2 nsa0.5 nsc3 ns– 1980s/1990s: Wire delays were tinycompared to logic delays– But wire delays not shrinking as fast aslogic delays0.5 ns3 ns Trend Must also consider register setup andhold times, also add to path Then add some time to the computedpath, just to be safe– e.g., if path is 3 ns, say 4 ns insteadDigital Design 2eCopyright 2010Frank Vahid45

A Circuit May Have Numerous Paths Paths can exist– In the datapath– In the controller– Between thecontroller anddatapath– May behundreds orthousands ofpaths Timing analysistools that evaluateall possible pathsautomatically veryhelpfulDigital Design 2eCopyright 2010Frank VahidsCombinational logica88dtot ldldtott ot clrcclr8(c )tot lt sn18-bit n08-bitadder8tot lt saDatapaths1clks0(b )(a)State register46

Behavioral Level Design: C to GatesInputs : A, B [256](8 bits); go (bit)Outputs : sad (32 bits)Local storage : sum, sadreg (32 bits); i (9 bits)S0goS1!gosum : 0i : 0(i 256)’S2i 256S3 sum: sum abs(A[i]-B[i])i : i 1S4sadreg : suma5.6C codeint SAD (byte A[256], byte B[256]) // not quite C syntax{uint sum; short uint I;sum 0;i 0;while (i 256) {sum sum abs(A[i] – B[i]);i i 1;}return sum;} Earlier sum-of-absolute-differences example– Started with high-level state machine– C code is an even better starting point -- easier to understandDigital Design 2eCopyright 2010Frank Vahid47

Converting from C to High-Level State Machine Convert each C construct toequivalent states andtransitions Assignment statement– Becomes one state withassignmenttarget : expressiontarget expression;a If-then statement– Becomes state with conditioncheck, transitioning to “then”statements if condition true,otherwise to ending state “then” statements would alsobe converted to statesDigital Design 2eCopyright 2010Frank Vahidcond’if (cond) {// then stmts}conda(then stmts)(end)48

Converting from C to High-Level State Machine If-then-else– Becomes state with conditioncheck, transitioning to “then”statements if condition true, orto “else” statements if conditionfalsecond’if (cond) {// then stmts}else {// else stmts}cond(then stmts) (else stmts)a(end) While loop statement– Becomes state with conditioncheck, transitioning to whileloop’s statements if true, thentransitioning back to conditioncheckDigital Design 2eCopyright 2010Frank Vahidcond’while (cond) {// while stmts}cond(while stmts)a(end)49

Simple Example of Converting from C to HighLevel State MachineInputs: uint X, YOutputs: uint Max(X Y)’(X Y)’X YX Yif (X Y) {Max X;(then stmts)(else stmts)Max: XMax: Y}else {Max Y;(end)(end)}aa(a)(b)(c) Simple example: Computing the maximum of two numbers– Convert if-then-else statement to states (b)– Then convert assignment statements to states (c)Digital Design 2eCopyright 2010Frank Vahid50

Example: SAD Ccode to HLSM Convert each constructto statesInputs: byte A[256],B[256]bit go;Output: int sadmain(){uint sum; short uint i;while (1) {– Actually, subset of C(not all C constructseasily convertible)– Can use languageother than Cgo'go'}go'gosum: 0i: 0i 0sum 0;i 0;}gosum: 0while (!go);– Simplify, e.g., mergestates RTL design process toconvert to circuit Can thus convert C tocircuit usingstraightforward process(go')'(c)(b)while (i 256) {sum sum abs(A[i] – B[i]);i i 1;}sad sum;go'(d)gogo'go(a)sum: 0i: 0go'sum: 0i: 0go(i 256)'sum: 0i: 0i 256(i 256)'sum: sum abs.i : i 1i 256while stmts(i 256)'i 256sum: sum abs.i : i 1sadreg : sum(g)Digital Design 2eCopyright 2010Frank Vahidasadreg : sum(e)(f)51

5.7Memory Components– Some components are usedoutside the controller and DP MxN memoryM words RTL design instantiatesdatapath components tocreate datapath, controlledby a controller– M words, N bits wide each Several varieties of memory,which we now introduceN-bitswide eachM N memoryDigital Design 2eCopyright 2010Frank Vahid52

Random Access Memory (RAM) RAM – Readable and writable memory– “Random access memory” Strange name—Created several decades ago tocontrast with sequentially-accessed storage liketape drives– Logically same as register file—Memory withaddress inputs, data inputs/outputs, and control32432W dataR dataW addrR addrW en16 32register file4R enRegister file from Chpt. 4 RAM usually one port; RF usually two or more– RAM vs. RF RAM typically larger than about 512 or 1024 words RAM typically stores bits using a bit storageapproach that is more efficient than a flip-flop RAM typically implemented on a chip in a squarerather than rectangular shape—keeps longestwires (hence delay) short32data10addrrw1024 32RAMenRAM block symbolDigital Design 2eCopyright 2010Frank Vahid53

RAM Internal Structure3210wdata(N-1) wdata(N-2) wdata0Let A log2Mdataaddrrw1024x32RAMd0ena0a1 AxMd1decodera(A-1)addr0addr1addr(A-1)clkenrww orddata cellword wordenable enablerw datad(M-1)to all cellswdata0wdata(N-1)rdata(N-1)ebit storageblock(aka “cell”)rdata0Combining rd and wrdata lineswordenabledata0 Similar internal structure as register filerdata(N-1) rdata(N-2) rdata0RAM cellrwdata(N-1)Digital Design 2eCopyright 2010Frank Vahid––––Decoder enables appropriate word based on address inputsrw controls whether cell is written or readrd and wr data lines typically combined54Let’s see what’s inside each RAM cell

Static RAM (SRAM)3210SRAM rdenableSRAM celldata’0data1 “Static” RAM cell– 6 transistors (recall inverter is 2 transistors)– Writing this cell word enable input comes from decoder When 0, value d loops around inverters– That loop is where a bit stays storedda101wordenable When 1, the data bit value enters the loop– data is the bit to be stored in this cell– data’ enters on other side– Example shows a “1” being written into cellDigital Design 2eCopyright 2010Frank Vahiddata1wordenableddata’celld’a0055

Static RAM (SRAM)3210dataaddrrw1024x32RAMen “Static” RAM cellSRAM cell Somewhat trickier When rw set to read, the RAM logic setsboth data and data’ to 1 The stored bit d will pull either the left line orthe right bit down slightly below 1 “Sense amplifiers” detect which side isslightly pulled downdata’1data1– Reading this celld10awordenable11 1To sense amplifiers– The electrical description of SRAM is reallybeyond our scope – just general idea here,mainly to contrast with DRAM.Digital Design 2eCopyright 2010Frank Vahid56

Dynamic RAM (DRAM)3210dataadd

Frank Vahid 1 Digital Design Chapter 5: Register-Transfer Level (RTL) Design Regiszter-Transzfer Szintű Tervezés Slides to accompany the textbook Digital Design, with RTL Design, VHDL, and Verilog, 2nd Edition, by Frank

Related Documents:

Part One: Heir of Ash Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26 Chapter 27 Chapter 28 Chapter 29 Chapter 30 .

TO KILL A MOCKINGBIRD. Contents Dedication Epigraph Part One Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Part Two Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18. Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26

DEDICATION PART ONE Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 PART TWO Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 .

ebay,4life transfer factor eczema,4life transfer factor effectiveness,4life transfer factor en el salvador,4life transfer factor en espanol,4life transfer factor en español,4life transfer factor energy go stix,4life transfer factor enummi,4life transfer factor 4life transfer factor equine,4li

stair pressurization fan condensing units, typ. of (3) elevator overrun stair pressurization fan november 2, 2016. nadaaa perkins will ]mit ]] ]site 4 october 21 2016 10 7'-3" hayward level 1 level 2 level 3 level 4 level 5 level 6 level 7 level 1 level 2 level 3 level 4 level 5 level 6 level 7 level 8 level 9 level 10 level 11 level 12

About the husband’s secret. Dedication Epigraph Pandora Monday Chapter One Chapter Two Chapter Three Chapter Four Chapter Five Tuesday Chapter Six Chapter Seven. Chapter Eight Chapter Nine Chapter Ten Chapter Eleven Chapter Twelve Chapter Thirteen Chapter Fourteen Chapter Fifteen Chapter Sixteen Chapter Seventeen Chapter Eighteen

18.4 35 18.5 35 I Solutions to Applying the Concepts Questions II Answers to End-of-chapter Conceptual Questions Chapter 1 37 Chapter 2 38 Chapter 3 39 Chapter 4 40 Chapter 5 43 Chapter 6 45 Chapter 7 46 Chapter 8 47 Chapter 9 50 Chapter 10 52 Chapter 11 55 Chapter 12 56 Chapter 13 57 Chapter 14 61 Chapter 15 62 Chapter 16 63 Chapter 17 65 .

HUNTER. Special thanks to Kate Cary. Contents Cover Title Page Prologue Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter