用VHDL语言设计一个四位二进制数循环左移一位器的具体写法,谢谢了

2025-04-13 22:14:52
推荐回答(1个)
回答1:

没当do为1时循环左移一位:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use IEEE.std_logic_unsigned.all;

entity txt is
port (clk:in std_logic;
do:in std_logic;
putout:out std_logic_vector(3 downto 0)
);
end entity;

architecture behav of txt is
signal tmp:std_logic_vector(3 downto 0):="1010";
begin
process (clk,do)
begin
if clk'event and clk='1' then
if do='1' then
tmp<=tmp(2 downto 0)&tmp(3);
end if;
putout<=tmp;
end if;
end process;
end behav;