Syntax Error Rectification

OP (Company: Lab Instructor) #5415729
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.

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.