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

📄 sqrppgenuns.vhd

📁 VHDL的基本数学运算库,非常好用
💻 VHD
字号:
--------------------------------------------------------------------------------- Title       : Partial-product generator for unsigned squarer-- Project     : VHDL Library of Arithmetic Units--------------------------------------------------------------------------------- File        : SqrPPGenUns.vhd-- Author      : Reto Zimmermann  <zimmi@iis.ee.ethz.ch>-- Company     : Integrated Systems Laboratory, ETH Zurich-- Date        : 1997/11/14--------------------------------------------------------------------------------- Copyright (c) 1998 Integrated Systems Laboratory, ETH Zurich--------------------------------------------------------------------------------- Description :-- Partial-product generator for unsigned squarer.---- Partial products for 4-bit squaring:----      0  x(2)y(3)  x(1)y(3)  x(0)y(3)  x(0)y(2)  x(0)y(1)         0  x(0)y(0)--      0  x(3)y(3)         0  x(1)y(2)         0  x(1)y(1)         0         0--      0         0         0  x(2)y(2)         0         0         0         0---------------------------------------------------------------------------------   p(7)      p(6)      p(5)      p(4)      p(3)      p(2)      p(1)      p(0)-------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;library arith_lib;use arith_lib.arith_lib.all;-------------------------------------------------------------------------------entity SqrPPGenUns is  generic (width : integer := 8);	-- word width  port (X : in std_logic_vector(width-1 downto 0);  -- operand						    -- partial products        PP : out std_logic_vector((width/2+1)*2*width-1 downto 0));end SqrPPGenUns;-------------------------------------------------------------------------------architecture Structural of SqrPPGenUns is   constant widthP : integer := 2*width;  -- width of single part. productbegin  ppGen : process (X)    variable ppt : std_logic_vector((width/2+1)*widthP-1 downto 0);  begin    -- defaults    ppt := (others => '0');    -- lower products x(i)x(k), i /= k    for i in 0 to (width-1)/2-1 loop      for k in i+1 to width-i-2 loop	ppt(i*widthP+i+k+1) := X(i) and X(k);      end loop;    end loop;        -- upper products x(i)x(k), i /= k    for i in 0 to width/2-1 loop      for k in i to width-i-2 loop	ppt(i*widthP+width-i+k) := X(k) and X(width-i-1);      end loop;    end loop;    -- lower products x(i)x(i)    for i in 0 to (width-1)/2 loop      ppt(i*widthP+2*i) := X(i);    end loop;    -- upper products x(i)x(i)    for i in 1 to width/2 loop      ppt(i*widthP+2*width-2*i) := X(width-i);    end loop;    PP <= ppt;  end process ppGen;end Structural;-------------------------------------------------------------------------------

⌨️ 快捷键说明

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