Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

VHDL question

Altera_Forum
Honored Contributor II
1,387 Views

Hi all! 

 

According to std.standard: 

 

TYPE string IS ARRAY ( positive RANGE <> OF character); 

 

"hello" is a valid string litteral 

"" is a valid string litteral too, it is the empty string. 

 

 

Let 

 

TYPE foo IS ARRAY ( positive RANGE <> OF integer); 

 

(0, 1, 1, 2, 3, 5) is a valid foo litteral 

 

What is the litteral for an empty foo? 

 

Thx 

 

Julien
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
518 Views

Did you try () or (null)?

0 Kudos
Altera_Forum
Honored Contributor II
518 Views

The only way I know is to create a null array constant, and use that in place of a literal: 

 

constant NULL_FOO : foo(1 downto 2) := (others => 0);
0 Kudos
Altera_Forum
Honored Contributor II
518 Views

yes. 

 

neither of these work :(
0 Kudos
Altera_Forum
Honored Contributor II
518 Views

OK for 1 downto 2 range. 

 

Any other (cleaner) way?
0 Kudos
Altera_Forum
Honored Contributor II
518 Views

I dont think there is. Could you explain why you want to do it? 

 

another less "clean" way - declare a pointer to foo. 

 

type foo_ptr_t is access foo; 

 

variable foo_ptr : foo_ptr_t; 

 

and then you can actually compare it to null: 

 

if foo_ptr = null then 

...etc 

 

But that is getting rather extreme.
0 Kudos
Reply