From 32786c63930bc532bca1f25ab8d3404b5773edfd Mon Sep 17 00:00:00 2001 From: Javier Valenzuela Date: Tue, 14 Jun 2022 10:10:59 -0500 Subject: fpga: lib: Add read-only strategy for port B in 2-port RAM --- fpga/usrp3/lib/control/ram_2port.v | 2 +- fpga/usrp3/lib/control/ram_2port_impl.vh | 53 ++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/fpga/usrp3/lib/control/ram_2port.v b/fpga/usrp3/lib/control/ram_2port.v index 96db90061..6f32409c1 100644 --- a/fpga/usrp3/lib/control/ram_2port.v +++ b/fpga/usrp3/lib/control/ram_2port.v @@ -54,7 +54,7 @@ module ram_2port #( parameter DWIDTH = 32, // Width of the memory block parameter AWIDTH = 9, // log2 of the depth of the memory block - parameter RW_MODE = "READ-FIRST", // Read-write mode {READ-FIRST, WRITE-FIRST, NO-CHANGE} + parameter RW_MODE = "READ-FIRST", // Read-write mode {READ-FIRST, WRITE-FIRST, NO-CHANGE, B-READ-ONLY} parameter RAM_TYPE = "AUTOMATIC", // Type of RAM to infer {AUTOMATIC, REG, LUTRAM, BRAM, URAM} parameter OUT_REG = 0, // Instantiate an output register? (+1 cycle of read latency) parameter INIT_FILE = "" // Optionally initialize memory with this file diff --git a/fpga/usrp3/lib/control/ram_2port_impl.vh b/fpga/usrp3/lib/control/ram_2port_impl.vh index 8f8f3bab3..fe1d790cc 100644 --- a/fpga/usrp3/lib/control/ram_2port_impl.vh +++ b/fpga/usrp3/lib/control/ram_2port_impl.vh @@ -10,7 +10,7 @@ module `RAM_MOD_NAME #( parameter DWIDTH = 32, // Width of the memory block parameter AWIDTH = 9, // log2 of the depth of the memory block - parameter RW_MODE = "READ-FIRST", // Read-write mode {READ-FIRST, WRITE-FIRST, NO-CHANGE} + parameter RW_MODE = "READ-FIRST", // Read-write mode {READ-FIRST, WRITE-FIRST, NO-CHANGE, B-READ-ONLY} parameter OUT_REG = 0, // Instantiate an output register? (+1 cycle of read latency) parameter INIT_FILE = "" // Optionally initialize memory with this file ) ( @@ -33,13 +33,16 @@ module `RAM_MOD_NAME #( // Initialize ram to a specified file or to all zeros to match hardware generate if (INIT_FILE != "") begin - initial + initial begin $readmemh(INIT_FILE, ram, 0, (1<