title: Using assign inside a for loop
body: <p>I'm trying to assign I/O vectors inside a for loop in order to save space. I am unsure if this is not possible or I am running into a syntax issue. </p>
  
  <p>I have tried using generate and am still running into issues</p>
  
  <p>My current code is as follows:</p>
  
  <pre><code>module Test_IO
  (
       output [7:0] led,  
       input  [7:0] sw 
  );
  
  genvar i;
  generate
  for(i = 0;i &lt; 8; i = i + 1)
  {
       assign led&lt;i&gt; = sw&lt;i&gt;;
  }
  endgenerate
  
  endmodule
  </code></pre>
  
  <p>I was hoping to save space instead of having to use 8 assign statements but I have been receiving the following error:</p>
  
  <pre><code>ERROR:HDLCompiler:806 - 
  "C:/Users/Danie/Desktop/Digilent/Projects/Test_IO/Test_IO.v" Line 31: 
  Syntax error near "{".
  </code></pre>