I am trying to compile the following code but whenever I do I get the errors:
'10170 Verilog HDL syntax error at FSM.v(9) near text "case"; expecting an operand'
'10170 Verilog HDL syntax error at FSM.v(9) near text ")"; epecting "<=" or "="'
'10170 Verilog HDL syntax error at FSM.v(11) near text "4"; expecting "end"'
module FSM (in0, in1, in2, in3, S, out0, out1, out2, out3);
input in0, in1, in2, in3, S;
output out0, out1, out2, out3;
reg out0, out1, out2, out3;
always @(in0 or in1 or in2 or in3 or S)
begin
if(S == 0) begin
{
case({in3, in2, in1, in0})
4'b0000: {out3, out2, out1, out0} = 4'b0000; //0->0
4'b0001: {out3, out2, out1, out0} = 4'b0011; //1->3
4'b0010: {out3, out2, out1, out0} = 4'b0110; //2->6
4'b0011: {out3, out2, out1, out0} = 4'b1001; //3->9
4'b0100: {out3, out2, out1, out0} = 4'b0010; //4->2
4'b0101: {out3, out2, out1, out0} = 4'b0101; //5->5
4'b0110: {out3, out2, out1, out0} = 4'b1000; //6->8
4'b0111: {out3, out2, out1, out0} = 4'b0001; //7->1
4'b1000: {out3, out2, out1, out0} = 4'b0100; //8->4
4'b1001: {out3, out2, out1, out0} = 4'b0111; //9->7
endcase
}
end
else begin
{
case({in3, in2, in1, in0})
4'b0000: {out3, out2, out1, out0} = 4'b0111; //0->7
4'b0001: {out3, out2, out1, out0} = 4'b1000; //1->8
4'b0010: {out3, out2, out1, out0} = 4'b1001; //2->9
4'b0011: {out3, out2, out1, out0} = 4'b0000; //3->0
4'b0100: {out3, out2, out1, out0} = 4'b0001; //4->1
4'b0101: {out3, out2, out1, out0} = 4'b0010; //5->2
4'b0110: {out3, out2, out1, out0} = 4'b0011; //6->3
4'b0111: {out3, out2, out1, out0} = 4'b0100; //7->4
4'b1000: {out3, out2, out1, out0} = 4'b0101; //8->5
4'b1001: {out3, out2, out1, out0} = 4'b0110; //9->6
endcase
}
end
end
endmodule
with the last error repeating for every line of code that's found in the case statements. If anyone has an idea of what I have wrong and how I could fix this I'd greatly appreciate it!