title: "Multiple Constant Drivers" Error Verilog with Quartus Prime
body: <p>I am working on designing a finite state machine in Verilog to represent a stack. The module is as follows:</p>
  
  <pre><code>module state_machine (s, Enable, Clock, Resetn, c, OF_Err, UF_Err);
  input [2:0] s;
  input Enable, Clock, Resetn;
  output reg [1:0] c;
  output reg OF_Err = 0, UF_Err = 0;
  reg [2:0] y, Y;
  parameter [2:0] A = 3'b000, B = 3'b001, C = 3'b010, D = 3'b011, E = 3'b100;
  
  always @(s, y, Enable)
      if (Enable)
          begin
              case (y)
                  A: if (s == 3'b000) Y = B;
                      else
                          begin
                              Y = A;
                              UF_Err = 1;
                          end
  
                  B: if (s == 3'b000) Y = C;
                      else if (s == 3'b001) Y = A;
                      else
                          begin
                              Y = B;
                              UF_Err = 1;
                          end
  
                  C: if (s == 3'b000) Y = D;
                      else if (s == 3'b100) Y = C;
                      else Y = B;
  
                  D: if (s == 3'b000) Y = E;
                      else if (s == 3'b100) Y = D;
                      else Y = C;
  
                  E: if (s == 3'b000)
                          begin
                              Y = E;
                              OF_Err = 1;
                          end
                      else if (s == 3'b100) Y = E;
                      else Y = D;
  
                  default: Y = 3'bxxx;
              endcase
  
              c[1] = y[1];
              c[0] = y[0];
          end
  
  always @(negedge Resetn, posedge Clock)
      begin
          if (Resetn == 0)
              begin
                  y &lt;= A;
                  OF_Err = 0; //Problem
                  UF_Err = 0; //Problem
              end
          else y &lt;= Y;
      end
  </code></pre>
  
  <p><code>OF_Err</code> and <code>UF_Err</code> are indicators of overflow and underflow errors, respectively.</p>
  
  <p>However, I get the following errors when compiling my project:</p>
  
  <p><code>Error (10028): Can't resolve multiple constant drivers for net "OF_Err" at state_machine.v(59)
  Error (10029): Constant driver at state_machine.v(10)
  Error (10028): Can't resolve multiple constant drivers for net "UF_Err" at state_machine.v(59)</code></p>
  
  <p>These only appeared after I added the commented lines. I want to reset the over- and underflow indicators when the FSM is reset, but I can't do it the way I have it. How do I go about doing this?</p>
  
  <p>(If it's of any value, this is to be executed on an Altera DE2-115).</p>