Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Strange FSM behavior: it goes straight to "work" state without "wait2work"

Status
Not open for further replies.

Pavelll

Newbie level 1
Joined
Jul 18, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
Strange FSM behavior: it goes straight to "work" state without "wait2work"

Hello friends!
I use FSM in my project and it behaves very strange.
Code:
always @(*)
        case (state_global)

        `WAIT : if      (wait2pass) state_next_global = `PASS;
                else if (wait2work) state_next_global = `WORK;
		else		    state_next_global = `WAIT;

        `PASS : if      (pass2wait) state_next_global = `WAIT;

        `WORK : if      (work2wait) state_next_global = `WAIT;


        default : 		    state_next_global = `PASS;

        endcase 

always @(posedge CLK or negedge RSTn) if (!RSTn) state_global<=`WAIT;
        			      else state_global<=state_next_global;
During simulation there is never high ¨wait2work¨ signal but the state machine turns in ¨WORK¨ state. Why does it happen?
Thanks.
 

Re: Strange FSM behavior

FSM has three states, which needs 2-bits to cover all the possible states. I guess one possibility is that only 1-bit is assigned.
BTW, `PASS and `WORK state should add 'else' branch to avoid latch.


Hello friends!
I use FSM in my project and it behaves very strange.
Code:
always @(*)
        case (state_global)

        `WAIT : if      (wait2pass) state_next_global = `PASS;
                else if (wait2work) state_next_global = `WORK;
		else		    state_next_global = `WAIT;

        `PASS : if      (pass2wait) state_next_global = `WAIT; 

        `WORK : if      (work2wait) state_next_global = `WAIT;

        default : 		    state_next_global = `PASS;

        endcase 

always @(posedge CLK or negedge RSTn) if (!RSTn) state_global<=`WAIT;
        			      else state_global<=state_next_global;
During simulation there is never high ¨wait2work¨ signal but the state machine turns in ¨WORK¨ state. Why does it happen?
Thanks.

- - - Updated - - -
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top