AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
 All Classes Variables
udp_dualportram.vhd
1 LIBRARY ieee;
2 USE ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
4 
5 ENTITY udp_DualPortRAM IS
6 generic(
7  BUFWIDTH: natural := 0;
8  ADDRWIDTH: natural := 0
9 );
10 port (
11  ClkA : in std_logic;
12  ClkB : in std_logic;
13  wea : in std_logic;
14  addra : in std_logic_vector(BUFWIDTH + ADDRWIDTH - 1 downto 0);
15  addrb : in std_logic_vector(BUFWIDTH + ADDRWIDTH - 1 downto 0);
16  dia : in std_logic_vector(7 downto 0);
17  dob : out std_logic_vector(7 downto 0)
18  );
19 END ENTITY udp_DualPortRAM;
20 
21 --
22 ARCHITECTURE initial OF udp_DualPortRAM IS
23 type ram_type is array (2**(BUFWIDTH + ADDRWIDTH) - 1 downto 0) of std_logic_vector (7 downto 0);
24 signal ram : ram_type;
25 attribute block_ram : boolean;
26 attribute block_ram of RAM : signal is TRUE;
27 BEGIN
28 
29 write: process (ClkA)
30 begin
31  if (rising_edge(ClkA)) then
32  if (wea = '1') then
33  ram(to_integer(unsigned(addra))) <= dia
34 -- pragma translate_off
35  after 4 ns
36 -- pragma translate_on
37  ;
38  end if;
39  end if;
40 end process write;
41 
42 read: process (ClkB)
43 begin
44  if (rising_edge(ClkB)) then
45  dob <= ram(to_integer(unsigned(addrb)))
46 -- pragma translate_off
47  after 4 ns
48 -- pragma translate_on
49  ;
50  end if;
51 end process read;
52 END ARCHITECTURE initial;