-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcic_stack.vhd
39 lines (34 loc) · 843 Bytes
/
cic_stack.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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;
entity cic_stack is
PORT (
clka : IN STD_LOGIC;
wea : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
addra : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
dina : IN STD_LOGIC_VECTOR(9 DOWNTO 0);
douta : OUT STD_LOGIC_VECTOR(9 DOWNTO 0)
);
end cic_stack;
architecture behaviour of cic_stack is
subtype stack_addr is std_logic_vector(9 downto 0);
type stack_t is array (0 to 3) of stack_addr;
signal stack : stack_t;
begin
write_proc : process(clka)
begin
if rising_edge(clka) then
if wea(0) = '1' then
stack(to_integer(unsigned(addra))) <= dina;
end if;
end if;
end process;
read_proc : process(clka)
begin
if rising_edge(clka) then
--if wea(0) = '0' then
douta <= stack(to_integer(unsigned(addra)));
--end if;
end if;
end process;
end behaviour;