Mudanças entre as edições de "VHDL:array type definition"

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
Linha 3: Linha 3:
  
 
;Examples:
 
;Examples:
 +
<syntaxhighlight lang=vhdl>
 +
type MY_WORD is array (0 to 31) of BIT;
 +
-- A memory word type with an ascending range.
 +
 +
type DATA_IN is array (7 downto 0) of FIVE_LEVEL_LOGIC;
 +
-- An input port type with a descending range.
 +
 +
type MEMORY is array (INTEGER range <>) of MY_WORD;
 +
-- A memory array type.
 +
 +
type Word is array (NATURAL range <>) of BIT;
 +
type Memory is array (NATURAL range <>) of Word (31 downto 0);
 +
constant A_Word: Word := "10011";
 +
-- The index range of A_Word is 0 to 4
 +
 +
-------
 +
-- Predefined array types(IEEE Std 1076-2008)
 +
-------
 +
type BOOLEAN_VECTOR is array (NATURAL range <>) of BOOLEAN;
 +
type BIT_VECTOR is array (NATURAL range <>) of BIT;
 +
type INTEGER_VECTOR is array (NATURAL range <>) of INTEGER;
 +
type REAL_VECTOR is array (NATURAL range <>) of REAL;
 +
type TIME_VECTOR is array (NATURAL range <>) of TIME;
 +
 +
</syntaxhighlight>

Edição das 17h05min de 18 de setembro de 2015

Syntax rule
array ( discrete_range {, ...}) of  element_subtype_indication
Examples
type MY_WORD is array (0 to 31) of BIT;
-- A memory word type with an ascending range.

type DATA_IN is array (7 downto 0) of FIVE_LEVEL_LOGIC;
-- An input port type with a descending range.

type MEMORY is array (INTEGER range <>) of MY_WORD;
-- A memory array type.

type Word is array (NATURAL range <>) of BIT;
type Memory is array (NATURAL range <>) of Word (31 downto 0);
constant A_Word: Word := "10011";
-- The index range of A_Word is 0 to 4

-------
-- Predefined array types(IEEE Std 1076-2008)
-------
type BOOLEAN_VECTOR is array (NATURAL range <>) of BOOLEAN;
type BIT_VECTOR is array (NATURAL range <>) of BIT;
type INTEGER_VECTOR is array (NATURAL range <>) of INTEGER;
type REAL_VECTOR is array (NATURAL range <>) of REAL;
type TIME_VECTOR is array (NATURAL range <>) of TIME;