Line 37... |
Line 37... |
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
//
|
//
|
//
|
//
|
module memdev(i_clk, i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
|
module memdev(i_clk, i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
|
o_wb_ack, o_wb_stall, o_wb_data);
|
o_wb_ack, o_wb_stall, o_wb_data);
|
parameter AW=15, DW=32;
|
parameter AW=15, DW=32, EXTRACLOCK= 0;
|
input i_clk, i_wb_cyc, i_wb_stb, i_wb_we;
|
input i_clk, i_wb_cyc, i_wb_stb, i_wb_we;
|
input [(AW-1):0] i_wb_addr;
|
input [(AW-1):0] i_wb_addr;
|
input [(DW-1):0] i_wb_data;
|
input [(DW-1):0] i_wb_data;
|
output reg o_wb_ack;
|
output reg o_wb_ack;
|
output wire o_wb_stall;
|
output wire o_wb_stall;
|
output reg [(DW-1):0] o_wb_data;
|
output reg [(DW-1):0] o_wb_data;
|
|
|
|
wire w_wstb, w_stb;
|
|
wire [(DW-1):0] w_data;
|
|
wire [(AW-1):0] w_addr;
|
|
|
|
generate
|
|
if (EXTRACLOCK == 0)
|
|
begin
|
|
|
|
assign w_wstb = (i_wb_stb)&&(i_wb_we);
|
|
assign w_stb = i_wb_stb;
|
|
assign w_addr = i_wb_addr;
|
|
assign w_data = i_wb_data;
|
|
|
|
end else begin
|
|
|
reg last_wstb, last_stb;
|
reg last_wstb, last_stb;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
last_wstb <= (i_wb_stb)&&(i_wb_we);
|
last_wstb <= (i_wb_stb)&&(i_wb_we);
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
last_stb <= (i_wb_stb);
|
last_stb <= (i_wb_stb);
|
Line 58... |
Line 73... |
always @(posedge i_clk)
|
always @(posedge i_clk)
|
last_data <= i_wb_data;
|
last_data <= i_wb_data;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
last_addr <= i_wb_addr;
|
last_addr <= i_wb_addr;
|
|
|
|
assign w_wstb = last_wstb;
|
|
assign w_stb = last_stb;
|
|
assign w_addr = last_addr;
|
|
assign w_data = last_data;
|
|
end endgenerate
|
|
|
reg [(DW-1):0] mem [0:((1<<AW)-1)];
|
reg [(DW-1):0] mem [0:((1<<AW)-1)];
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
o_wb_data <= mem[last_addr];
|
o_wb_data <= mem[w_addr];
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if (last_wstb)
|
if (w_wstb)
|
mem[last_addr] <= last_data;
|
mem[w_addr] <= w_data;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
o_wb_ack <= (last_stb);
|
o_wb_ack <= (w_stb);
|
assign o_wb_stall = 1'b0;
|
assign o_wb_stall = 1'b0;
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|