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

Expressions

A[1]

EO

B[1]

A[2]

EO

B[2]

NR4 G

A[3]

EO

B[3]

A[0]

EO

B[0]

D[1]

ND2

 

IV

 

C[1]

H

ND2

 

NR2

 

C[0]

OR3

 

MUX21

 

 

 

 

OR2

I

D[0]

IV

 

 

 

 

EO

 

F

NR2

J

E

 

 

 

 

X8674

Figure 4-2 Circuit for Relational Operators

Adding Operators

Adding operators include arithmetic and concatenation operators.

The arithmetic operators + and - are predefined for all integer operands. These addition and subtraction operators perform conventional arithmetic. The following example uses the + operator.

The concatenation operator & is predefined for all one-dimensional array operands. The concatenation operator builds arrays by combining the operands. Each operand of & can be an array or an

VHDL Reference Guide

4-7

VHDL Reference Guide

element of an array. Use & to add a single element to the beginning or end of an array, to combine two arrays, or to build an array from

elements, as shown in the following examples. The schematic for the resulting circuits follow the examples.

signal A, D: BIT_VECTOR(3 downto 0); signal B, C, G: BIT_VECTOR(1 downto 0); signal E: BIT_VECTOR(2 downto 0); signal F, H, I: BIT;

signal

J, K,

L: INTEGER

range 0

to 3;

A <= not

B &

not C;

--

Array

&

array

D <= not

E

&

not

F;

--

Array

&

element

G

<= not

H

&

not

I;

--

Element

& element

J

<= K

+

L;

 

 

--

Simple addition

4-8

Xilinx Development System

Expressions

IV

A[0]

C[0]

IV

A[1]

C[1]

IV

A[2]

B[0]

IV

A[3]

B[1]

IV

D[0]

F

IV

D[1]

E[0]

IV

D[2]

E[1]

IV

D[3]

E[2]

IV

G[0]

I

IV

G[1]

H

EO

J[0]

L[0]

 

AN2

 

K[0]

 

EO

J[1]

K[1]

 

EO

 

L[1]

 

X8656

Figure 4-3 Circuits for Adding Operators

Unary (Signed) Operators

A unary operator has only one operand. Foundation Express predefines unary operators + and - for all integer types. The + operator has no effect. The - operator negates its operand as shown in the following example.

5 = +5

5 = -(-5)

The following example shows how unary negation is synthesized. The resulting design follows the example.

signal A, B: INTEGER range -8 to 7;

VHDL Reference Guide

4-9

VHDL Reference Guide

A <= -B;

 

 

A[0]

 

EO

A[1]

B[0]

 

 

 

EO

A[2]

B[1]

NR2

 

 

 

B[3]

OR3

 

 

EO

A[3]

B[4]

 

 

 

 

X8673

Figure 4-4 Design Illustrating Unary Negation

Multiplying Operators

Foundation Express predefines the multiplying operators (*, /, mod, and rem) for all integer types.

Foundation Express places some restrictions on the supported values for the right operands of the multiplying operators, as follows.

*—integer multiplication; no restrictions

/—integer division; The right-hand operand must be a computable power of 2 and cannot be negative. (See the “Computable Operands” section of this chapter.) This operator is implemented as a bit shift.

mod—modulus; same as /

rem—remainder; same as /

The following example shows some uses of the multiplying operators whose right operands are all powers of 2. The resulting synthesized circuit design follows the example.

4-10

Xilinx Development System

Expressions

signal A, B, C, D, E, F, G, H: INTEGER range 0 to 15;

A <= B * 4;

C <= D / 4;

E <= F mod 4;

G <= H rem 4;

VHDL Reference Guide

4-11

VHDL Reference Guide

G[3]

G[2]

E[3]

E[2]

C[3]

C[2]

A[1]

A[0]

B[0] A[2]

B[1] A[3]

B[2]

B[3]

D[2] C[0]

D[3] C[1]

D[0]

D[1]

F[0] E[0]

F[1] E[1]

F[2]

F[3]

H[0] G[0]

H[1] G[1]

H[2]

H[3]

X8655

Figure 4-5 Design Illustrating Multiplying Operators

4-12

Xilinx Development System

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