-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemory_array.vhd
More file actions
33 lines (30 loc) · 1022 Bytes
/
memory_array.vhd
File metadata and controls
33 lines (30 loc) · 1022 Bytes
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
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
ENTITY memory_arr IS
PORT (
clk : IN std_logic;
we : IN std_logic;
addre1 : IN std_logic_vector(2 DOWNTO 0);
addre2 : IN std_logic_vector(2 DOWNTO 0);
addwe : IN std_logic_vector(2 DOWNTO 0);
datain : IN std_logic_vector(7 DOWNTO 0);
portout1 : OUT std_logic_vector(7 DOWNTO 0);
portout2 : OUT std_logic_vector(7 DOWNTO 0)
);
END ENTITY memory_arr;
ARCHITECTURE sync_memory_arr OF memory_arr IS
TYPE memory_type IS ARRAY(0 TO 7) OF std_logic_vector(7 DOWNTO 0);
SIGNAL memory : memory_type;
BEGIN
PROCESS(clk)
BEGIN
IF rising_edge(clk) THEN
IF we = '1' THEN
memory(to_integer(unsigned(addwe))) <= datain;
END IF;
END IF;
END PROCESS;
portout1 <= memory(to_integer(unsigned(addre1)));
portout2 <= memory(to_integer(unsigned(addre2)));
END ARCHITECTURE sync_memory_arr;