DOC PREVIEW
UCSD CSE 141L - State Machines Tutorial

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:

Slide 1Slide 2Slide 3Slide 4State Machines Tutorial CSE 141 LFinite State Machines (FSMs)●Useful for designing many different types of circuits●3 basic components:–Combinational logic (next state)– Sequential logic (store state)–Output logic●Different encodings for state:–Binary (min FF’s), Gray, One hot (good for FPGA), One cold, etcA simple FSM in Verilogmodule simple_fsm( input clk, start,output restart);reg [1:0] state, next_state;parameter S0 = 2’b00, S1 = 2’b01, S2 = 2’b10; // binary encodealways @ (*)begin : next_state_logiccase ( state )S0: begin if ( start ) next_state = S1; else next_state = S0; endS1: begin next_state = S2; endS2: begin if (restart) next_state = S0; else next_state = S2; enddefault: next_state = S0;endcaseend // continued to the right// continued from leftalways @ (posedge clk)begin: state_assignment state <= next_state;endendmoduleTips on FSMs● Don’t forget to handle the default case● Use two different always blocks for next state and state assignment●Can do it in one big block but not as clear● Outputs can be a mix of combin. and seq.●Moore Machine: Output only depends on state●Mealy Machine: Output depends on state and


View Full Document

UCSD CSE 141L - State Machines Tutorial

Download State Machines Tutorial
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 State Machines Tutorial 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 State Machines Tutorial 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?