EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

empty array litteral

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - VHDL Language - empty array litteral

Julien REINAULD
Guest

Wed Jul 13, 2011 2:54 pm   



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

Tricky
Guest

Wed Jul 13, 2011 3:25 pm   



On Jul 13, 1:54 pm, Julien REINAULD <julien.reina...@gmail.com> wrote:
Quote:
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

That is an interesting question.

You can make a null constant like this:

constant NULL_FOO : foo(1 downto 2) := (others => 0);

then use the constant in place of a literal.

Alan Fitch
Guest

Mon Jul 18, 2011 11:09 pm   



On 13/07/11 14:25, Tricky wrote:
Quote:
On Jul 13, 1:54 pm, Julien REINAULD <julien.reina...@gmail.com> wrote:
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

That is an interesting question.

You can make a null constant like this:

constant NULL_FOO : foo(1 downto 2) := (others => 0);

then use the constant in place of a literal.


I haven't tried it, or looked it up in the LRM, but I imagine you may be
able to use

(1 downto 2 => 0)

though of course a named constant is nicer.

regards
Alan

--
Alan Fitch

elektroda.net NewsGroups Forum Index - VHDL Language - empty array litteral

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony