📄 comparator.vhd
字号:
--------------------------------------------------------------------------------- $Id: comparator.vhd,v 1.3 2007/11/09 13:06:27 stefana Exp $--------------------------------------------------------------------------------- comparator_gti.vhd - Entity and architecture---- ***************************************************************************-- ** Copyright(C) 2003 by Xilinx, Inc. All rights reserved. **-- ** **-- ** This text contains proprietary, confidential **-- ** information of Xilinx, Inc. , is distributed by **-- ** under license from Xilinx, Inc., and may be used, **-- ** copied and/or disclosed only pursuant to the terms **-- ** of a valid license agreement with Xilinx, Inc. **-- ** **-- ** Unmodified source code is guaranteed to place and route, **-- ** function and run at speed according to the datasheet **-- ** specification. Source code is provided "as-is", with no **-- ** obligation on the part of Xilinx to provide support. **-- ** **-- ** Xilinx Hotline support of source code IP shall only include **-- ** standard level Xilinx Hotline support, and will only address **-- ** issues and questions related to the standard released Netlist **-- ** version of the core (and thus indirectly, the original core source). **-- ** **-- ** The Xilinx Support Hotline does not have access to source **-- ** code and therefore cannot answer specific questions related **-- ** to source HDL. The Xilinx Support Hotline will only be able **-- ** to confirm the problem in the Netlist version of the core. **-- ** **-- ** This copyright and support notice must be retained as part **-- ** of this text at all times. **-- ***************************************************************************----------------------------------------------------------------------------------- Filename: comparator_gti.vhd---- Description: -- -- VHDL-Standard: VHDL'93--------------------------------------------------------------------------------- Structure: -- comparator_gti.vhd----------------------------------------------------------------------------------- Author: goran-- Revision: $Revision: 1.3 $-- Date: $Date: 2007/11/09 13:06:27 $---- History:-- goran 2006-04-11 First Version----------------------------------------------------------------------------------- Naming Conventions:-- active low signals: "*_n"-- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_com" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*"-- clock enable signals: "*_ce" -- internal version of output port "*_i"-- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC>-------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;library Microblaze_v7_10_a;use Microblaze_v7_10_a.MicroBlaze_Types.all;library unisim;use unisim.vcomponents.all;entity comparator is generic ( C_TARGET : TARGET_FAMILY_TYPE; C_IS_FIRST : boolean; C_SIZE : natural); port ( Carry_IN : in std_logic; DI : in std_logic; A : in std_logic_vector(0 to C_SIZE-1); B : in std_logic_vector(0 to C_SIZE-1); Carry_OUT : out std_logic);end entity comparator;architecture IMP of comparator isbegin -- architecture IMP ----------------------------------------------------------------------------- -- FPGA implementation ----------------------------------------------------------------------------- Using_FPGA : if (C_TARGET /= RTL) generate constant carry_chain_length : natural := (C_SIZE + 1)/2; signal carry_sel : std_logic_vector(0 to carry_chain_length-1); signal carry_chain : std_logic_vector(0 to carry_chain_length); signal A_i : std_logic_vector(0 to carry_chain_length*2 - 1); signal B_i : std_logic_vector(0 to carry_chain_length*2 - 1); begin input_size_padding : process (A, B) is begin -- process input_size_padding A_i <= (others => '0'); A_i(0 to C_SIZE-1) <= A; B_i <= (others => '0'); B_i(0 to C_SIZE-1) <= B; end process input_size_padding; carry_chain(0) <= Carry_IN; Comp_Carry_Chain : for I in 0 to carry_chain_length-1 generate carry_sel(I) <= '1' when A_i(I*2 to I*2+1) = B_i(I*2 to I*2+1) else '0'; MUXCY_I : MUXCY_L port map ( DI => DI, CI => carry_chain(I), S => carry_sel(I), LO => carry_chain(I+1)); end generate Comp_Carry_Chain; Carry_OUT <= carry_chain(carry_chain_length); end generate Using_FPGA; ----------------------------------------------------------------------------- -- RTL Implementation ----------------------------------------------------------------------------- Using_RTL: if (C_TARGET = RTL) generate Carry_OUT <= Carry_IN when A = B else DI; end generate Using_RTL;end architecture IMP;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -