Homework1Solutions

Homework1Solutions - ECE 485/585 Fall 2008 Homework 1...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 485/585 Fall 2008 Homework 1 Example Solution We modify the state transition diagram to reflect the changes in behavior mandated by the problem statement, specifically that once the state machine enters the left or right turn sequence, the HAZARD input will not affect the state machine until it returns to the IDLE state. Also, assume that the LEFT and RIGHT inputs are mutually exclusive (that is at most one can be asserted at time). Note: to save space, LEFT, RIGHT, and HAZARD inputs have been named L,R, and H in the table below. They appear in their original form in the Verilog code. Present State Inputs Next State IDLE (L+R+H)’ IDLE IDLE H LR3 IDLE R H’ R1 IDLE L H’ L1 R1 1 R2 R2 1 R3 R3 1 IDLE L1 1 L2 L2 1 L3 L3 1 IDLE LR3 1 IDLE Idle R3 L3 R2 LR3 R1 L1 L2 H 1 R H’ 1 1 1 1 1 1 L H’
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
// // behavioral model of the T Bird Tail Light FSM // // using encoded states and Moore state machine. // this FSM is modified from the one presented in class // see the accompanying documentation with revised state // transition diagram and PS/NS table. // // module TBirdTailLights(Clock, Clear, Left, Right, Hazard, LA, LB, LC, RA, RB, RC); input Clock, Clear, Left, Right, Hazard; output LA,LB,LC,RA,RB,RC; reg LA,LB,LC,RA,RB,RC; parameter ON = 1'b1; parameter OFF = 1'b0; parameter IDLE = 8’b00000001, L1 = 8’b00000010, L2 = 8’b00000100, L3 = 8’b00001000, R1 = 8’b00010000, R2 = 8’b00100000, R3 = 8’b01000000, LR3 = 8’b10000000; reg [7:0] State, NextState; // // Update state or reset on every + clock edge // always @(posedge Clock) begin if (Clear) State <= IDLE; else State <= NextState; end
Background image of page 2
// Outputs depend only upon state (Moore machine) // always @(State) begin case (State) IDLE: begin LA = OFF; LB = OFF; LC = OFF; RA = OFF; RB = OFF; RC = OFF; end L1: begin LA = ON; LB = OFF; LC = OFF; RA = OFF; RB = OFF; RC = OFF; end L2: begin LA = ON; LB = ON; LC = OFF; RA = OFF; RB = OFF; RC = OFF; end L3: begin LA = ON; LB = ON; LC = ON; RA = OFF; RB = OFF; RC = OFF; end R1: begin LA = OFF; LB = OFF; LC = OFF; RA = ON;
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/01/2010 for the course ECE 585 taught by Professor Faust during the Fall '08 term at Portland State.

Page1 / 10

Homework1Solutions - ECE 485/585 Fall 2008 Homework 1...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online