1 | ---------------------------------------------------------------------------------- |
---|
2 | -- Company: |
---|
3 | -- Engineer: |
---|
4 | -- |
---|
5 | -- Create Date: 21:45:28 07/26/2012 |
---|
6 | -- Design Name: |
---|
7 | -- Module Name: RAM_MUX - Behavioral |
---|
8 | -- Project Name: |
---|
9 | -- Target Devices: |
---|
10 | -- Tool versions: |
---|
11 | -- Description: |
---|
12 | -- Multiplexeur de la memoire du noeud |
---|
13 | -- Dependencies: |
---|
14 | -- |
---|
15 | -- Revision: |
---|
16 | -- Revision 0.01 - File Created |
---|
17 | -- Additional Comments: |
---|
18 | -- |
---|
19 | ---------------------------------------------------------------------------------- |
---|
20 | LIBRARY ieee; |
---|
21 | USE ieee.std_logic_1164.ALL; |
---|
22 | library NocLib ; |
---|
23 | --use IEEE.STD_LOGIC_ARITH.ALL; |
---|
24 | --use IEEE.STD_LOGIC_UNSIGNED.ALL; |
---|
25 | use NocLib.CoreTypes.all; |
---|
26 | use work.Packet_type.all; |
---|
27 | -- Uncomment the following library declaration if using |
---|
28 | -- arithmetic functions with Signed or Unsigned values |
---|
29 | USE ieee.numeric_std.ALL; |
---|
30 | |
---|
31 | -- Uncomment the following library declaration if instantiating |
---|
32 | -- any Xilinx primitives in this code. |
---|
33 | --library UNISIM; |
---|
34 | --use UNISIM.VComponents.all; |
---|
35 | |
---|
36 | entity RAM_MUX is |
---|
37 | Port ( ram_ena_in : in STD_LOGIC_VECTOR (1 downto 0); |
---|
38 | ram_enb_in : in STD_LOGIC_VECTOR (1 downto 0); |
---|
39 | ram_we_in : in STD_LOGIC_VECTOR (1 downto 0); |
---|
40 | ram_dina_in_0 : in STD_LOGIC_VECTOR (word - 1 downto 0); |
---|
41 | ram_dina_in_1 : in STD_LOGIC_VECTOR (word - 1 downto 0); |
---|
42 | ram_addra_in_0 : in STD_LOGIC_VECTOR (ADRLEN - 1 downto 0); |
---|
43 | ram_addra_in_1 : in STD_LOGIC_VECTOR (ADRLEN - 1 downto 0); |
---|
44 | ram_addrb_in_0 : in STD_LOGIC_VECTOR (ADRLEN - 1 downto 0); |
---|
45 | ram_addrb_in_1 : in STD_LOGIC_VECTOR (ADRLEN - 1 downto 0); |
---|
46 | ram_dob_in : in STD_LOGIC_VECTOR (word - 1 downto 0); |
---|
47 | |
---|
48 | |
---|
49 | ram_ena_out : out STD_LOGIC; |
---|
50 | ram_enb_out : out STD_LOGIC; |
---|
51 | ram_we_out : out STD_LOGIC; |
---|
52 | ram_dina_out : out STD_LOGIC_VECTOR (word - 1 downto 0); |
---|
53 | ram_addra_out : out STD_LOGIC_VECTOR (ADRLEN - 1 downto 0); |
---|
54 | ram_addrb_out : out STD_LOGIC_VECTOR (ADRLEN - 1 downto 0); |
---|
55 | ram_dob_out_0 : out STD_LOGIC_VECTOR (word - 1 downto 0); |
---|
56 | ram_dob_out_1 : out STD_LOGIC_VECTOR (word - 1 downto 0); |
---|
57 | sel : in std_logic |
---|
58 | ); |
---|
59 | end RAM_MUX; |
---|
60 | |
---|
61 | architecture Behavioral of RAM_MUX is |
---|
62 | |
---|
63 | begin |
---|
64 | |
---|
65 | mux : process(sel,ram_ena_in,ram_enb_in ,ram_we_in,ram_dina_in_0, ram_dina_in_1,ram_addra_in_0,ram_addra_in_1, ram_addrb_in_0, ram_addrb_in_1, ram_dob_in) |
---|
66 | begin |
---|
67 | |
---|
68 | if sel = '1' then |
---|
69 | -- si sel est à 1 les entrées 1 sont sur les sorties correspondantes |
---|
70 | ram_ena_out <= ram_ena_in(1); |
---|
71 | ram_enb_out <= ram_enb_in(1); |
---|
72 | ram_we_out <= ram_we_in(1); |
---|
73 | ram_dina_out <= ram_dina_in_1; |
---|
74 | ram_addra_out <= ram_addra_in_1; |
---|
75 | ram_addrb_out <= ram_addrb_in_1 ; |
---|
76 | ram_dob_out_1 <= ram_dob_in; |
---|
77 | ram_dob_out_0 <= (others => '0'); |
---|
78 | else |
---|
79 | -- si est à 0 les entrées 0 sont sur les sorties correspondantes |
---|
80 | ram_ena_out <= ram_ena_in(0); |
---|
81 | ram_enb_out <= ram_enb_in(0); |
---|
82 | ram_we_out <= ram_we_in(0); |
---|
83 | ram_dina_out <= ram_dina_in_0; |
---|
84 | ram_addra_out <= ram_addra_in_0; |
---|
85 | ram_addrb_out <= ram_addrb_in_0 ; |
---|
86 | ram_dob_out_0 <= ram_dob_in; |
---|
87 | ram_dob_out_1 <= (others => '0'); |
---|
88 | |
---|
89 | end if; |
---|
90 | |
---|
91 | |
---|
92 | end process; |
---|
93 | |
---|
94 | |
---|
95 | end Behavioral; |
---|
96 | |
---|