Download Xilinx XST User Guide

Transcript
Chapter 3: XST Hardware Description Language (HDL) Coding Techniques
3-Bit 1-of-9 Priority Encoder Coding Examples
For this example XST may infer a priority encoder. Use Priority Encoder Extraction (PRIORITY_EXTRACT)
with a value force to force its inference.
3-Bit 1-of-9 Priority Encoder Pin Descriptions
IO Pins
Description
sel
Selector
code
Encoded Output Bus
3-Bit 1-of-9 Priority Encoder VHDL Coding Example
--- 3-Bit 1-of-9 Priority Encoder
-library ieee;
use ieee.std_logic_1164.all;
entity priority_encoder_1 is
port ( sel : in std_logic_vector (7 downto 0);
code :out std_logic_vector (2 downto 0));
attribute priority_extract: string;
attribute priority_extract of priority_encoder_1: entity is "force";
end priority_encoder_1;
architecture archi of priority_encoder_1 is
begin
code <= "000" when
"001" when
"010" when
"011" when
"100" when
"101" when
"110" when
"111" when
"---";
sel(0)
sel(1)
sel(2)
sel(3)
sel(4)
sel(5)
sel(6)
sel(7)
=
=
=
=
=
=
=
=
’1’
’1’
’1’
’1’
’1’
’1’
’1’
’1’
else
else
else
else
else
else
else
else
end archi;
80
www.xilinx.com
XST User Guide
UG627 (v 11.3) September 16, 2009