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 unconstrained arrays

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
In VHDL you can do the following assignment :

Code:
x <= ( others => '1' ) ;
However,
You cannot compare this way :
Code:
if x = ( others => '1' ) then
Is there a way to do it compactly without writing the whole long vector?
Code:
if x =  "1111111111111111111111111111111111111111" then
 

Good question, I will like to know that too!

But for me, since "1111111111111111111..." is a constant, will consider to declare CONSTANT in generic or library package named CONSTANT32bit1

then

Code:
if x = CONSTANT32bit1 then
..
..
end if;

if y = CONSTANT32bit1 then
..
..
end if;

---etc
 

either declare a handy constant:

constant ONES : std_logic_vector(x'range) := (others => '1');

if x = ONES then

or create the vector properly:

if x = (x'range => (others => '1') ) then

I think the first one is better.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
IIRC, you can do "x = (x'range => '1')" or "signed(x) = -1"
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top