📄 redand.vhd
字号:
--------------------------------------------------------------------------------- Title : Reduce AND-- Project : VHDL Library of Arithmetic Units--------------------------------------------------------------------------------- File : RedAnd.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 :-- AND all bits of the input vector.-------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;library arith_lib;use arith_lib.arith_lib.all;-------------------------------------------------------------------------------entity RedAnd is generic (width : positive := 8); -- word width port (A : in std_logic_vector(width-1 downto 0); -- input vector Z : out std_logic); -- output bitend RedAnd;-------------------------------------------------------------------------------architecture Behavioral of RedAnd isbegin -- AND all bits reduceAnd : process (A) variable zv : std_logic; begin zv := A(0); for i in 1 to width-1 loop zv := zv and A(i); end loop; Z <= zv; end process reduceAnd;end Behavioral;-------------------------------------------------------------------------------architecture Structural of RedAnd is begin -- AND all bits -- again behavioral description used (well handled by all synthesizers) reduceAnd : process (A) variable zv : std_logic; begin zv := A(0); for i in 1 to width-1 loop zv := zv and A(i); end loop; Z <= zv; end process reduceAnd;end Structural;-------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -