-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpiso.vhd
More file actions
56 lines (52 loc) · 1.68 KB
/
Copy pathpiso.vhd
File metadata and controls
56 lines (52 loc) · 1.68 KB
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
54
55
56
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity piso is
Port (
DIN : in STD_LOGIC_VECTOR (1 to 13);
IN_EN : in STD_LOGIC;
DOUT : out STD_LOGIC;
clk : in STD_LOGIC;
OUT_EN : out STD_LOGIC
);
end piso;
architecture Behavioral of piso is
signal temp1, temp2, temp3, temp4 : std_logic_vector(1 to 13) := (others => '0');
signal counter : integer range 0 to 4 := 0;
signal shift_count : integer range 0 to 52 := 0;
signal temp : std_logic_vector(1 to 52) := (others => '0');
signal start_shifting : std_logic := '0';
begin
process(clk)
begin
if rising_edge(clk) then
if IN_EN = '1' then
if counter = 0 then
temp1 <= DIN;
counter <= 1;
elsif counter = 1 then
temp2 <= DIN;
counter <= 2;
elsif counter = 2 then
temp3 <= DIN;
counter <= 3;
elsif counter = 3 then
temp4 <= DIN;
counter <= 4;
temp(1 to 13) <= DIN;
temp <= temp1 & temp2 & temp3 & DIN;
start_shifting <= '1';
shift_count <= 52;
end if;
end if;
if start_shifting = '1' and shift_count > 0 then
DOUT <= temp(1);
temp <= temp(2 to 52) & '0';
OUT_EN <= '1';
shift_count <= shift_count - 1;
else
OUT_EN <= '0';
DOUT <= '0';
end if;
end if;
end process;
end Behavioral;