Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
xst.pdf
Скачиваний:
141
Добавлен:
11.06.2015
Размер:
5.64 Mб
Скачать

Chapter 2: XST HDL Coding Techniques

R

Q <= 4'b1111; else

if (CE)

Q <= D;

end

endmodule

Latches HDL Coding Techniques

This section discusses Latches HDL Coding Techniques, and includes:

“About Latches”

“Latches Log File”

“Latches Related Constraints”

“Latches Coding Examples”

About Latches

XST can recognize latches with asynchronous set/reset control signals. Latches can be described using:

Process (VHDL) and always block (Verilog)

Concurrent state assignment.

XST does not support Wait statements (VHDL) for latch descriptions.

Latches Log File

The XST log file reports the type and size of recognized latches during the Macro

Recognition step.

...

Synthesizing Unit <latch>.

Related source file is latch_1.vhd. WARNING:Xst:737 - Found 1-bit latch for signal <q>.

Summary:

inferred 1 Latch(s). Unit <latch> synthesized.

=======================================

HDL Synthesis Report

Macro Statistics

 

 

# Latches

:

1

1-bit latch

:

1

========================================

...

Latches Related Constraints

“Pack I/O Registers Into IOBs (IOB)”

34

www.xilinx.com

XST User Guide

 

 

10.1

R

Latches HDL Coding Techniques

Latches Coding Examples

This section gives the following Latches examples:

“Latch With Positive Gate”

“Latch With Positive Gate and Asynchronous Reset”

“4-Bit Latch With Inverted Gate and Asynchronous Set”

The coding examples in this section are accurate as of the date of publication. Download updates from ftp://ftp.xilinx.com/pub/documentation/misc/examples_v9.zip.

Latch With Positive Gate

This section discusses Latch With Positive Gate, and includes:

“Latch With Positive Gate Diagram”

“Latch With Positive Gate Pin Descriptions”

“Latch With Positive Gate VHDL Coding Example”

“Latch With Positive Gate Verilog Coding Example”

 

D

LD

Q

 

 

 

 

 

 

 

 

 

G

 

 

 

 

 

 

 

X3740

 

 

 

 

 

Figure 2-6: Latch With Positive Gate Diagram

Table 2-8: Latch With Positive Gate Pin Descriptions

 

 

 

 

 

 

IO Pins

Description

 

 

 

 

 

 

 

 

 

D

Data Input

 

 

 

 

 

 

 

 

 

G

Positive Gate

 

 

 

 

 

 

 

 

 

Q

Data Output

 

 

 

 

 

 

 

 

 

Latch With Positive Gate VHDL Coding Example

--

-- Latch with Positive Gate

--

library ieee;

use ieee.std_logic_1164.all;

entity latches_1 is

port(G, D : in std_logic; Q : out std_logic);

end latches_1;

architecture archi of latches_1 is begin

XST User Guide

www.xilinx.com

35

10.1

Chapter 2: XST HDL Coding Techniques

R

process (G, D) begin

if (G='1') then Q <= D;

end if; end process;

end archi;

Latch With Positive Gate Verilog Coding Example

//

// Latch with Positive Gate

//

module v_latches_1 (G, D, Q); input G, D;

output Q; reg Q;

always @(G or D) begin

if (G)

Q = D;

end endmodule

Latch With Positive Gate and Asynchronous Reset

This section discusses Latch With Positive Gate and Asynchronous Reset, and includes:

“Latch With Positive Gate and Asynchronous Reset Diagram”

“Latch With Positive Gate and Asynchronous Reset Pin Descriptions”

“Latch With Positive Gate and Asynchronous Reset VHDL Coding Example”

“Latch With Positive Gate and Asynchronous Reset Verilog Coding Example”

D

LDC

Q

 

 

G

 

 

 

 

 

 

 

 

 

CLR

 

 

X4070

 

 

 

Figure 2-7: Latch With Positive Gate and Asynchronous Reset Diagram

36

www.xilinx.com

XST User Guide

 

 

10.1

R

Latches HDL Coding Techniques

Table 2-9: Latch With Positive Gate and Asynchronous Reset Pin Descriptions

IO Pins

Description

 

 

D

Data Input

 

 

G

Positive Gate

 

 

CLR

Asynchronous Reset (Active High)

 

 

Q

Data Output

 

 

Latch With Positive Gate and Asynchronous Reset VHDL Coding Example

--

-- Latch with Positive Gate and Asynchronous Reset

--

library ieee;

use ieee.std_logic_1164.all;

entity latches_2 is

port(G, D, CLR : in std_logic; Q : out std_logic);

end latches_2;

architecture archi of latches_2 is begin

process (CLR, D, G) begin

if (CLR='1') then Q <= '0';

elsif (G='1') then Q <= D;

end if; end process;

end archi;

Latch With Positive Gate and Asynchronous Reset Verilog Coding Example

//

// Latch with Positive Gate and Asynchronous Reset

//

module v_latches_2 (G, D, CLR, Q); input G, D, CLR;

output Q; reg Q;

always @(G or D or CLR) begin

if (CLR)

Q = 1'b0; else if (G)

Q = D;

end endmodule

XST User Guide

www.xilinx.com

37

10.1

Chapter 2: XST HDL Coding Techniques

R

4-Bit Latch With Inverted Gate and Asynchronous Set

This section discusses 4-Bit Latch With Inverted Gate and Asynchronous Set, and includes:

“4-Bit Latch With Inverted Gate and Asynchronous Set Diagram”

“4-Bit Latch With Inverted Gate and Asynchronous Set Pin Descriptions”

“4-Bit Latch With Inverted Gate and Asynchronous Set VHDL Coding Example”

“4-Bit Latch With Inverted Gate and Asynchronous Set Verilog Coding Example”

4-Bit Latch With Inverted Gate and Asynchronous Set Diagram

PRE

D LDP_1

Q

G

X8376

Figure 2-8: 4-Bit Latch With Inverted Gate and Asynchronous Set Diagram

4-Bit Latch With Inverted Gate and Asynchronous Set Pin Descriptions

Table 2-10: 4-Bit Latch With Inverted Gate and Asynchronous Set Pin Descriptions

IO Pins

Description

 

 

D

Data Input

 

 

G

Inverted Gate

 

 

PRE

Asynchronous Preset (Active High)

 

 

Q

Data Output

 

 

4-Bit Latch With Inverted Gate and Asynchronous Set VHDL Coding Example

--

-- 4-bit Latch with Inverted Gate and Asynchronous Set

--

library ieee;

use ieee.std_logic_1164.all;

entity latches_3 is

port(D

:

in std_logic_vector(3 downto 0);

G, PRE :

in std_logic;

Q

:

out std_logic_vector(3 downto 0));

end latches_3;

architecture archi of latches_3 is begin

process (PRE, G, D) begin

if (PRE='1') then Q <= "1111"; elsif (G='0') then

38

www.xilinx.com

XST User Guide

 

 

10.1

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]