-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeslocador_n.vhd
52 lines (45 loc) · 1.58 KB
/
deslocador_n.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
------------------------------------------------------------------
-- Arquivo : deslocador_n.vhd
-- Projeto : Experiencia 2 - Transmissao Serial Assincrona
------------------------------------------------------------------
-- Descricao : deslocador
-- > parametro N: numero de bits
--
------------------------------------------------------------------
-- Revisoes :
-- Data Versao Autor Descricao
-- 09/09/2021 1.0 Edson Midorikawa versao inicial
-- 31/08/2022 2.0 Edson Midorikawa revisao
------------------------------------------------------------------
--
library ieee;
use ieee.std_logic_1164.all;
entity deslocador_n is
generic (
constant N : integer := 4
);
port (
clock : in std_logic;
reset : in std_logic;
carrega : in std_logic;
desloca : in std_logic;
entrada_serial : in std_logic;
dados : in std_logic_vector (N-1 downto 0);
saida : out std_logic_vector (N-1 downto 0)
);
end entity deslocador_n;
architecture deslocador_n_arch of deslocador_n is
signal IQ: std_logic_vector (N-1 downto 0);
begin
process (clock, reset, IQ)
begin
if reset='1' then IQ <= (others=>'1');
elsif (clock'event and clock='1') then
if carrega='1' then IQ <= dados;
elsif desloca='1' then IQ <= entrada_serial & IQ(N-1 downto 1);
else IQ <= IQ;
end if;
end if;
saida <= IQ;
end process;
end architecture deslocador_n_arch;