Please help with for loop problem I think

The favorite HDL language in North America

Please help with for loop problem I think

Postby randomcodejb » Mon May 31, 2010 7:20 pm

Hi, I am new to coding and am getting this error
"Bin_BCD.v" line 31 expecting 'endmodule', found 'for'
from the compiler with this code
Code: Select all
module Bin_BCD(
    input [7:0] binNum, clk,
    output [9:0] BCDNum
    );
   
   reg [9:0] tmp;
   reg [7:0] count;
  initial tmp = 0;
// initial count =7;
 
   for( i=7; i >= 0;i=i-1)
   begin
      tmp = tmp << 1;
      tmp[0] = binNum[i];
      if(tmp[3:0] > 4'b0100)
      begin
         tmp[3:0] = tmp[3:0] + 1;
      end
      if(tmp[7:4] > 4'b0100)
      begin
         tmp[7:4] = tmp[7:4] + 1;
      end      
   end
         
endmodule

but I have no idea why or how to fix it could someone please help me?
randomcodejb
 
Posts: 1
Joined: Mon May 31, 2010 6:20 pm

Return to Verilog HDL