Hey guys! I'm working on a project and I have a problem with the construction of the following module:
module posiciones( input logic clk, reset,
input logic n, s, w, e, esp,
output logic secue,
output logic [2:0] art);
// Contador
logic [3:0] counter;
//Definición de Estados
typedef enum logic [2:0] {Cueva, Tunel, Taberna, Cuarto, Garganta, Tesoro, Cementerio} statetype;
statetype [2:0] state, nextstate;
//Lógica secueuencial
always_ff@(posedge clk, posedge reset)
if (reset)
begin
state <= Cueva;
counter <= 4'b0000;
secue <= 0;
end
else if(counter == 4'b1111)
begin
state <= nextstate;
counter <= 4'b0000;
end
else
begin
state <= state;
counter <= counter + 4'b0001;
end
//Lógica Combinacional - Cambio de Estado
always_comb
case (state)
Cueva: if (n&e) nextstate = Tunel;
else if (~(n&e)) nextstate = Cueva;
Tunel: if (s) nextstate = Taberna;
else nextstate = Tunel;
Taberna: if (e) nextstate = Garganta;
else if (w) nextstate = Cuarto;
else nextstate = Taberna;
Cuarto: if (e) nextstate = Taberna;
else nextstate = Cuarto;
Garganta: if (esp) nextstate = Tesoro;
else nextstate = Cementerio;
Tesoro: nextstate = Tesoro;
Cementerio: nextstate = Cementerio;
endcase
// Lógica Combinacional - Salidas
assign art = state;
assign secue = (state == Cuarto);
endmodule
The Error says:
ERROR: [VRFC 10-1546] variable secue might have multiple concurrent drivers
and it is provocated by the line " assign secue = (state == Cuarto)".
How could I fix this?