mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-17 20:02:53 +08:00
Fixing compiler warnings
This commit is contained in:
parent
eb162a3bf3
commit
2dd46abdd1
@ -19,9 +19,8 @@ module oh_fifo_async
|
||||
parameter PROGFULL = DEPTH-1, // programmable almost full level
|
||||
parameter SHAPE = "square" // hard macro shape (square, tall, wide)
|
||||
)
|
||||
(
|
||||
//basic interface
|
||||
input nreset, //async reset
|
||||
(//nreset
|
||||
input nreset,
|
||||
//write port
|
||||
input wr_clk,
|
||||
input [DW-1:0] wr_din, // data to write
|
||||
@ -53,7 +52,6 @@ module oh_fifo_async
|
||||
);
|
||||
|
||||
//local wires
|
||||
wire [AW-1:0] wr_count; // valid entries in fifo
|
||||
reg [AW:0] wr_addr; // extra bit for wraparound comparison
|
||||
reg [AW:0] rd_addr;
|
||||
wire [AW:0] wr_addr_gray;
|
||||
@ -61,6 +59,9 @@ module oh_fifo_async
|
||||
wire [AW:0] rd_addr_gray;
|
||||
wire [AW:0] rd_addr_gray_sync;
|
||||
wire [AW:0] rd_addr_sync;
|
||||
wire fifo_write;
|
||||
wire rd_nreset;
|
||||
wire wr_nreset;
|
||||
|
||||
|
||||
|
||||
@ -71,13 +72,13 @@ module oh_fifo_async
|
||||
oh_rsync #(.SYN(SYN),
|
||||
.SYNCPIPE(SYNCPIPE))
|
||||
wr_rsync (.nrst_out (wr_nreset),
|
||||
.clk (wrclk),
|
||||
.clk (wr_clk),
|
||||
.nrst_in (nreset));
|
||||
|
||||
oh_rsync #(.SYN(SYN),
|
||||
.SYNCPIPE(SYNCPIPE))
|
||||
rd_rsync (.nrst_out (rd_nreset),
|
||||
.clk (rdclk),
|
||||
.clk (rd_clk),
|
||||
.nrst_in (nreset));
|
||||
|
||||
//###########################
|
||||
@ -112,15 +113,15 @@ module oh_fifo_async
|
||||
// convert to gray code (only one bit can toggle)
|
||||
oh_bin2gray #(.DW(AW+1))
|
||||
wr_bin2gray (.out (wr_addr_gray[AW:0]),
|
||||
.in (wr_addr[AW:0]));
|
||||
.in (wr_addr[AW:0]));
|
||||
|
||||
// synchronize to read clock
|
||||
oh_dsync #(.SYN(SYN),
|
||||
.SYNCPIPE(SYNCPIPE))
|
||||
wr_sync[AW:0] (.dout (wr_addr_gray_sync[AW:0]),
|
||||
.clk (rdclk),
|
||||
.nreset(rd_nreset),
|
||||
.din (wr_addr_gray[AW:0]));
|
||||
wr_sync[AW:0] (.dout (wr_addr_gray_sync[AW:0]),
|
||||
.clk (rd_clk),
|
||||
.nreset (rd_nreset),
|
||||
.din (wr_addr_gray[AW:0]));
|
||||
|
||||
//###########################
|
||||
//# READ ---> WRITE
|
||||
@ -128,13 +129,13 @@ module oh_fifo_async
|
||||
|
||||
oh_bin2gray #(.DW(AW+1))
|
||||
rd_bin2gray (.out (rd_addr_gray[AW:0]),
|
||||
.in (rd_addr[AW:0]));
|
||||
.in (rd_addr[AW:0]));
|
||||
|
||||
//synchronize to wr clock
|
||||
oh_dsync #(.SYN(SYN),
|
||||
.SYNCPIPE(SYNCPIPE))
|
||||
rd_sync[AW:0] (.dout (rd_addr_gray_sync[AW:0]),
|
||||
.clk (wrclk),
|
||||
.clk (wr_clk),
|
||||
.nreset (wr_nreset),
|
||||
.din (rd_addr_gray[AW:0]));
|
||||
|
||||
@ -149,9 +150,6 @@ module oh_fifo_async
|
||||
assign wr_full = (wr_addr[AW-1:0] == rd_addr_sync[AW-1:0]) &
|
||||
(wr_addr[AW] != rd_addr_sync[AW]);
|
||||
|
||||
|
||||
|
||||
|
||||
//###########################
|
||||
//# Memory Array
|
||||
//###########################
|
||||
@ -160,7 +158,6 @@ module oh_fifo_async
|
||||
.DEPTH(DEPTH),
|
||||
.REG(REG),
|
||||
.SYN(SYN),
|
||||
.SYN(SYN),
|
||||
.SHAPE(SHAPE))
|
||||
oh_memory_dp(.wr_wem ({(DW){1'b1}}),
|
||||
.wr_en (fifo_write),
|
||||
|
@ -40,7 +40,7 @@ module oh_memory_dp
|
||||
);
|
||||
|
||||
generate
|
||||
if(SYN=="true") begin: soft
|
||||
if(SYN=="true") begin
|
||||
//#########################################
|
||||
// Generic RAM for synthesis
|
||||
//#########################################
|
||||
@ -53,7 +53,8 @@ module oh_memory_dp
|
||||
always @(posedge wr_clk)
|
||||
for (i=0;i<DW;i=i+1)
|
||||
if (wr_en & wr_wem[i])
|
||||
ram[wr_addr[AW-1:0]][i] <= wr_din[i];
|
||||
ram[wr_addr[AW-1:0]][i] = wr_din[i];
|
||||
|
||||
//read port
|
||||
assign rdata[DW-1:0] = ram[rd_addr[AW-1:0]];
|
||||
|
||||
@ -67,7 +68,7 @@ module oh_memory_dp
|
||||
assign rd_dout[DW-1:0] = (REG==1) ? rd_reg[DW-1:0] :
|
||||
rdata[DW-1:0];
|
||||
end // block: soft
|
||||
else begin: hard
|
||||
else begin
|
||||
asic_memory_dp #(.DW(DW),
|
||||
.DEPTH(DEPTH),
|
||||
.SHAPE(SHAPE),
|
||||
|
@ -16,17 +16,18 @@ module oh_rsync
|
||||
);
|
||||
|
||||
generate
|
||||
if(SYN=="true") begin: soft
|
||||
reg [SYNCPIPE-1:0] sync_pipe;
|
||||
always @ (posedge clk or negedge nrst_in)
|
||||
if(!nrst_in)
|
||||
sync_pipe[SYNCPIPE-1:0] <= 1'b0;
|
||||
else
|
||||
sync_pipe[SYNCPIPE-1:0] <= {sync_pipe[SYNCPIPE-2:0],1'b1};
|
||||
assign nrst_out = sync_pipe[SYNCPIPE-1];
|
||||
end
|
||||
if(SYN=="true")
|
||||
begin
|
||||
reg [SYNCPIPE-1:0] sync_pipe;
|
||||
always @ (posedge clk or negedge nrst_in)
|
||||
if(!nrst_in)
|
||||
sync_pipe[SYNCPIPE-1:0] <= 'b0;
|
||||
else
|
||||
sync_pipe[SYNCPIPE-1:0] <= {sync_pipe[SYNCPIPE-2:0],1'b1};
|
||||
assign nrst_out = sync_pipe[SYNCPIPE-1];
|
||||
end
|
||||
else
|
||||
begin: hard
|
||||
begin
|
||||
asic_rsync #(.TYPE(TYPE),
|
||||
.SYNCPIPE(SYNCPIPE))
|
||||
asic_rsync (.clk(clk),
|
||||
|
Loading…
x
Reference in New Issue
Block a user