[SOLVED] how to initialize an array with zeros in verilog

Status
Not open for further replies.

Mina Magdy

Member level 3
Joined
Jun 19, 2012
Messages
67
Helped
6
Reputation
12
Reaction score
5
Trophy points
1,288
Location
Cairo, Egypt
Visit site
Activity points
1,742
please i want to know how to initialize an array with zeros case when i do this

for(i=0;i<9000;i=i+1)
begin
parity=0;
end


it gives me this Loop count limit exceeded. Condition is never false.
please help thanks in advance
 

To get around this specific limitation do:

Right mouse button on "Synthesize - XST" ==> Process Properties => Synthesis Options => Other XST Command Line Options => and then add this option: "-loop_iteration_limit 12345"

And don't forget to put it in an initial block, so something like:


Code Verilog - [expand]
1
2
3
4
5
6
integer i;
initial begin
    for (i=0;i<9000;i=i+1) begin
        parity[i]=0;
    end
end


And this is all assuming that you chose this particular method because there is no other cleaner method to initialize it. And I am also assuming that when you say initialize, you actually mean initialize. Some other ideas as inspiration:


Code Verilog - [expand]
1
2
reg [8999:0] parity = 0; // This will also initialize it with zero's, no loop required
reg [8999:0] more_parity = {4500{2'b10}}; // initialize with 101010.... pattern



This will synthesize just fine, and will fill those flip-flops with the required initial values.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…