Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Digital design with CPLD applications and VHDL (R. Dueck, 2000)

.pdf
Скачиваний:
259
Добавлен:
12.08.2013
Размер:
9 Mб
Скачать

778

Answers to Selected Odd-Numbered Problems

 

 

FIGURE ANS3.3

T

 

A

 

 

U

X

B

 

 

V

Y

 

 

 

 

 

 

 

 

 

W

 

C

 

 

a.

 

 

 

 

e.

 

 

 

 

 

 

A

 

A

 

 

B

 

 

 

 

 

Y

B

 

 

 

 

 

 

 

 

Y

 

 

C

 

 

 

 

f.

 

C

 

 

 

 

 

 

 

 

h.

A

 

A

 

 

 

 

 

 

B

 

B

Y

C

 

 

Y

 

D

 

 

 

 

 

C

 

 

 

 

i.

 

j.

 

 

 

3.3See Figure ANS3.3.

Boolean expressions:

a. X T U V W;

e.Y AB AC;

f.Y (A B)(A C);

h.Y A B B C A C;

i.Y (A B) (B C) (A C) 1;

j.Y (A B C D)ABC ABC

3.5Y D3D2D1D0 D3D2D1D0 D3D2D1D0 D3D2D1D0 for a circuit that indicates that exactly three inputs are HIGH. If at least three inputs are HIGH, the

equation simplifies to Y D2D1D0 D3D1D0 D3D2D0 D3D2D1. The latter circuit is shown in Figure ANS3.5.

D3 D2 D1 D0

D3D2D1

D3D1D0

Y

D3D2D0

D2D1D0

FIGURE ANS3.5

3.7e. Y (A C) B C;

f.Y ABC C;

g.(ABD)(B C) A C;

h.Y (AB)(AC)(BC);

i.Y (A B) (A C)(BC)

All of the above equations could be simplified further with Boolean algebra.

 

 

 

 

 

 

 

Answers to Selected Odd-Numbered Problems

779

3.9 a. T

U

V

W

 

X

j. A

B

C

D

 

Y

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

0

0

 

1

 

 

 

 

 

 

 

 

 

 

0

0

0

0

 

0

 

 

0

0

0

1

 

1

0

0

0

1

 

0

 

 

0

0

1

0

 

1

0

0

1

0

 

0

 

 

0

0

1

1

 

1

0

0

1

1

 

0

 

 

0

1

0

0

 

1

0

1

0

0

 

0

 

 

0

1

0

1

 

1

0

1

0

1

 

0

 

 

0

1

1

0

 

1

0

1

1

0

 

0

 

 

0

1

1

1

 

1

0

1

1

1

 

0

 

 

1

0

0

0

 

1

1

0

0

0

 

0

 

 

1

0

0

1

 

1

1

0

0

1

 

0

 

 

1

0

1

0

 

1

1

0

1

0

 

0

 

 

1

0

1

1

 

1

1

0

1

1

 

0

 

 

1

1

0

0

 

1

1

1

0

0

 

1

 

 

1

1

0

1

 

0

1

1

0

1

 

0

 

 

1

1

1

0

 

1

1

1

1

0

 

1

 

 

1

1

1

1

 

1

1

1

1

1

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

h. A

B

C

Y

 

 

 

 

 

0

0

0

0

0

0

1

0

0

1

0

1

0

1

1

1

1

0

0

0

1

0

1

0

1

1

0

1

1

1

1

0

 

 

 

 

 

i. A

B

C

Y

 

0

0

0

1

0

0

1

1

0

1

0

1

0

1

1

1

1

0

0

1

1

0

1

1

1

1

0

1

1

1

1

1

 

 

 

 

 

3.11SOP: Y A B C A B C A B C A B C

POS: Y (A B C)(A B C)(A B C) (A B C)

See Figure ANS3.11

A

B

C

 

 

Y (SOP)

 

 

Y (POS)

FIGURE ANS3.11

780

Answers to Selected Odd-Numbered Problems

 

 

3.13 SOP: Y A B C A B C A B C A B C A B C

3.29

Y A B C D A B C D BC

 

POS: Y (A B C)(A B C)(A B C)

3.31

Y A B C A B C A B D A D

 

See Figure ANS3.13

 

See Figure ANS3.31.

 

 

 

 

 

3.33

Y A B CD See Figure ANS3.33.

A

B

C

 

ABC

 

ABD

 

 

 

CD

 

 

 

 

 

 

 

 

 

 

 

AB

00

01

11

10

 

 

 

00

1

1

1

0

 

 

 

01

0

0

0

0

 

 

 

11

1

1

0

1

 

 

Y

ABC

 

 

 

 

 

 

 

10

1

0

0

1

 

 

 

 

 

 

 

AD

 

 

 

FIGURE ANS3.31

 

 

 

 

 

 

 

