Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 8182

Скачиваний: 6

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

698

A P P E N D I X B • VHDL Language Reference

END COMPONENT;

(example continues)

BEGIN

—— component instantiation

Shift_right_8: srt_bhv

GENERIC MAP (width=> 8)

PORT MAP (serial_in => data_in,

clk

=> clock,

q

=> qo);

END right_shift;

2.5 Generate Statement

A generate statement is used to create multiple instances of a particular hardware structure. It relies on the value of one or more index variables to create the required number of repetitions.

Syntax:

__generate_label:

FOR __index_variable IN __range GENERATE __statement;

__statement; END GENERATE;

EXAMPLES: —— Instantiate four full adders adders:

FOR i IN 1 to 4 GENERATE

adder: full_add PORT MAP (a(i), b(i), c(i-1), c(i), sum(i));

END GENERATE;

—— Instantiate four latches from MAX+PLUS II primitives

—— Requires the statements LIBRARY altera; and

—— USE altera.maxplus.ALL;

latch4:

FOR i IN 3 downto 0 GENERATE

latch_primitive: latch

PORT MAP (d => d_in(i), ena => enable, q => q_out (i));

END GENERATE;

2.6 Process Statement

A process is a concurrent statement, but the statements inside the process are sequential. For example, a process can define a flip-flop, a separate component whose ports are affected concurrently, but the inside of the flip-flop acts sequentially. A process executes all statements inside it when there is a change of a signal in its sensitivity list. The process label is optional.

Syntax:

__process_label:

PROCESS (sensitivity list)

variable declarations

BEGIN

sequential statements


A P P E N D I X B • VHDL Language Reference

699

END PROCESS __process_label;

EXAMPLE:

—— D latch

PROCESS (en)

BEGIN

IF (en = ‘1’) THEN

q <= d;

END IF;

END PROCESS;

3.Sequential Structures

3.1.If Statement

3.1.1.Evaluating Clock Functions

3.2.Case Statement

A sequential structure in VHDL is one in which the order of statements affects the operation of the circuit. It can be used to implement combinational circuits, but is primarily used to implement sequential circuits such as latches, counters, shift registers, and state machines. Sequential statements must be contained within a process.

3.1 If Statement

An IF statement executes one or more statements if a Boolean condition is satisfied.

Syntax:

IF __expression THEN __statement; __statement;

ELSIF __expression THEN __statement; __statement;

ELSE __statement; __statement;

END IF;

EXAMPLE: PROCESS (reset, load, clock)

VARIABLE count INTEGER RANGE 0 TO 255;

BEGIN

IF (reset = ‘0’) THEN q <= 0;

ELSIF (reset = ‘1’ and load = ‘0’) THEN q <= p;

ELSIF (clock’EVENT and clock = ‘1’) THEN count := count + 1;

q <= count; END IF;


700 A P P E N D I X B • VHDL Language Reference

END PROCESS;

3.1.1Evaluating Clock Functions

As implied in previous examples, the state of a system clock can be checked with an IF statement using the predefined attribute called EVENT. The clause clock’EVENT (“clock tick EVENT”) is true if there has been activity on the signal called clock. Thus (clock’EVENT and clock ‘1’) is true just after a positive edge on clock.

3.2 Case Statement

A case statement is used to execute one of several sets of statements, based on the evaluation of a signal.

Syntax:

CASE __expression IS

WHEN __constant_value => __statement; __statement;

WHEN __constant_value => __statement; __statement;

WHEN OTHERS => __statement; __statement;

END CASE;

EXAMPLES: —— Case evaluates 2-bit value of s and assigns

——4-bit values of x and y accordingly

——Default case (others) required if using STD_LOGIC CASE s IS

WHEN “00” =>

y <= “0001”; x <= “1110”;

WHEN “01” =>

y <= “0010”; x <= “1101”;

WHEN “10” =>

y <= “0100”; x <= “1011”;

WHEN “11” =>

y <= “1000”; x <= “0111”;

WHEN others => y <= “0000”;

A P P E N D I X B • VHDL Language Reference

701

x <= “1111”;

END CASE;

——This case evaluates the state variable “sequence”

——that can have two possible values: “start” and “continue”

——Values of out1 and out2 are also assigned for each case. CASE sequence IS

WHEN start =>

IF in1 = ‘1’ THEN

sequence <= start; out1 <= ‘0’;

out2 <= ‘0’; ELSE

sequence <= continue; out1 <= ‘1’;

out2 <= ‘0’;

END IF;

WHEN continue =>

sequence <= start;

out1 <= ‘0’;

out2 <= ‘1’;

END CASE;


A P P E N D I X C

Manufacturers’ Data Sheets

Data Sheet List

Device

Description

Source/File Name

Pages

74LS00

Quad 2-input NAND Gate

Motorola/sn74ls00rev6.pdf

703

74LS02

Quad 2-input NOR Gate

Motorola/sn74ls02rev5.pdf

705

74LS04

Hex Inverter

Motorola/sn74ls04rev6.pdf

707

74LS05

Hex Inverter (Open Collector)

Motorola/sn74ls05rev6.pdf

709

74LS06/16

Hex Inverting Buffer (Open Collector)

Texas Instruments/sdls020a.pdf

711

75LS07

Hex Noninverting Buffer (Open Collector)

Texas Instruments/sdls021a.pdf

714

74LS08

Quad 2-input AND Gate

Motorola/sn74ls08rev6.pdf

717

74LS32

Quard 2-input OR Gate

Motorola/sn74ls32rev6.pdf

719

74LS86

Quard 2-input XOR Gate

Motorola/sn74ls86rev6.pdf

721

74F00

Quad 2-input NAND Gate

Texas Instruments/sdfs035a.pdf

723

74AS/ALS00

Quad 2-input NAND Gate

Texas Instruments/sdas187a.pdf

726

74HC00

Quad 2-input NAND Gate

Motorola/mc74hc00arev7a.pdf

731

74HCT00

Quad 2-input NAND Gate (TTL Input Levels)

Motorola/mc74hct00arev6.pdf

735

74VHC00

Quad 2-input NAND Gate

Motorola/mc74vhc00arev0.pdf

738

74VHCT00

Quad 2-input NAND Gate (TTL Input Levels)

Motorola/mc74vhct00arev0.pdf

741

74HCU04

Hex Inverter (Unbuffered)

Motorola/mc74hcu04arev1.pdf

744

74HC4049/4050

Hex Buffer

Motorola/mc74hc4049rev6.pdf

749

74LVX00

Quad 2-input NAND Gate

Motorola/mc74lvx00rev0b.pdf

753

74LCX00

Quad 2-input NAND Gate

Motorola/mc74lcx00rev1.pdf

756

MC14XXXB

4000B-series CMOS Gates

Motorola/mc14001brev3.pdf

759