title: Function in verilog
body: <p>I used the code below as a function in ModelSim, and it raised the error of 'Global declarations are illegal in Verilog 2001 syntax'. could anyone help me with this?</p>
  <pre><code>function [24:0] shiftright(input [24:0] in);
  integer i;
  begin
  if (in)
  for (i=0; i&lt;25; i=i+1) begin
      if (i == 24) shiftright[i]&lt;= 0;
      else shiftright[i] &lt;= in[i+1];
  end
  end
  endfunction
  </code></pre>