This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
column.vhd
58 lines (53 loc) · 1.49 KB
/
column.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
54
55
56
57
58
-- Stlpec LED displeja
-- @author Onegen Something <xkrame00@vutbr.cz>
-- @date 2023-04-22
--
library ieee;
use ieee.std_logic_1164.all;
library work;
use work.effects_pack.all;
entity column is
generic (
N : positive := 8
);
port (
CLK : in std_logic;
RESET : in std_logic;
STATE : buffer std_logic_vector(N - 1 downto 0);
INIT_STATE : in std_logic_vector(N - 1 downto 0);
NEIGH_LEFT : in std_logic_vector(N - 1 downto 0);
NEIGH_RIGHT : in std_logic_vector(N - 1 downto 0);
DIRECTION : in DIRECTION_T;
EN : in std_logic
);
end column;
architecture behavioral of column is
begin
process (CLK, RESET)
begin
if RESET = '1' then
----- Reset -----
STATE <= INIT_STATE;
elsif rising_edge(CLK) and (EN = '1') then
if (DIRECTION = DIR_LEFT) then
----- Posun vlavo -----
STATE <= NEIGH_RIGHT;
elsif (DIRECTION = DIR_RIGHT) then
----- Posun vpravo -----
STATE <= NEIGH_LEFT;
elsif (DIRECTION = DIR_TOP) then
----- Shift nahor -----
STATE(N - 2 downto 0) <= STATE(N - 1 downto 1);
STATE(N - 1) <= '0';
elsif (DIRECTION = DIR_TOP_BOTTOM) then
----- Ripple efekt -----
STATE(N - 1 downto (N / 2) + 1) <= STATE(N - 2 downto (N / 2));
STATE((N / 2) - 1 downto 0) <= STATE((N / 2) downto 1);
STATE((N / 2)) <= '0';
elsif (DIRECTION = DIR_NEGATE) then
----- Negacia -----
STATE <= not STATE;
end if;
end if;
end process;
end behavioral;