ex_4_2_barrel.vhd

来自「This is the course for VHDL programming」· VHDL 代码 · 共 15 行

VHD
15
字号
library IEEE;use IEEE.std_logic_1164.all;use IEEE.std_logic_unsigned.all;entity barrel_shifter is	port(A:in  std_logic_vector(7 downto 0);--Input		  B:out std_logic_vector(7 downto 0);--Output		  C:in std_logic_vector(3 downto 0));--Shift count C(3) = Direction end barrel_shifter;architecture DF2 of barrel_shifter is	signal s:integer;begin	s <= conv_integer(C(2 downto 0));	B<= To_stdlogicvector(To_bitvector(A) sll s)   when C(3) = '0' else	        To_stdlogicvector(To_bitvector(A) srl s);end DF2;

⌨️ 快捷键说明

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