2019-11-06 13:21:20 -06:00
|
|
|
//-----------------------------------------------------
|
2019-11-07 15:57:46 -06:00
|
|
|
// Design Name : dual_port_ram_32x512
|
|
|
|
// File Name : dpram.v
|
|
|
|
// Function : Dual port RAM 32x512
|
2019-11-06 13:21:20 -06:00
|
|
|
// Coder : Aurelien Alacchi
|
|
|
|
//-----------------------------------------------------
|
|
|
|
|
2019-11-07 15:57:46 -06:00
|
|
|
module dual_port_ram_32x512 (
|
2019-11-06 13:21:20 -06:00
|
|
|
input clk,
|
|
|
|
input wen,
|
|
|
|
input ren,
|
2019-11-07 15:57:46 -06:00
|
|
|
input[0:8] waddr,
|
|
|
|
input[0:8] raddr,
|
2019-11-06 13:21:20 -06:00
|
|
|
input[0:31] d_in,
|
|
|
|
output[0:31] d_out );
|
|
|
|
|
2019-11-07 15:57:46 -06:00
|
|
|
dual_port_sram_32x512 memory_0 (
|
2019-11-06 13:21:20 -06:00
|
|
|
.wclk (clk),
|
|
|
|
.wen (wen),
|
|
|
|
.waddr (waddr),
|
|
|
|
.data_in (d_in),
|
|
|
|
.rclk (clk),
|
|
|
|
.ren (ren),
|
|
|
|
.raddr (raddr),
|
|
|
|
.d_out (d_out) );
|
|
|
|
|
|
|
|
endmodule
|
|
|
|
|
2019-11-07 15:57:46 -06:00
|
|
|
module dual_port_sram_32x512 (
|
2019-11-06 13:21:20 -06:00
|
|
|
input wclk,
|
|
|
|
input wen,
|
2019-11-07 15:57:46 -06:00
|
|
|
input[0:8] waddr,
|
2019-11-06 13:21:20 -06:00
|
|
|
input[0:31] data_in,
|
|
|
|
input rclk,
|
|
|
|
input ren,
|
2019-11-07 15:57:46 -06:00
|
|
|
input[0:8] raddr,
|
2019-11-06 13:21:20 -06:00
|
|
|
output[0:31] d_out );
|
|
|
|
|
2019-11-07 15:57:46 -06:00
|
|
|
reg[0:31] ram[0:511];
|
2019-11-06 13:21:20 -06:00
|
|
|
reg[0:31] internal;
|
|
|
|
|
|
|
|
assign d_out = internal;
|
|
|
|
|
2019-11-07 15:57:46 -06:00
|
|
|
always @(posedge wclk) begin
|
2019-11-06 13:21:20 -06:00
|
|
|
if(wen) begin
|
|
|
|
ram[waddr] <= data_in;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-11-07 15:57:46 -06:00
|
|
|
always @(posedge rclk) begin
|
2019-11-06 13:21:20 -06:00
|
|
|
if(ren) begin
|
|
|
|
internal <= ram[raddr];
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
endmodule
|