1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-17 20:02:53 +08:00

Rallying around TARGET for any platform specific RTL

This commit is contained in:
aolofsson 2022-06-17 15:10:19 -04:00
parent f0372e5afe
commit 1d7dd09b19
5 changed files with 20 additions and 30 deletions

View File

@ -8,8 +8,7 @@
module oh_dsync module oh_dsync
#(parameter SYNCPIPE = 2, // number of sync stages #(parameter SYNCPIPE = 2, // number of sync stages
parameter DELAY = 0, // random delay parameter DELAY = 0, // random delay
parameter SYN = "TRUE", // true=synthesizable parameter TARGET = "DEFAULT" // scell type/size
parameter TYPE = "DEFAULT" // scell type/size
) )
( (
input clk, // clock input clk, // clock
@ -19,7 +18,7 @@ module oh_dsync
); );
generate generate
if(SYN == "TRUE") begin if(TARGET == "DEFAULT") begin
reg [SYNCPIPE:0] sync_pipe; reg [SYNCPIPE:0] sync_pipe;
always @ (posedge clk or negedge nreset) always @ (posedge clk or negedge nreset)
if(!nreset) if(!nreset)
@ -32,8 +31,7 @@ module oh_dsync
end // block: reg end // block: reg
else else
begin begin
asic_dsync #(.TYPE(TYPE), asic_dsync #(.TARGET(TARGET),
.SYN(SYN),
.SYNCPIPE(SYNCPIPE)) .SYNCPIPE(SYNCPIPE))
asic_dsync (.clk(clk), asic_dsync (.clk(clk),
.nreset(nreset), .nreset(nreset),

View File

@ -14,8 +14,7 @@ module oh_fifo_async
parameter REG = 1, // Register fifo output parameter REG = 1, // Register fifo output
parameter AW = $clog2(DEPTH),// rd_count width (derived) parameter AW = $clog2(DEPTH),// rd_count width (derived)
parameter SYNCPIPE = 2, // depth of synchronization pipeline parameter SYNCPIPE = 2, // depth of synchronization pipeline
parameter SYN = "TRUE", // synthesizable parameter TARGET = "DEFAULT", // implementation type
parameter TYPE = "DEFAULT", // implementation type
parameter PROGFULL = DEPTH-1, // programmable almost full level parameter PROGFULL = DEPTH-1, // programmable almost full level
parameter SHAPE = "SQUARE" // hard macro shape (square, tall, wide) parameter SHAPE = "SQUARE" // hard macro shape (square, tall, wide)
) )
@ -63,19 +62,17 @@ module oh_fifo_async
wire rd_nreset; wire rd_nreset;
wire wr_nreset; wire wr_nreset;
//########################### //###########################
//# Reset synchronizers //# Reset synchronizers
//########################### //###########################
oh_rsync #(.SYN(SYN), oh_rsync #(.TARGET(TARGET),
.SYNCPIPE(SYNCPIPE)) .SYNCPIPE(SYNCPIPE))
wr_rsync (.nrst_out (wr_nreset), wr_rsync (.nrst_out (wr_nreset),
.clk (wr_clk), .clk (wr_clk),
.nrst_in (nreset)); .nrst_in (nreset));
oh_rsync #(.SYN(SYN), oh_rsync #(.TARGET(TARGET),
.SYNCPIPE(SYNCPIPE)) .SYNCPIPE(SYNCPIPE))
rd_rsync (.nrst_out (rd_nreset), rd_rsync (.nrst_out (rd_nreset),
.clk (rd_clk), .clk (rd_clk),
@ -116,7 +113,7 @@ module oh_fifo_async
.in (wr_addr[AW:0])); .in (wr_addr[AW:0]));
// synchronize to read clock // synchronize to read clock
oh_dsync #(.SYN(SYN), oh_dsync #(.TARGET(TARGET),
.SYNCPIPE(SYNCPIPE)) .SYNCPIPE(SYNCPIPE))
wr_sync[AW:0] (.dout (wr_addr_gray_sync[AW:0]), wr_sync[AW:0] (.dout (wr_addr_gray_sync[AW:0]),
.clk (rd_clk), .clk (rd_clk),
@ -132,7 +129,7 @@ module oh_fifo_async
.in (rd_addr[AW:0])); .in (rd_addr[AW:0]));
//synchronize to wr clock //synchronize to wr clock
oh_dsync #(.SYN(SYN), oh_dsync #(.TARGET(TARGET),
.SYNCPIPE(SYNCPIPE)) .SYNCPIPE(SYNCPIPE))
rd_sync[AW:0] (.dout (rd_addr_gray_sync[AW:0]), rd_sync[AW:0] (.dout (rd_addr_gray_sync[AW:0]),
.clk (wr_clk), .clk (wr_clk),
@ -157,7 +154,7 @@ module oh_fifo_async
oh_memory_dp #(.N(N), oh_memory_dp #(.N(N),
.DEPTH(DEPTH), .DEPTH(DEPTH),
.REG(REG), .REG(REG),
.SYN(SYN), .TARGET(TARGET),
.SHAPE(SHAPE)) .SHAPE(SHAPE))
oh_memory_dp(.wr_wem ({(N){1'b1}}), oh_memory_dp(.wr_wem ({(N){1'b1}}),
.wr_en (fifo_write), .wr_en (fifo_write),

View File

@ -6,11 +6,10 @@
//############################################################################# //#############################################################################
module oh_fifo_cdc module oh_fifo_cdc
#(parameter N = 32, // FIFO width #(parameter N = 32, // fifo width
parameter DEPTH = 32, // FIFO depth parameter DEPTH = 32, // fifo depth
parameter SYN = "TRUE", // true=synthesizable parameter TARGET = "DEFAULT", // synthesis/sim target
parameter TYPE = "DEFAULT", // true=synthesizable parameter AW = $clog2(DEPTH) // rd_count width (derived)
parameter AW = $clog2(DEPTH) // rd_count width (derived)
) )
( (
input nreset, // async active low reset input nreset, // async active low reset
@ -36,8 +35,7 @@ module oh_fifo_cdc
assign ready_out = ~(wr_almost_full | wr_full | wr_prog_full); assign ready_out = ~(wr_almost_full | wr_full | wr_prog_full);
//async asser, sync deassert of reset //async asser, sync deassert of reset
oh_rsync #(.SYN(SYN), oh_rsync #(.TARGET(TARGET))
.TYPE(TYPE))
sync_reset(.nrst_out (nreset_out), sync_reset(.nrst_out (nreset_out),
.clk (clk_out), .clk (clk_out),
.nrst_in (nreset)); .nrst_in (nreset));
@ -50,7 +48,7 @@ module oh_fifo_cdc
valid_out <= rd_en; valid_out <= rd_en;
// parametric async fifo // parametric async fifo
oh_fifo_async #(.SYN(SYN), oh_fifo_async #(.TARGET(TARGET),
.N(N), .N(N),
.DEPTH(DEPTH)) .DEPTH(DEPTH))
oh_fifo_async ( oh_fifo_async (

View File

@ -9,8 +9,7 @@ module oh_memory_dp
#(parameter N = 32, // FIFO width #(parameter N = 32, // FIFO width
parameter DEPTH = 32, // FIFO depth parameter DEPTH = 32, // FIFO depth
parameter REG = 1, // Register fifo output parameter REG = 1, // Register fifo output
parameter SYN = "TRUE", // hard (macro) or soft (rtl) parameter TARGET = "DEFAULT", // pass through variable for hard macro
parameter TYPE = "DEFAULT", // pass through variable for hard macro
parameter SHAPE = "SQUARE", // hard macro shape (square, tall, wide) parameter SHAPE = "SQUARE", // hard macro shape (square, tall, wide)
parameter AW = $clog2(DEPTH) // rd_count width (derived) parameter AW = $clog2(DEPTH) // rd_count width (derived)
) )
@ -40,7 +39,7 @@ module oh_memory_dp
); );
generate generate
if(SYN == "TRUE") begin if(TARGET == "DEFAULT") begin
//######################################### //#########################################
// Generic RAM for synthesis // Generic RAM for synthesis
//######################################### //#########################################

View File

@ -7,8 +7,7 @@
module oh_rsync module oh_rsync
#(parameter SYNCPIPE = 2, // number of sync stages #(parameter SYNCPIPE = 2, // number of sync stages
parameter SYN = "TRUE", // true=synthesizable parameter TARGET = "DEFAULT" // scell type/size
parameter TYPE = "DEFAULT" // scell type/size
) )
( (
input clk, input clk,
@ -17,7 +16,7 @@ module oh_rsync
); );
generate generate
if(SYN == "TRUE") if(TARGET == "DEFAULT")
begin begin
reg [SYNCPIPE-1:0] sync_pipe; reg [SYNCPIPE-1:0] sync_pipe;
always @ (posedge clk or negedge nrst_in) always @ (posedge clk or negedge nrst_in)
@ -29,8 +28,7 @@ module oh_rsync
end end
else else
begin begin
asic_rsync #(.TYPE(TYPE), asic_rsync #(.TARGET(TARGET),
.SYN(SYN),
.SYNCPIPE(SYNCPIPE)) .SYNCPIPE(SYNCPIPE))
asic_rsync (.clk(clk), asic_rsync (.clk(clk),
.nrst_in(nrst_in), .nrst_in(nrst_in),