title: Parameter array in SystemVerilog
body: <p>In systemverilog, it allows passing parameter array to lower module. Currently I have two .sv modules with parameters that use such feature. Below, <code>lowMod</code> is being instantiated in <code>uppMod</code>.</p>
  
  <pre><code>module lowMod #(parameter logic row [0:2], parameter logic col [0:1])
                 (output logic a, input logic b);
  
       // main body of codes...
  
  endmodule
  </code></pre>
  
  <p>and here's the uppMod.</p>
  
  <pre><code>module uppMod #(parameter logic row [0:4], parameter logic col [0:3])
                 (output logic a, input logic b);
  
       lowMod #(row[1:3], col[0:1]) unit01 (.);
       lowMod #(row[1:3], col[2:3]) unit02 (.);
  
       // rest of codes...
  
  endmodule
  </code></pre>
  
  <p>Constant values are assigned as parameters to the uppMod in testbench, and it works perfectly for behavioural simulation on Modelsim. But when I <code>read</code> it on DC Compiler, complaint pops up</p>
  
  <blockquote>
    <p>Syntax error at or near token ','. (VER-294)</p>
  </blockquote>
  
  <p>It complains about the comma when declaring the parameter array. Presumably, I think DC uses VCS-like Verilog simulator (is that right?), and it seems, in contrast to Modelsim, DC doesn't like this syntax. </p>
  
  <p>So is there anyway to make it work? I am actually doing something like this, where these arrays are initialised to some values...</p>
  
  <pre><code>module uppMod #(parameter logic row [0:4] = '{1,1,1}, parameter logic col [0:3] = '{1,1})
                 (output logic a, input logic b);
  
       lowMod #(row[1:3], col[0:1]) unit01 (.);
       lowMod #(row[1:3], col[2:3]) unit02 (.);
  
       // rest of codes...
  
  endmodule
  </code></pre>
  
  <p>so that when I elaborate the design on DC, my hope is to tune the parameters to the values I want, by </p>
  
  <pre><code>elaborate -library WORK -parameters "row[0:4]=&gt;'{1,2,3,4,5}, col[0:3]=&gt;'{1,2,3,4}"
  </code></pre>
  
  <p>But that doesn't work either.</p>
  
  <blockquote>
    <p>Error:  Syntax error in parameter value list at or near token '[0:4]' (string position 7). (VER-279)</p>
  </blockquote>
  
  <p>Any thoughts?</p>
  
  <p>Thanks for your time in advance. </p>
  
  <p>Tidus</p>