3.35 Y AD BC See Figure ANS3.35.

FIGURE ANS3.13

 

 

 

 

 

 

 

 

 

CD

 

CD

 

 

 

 

 

 

 

 

 

3.15 Y (A B)(A B) See Figure ANS3.15.

AB

00

01

11

10

 

 

 

00

0

0

1

0

A

B

 

 

 

 

 

AB

 

01

1

1

1

1

 

 

 

 

 

 

11

0

0

1

0

 

 

 

10

0

0

1

0

 

 

Y (A B)(A B)

FIGURE ANS3.33

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3.37 Y AB C D AD CD. See Figure ANS3.37.

FIGURE ANS3.15

3.17Y (A B C)D AD BD CD

3.19 a. Y AB C;

b. Y C;

c. J K;

d. S 0;

e. S T;

f. Y B C D A B F C F

3.21a. Y A B;

b.Y C D C D A B;

c.K MN ML

3.23SOP: Y A C B C; POS: Y (A B)C

3.25Y AD BC

3.27Y AD CD BCD

CD

 

 

 

 

 

 

AB

00

01

11

10

BC

00

0

0

1

1

 

 

01

0

0

0

0

 

 

11

X

X

X

X

 

 

10

0

1

X

X

 

 

 

AD

 

 

 

 

 

FIGURE ANS3.35

 

 

 

 

 

 

 

 

 

 

 

 

Answers to Selected Odd-Numbered Problems

781

3.39 Y AB CD AB BD. See Figure ANS3.39.

3.45 Y (A C)(A C)(A B D). See Figure

 

CD

 

 

 

 

 

 

 

 

 

 

 

 

 

CD

 

 

 

 

 

 

 

 

 

 

 

 

 

AD

 

 

 

 

 

 

 

 

 

AB

00

01

11

10

AB

00

01

11

10

 

 

 

 

00

0

1

1

CD

00

0

0

0

0

 

 

 

 

0

 

 

 

 

01

0

1

1

0

01

0

0

1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BCD

 

11

0

0

1

0

 

 

11

1

1

1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AC

 

 

 

 

 

 

 

 

10

1

0

1

0

10

1

1

1

1

 

 

 

 

AB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ABCD

 

FIGURE ANS3.43

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

FIGURE ANS3.37.

ANS3.45.

3.41Y D. See Figure ANS3.41.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CD

 

(A B D)

 

 

 

 

CD

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AB

00

01

11

 

 

10

 

 

 

AB

00

01

11

 

10

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00

0

0

0

 

 

 

0

BD

 

 

00

1

0

0

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(A

 

 

01

1

1

1

 

 

1

 

 

 

 

 

 

 

01

1

1

0

 

 

0

C)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AB

 

 

 

 

 

 

 

 

 

 

 

 

11

1

0

0

 

 

1

 

 

 

 

 

 

 

11

0

0

1

 

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

10

0

1

0

 

 

0

 

 

 

 

 

 

 

10

0

0

1

 

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ABCD

 

 

 

 

 

 

 

 

 

 

 

(A C)

 

 

 

 

FIGURE ANS3.39

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

a. K-map

 

 

 

 

3.43Y AC AB BCD. See Figure ANS3.43.

CD

 

 

 

 

AB

00

01

11

10

00

0

1

1

0

01

0

1

1

0

A

B

Y

C

D

11

0

1

1

0

b. Circuit

 

 

 

 

 

10

0

1

1

0

FIGURE ANS3.45

 

 

 

 

D

 

FIGURE ANS3.41

782

Answers to Selected Odd-Numbered Problems

 

 

 

 

 

 

 

 

 

 

 

 

D4

D3

D2

D1

D2 D1

 

 

 

D2 D1

 

 

 

 

 

 

D4 D3

00

01

11

10

D4 D3

00

01

11

10

 

 

 

00

0

0

0

0

00

0

1

1

1

 

 

E4

01

0

1

1

1

01

1

0

0

0

 

 

 

11

X

X

X

X

11

X

X

X

X

 

 

 

10

1

1

X

X

10

0

1

X

X

 

 

 

 

 

 

E4

 

 

 

 

E3

 

 

 

E3

 

 

 

 

 

 

 

 

 

 

 

 

D2 D1

 

 

 

D2 D1

 

 

 

 

 

 

D4 D3

00

01

11

10

D4 D3

00

01

11

10

 

 

 

00

1

0

1

0

00

1

0

0

1

 

 

 

01

1

0

1

0

01

1

0

0

1

 

 

E2

 

 

 

 

 

 

 

 

 

 

 

 

11

X

X

X

X

11

X

X

X

X

 

 

 

10

1

0

X

X

10

1

0

X

X

 

 

E1

 

 

 

 

 

 

 

 

E1

 

 

 

 

 

 

