您好,欢迎光临本网站![请登录][注册会员]  
文件名称: vdhl实现移位器功能
  所属分类: 其它
  开发工具:
  文件大小: 2kb
  下载次数: 0
  上传时间: 2013-04-26
  提 供 者: alan****
 详细说明: 32位桶氏移位器,实现了逻辑左移、逻辑右移和算术右移,以下是代码片段: -- bshift.vhdl A barrel shifter for 32 bit words -- includes shift left logical (sll), shift right logical(srl) and -- shift right arithmetic (sra) -- both behavioral and circuit models (two architectures) included -- -- Note: behavior requires util_package for 'to_integer' -- circuit requires mux_32 component -- the physical circuit uses 17 mux's, 7 mux delay library IEEE; use IEEE.std_logic_11 64.all; Entity bshift is -- barrel shifter port (left : in std_logic; -- '1' for left, '0' for right logical : in std_logic; -- '1' for logical, '0' for arithmetic shift : in std_logic_vector(4 downto 0); -- shift count input : in std_logic_vector (31 downto 0); output : out std_logic_vector (31 downto 0) ); end entity bshift; architecture behavior of bshift is function to_integer(sig : std_logic_vector) return integer is variable num : integer := 0; -- descending sig as integer begin for i in sig'range loop if sig(i)='1' then num := num*2+1; else num := num*2; end if; end loop; -- i return num; end function to_integer; begin -- behavior shft32: process(left, logical, input, shift) variable shft : integer; variable out_right_arithmetic : std_logic_vector(31 downto 0); variable out_right_logical : std_logic_vector(31 downto 0); variable out_left_logical : std_logic_vector(31 downto 0); begin shft := to_integer(shift); if logical = '0' then out_right_arithmetic := (31 downto 32-shft => input(31)) & input(31 downto shft); output <= out_right_arithmetic after 250 ps; else if left = '1' then out_left_logical := input(31-shft downto 0) & (shft-1 downto 0 => '0'); output <= out_left_logical after 250 ps; else out_right_logical := (31 downto 32-shft => '0') & input(31 downto shft); output <= out_right_logical after 250 ps; end if; end if; end process shft32; end architecture behavior; -- of bshift ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: VDHL
 输入关键字,在本站1000多万海量源码库中尽情搜索: