Skip to content

Commit 316c9c3

Browse files
committed
library: common: ad_mem_dist: Rename and add registered output
Signed-off-by: Bogdan Luncan <bogdan.luncan@analog.com>
1 parent 79de919 commit 316c9c3

File tree

1 file changed

+52
-12
lines changed

1 file changed

+52
-12
lines changed

library/common/ad_mem_dist.v

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,44 @@
1-
//////////////////////////////////////////////////////////////////////////////////
2-
// Company: Analog Devices, Inc.
3-
// Engineer: MBB
4-
// Simple dual-port distributed RAM with non-registered output
5-
//////////////////////////////////////////////////////////////////////////////////
1+
// ***************************************************************************
2+
// ***************************************************************************
3+
// Copyright (C) 2025 Analog Devices, Inc. All rights reserved.
4+
//
5+
// In this HDL repository, there are many different and unique modules, consisting
6+
// of various HDL (Verilog or VHDL) components. The individual modules are
7+
// developed independently, and may be accompanied by separate and unique license
8+
// terms.
9+
//
10+
// The user should read each of these license terms, and understand the
11+
// freedoms and responsibilities that he or she has by using this source/core.
12+
//
13+
// This core is distributed in the hope that it will be useful, but WITHOUT ANY
14+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15+
// A PARTICULAR PURPOSE.
16+
//
17+
// Redistribution and use of source or resulting binaries, with or without modification
18+
// of this file, are permitted under one of the following two license terms:
19+
//
20+
// 1. The GNU General Public License version 2 as published by the
21+
// Free Software Foundation, which can be found in the top level directory
22+
// of this repository (LICENSE_GPL2), and also online at:
23+
// <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
24+
//
25+
// OR
26+
//
27+
// 2. An ADI specific BSD license, which can be found in the top level directory
28+
// of this repository (LICENSE_ADIBSD), and also on-line at:
29+
// https://github.com/analogdevicesinc/hdl/blob/main/LICENSE_ADIBSD
30+
// This will allow to generate bit files and not release the source code,
31+
// as long as it attaches to an ADI device.
32+
//
33+
// ***************************************************************************
34+
// ***************************************************************************
635

7-
`timescale 1ps / 1ps
8-
`default_nettype none
36+
`timescale 1ns/100ps
937

10-
module dual_port_dist_ram #(
38+
module ad_mem_dist #(
1139
parameter RAM_WIDTH = 32,
12-
parameter RAM_ADDR_BITS = 4
40+
parameter RAM_ADDR_BITS = 4,
41+
parameter REGISTERED_OUTPUT = 1
1342
)(
1443
output wire [RAM_WIDTH-1:0] rd_data,
1544
input wire clk,
@@ -22,12 +51,23 @@ module dual_port_dist_ram #(
2251
(* ram_style="distributed" *)
2352
reg [RAM_WIDTH-1:0] ram [(2**RAM_ADDR_BITS)-1:0];
2453

54+
reg [RAM_WIDTH-1:0] rd_data_s;
55+
2556
always @(posedge clk)
2657
if (wr_en)
2758
ram[wr_addr] <= wr_data;
2859

29-
assign rd_data = ram[rd_addr];
60+
generate if (REGISTERED_OUTPUT) begin
61+
always @(posedge clk) begin
62+
rd_data_s <= ram[rd_addr];
63+
end
64+
end else begin
65+
always @(*) begin
66+
rd_data_s = ram[rd_addr];
67+
end
68+
end
69+
endgenerate
3070

31-
endmodule
71+
assign rd_data = rd_data_s;
3272

33-
`default_nettype wire
73+
endmodule

0 commit comments

Comments
 (0)