-
Notifications
You must be signed in to change notification settings - Fork 0
/
eight_n_bit_register_file.vhd
78 lines (66 loc) · 2.5 KB
/
eight_n_bit_register_file.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
----------------------------------------------------------------------------------
-- Company:
-- Engineer: Umar Farouk Umar
--
-- Create Date: 22:26:22 11/29/2010
-- Design Name:
-- Module Name: eight_n_bit_register_file - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity eight_n_bit_register_file is
generic (n : positive := 4);
Port ( Data_in : in STD_LOGIC_VECTOR (n-1 downto 0);
Read_address_a : in STD_LOGIC_VECTOR (2 downto 0);
Read_address_b : in STD_LOGIC_VECTOR (2 downto 0);
Write_address : in STD_LOGIC_VECTOR (2 downto 0);
REA : in STD_LOGIC;
REB : in STD_LOGIC;
WE : in STD_LOGIC;
CLK : in STD_LOGIC;
OutA : out STD_LOGIC_VECTOR (n-1 downto 0);
OutB : out STD_LOGIC_VECTOR (n-1 downto 0));
end eight_n_bit_register_file;
architecture Behavioral of eight_n_bit_register_file is
component three_to_eight_decoder
Port ( OE : in std_logic;
address : in std_logic_vector(2 downto 0);
O_outputs : out std_logic_vector(7 downto 0));
end component;
component rfc_register
generic (n : positive := 4);
Port ( Data_in : in STD_LOGIC_VECTOR (n-1 downto 0);
REA : in STD_LOGIC;
REB : in STD_LOGIC;
WE : in STD_LOGIC;
CLK : in STD_LOGIC;
OutA : out STD_LOGIC_VECTOR (n-1 downto 0);
OutB : out STD_LOGIC_VECTOR (n-1 downto 0));
end component;
signal ReadA, ReadB, WriteA : STD_LOGIC_VECTOR (7 downto 0);
begin
three_to_eight_decoder_one : three_to_eight_decoder port map (REA, Read_address_a, ReadA);
three_to_eight_decoder_two : three_to_eight_decoder port map (REB, Read_address_b, ReadB);
three_to_eight_decoder_three : three_to_eight_decoder port map (WE, Write_address, WriteA);
inst : for i in 7 downto 0 generate
rfc_register_i : rfc_register generic map (n) port map (Data_in, ReadA(i), ReadB(i), WriteA(i), CLK, OutA, OutB);
end generate;
end Behavioral;