EmbDev.net

Forum: FPGA, VHDL & Verilog Syntax Error Rectification


von Rejoy M. (Company: Lab Instructor) (rejoymathews32)


Rate this post
useful
not useful
module State_Machine(
    input button_start,
    input marbles,
    input clk,
    input player_turn_complete,
    output reg turn
    );

    reg [2:0] state;

    initial begin
        state = 0;
        turn = 0;
    end

    always @(posedge clk) begin
        case(state)
            3'b000:
                if(button_start == 1) state = 1; //button press to start 
playing
                else state = 0;
            3'b001:
                turn = 1;
                if(player_turn_complete == 1) state = 2;
                else state = 1;
        endcase
    end
endmodule

I get a syntax error near if at 'if(player_turn_complete == 1) state = 
2;'. Can someone kindly rectify the same. I am unable to figure out the 
syntax error here.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.