So I am currently facing an issue where break; statements aren't allowed in verilog? Is there an alternative to this? I've tried disable block_to_disable, but that did not solve anything. Is there possibly an easy fix or is Verilog unable to do this? I only ask since Verilog is a derivation of C. Thank you for your time and help.
module prj2(input [2:0] usr, input button, output reg [6:0] stage);
//input button
reg currentState = 0;
reg tracker = 0;
reg stage_0 = 0;
reg stage_1 = 1;
reg stage_2 = 2;
reg stage_3 = 3;
reg stage_4 = 4;
reg winner = 5;
/*stage is read in binary
stage 0 = 1
stage 1 = 2
stage 2 = 4
stage 3 = 8
stage 4 = 16
stage win[5] = 32 NO STAGE WIN
*/
/*r/p/s is read in binary
0: rock = 1
1: scissors = 2
2: paper = 4
*/
always @ (button) //start of the action section
begin
case(currentState)//draw and loss are the same
/*=======================================================================================*/
0://using scissors
if(usr == 1)
begin //beat scissors so use rock
tracker <= stage_1;
currentState <= stage_1; //moved to state 1
stage <= 2; //stage_1
//disable block_to_disable;
end
else begin//don't move
tracker <= stage_0;
currentState <= stage_0; //stay in same state
stage <= 1; //stage_0
//disable block_to_disable;
end
/*=======================================================================================*/
1://using rock
if(usr == 4) begin//beat rock so use paper
tracker <= stage_2;
currentState <= stage_2; //moved to state 2
stage <= 4; //stage_2
//disable block_to_disable;
end
else begin //move back to state 1
tracker <= stage_0;
currentState <= stage_0; //go back to previous state
stage <= 1; //stage_0
//disable block_to_disable;
end
//break;
/*=======================================================================================*/
endcase //end case
end //end begin that comes after always()
endmodule //end the actual module