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

VHDL Reference Guide

sequential_statement; else

sequential_statement; end if;

An edge expression cannot be part of another logical expression or be used as an argument.

The following function call is invalid, because you cannot use the edge expression as an argument.

any_function(edge);

Three-State Inference

Foundation Express infers a three-state driver when you assign the value of Z to a variable. The Z value represents the high-impedance state. Foundation Express infers one three-state driver per process.

You can assign high-impedance values to single-bit or bused signals (or variables).

Reporting Three-State Inference

The following example shows a three-state inference report.

Three-State Device Name

Type

MB

 

 

 

OUT1_tri

Three-State Buffer

N

 

 

 

The first column of the report indicates the name of the inferred three-state device. The second column of the report indicates the type of three-state device that Foundation Express inferred. The third column indicates whether the three-state device has multiple bits.

Controlling Three-State Inference

Foundation Express always infers a three-state driver when you assign the value of Z to a signal or variable. Foundation Express does not provide any means of controlling the inference.

Inferring Three-State Drivers

This section contains VHDL examples that infer the following types of three-state drivers.

Simple three-state driver

7-46

Xilinx Development System

Register and Three-State Inference

Three-state driver with registered enable

Three-state driver without registered enable

Inferring a Simple Three-State Driver

This section provides a template for a simple three-state driver. In addition, this section supplies examples of how allocating highimpedance assignments to different processes affects three-state inference.

The following example provides the VHDL template for a simple three-state driver. Foundation Express generates the inference report shown following the example for a simple three-state driver. The figure “Three-State Driver” shows the inferred three-state driver.

library IEEE, synopsys;

use IEEE.std_logic_1164.all; entity three_state is

port(IN1, ENABLE : in std_logic; OUT1 : out std_logic );

end;

architecture rtl of three_state is begin

process (IN1, ENABLE) begin if (ENABLE = ’1’) then

OUT1 <= IN1; else

OUT1 <= ’Z’; -- assigns high-impedance state end if;

end process;

end rtl;

The following example shows an inference report for a simple threestate driver.

Three-State Device Name

Type

MB

 

 

 

OUT1_tri

Three-State Buffer

N

 

 

 

VHDL Reference Guide

7-47

VHDL Reference Guide

ENABLE

IN1 OUT

X8604

Figure 7-25 Simple Three-State Driver

Inferring One Three-State Driver from a Single Process The following example shows how to place all high-impedance assignments in a single process. In this case, the data is gated and Foundation Express infers a single three-state driver. An inference report for a single process follows the example. The figure “Inferring One Three-State Driver” shows the schematic the code generates.

library IEEE;

use IEEE.std_logic_1164.all;

entity three_state is

port ( A, B, SELA, SELB : in std_logic ; T : out std_logic );

end three_state;

architecture rtl of three_state is begin

infer : process (SELA, A, SELB, B) begin T <= ’Z’;

if (SELA = ’1’) then T <= A;

elsif (SELB = ’1’) then T <= B;

end if;

end process infer;

end rtl;

The following example shows a single block inference report.

Three-State Device Name

Type

MB

 

 

 

T_tri

Three-State Buffer

N

 

 

 

7-48

Xilinx Development System

Register and Three-State Inference

Figure 7-26 Inferring One Three-State Driver

Inferring Three-State Drivers from Separate Processes The following example shows how to place each high-impedance assignment in a separate process. In this case, Foundation Express infers multiple three-state drivers.

The inference report for two three-state drivers follows the example.

The figure “Inferring Two Three-State Drivers” shows the schematic the code generates.

library IEEE;

use IEEE.std_logic_1164.all;

entity three_state is

port ( A, B, SELA, SELB : in std_logic ; T : out std_logic );

end three_state;

architecture rtl of three_state is begin

infer1 : process (SELA, A) begin if (SELA = ’1’) then

T <= A;

VHDL Reference Guide

7-49

VHDL Reference Guide

else

T <= ’Z’; end if;

end process infer1;

infer2 : process (SELB, B) begin if (SELB = ’1’) then

T <= B; else

T <= ’Z’; end if;

end process infer2;

end rtl;

The following example shows an inference report for two three-state drivers from separate processes.

Three-State Device Name

Type

MB

 

 

 

T_tri

Three-State Buffer

N

 

 

 

 

 

 

Three-State Device Name

Type

MB

 

 

 

T_tri2

Three-State Buffer

N

 

 

 

SELA

A T

SELB

B

X8606

Figure 7-27 Inferring Two Three-State Drivers

7-50

Xilinx Development System

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