I am relatively very new(just a few hours old) in Xilinx ISE verilog coding. This is my code from my uni project. And it shows syntax error on the count = 0 line. I dont see anything wrong here upon running check syntax. How do i fix this?
module syncdown(clk,rst,count);
input clk,rst;
output reg [3:0] count = 1;
always @(posedge clk);
begin
if(rst)
count = 0; // wrong here
else
count = count-1;
end
endmodule
The error
ERROR:HDLCompiler:806 - "/home/bossman/mux/syncdown.v" Line 8: Syntax error near "=".
Remove the semicolon at the end of the always
line:
module syncdown(clk,rst,count);
input clk,rst;
output reg [3:0] count = 1;
always @(posedge clk)
begin
if(rst)
count = 0; // wrong here
else
count = count-1;
end
endmodule