Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generic_dpram.v #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions rtl/verilog/generic_dpram.v
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ module generic_dpram(
input rce; // read port chip enable, active high
input oe; // output enable, active high
input [aw-1:0] raddr; // read address
output [dw-1:0] dout; // data output

//output [dw-1:0] dout; // data output
output reg [dw-1:0] dout;//will test
// write port
input wclk; // write clock, rising edge trigger
input wrst; // write port reset, active high
Expand All @@ -141,16 +141,24 @@ module generic_dpram(
// This code has been tested using LeonardoSpectrum and Synplicity.
// The code correctly instantiates Altera EABs and Xilinx BlockRAMs.
//
reg [dw-1:0] mem [(1<<aw) -1:0]; // instantiate memory
// (* ram_style="block" *)
reg [dw-1:0] mem [(1<<aw) -1:0]; // instantiate memory
reg [aw-1:0] ra; // register read address

// read operation
/*
always @(posedge rclk)
if (rce)
ra <= raddr;

assign dout = mem[ra];

*/
//will test
always @(posedge rclk)
if (rce)
dout <= mem[raddr];


// write operation
always@(posedge wclk)
if (we && wce)
Expand Down