title: "<signal> is not a constant" error in if-statement
body: <p>I am trying to write a simple module to output a 14-bit number based on the value of four input signals. My attempt is shown below.</p>
  
  <pre><code>module select_size(
      input a,
      input b,
      input c,
      input d,
      output [13:0] size
  );
  
      if (a) begin
          assign size = 14'h2222;
      end
      else begin
          if (b) begin
              assign size = 14'h1111;
          end
          else begin
              if (c) begin
                  assign size = 14'h0777;
              end
              else begin
                  assign size = 14'h0333;
              end
          end
      end
  
  endmodule
  </code></pre>
  
  <p>Upon compilation, I receive the following error:</p>
  
  <blockquote>
    <p>ERROR:HDLCompiler:44 -  Line 67: c is not a constant</p>
  </blockquote>
  
  <p>I don't understand why that particular if-statement isn't working if the other two preceding it are. I have tried changing the condition to</p>
  
  <pre><code>if (c == 1) begin
  </code></pre>
  
  <p>but to no avail.</p>
  
  <p>Does anybody know how to solve this error? Thank you!</p>