⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 incdec.vhd

📁 VHDL的基本数学运算库,非常好用
💻 VHD
字号:
--------------------------------------------------------------------------------- Title       : Parallel-prefix incrementer-decrementer-- Project     : VHDL Library of Arithmetic Units--------------------------------------------------------------------------------- File        : IncDec.vhd-- Author      : Reto Zimmermann  <zimmi@iis.ee.ethz.ch>-- Company     : Integrated Systems Laboratory, ETH Zurich-- Date        : 1997/11/04--------------------------------------------------------------------------------- Copyright (c) 1998 Integrated Systems Laboratory, ETH Zurich--------------------------------------------------------------------------------- Description :-- Incrementer-decrementer using parallel-prefix propagate-lookahead logic.-------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;library arith_lib;use arith_lib.arith_lib.all;-------------------------------------------------------------------------------entity IncDec is  generic (width : integer := 8;  	-- word width	   speed : integer := 2);  -- performance parameter  port (A : in std_logic_vector(width-1 downto 0);  -- operand        DEC : in std_logic;  		-- decrement enable	Z : out std_logic_vector(width-1 downto 0));  -- resultend IncDec;-------------------------------------------------------------------------------architecture Behavioral of IncDec is  signal Auns, Zuns : unsigned(width-1 downto 0);  -- unsignedbegin  -- type conversion: std_logic_vector -> unsigned  Auns <= unsigned(A);  -- increment or decrement  Zuns <= Auns + 1 when DEC = '0' else          Auns - 1;  -- type conversion: unsigned -> std_logic_vector  Z <= std_logic_vector(Zuns);end Behavioral;-------------------------------------------------------------------------------architecture Structural of IncDec is   signal AI : std_logic_vector(width-1 downto 0);  -- A inverted  signal PO : std_logic_vector(width-1 downto 0);  -- prefix propagate outbegin  -- invert A for decrement  AI <= A xor (width-1 downto 0 => DEC);    -- calculate prefix output propagate signal  prefix : PrefixAnd    generic map (width, speed)    port map (AI, PO);  -- calculate result bits  Z <= A xor PO(width-2 downto 0) & '1';end Structural;-------------------------------------------------------------------------------

⌨️ 快捷键说明

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