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.

VHDL bit assignments

Status
Not open for further replies.

shaiko

Advanced Member level 5
Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Visit site
Activity points
18,302
Code:
signal x : ( A downto B ) ; -- A and B are entity generics
suppose we want to assign location 'B' with '1' and all the other bits with '0'.
If A is 7 and B is 0 then signal x becomes ( 7 downto 0 ) and we can write:
Code:
x <= ( 7 downto 1 => '0' , 0 => '1' );
But if we keep it generic and write
Code:
x <= ( x ' high downto x ' low + 1 => '0' , x ' low => '1' ) ;
it fails in compilation with the following message:
Non-locally static choice (association #1, choice #1) is allowed only if it is the only choice of the only association.
Please advice.
 

Like it says, the values are not static. Therefore, you cannot assign the values like that.
Therefore, why not just try (I cant remember if generics are counted as locally static):

x <= (A downto B+1 => '0', B => '1');

- - - Updated - - -

or even tidier:
x <= (B => '1', others => '0');
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top