1 | ---------------------------------------------------------------------------------- |
---|
2 | -- Company: |
---|
3 | -- Engineer: KIEGAING EMMANUEL GEL EN 5 |
---|
4 | -- |
---|
5 | -- Create Date: 18:54:08 04/19/2011 |
---|
6 | -- Design Name: |
---|
7 | -- Module Name: RAM_64 - Behavioral |
---|
8 | -- Project Name: |
---|
9 | -- Target Devices: |
---|
10 | -- Tool versions: |
---|
11 | -- Description: SYNTHESE d'une RAM 256 octet par inferation |
---|
12 | -- la ram possède un port d'écriture et un port de lecture |
---|
13 | -- le port primaire est à lecture et ecrite et le port secondaire à lecture seule |
---|
14 | -- |
---|
15 | -- Dependencies: |
---|
16 | -- |
---|
17 | -- Revision: |
---|
18 | -- Revision 0.01 - File Created |
---|
19 | -- Additional Comments: |
---|
20 | -- |
---|
21 | ---------------------------------------------------------------------------------- |
---|
22 | library IEEE; |
---|
23 | use IEEE.STD_LOGIC_1164.ALL; |
---|
24 | use IEEE.STD_LOGIC_ARITH.ALL; |
---|
25 | use IEEE.STD_LOGIC_UNSIGNED.ALL; |
---|
26 | --Library NocLib; |
---|
27 | --use NocLib.CoreTypes.all; |
---|
28 | use work.CoreTypes.all; |
---|
29 | ---- Uncomment the following library declaration if instantiating |
---|
30 | ---- any Xilinx primitives in this code. |
---|
31 | --library UNISIM; |
---|
32 | --use UNISIM.VComponents.all; |
---|
33 | |
---|
34 | entity RAM_256 is |
---|
35 | Port ( clka, clkb : in std_logic; |
---|
36 | wea : in std_logic; |
---|
37 | ena, enb : in std_logic; |
---|
38 | addra, addrb : in std_logic_vector(Word-1 downto 0); |
---|
39 | dia : in std_logic_vector(Word-1 downto 0); |
---|
40 | dob : out std_logic_vector(Word-1 downto 0)); |
---|
41 | end RAM_256; |
---|
42 | |
---|
43 | architecture Behavioral of RAM_256 is |
---|
44 | type ram_type is array (255 downto 0) of std_logic_vector (Word-1 downto 0); |
---|
45 | signal RAM: ram_type; |
---|
46 | begin |
---|
47 | process (clka) |
---|
48 | begin |
---|
49 | if clka'event and clka = '1' then |
---|
50 | if ena = '1' then |
---|
51 | if wea = '1' then |
---|
52 | RAM(conv_integer(addra)) <= dia; |
---|
53 | end if; |
---|
54 | end if; |
---|
55 | end if; |
---|
56 | end process; |
---|
57 | |
---|
58 | process (clkb) |
---|
59 | begin |
---|
60 | if clkb'event and clkb = '1' then |
---|
61 | if enb = '1' then |
---|
62 | dob <= RAM(conv_integer(addrb)) ; |
---|
63 | end if; |
---|
64 | end if; |
---|
65 | end process; |
---|
66 | |
---|
67 | end Behavioral; |
---|
68 | |
---|