Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Range in parameter specification of FOR GENERATE must be static

Status
Not open for further replies.

MSAKARIM

Full Member level 3
Joined
Jun 2, 2015
Messages
154
Helped
1
Reputation
2
Reaction score
4
Trophy points
1,298
Activity points
2,528
I'm working on SHA512 algorithm and i have some error in this part of code:

Code:
--padding message
mod_val<= (message'length) mod block_size;
padding_length <= ((block_size-129)+(block_size - mod_val));
padded_length <= ( message'length + (1 + padding_length) + length_bits);
message_length <= std_logic_vector(to_unsigned(message'length,length_bits)); 
padding <= "1" & std_logic_vector(to_unsigned(0,padding_length));  
padded_message <= message & padding & message_length; 
block_count<= (padded_message'length)/(block_size);


--assigning block to words
Block_loop: for block_number in 1 to block_count generate
block_block <= padded_message(((block_count - block_number) * block_size) - 1 downto (((block_count - (block_number + 1)) * block_size )))

Error : (vcom-1147) Range in parameter specification of FOR GENERATE must be static.
 

block_count isn't a constant at compile time, therefore you get an error.

For loops are NOT the same as software for loops they are unrolled at compile time generating all the iterations of the code.

The range value in a for generate loop (start to end) should both be constants. If all those signal assignments are ultimately based off of some constants make all the computations as constants and use the resulting final calculated constant for block_count instead.
 
Imagine a generate loop is there to tell the designer how many chips to place on a circuit board.
For one design it may have 6, for another it has 10 (as these may be set from generics)

But it would be impossible for that number to change while the board was switched on and running.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top