forked from openrisc/mor1kx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix resource issue with non inferring RAM (openrisc#66)
Introduced with commit 73bf629 (true_dpram: Use a single sequential block). Change to use 2 clocks to better match what xilinx expects when inferring true dual port RAM. Tested and works on quartus/altera/intel.
- Loading branch information
Showing
3 changed files
with
17 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
of the OHDL was not distributed with this file, You | ||
can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt | ||
Description: True dual port ram with single clock | ||
Description: True dual port ram with dual clock's | ||
Copyright (C) 2013 Stefan Kristiansson <[email protected]> | ||
|
@@ -16,11 +16,15 @@ module mor1kx_true_dpram_sclk | |
parameter DATA_WIDTH = 32 | ||
) | ||
( | ||
input clk, | ||
/* Port A */ | ||
input clk_a, | ||
input [ADDR_WIDTH-1:0] addr_a, | ||
input we_a, | ||
input [DATA_WIDTH-1:0] din_a, | ||
output [DATA_WIDTH-1:0] dout_a, | ||
|
||
/* Port B */ | ||
input clk_b, | ||
input [ADDR_WIDTH-1:0] addr_b, | ||
input we_b, | ||
input [DATA_WIDTH-1:0] din_b, | ||
|
@@ -35,14 +39,16 @@ module mor1kx_true_dpram_sclk | |
assign dout_a = rdata_a; | ||
assign dout_b = rdata_b; | ||
|
||
always @(posedge clk) begin | ||
always @(posedge clk_a) begin | ||
if (we_a) begin | ||
mem[addr_a] <= din_a; | ||
rdata_a <= din_a; | ||
end else begin | ||
rdata_a <= mem[addr_a]; | ||
end | ||
end | ||
|
||
always @(posedge clk_b) begin | ||
if (we_b) begin | ||
mem[addr_b] <= din_b; | ||
rdata_b <= din_b; | ||
|