-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorrimiento_registros.vhd
53 lines (46 loc) · 1.19 KB
/
corrimiento_registros.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
52
53
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
library work;
use work.usart_pkg.all;
entity corrimiento_registros is
port(
dato_en,clk_p,reset_n,enable,out_cont: in std_logic;
sal: out std_logic_vector(7 downto 0);
ya_dato,error:out std_logic
);
end entity;
architecture rtl of corrimiento_registros is
signal p: std_logic_vector(11 downto 0);
signal suma:std_logic_vector(3 downto 0);
signal comparacion,comparacion2:std_logic;
signal A,B,C,D,E,F,G,H:std_logic_vector(3 downto 0);
begin
regs:
for i in 1 to 11 generate
begin
nombre_Generico: reg1bit
port map (
d => p(i-1),
q => p(i),
clk => clk_p,
reset_n => reset_n,
ena => enable
);
end generate;
sal <= p(3) & p(4) & p(5) & p(6) & p(7) & p(8) & p(9) & p(10);
p(0) <= dato_en;
A <= "000"&P(3);
B <= "000"&p(4);
D <= "000"&p(5);
E <= "000"&p(6);
F <= "000"&p(7);
G <= "000"&p(8);
H <= "000"&p(9);
C <= "000"&p(10);
suma <= std_logic_vector(unsigned(A) + unsigned(B) + unsigned(C) + unsigned(D) + unsigned(E) + unsigned(F) + unsigned(G) + unsigned(H));
comparacion <= not(suma(0)) xor p(2);
ya_dato <= out_cont;
error <= comparacion;
end architecture;