E2

 

 

 

 

 

 

 

 

FIGURE ANS3.47

3.47E4 D4D2 D3D1 D3D2 E3 D3D2 D3D1 D3D2D1 E2 D2D1 D2 D1

E1 D1

See Figure ANS3.47.

Chapter 4

4.1Advantages of programmable logic: User is not restricted to standard digital functions from a device manufacturer; only required functions need be implemented; package count can be reduced; design can be reprogrammed or reconfigured without changing the circuit board.

4.3PAL (Programmable Array Logic); GAL (Generic Array Logic); EPLD (Erasable Programmable Logic Device); FPGA (Field-Programmable Gate Array)

4.5A design file in MAX PLUS II is a single file with descriptive information, such as a schematic or text in a hardware description language. A project is a collection of files associated with a design entered in MAX PLUS II.

4.7Primitives—Basic functional blocks, such as logic gates, used in PLD design files.

Instance—A single copy of a component in a PLD design file.

4.9The gdf for the 4-channel demultiplexer circuit is shown in Figure ANS4.9.

4.11The gdf for the half adder is shown in Figure ANS4.11a. The default symbol for the half adder is shown in Figure ANS4.11b.

4.13The gdf for the full adder (hierarchical design) is shown in Figure ANS4.13

4.15AHDL—Altera Hardware Description Language

VHDL—VHSIC Hardware Description Language

VHSIC—Very High Speed Integrated Circuit

4.17The two minimum VHDL structures are an entity declaration and an architecture body. The entity describes the input and output terminals of the design. The architecture defines the relationship between the inputs, outputs, and internal signals of the design.

4.19A VHDL port of mode OUT can be used as an output only. A port of mode BUFFER is an output that can also be fed back into the design entity for use by other functions within the entity.

FIGURE ANS4.9

FIGURE ANS4.11

Answers to Selected Odd-Numbered Problems

783

 

 

 

 

AND3

 

 

INPUT

 

OUTPUT

D

 

 

Y0

 

VCC

 

14

 

 

 

22

 

 

 

 

AND3

 

 

 

 

OUTPUT

 

 

 

 

Y1

 

 

 

 

19

 

 

 

 

23

 

 

 

 

AND3

 

 

 

 

OUTPUT

 

 

 

 

Y2

 

 

 

 

20

 

 

 

 

24

 

 

 

 

AND3

 

 

 

 

OUTPUT

 

 

 

 

Y3

 

 

 

NOT

21

 

 

INPUT

25

S1

 

 

 

 

 

 

VCC

 

 

 

 

8

 

 

 

 

 

 

 

INPUT

 

NOT

S0

 

 

 

 

VCC

 

 

 

 

 

7

 

 

 

 

 

A

INPUT

 

AND2

 

 

OUTPUT

 

VCC

 

 

 

 

SUM

 

B

INPUT

 

A

 

VCC

 

 

 

 

1

 

 

 

 

 

 

 

 

XOR

 

 

 

 

CARRY

 

 

 

 

B

 

 

 

 

2

a. Half Adder Circuit

halfadd

ASUM

BCARRY

1

b. Symbol

 

 

 

 

halfadd

 

 

 

 

halfadd

 

 

 

 

 

 

 

A

INPUT

 

 

 

 

 

 

 

 

 

 

 

OUTPUT

 

 

 

 

 

 

 

 

A

SUM

 

 

 

A

SUM

 

 

 

 

 

 

SUM

 

 

VCC

 

 

 

 

 

 

 

 

 

 

 

A

B

INPUT

B

CARRY

 

 

 

B

CARRY

 

 

 

 

 

 

 

VCC

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

11

 

 

 

 

12

 

 

 

 

 

 

 

 

 

 

 

INPUT

 

 

 

 

 

 

 

OR2

CARRY_IN

 

 

 

 

 

 

 

 

 

 

 

OUTPUT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CARRY_OUT

 

VCC

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

B

 

 

 

 

 

 

 

 

10

 

 

 

 

 

 

 

 

 

 

 

 

 

FIGURE ANS4.13

784 Answers to Selected Odd-Numbered Problems

4.21—— mux4.vhd

——4-to-1 multiplexer

——Directs one of four input signals (d0 to d3) to output,

——depending on status of select bits (s1, s0).

——STD_LOGIC types

LIBRARY ieee;

USE ieee.std_logic_1164.ALL;

—— Define inputs and outputs

 

ENTITY mux4 IS

 

 

PORT(

d0, d1, d2, d3

: IN STD_LOGIC;

—— data inputs

s: IN STD_LOGIC_VECTOR (1 downto 0); —— select inputs y: OUT STD_LOGIC);

END mux4;

—— Define i/o relationship ARCHITECTURE mux4to1 OF mux4 IS BEGIN

——Choose a signal assignment for y

