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.

Assigning a null array in VHDL

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
Hello,

In a package I have the following definition of a unconstrained unsigned array:
Code:
type array_1d_unsigned is array ( integer range <> ) of unsigned ;
In another file I have an input port named 'x' that is of that type:
Code:
entity some_entity is
(
x : array_1d_unsigned  
) ;
While instantiating the entity, I want x to be assigned with a null array.
Code:
inst_some_entity : some_entity
(
x => -- I want to assign a null array here.  
) ;
What's the correct syntax for that ?
 

You'll need to create a null constant (or signal):


Code VHDL - [expand]
1
2
3
4
5
constant NULL_ARRAY : array_1d_unsigned(1 to 0)(1 to 0) := (others => "");
 
..
 
x => NULL_ARRAY,



Because its unconstrained, you cannot do it inline, because OTHERS is not allowed in an unconstrained context
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
This is what I tried to do.
But how will the definition of that constant look?
Please show an example.
 

I dont understand what you mean, I showed you how to define the constant.
 

Sorry.
I viewed this on my cellphone first.
And what you wrote in the line of code didn't show.

Forum admins - please note of this problem.
A snapshot of how this looks on my phone is attached. no_text.JPG
 

Sorry.
I viewed this on my cellphone first.
And what you wrote in the line of code didn't show.

Forum admins - please note of this problem.
A snapshot of how this looks on my phone is attached.View attachment 156581

You can't use the mobile site if you want to see any attachments. The forum on the mobile site is text based only.

Use the full site.
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
TrickyDicky,

The solution with the constant worked.
But what if x was an array of integers ?
Code:
type array_1d_integer is array ( integer range <> ) of integer ;
Can you post an example of a null array instantiation of this type ?
 

A NULL array is defined as array with 0 length. ie. one with a range where 'left is higher than 'right in the case of to, and 'left is less that 'right when using downto.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top