📄 redxor.vhd
字号:
--------------------------------------------------------------------------------- Title : Reduce XOR-- Project : VHDL Library of Arithmetic Units--------------------------------------------------------------------------------- File : RedXor.vhd-- Author : Reto Zimmermann <zimmi@iis.ee.ethz.ch>-- Company : Integrated Systems Laboratory, ETH Zurich-- Date : 1998/01/11--------------------------------------------------------------------------------- Copyright (c) 1998 Integrated Systems Laboratory, ETH Zurich--------------------------------------------------------------------------------- Description :-- XOR all bits of the input vector.-------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;library arith_lib;use arith_lib.arith_lib.all;-------------------------------------------------------------------------------entity RedXor is generic (width : integer := 8); -- word width port (A : in std_logic_vector(width-1 downto 0); -- input vector Z : out std_logic); -- output bitend RedXor;-------------------------------------------------------------------------------architecture Behavioral of RedXor isbegin -- XOR all bits reduceXor : process (A) variable zv : std_logic; begin zv := A(0); for i in 1 to width-1 loop zv := zv xor A(i); end loop; Z <= zv; end process reduceXor;end Behavioral;-------------------------------------------------------------------------------architecture Structural of RedXor is begin -- XOR all bits -- again behavioral description used (well handled by all synthesizers) reduceXor : process (A) variable zv : std_logic; begin zv := A(0); for i in 1 to width-1 loop zv := zv xor A(i); end loop; Z <= zv; end process reduceXor;end Structural;-------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -