Author Topic: SystemVerilog - Multiple concurrent drivers  (Read 789 times)

0 Members and 1 Guest are viewing this topic.

Offline santyp18Topic starter

  • Newbie
  • Posts: 1
  • Country: ec
SystemVerilog - Multiple concurrent drivers
« on: May 10, 2022, 10:47:05 am »
Hey guys!  I'm working on a project and I have a problem with the construction of the following module:

Code: [Select]
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?

 

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: SystemVerilog - Multiple concurrent drivers
« Reply #1 on: May 10, 2022, 11:38:38 am »
.
« Last Edit: August 19, 2022, 05:25:19 pm by emece67 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf