AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
 All Classes Variables
udp_rxram_shim.vhd
1 -- Dave Sankey May 2013
2 
3 LIBRARY ieee;
4 USE ieee.std_logic_1164.all;
5 use ieee.numeric_std.all;
6 
7 ENTITY udp_rxram_shim IS
8  generic(
9  BUFWIDTH: natural := 0
10  );
11  port (
12  mac_clk: in std_logic;
13  rst_macclk: in std_logic;
14 --
15  rxram_end_addr: in std_logic_vector(12 downto 0);
16  rxram_send: in std_logic;
17  rxram_write_buf: in std_logic_vector(BUFWIDTH - 1 downto 0);
18 --
19  rxram_req_send: in std_logic;
20  rxram_send_buf: in std_logic_vector(BUFWIDTH - 1 downto 0);
21 --
22  rxram_busy: in std_logic;
23 --
24  rxram_end_addr_x: out std_logic_vector(12 downto 0);
25  rxram_send_x: out std_logic;
26  rxram_sent: out std_logic
27  );
28 end udp_rxram_shim;
29 
30 architecture simple of udp_rxram_shim is
31 
32  type address_buf is array (2**BUFWIDTH - 1 downto 0) of std_logic_vector(12 downto 0);
33  signal end_address_buf: address_buf;
34  signal last_busy: std_logic;
35 
36 begin
37 
38 input_block: process (mac_clk)
39  begin
40  if rising_edge(mac_clk) then
41  if rst_macclk = '1' then
42  end_address_buf <= (Others => (Others => '0'));
43  elsif rxram_send = '1' then
44  end_address_buf(to_integer(unsigned(rxram_write_buf))) <= rxram_end_addr;
45  end if;
46  end if;
47  end process;
48 
49 output_block: process (mac_clk)
50  begin
51  if rising_edge(mac_clk) then
52  if rxram_req_send = '1' then
53  rxram_send_x <= '1'
54 -- pragma translate_off
55  after 4 ns
56 -- pragma translate_on
57  ;
58  rxram_end_addr_x <= end_address_buf(to_integer(unsigned(rxram_send_buf)))
59 -- pragma translate_off
60  after 4 ns
61 -- pragma translate_on
62  ;
63  else
64  rxram_send_x <= '0'
65 -- pragma translate_off
66  after 4 ns
67 -- pragma translate_on
68  ;
69  rxram_end_addr_x <= (Others => '0')
70 -- pragma translate_off
71  after 4 ns
72 -- pragma translate_on
73  ;
74  end if;
75  end if;
76  end process;
77 
78 busy_block: process (mac_clk)
79  begin
80  if rising_edge(mac_clk) then
81  if (rxram_busy = '0') and (last_busy = '1') then
82  rxram_sent <= '1'
83 -- pragma translate_off
84  after 4 ns
85 -- pragma translate_on
86  ;
87  else
88  rxram_sent <= '0'
89 -- pragma translate_off
90  after 4 ns
91 -- pragma translate_on
92  ;
93  end if;
94  last_busy <= rxram_busy
95 -- pragma translate_off
96  after 4 ns
97 -- pragma translate_on
98  ;
99  end if;
100  end process;
101 
102 end simple;