There are a couple of errors in your code -
You missed the "end" after the "endcase" statement. The end is required for the begin block just before the case statement.
You have added ";" in the always block declaration.
always@(posedge clk);
begin
state = next_state;
tt = tt - 1;
end
There is no need of an ";" in the always block.
module TrafficLight(t, state, next_state, clk, out);
input t, clk;
output out;
localparam s0=3'b000, s1=3'b001, s2=3'b010, s3=3'b011, s4=3'b100, s5=3'b101;
reg[2:0] state, next_state, tt;
In the above snippet I see that you have added "state" and "next_state" as ports to the module but haven't assigned any direction to them. Either remove them as ports or make them as "input" or "output".
You would also need to remove the "assign" statement when driving the out reg. Since it is inside a procedural block you don't need an "assign" here.
You can find all the updates to your code here
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…