Skip to content

Commit eaa0ee8

Browse files
Merge pull request #135 from os-fpga/Sarmad-Salman-patch-1
Forcing correct rd_clk in different FIFO_MODEs
2 parents cf8831f + c6d916b commit eaa0ee8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

sim_models/primitives_mapping/FIFO/fifo18kx2_to_rs_tdp_36k_mapping.v

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ wire [17:0] wrt_data2;
104104
wire [17:0] rd_data2;
105105
wire [17:0] fifo1_flags;
106106
wire [17:0] fifo2_flags;
107+
wire rd_clk1, rd_clk2;
107108

108109
assign OVERFLOW1 = fifo1_flags[0];
109110
assign PROG_FULL1 = fifo1_flags[1];
@@ -122,6 +123,8 @@ assign UNDERFLOW2 = fifo2_flags[4];
122123
assign PROG_EMPTY2 = fifo2_flags[5];
123124
assign ALMOST_EMPTY2 = fifo2_flags[6];
124125
assign EMPTY2 = fifo2_flags[7];
126+
assign rd_clk1 = (FIFO_TYPE1 == "SYNCHRONOUS") ? WR_CLK1 : RD_CLK1;
127+
assign rd_clk2 = (FIFO_TYPE2 == "SYNCHRONOUS") ? WR_CLK2 : RD_CLK2;
125128

126129
if (DATA_READ_WIDTH1 == 5'd18) begin
127130
assign RD_DATA1 = {rd_data1[17], rd_data1[15:8], rd_data1[16], rd_data1[7:0]};
@@ -155,7 +158,7 @@ RS_TDP36K_FIFO_18KX2 (
155158
.WEN_A1(WR_EN1),
156159
.REN_B1(RD_EN1),
157160
.CLK_A1(WR_CLK1),
158-
.CLK_B1(RD_CLK1),
161+
.CLK_B1(rd_clk1),
159162
.WDATA_A1(wrt_data1),
160163
.RDATA_A1(fifo1_flags),
161164
.RDATA_B1(rd_data1),
@@ -168,7 +171,7 @@ RS_TDP36K_FIFO_18KX2 (
168171
.RDATA_B2(rd_data2),
169172
.FLUSH2(RESET2),
170173
.CLK_A2(WR_CLK2),
171-
.CLK_B2(RD_CLK2),
174+
.CLK_B2(rd_clk2),
172175

173176
.WEN_B1(1'b0),
174177
.REN_A1(1'b0),

sim_models/primitives_mapping/FIFO/fifo36k_to_rs_tdp_36k_mapping.v

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ wire [35:0] wrt_data;
5959
wire [35:0] rd_data;
6060
wire [17:0] fifo_flags;
6161
wire [17:0] unused_rdataA2;
62+
wire rd_clk;
6263

6364
assign OVERFLOW = fifo_flags[0];
6465
assign PROG_FULL = fifo_flags[1];
@@ -68,6 +69,7 @@ assign UNDERFLOW = fifo_flags[4];
6869
assign PROG_EMPTY = fifo_flags[5];
6970
assign ALMOST_EMPTY = fifo_flags[6];
7071
assign EMPTY = fifo_flags[7];
72+
assign rd_clk = (FIFO_TYPE == "SYNCHRONOUS") ? WR_CLK : RD_CLK;
7173

7274
if (DATA_READ_WIDTH == 6'd36) begin
7375
assign RD_DATA = {rd_data[35], rd_data[33:26], rd_data[34], rd_data[25:18], rd_data[17], rd_data[15:8], rd_data[16], rd_data[7:0]};
@@ -93,15 +95,15 @@ end
9395
.WEN_A1(WR_EN),
9496
.REN_B1(RD_EN),
9597
.CLK_A1(WR_CLK),
96-
.CLK_B1(RD_CLK),
98+
.CLK_B1(rd_clk),
9799
.WDATA_A1(wrt_data[17:0]),
98100
.WDATA_A2(wrt_data[35:18]),
99101
.RDATA_A1(fifo_flags),
100102
.RDATA_B1(rd_data[17:0]),
101103
.RDATA_B2(rd_data[35:18]),
102104
.FLUSH1(RESET),
103105
.CLK_A2(WR_CLK),
104-
.CLK_B2(RD_CLK),
106+
.CLK_B2(rd_clk),
105107

106108
.WEN_B1(1'b0),
107109
.REN_A1(1'b0),

0 commit comments

Comments
 (0)