📄 barrel_shifter.vhd
字号:
------------------------------------------------------------------------------------ Company: -- Engineer: -- -- Create Date: 23:59:48 02/22/2009 -- Design Name: -- Module Name: barrel_shifter - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: ---- Dependencies: ---- Revision: -- Revision 0.01 - File Created-- Additional Comments: ------------------------------------------------------------------------------------library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;---- Uncomment the following library declaration if instantiating---- any Xilinx primitives in this code.--library UNISIM;--use UNISIM.VComponents.all;entity barrel_shifter is Port ( DATA_in : in STD_LOGIC_VECTOR (12 downto 0); clk : in STD_LOGIC; en : in STD_LOGIC; step_lenth:in STD_LOGIC_VECTOR (3 downto 0); R_L : in STD_LOGIC; DATA_out : out STD_LOGIC_VECTOR (12 downto 0); done : out STD_LOGIC);end barrel_shifter;architecture Behavioral of barrel_shifter issignal Din_bit,Dout_bit : bit_vector(12 downto 0);signal S_int : integer range 12 downto 0;--signal Dsign : bit;begin Din_bit <= to_bitvector(DATA_in); S_int <= conv_integer(step_lenth); process(clk) begin if (clk'event and clk = '1') then if (en = '0') then DATA_out <= DATA_in; else if (R_L = '1') then Dout_bit <= Din_bit sra S_int; else Dout_bit(11 downto 0) <= Din_bit(11 downto 0) sll S_int; Dout_bit(12) <= Din_bit(12); end if; DATA_out <= to_stdlogicvector(Dout_bit); done <= '1'; end if; end if; end process;end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -