]> git.gag.com Git - debian/gnuradio/blob - usrp2/fpga/control_lib/wb_ram_block.v
Merged r9433:9527 from features/gr-usrp2 into trunk. Adds usrp2 and gr-usrp2 top...
[debian/gnuradio] / usrp2 / fpga / control_lib / wb_ram_block.v
1
2
3 // Since this is a block ram, there are no byte-selects and there is a 1-cycle read latency
4 //   These have to be a multiple of 512 lines (2K) long
5
6 module wb_ram_block
7   #(parameter AWIDTH=9)
8     (input clk_i,
9      input stb_i,
10      input we_i,
11      input [AWIDTH-1:0] adr_i,
12      input [31:0] dat_i,
13      output reg [31:0] dat_o,
14      output ack_o);
15
16    reg [31:0] distram [0:1<<(AWIDTH-1)];
17
18    always @(posedge clk_i)
19      begin
20         if(stb_i & we_i)
21           distram[adr_i] <= dat_i;
22         dat_o <= distram[adr_i];
23      end
24
25    reg stb_d1, ack_d1;
26    always @(posedge clk_i)
27      stb_d1 <= stb_i;
28    
29    always @(posedge clk_i)
30      ack_d1 <= ack_o;
31    
32    assign ack_o = stb_i & (we_i | (stb_d1 & ~ack_d1));
33 endmodule // wb_ram_block
34
35
36