DOC PREVIEW
Berkeley COMPSCI 150 - FSMs in Verilog and other random things

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 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 9 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 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

FSMs in Verilog and other random thingsFSM structurePowerPoint PresentationSlide 4Slide 5Slide 6Slide 7Non-blockingBlockingFSMs in Verilog and other random things9/27/02FSM structureCLKSTATENextStateLogicInputsOutput LogicOutputsRedYellow Greenchange=1change=1change=1module trafficLightFSM(clk,reset,change,red,yellow,green); input clk,reset,change;output red,yellow,green;reg red,yellow,green;reg [1:0] curState,nextState;parameter showRed = 2’b00, showYellow = 2’b01;parameter showGreen = 2’b10;// state registeralways @(posedge clk)if (reset==1’b1) curState <= 2’b0;else curState <= nextState;// next state logic// dependent only on the current state and inputalways @(curState or change) beginnextState = showRed; // default statecase (curState)showRed: if (change) nextState=showGreen; showYellow: if (change) nextState=showRed; else nextState=showYellow;showGreen: if (change) nextState=showYellow; else nextState=showGreen;endcaseend// Output Logic: dependent ONLY on statealways @(curState) begin// *ALWAYS* put default output valuesred=1’b0; green=1’b0; yellow=1’b0;case (curState)showRed: red=1’b1;showYellow: yellow=1’b1;showGreen: green=1’b1;endcaseendendmoduleEdge DetectorOUTINa bcclkinaboutcNon-blockingalways @(posedge clk)beginE <= ~A;C <= ~E;endAECBlockingalways @(posedge clk)beginE = ~A;C =


View Full Document

Berkeley COMPSCI 150 - FSMs in Verilog and other random things

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 FSMs in Verilog and other random things
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 FSMs in Verilog and other random things 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 FSMs in Verilog and other random things 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?