——based on binary value of d

——Default case: output LOW

WITH s SELECT

y <= d0 WHEN “00”, d1 WHEN “01”, d2 WHEN “10”, d3 WHEN “11”, ‘0’ WHEN others;

END mux4to1;

4.23—— dmux4.vhd

——4-channel demultiplexer

——Directs input to one of four outputs,

——depending on state of select inputs (s1, s0)

——Standard VHDL models

LIBRARY ieee;

USE ieee.std_logic_1164.ALL;

—— Define inputs and outputs ENTITY dmux4 IS

PORT(

d, s1, s0

: IN

STD_LOGIC;

y0, y1, y2, y3

: OUT

STD_LOGIC);

END dmux4;

 

 

—— Define i/o relationship ARCHITECTURE four_ch_dmux OF dmux4 IS BEGIN

——Concurrent Signal Assignment

y0

<=

(not

s1)

and (not

s0)

and d;

y1

<=

(not

s1)

and (

s0)

and d;

y2

<=

(

s1)

and

(not

s0)

and d;

y3

<=

(

s1)

and

(

s0)

and d;

END four_ch_dmux;

4.25—— half add.vhd

——Half Adder

——Adds two bits, A and B and produces SUM and CARRY outputs

——Standard VHDL models

Answers to Selected Odd-Numbered Problems

785

LIBRARY ieee;

USE ieee.std_logic_1164.ALL;

——Define inputs and outputs ENTITY half_add IS

PORT(

a, b : IN STD_LOGIC; sum, carry : OUT STD_LOGIC);

END half_add;

——Define relationship between A, B and SUM, CARRY ARCHITECTURE half_adder OF half_add IS

BEGIN

— Concurrent Signal Assignment

sum <=

a

xor

b;

carry <=

a

and

b;

END half_adder;

 

 

4.27 The gdf for the full adder with VHDL half adder compo-

Chapter 5

nents is the same as Figure ANS4.13.

5.1

1100, 0001, 1111; Y D3D2D1D0; Y D3D2D1D0;

 

 

Y D3D2D1D0

 

5.3

See Figure ANS5.3.

FIGURE ANS5.3

D1

INPUT

 

 

D0

INPUT

INPUT

G

 

NOT

NOT

NOT

AND3

OUTPUT

Y0

AND3

OUTPUT

Y1

AND3

OUTPUT

Y2

AND3

OUTPUT

Y3

786 Answers to Selected Odd-Numbered Problems

5.5

a 32;

b. 64;

c. 256; m 2n.

5.7A selected signal assignment assigns an output value based on alternative input values. Each choice is independent of the others. A conditional signal assignment evaluates one input choice and assigns a value to an output if true. Otherwise, a second choice is evaluated, then a third, and so on. Low-priority choices are assigned only if

FIGURE ANS5.9A

higher-priority alternatives are false. This linked conditional structure tends to generate a more “serial” hardware, as opposed to the more “parallel” structure of the selected signal assignment. The selected signal assignment is preferable because it is generally results in a better use of chip resources and is more efficient.

5.9See Figures ANS5.9a and ANS5.9c.

FIGURE ANS5.9C

FIGURE ANS5.11

5.11See Figure ANS5.11.

5.13 a D3D2D1D0 D3D2D1D0 D3D2D1D0 D3D2D1D0

b D3D2D1D0 D3D2D1 D3D2D0 D3D1D0 D2D1D0

c D3D2D1D0 D3D2D1D0 D3D2D1

d D3D2D1D0 D3D2D1D0 D3D2D1D0 D2D1D0 e D3D0 D3D2D1 D2D1D0

f D3D2D0 D3D2D1 D3D1D0 D3D2D1D0 g D3D2D1 D3D2D1D0 D3D2D1D0

5.17 a. 1000;

b. 1001;

c. 1001

5.19See Figures ANS5.19a and b.

5.21See Figure ANS5.21.

Answers to Selected Odd-Numbered Problems

787

Truth Table for an 8-to-1 MUX

S2

S1

S0

Y

 

 

 

 

0

0

0

D0

0

0

1

D1

0

1

0

D2

0

1

1

D3

1

0

0

D4

1

0

1

D5

1

1

0

D6

1

1

1

D7

 

 

 

 

Truth Table for a 16-to-1 MUX

S3

S2

S1

S0

Y

 

 

 

 

 

0

0

0

0

D0

0

0

0

1

D1

0

0

1

0

D2

0

0

1

1

D3

0

1

0

0

D4

0

1

0

1

D5

0

1

1

0

D6

0

1

1

1

D7

1

0

0

0

D8

1

0

0

1

D9

1

0

1

0

D10

1

0

1

1

D11

1

1

0

0

D12

1

1

0

1

D13

1

1

1

0

D14

1

1

1

1

D15