DOC PREVIEW
Berkeley COMPSCI 150 - Verilog Synthesis & FSMs

This preview shows page 1-2-3-24-25-26 out of 26 pages.

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

Unformatted text preview:

Verilog Synthesis & FSMsTodayDesigning Digital Logic (1)Designing Digital Logic (2)Designing Digital Logic (3)Designing Digital Logic (4)Efficient Hardware Design (1)Efficient Hardware Design (2)HDL Simulation (1)HDL Simulation (2)Blocking vs. Non-Blocking (1)Blocking vs. Non-Blocking (2)Administrative InfoAdministrative Info (2)Lab #3: The Combo Lock (1)Lab #3: The Combo Lock (2)Lab #3: The Combo Lock (3)Lab #3: The Combo Lock (4)Lab #3: The Combo Lock (5)Lab #3: The Combo Lock (6)Lab #3: The Combo Lock (7)FSMs in Verilog (1)FSMs in Verilog (2)FSMs in Verilog (3)FSMs in Verilog (4)FSMs in Verilog (5)01/13/19 EECS150 Lab Lecture #3 1Verilog Synthesis & FSMsEECS150 Spring 2008 – Lab Lecture #3Shah Bawany01/13/19 EECS150 Lab Lecture #3 2TodayDesigning Digital LogicEfficient Hardware DesignHDL SimulationBlocking vs. Non-BlockingAdministrative InfoLab #3: The Combo LockFSMs in Verilog01/13/19 EECS150 Lab Lecture #3 3Designing Digital Logic (1)High Level DesignTop-Down DesignBreak down a larger module (ie combo lock) into smaller more manageable partsImplementing the DesignFollow the flow of dataPort specifications for modules provided in lab documentSimple FSMGet inputsUpdate stateGenerate outputs01/13/19 EECS150 Lab Lecture #3 4Designing Digital Logic (2)Start with InputsWhat are they?In this case values from the dipswitches as well as reset, reset combo and enterThey’ll often be outputs from other modulesProcess ThemRaw inputs are often not what you needi.e. Lab3, current combination is stored in registers, so we can process the inputs using a comparator before handing it off to the FSM01/13/19 EECS150 Lab Lecture #3 5Designing Digital Logic (3)Determine StateWhat does the module need to remember?Common tasks are determining if it seen a particular input or counting how many cycles have passed since an eventIn this lab, our FSM only knows of correct versus incorrect entries, as we have abstracted away knowledge of specific inputsDesign Memory for StateGeneralized FSM - Mutli-purpose using 2 always @ blocksCounter - Generally good for timing eventsShift Register - Serial <--> Parallel01/13/19 EECS150 Lab Lecture #3 6Designing Digital Logic (4)Generate OutputsWhat are they?Values passed outside the moduleCreate the outputsDon’t set them, they’re not variablesCompute them from state (and inputs)Learn to think in Boolean equationsassign is helpful01/13/19 EECS150 Lab Lecture #3 7Efficient Hardware Design (1)CaB1A01ZaA01auxZBCalways @ (*) beginif (a) aux =B;else aux = C;Z = A + aux;endORassign Z = A + (a ? B : C);always @ (*) beginif (a) Z = A + B;else Z = A + C;end01/13/19 EECS150 Lab Lecture #3 8Efficient Hardware Design (2)BZA<<AZn+1 bit adderassign B = 3;assign Z = A * B;Multipliers are bad for synthesisassign Z = A + (2 * A);assign Z = A + (A << 1);assign Z = A + {A, 1’b0};01/13/19 EECS150 Lab Lecture #3 9HDL Simulation (1)Software Based SimulationFast, simple and mostly accurateAllows for simulation at any precisionEasy to see any signal - perfect VisibilityDrawbacksSimulator DependantTime to simulate a single clock cycle is much slower than the actual clock speed, so extensive testing may take longerSimulation != Synthesis01/13/19 EECS150 Lab Lecture #3 10HDL Simulation (2)ImplicationsSome blocks of Verilog are not executedThings don’t necessarily happen in orderVerilog is SIMULATEDNeed to specify test input vectors, which can be painful01/13/19 EECS150 Lab Lecture #3 11Blocking vs. Non-Blocking (1)always @ (a) beginb = a;c = b;endalways @ (posedge Clock) beginb <= a;c <= b;endC = B = AB = AC = Old BVerilog Fragment Result01/13/19 EECS150 Lab Lecture #3 12Blocking vs. Non-Blocking (2)Use Non-Blocking for FlipFlop Inferenceposedge/negedge require Non-BlockingElse simulation and synthesis wont matchUse #1 to show causalityalways @ (posedge Clock) beginb <= #1 a;c <= #1 b;end01/13/19 EECS150 Lab Lecture #3 13Administrative InfoDon’t expect to be checked off during any lab times other than your ownYou should get checked off during your lab or during your lab TA’s office hoursIf your another TA does check you off, bring your checkoff sheet to your regular lab TAAt the end of lab, come up and put your 5-digit cardkey access number on the sheet if you didn’t already during lab.01/13/19 EECS150 Lab Lecture #3 14Administrative Info (2)Partners - 1 week warningYou MUST have one for Lab4 and later…Try to keep the same one for the projectThey must be in your lab sectionIf you do not have a partner:Find one now!Post to the newsgroup01/13/19 EECS150 Lab Lecture #3 15Lab #3: The Combo Lock (1)Used to control entry to a locked room2bit, 2 digit combo (By Default 11, 01)Set code to 11, Press EnterSet code to 01, Press EnterLock Opens (Open = 1)Lab4Top(Lab4Lock)0101Lab4CompareOpenErrorProg1Prog2ResetComboResetEnterCode[0]Code[1]DIPSwitchesButtonsOutputsYour Verilog01/13/19 EECS150 Lab Lecture #3 16Lab #3: The Combo Lock (2)Signal Width Dir DescriptionCode2 I Code from the dipswitchesEnter1 I Enter button (examine the code)ResetCombo1 I Reset to the default combinationClock1 I System ClockReset1 I System Reset, doesn’t affect the comboOpen1 O Indicates the lock is openError1 O Indicates a bad combinationProg11 O Reprogramming the first digitProg21 O Reprogramming the second digitLED8 O Use these for debugging01/13/19 EECS150 Lab Lecture #3 17Lab #3: The Combo Lock (3)Example 1:1: Press ResetCombo, Combo: 2’b11, 2’b012: Set 2’b11, Press Enter3: Set 2’b01, Press Enter, LEDs: “OPEN”4: Press Enter, LEDs: “Prog1”5: Set 2’b00, Press Enter, LEDs: “Prog2”6: Set 2’b10, Press Enter, LEDs: “OPEN”7: Combo: 2’b00, 2’b1001/13/19 EECS150 Lab Lecture #3 18Lab #3: The Combo Lock (4)Example 2:1: Press ResetCombo, Combo: 2’b11, 2’b012: Set 2’b01, Press Enter3: Set 2’b01, Press Enter, LEDs: “Error”Why doesn’t “Error” show until step 3?01/13/19 EECS150 Lab Lecture #3 19Lab #3: The Combo Lock (5)InitOK1 BAD1OK2[Open]Prog1[Prog1]Prog 2[Prog2]BAD2[Error]Code 1 &Enter~Code1 &EnterCode 2 & EnterEnterEnterEnter~Code2 &EnterEnter01/13/19 EECS150 Lab Lecture #3 20Lab #3: The Combo Lock (6)C ode 1R eg==C ode 2R eg==Lab4CompareD ecode 2D ecode 1C odeEnterProg1/Prog2In itOK 1 BAD 1OK 2[Op e n ]Pro g 1[Pro g 1 ]Pro g


View Full Document

Berkeley COMPSCI 150 - Verilog Synthesis & FSMs

Documents in this Course
Lab 2

Lab 2

9 pages

Debugging

Debugging

28 pages

Lab 1

Lab 1

15 pages

Memory

Memory

13 pages

Lecture 7

Lecture 7

11 pages

SPDIF

SPDIF

18 pages

Memory

Memory

27 pages

Exam III

Exam III

15 pages

Quiz

Quiz

6 pages

Problem

Problem

3 pages

Memory

Memory

26 pages

Lab 1

Lab 1

9 pages

Memory

Memory

5 pages

Load more
Download Verilog Synthesis & FSMs
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 Verilog Synthesis & FSMs 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 Verilog Synthesis & FSMs 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?