redor.vhd

来自「包括所有常用算法:加权计算」· VHDL 代码 · 共 73 行

VHD
73
字号
--------------------------------------------------------------------------------- Title       : Reduce OR-- Project     : VHDL Library of Arithmetic Units--------------------------------------------------------------------------------- File        : RedOr.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 :-- OR all bits of the input vector.-------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;library arith_lib;use arith_lib.arith_lib.all;-------------------------------------------------------------------------------entity RedOr 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 RedOr;-------------------------------------------------------------------------------architecture Behavioral of RedOr isbegin  -- OR all bits  reduceOr : process (A)    variable zv : std_logic;  begin    zv := A(0);    for i in 1 to width-1 loop      zv := zv or A(i);    end loop;    Z <= zv;  end process reduceOr;end Behavioral;-------------------------------------------------------------------------------architecture Structural of RedOr is begin  -- OR all bits  -- again behavioral description used (well handled by all synthesizers)   reduceOr : process (A)    variable zv : std_logic;  begin    zv := A(0);    for i in 1 to width-1 loop      zv := zv or A(i);    end loop;    Z <= zv;  end process reduceOr;end Structural;-------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?