Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ЛО САПР / VHDL.PDF
Скачиваний:
42
Добавлен:
17.04.2013
Размер:
5.27 Mб
Скачать

Expressions

X.BYTE(2)

-- one element from array field BYTE

X.BYTE(3 downto 0) -- 4-element slice of array field -- BYTE

Slice Names

Slice names identify a sequence of elements in an array variable or signal. The syntax follows.

identifier ( expression direction expression )

identifier is the name of a signal or variable of an array type. Each expression must return a value within the array’s index range and must be computable. See the “Computable Operands” section of this chapter.

The direction must be either to or downto. The direction of a slice must be the same as the direction of the identifier’s array type. If the left and right expressions are equal, they define a single element.

The value returned to an operator is a subarray containing the specified array elements.

The following example uses slices to assign an 8-bit input to an 8-bit output, exchanging the lower and upper 4 bits. The figure for the resulting synthesized circuit design follows the example. Slices are also used as assignment targets. This usage is described in “Assignment Statements and Targets” section of the “Sequential Statements” chapter.

signal A, Z: BIT_VECTOR(0 to 7);

Z(0 to 3) <= A(4 to 7);

Z(4 to 7) <= A(0 to 3);

VHDL Reference Guide

4-27

VHDL Reference Guide

A [4] Z [0]

A [5] Z [1]

A [6] Z [2]

A [7] Z [3]

A [0] Z [4]

A [1] Z [5]

A [2] Z [6]

A [3] Z [7]

X8660

Figure 4-8 Design Illustrating Use of Slices

Limitations on Null Slices

Foundation Express does not support null slices, which are indicated by the following.

A null range, such as (4 to 3)

A range with the wrong direction, such as UP_VAR(3 downto 2) when the declared range of UP_VAR is ascending

The following example shows three null slices and one noncomputable slice.

subtype DOWN

is

BIT_VECTOR(4

downto 0);

subtype UP

is

BIT_VECTOR(0

to 7);

. . .

 

 

 

variable UP_VAR:

UP;

 

variable DOWN_VAR: DOWN;

 

. . .

 

 

 

UP_VAR(4 to 3)

-- Null

slice (null range)

UP_VAR(4 downto

0) -- Null

slice (wrong direction)

4-28

Xilinx Development System

Соседние файлы в папке ЛО САПР