Skip to content

Commit c5da171

Browse files
committed
Update prim_fifo IP
This vendors a newer version of OT prim FIFO IP. The new version has a single core file for both async and sync FIFOs, and port names are changed. Signed-off-by: Gary Guo <gary@garyguo.net>
1 parent 619d72f commit c5da171

15 files changed

+1100
-293
lines changed

ip/core/muntjac_core.core

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ filesets:
1111
- lowrisc:muntjac:pipeline
1212
- lowrisc:prim:ram_1p
1313
- lowrisc:prim:util
14-
- lowrisc:prim:fifo_sync
14+
- lowrisc:prim:fifo
1515
- lowrisc:tl:common
1616
- lowrisc:tl:socket_m1
1717
- lowrisc:tl:adapter

ip/core/rtl/muntjac_dcache.sv

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,14 +1035,16 @@ module muntjac_dcache import muntjac_pkg::*; import tl_pkg::*; # (
10351035
) refill_fifo (
10361036
.clk_i,
10371037
.rst_ni,
1038-
.clr_i (1'b0),
1039-
.wvalid (refill_fifo_insert),
1040-
.wready (),
1041-
.wdata ({gnt_w, mem_d_last, mem_d_idx}),
1042-
.rvalid (refill_fifo_valid),
1043-
.rready (refill_fifo_ready),
1044-
.rdata ({refill_fifo_beat, refill_fifo_last, refill_fifo_idx}),
1045-
.depth ()
1038+
.clr_i (1'b0),
1039+
.wvalid_i (refill_fifo_insert),
1040+
.wready_o (),
1041+
.wdata_i ({gnt_w, mem_d_last, mem_d_idx}),
1042+
.rvalid_o (refill_fifo_valid),
1043+
.rready_i (refill_fifo_ready),
1044+
.rdata_o ({refill_fifo_beat, refill_fifo_last, refill_fifo_idx}),
1045+
.full_o (),
1046+
.depth_o (),
1047+
.err_o ()
10461048
);
10471049

10481050
logic refill_beat_saved_q, refill_beat_saved_d;

ip/core/rtl/muntjac_icache_coherent.sv

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -642,14 +642,16 @@ module muntjac_icache_coherent import muntjac_pkg::*; import tl_pkg::*; # (
642642
) refill_fifo (
643643
.clk_i,
644644
.rst_ni,
645-
.clr_i (1'b0),
646-
.wvalid (refill_fifo_insert),
647-
.wready (),
648-
.wdata ({gnt_w, mem_d_last, mem_d_idx}),
649-
.rvalid (refill_fifo_valid),
650-
.rready (refill_fifo_ready),
651-
.rdata ({refill_fifo_beat, refill_fifo_last, refill_fifo_idx}),
652-
.depth ()
645+
.clr_i (1'b0),
646+
.wvalid_i (refill_fifo_insert),
647+
.wready_o (),
648+
.wdata_i ({gnt_w, mem_d_last, mem_d_idx}),
649+
.rvalid_o (refill_fifo_valid),
650+
.rready_i (refill_fifo_ready),
651+
.rdata_o ({refill_fifo_beat, refill_fifo_last, refill_fifo_idx}),
652+
.full_o (),
653+
.depth_o (),
654+
.err_o ()
653655
);
654656

655657
logic refill_beat_saved_q, refill_beat_saved_d;

ip/tl/rtl/tl_fifo_sync.sv

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ module tl_fifo_sync import tl_pkg::*; #(
4747
) req_fifo (
4848
.clk_i,
4949
.rst_ni,
50-
.clr_i (1'b0),
51-
.wvalid (host_a_valid),
52-
.wready (host_a_ready),
53-
.wdata (req_w),
54-
.rvalid (device_a_valid),
55-
.rready (device_a_ready),
56-
.rdata (device_a),
57-
.depth ()
50+
.clr_i (1'b0),
51+
.wvalid_i (host_a_valid),
52+
.wready_o (host_a_ready),
53+
.wdata_i (req_w),
54+
.rvalid_o (device_a_valid),
55+
.rready_i (device_a_ready),
56+
.rdata_o (device_a),
57+
.full_o (),
58+
.depth_o (),
59+
.err_o ()
5860
);
5961

6062
///////////////////
@@ -72,14 +74,16 @@ module tl_fifo_sync import tl_pkg::*; #(
7274
) prb_fifo (
7375
.clk_i,
7476
.rst_ni,
75-
.clr_i (1'b0),
76-
.wvalid (device_b_valid),
77-
.wready (device_b_ready),
78-
.wdata (prb_w),
79-
.rvalid (host_b_valid),
80-
.rready (host_b_ready),
81-
.rdata (host_b),
82-
.depth ()
77+
.clr_i (1'b0),
78+
.wvalid_i (device_b_valid),
79+
.wready_o (device_b_ready),
80+
.wdata_i (prb_w),
81+
.rvalid_o (host_b_valid),
82+
.rready_i (host_b_ready),
83+
.rdata_o (host_b),
84+
.full_o (),
85+
.depth_o (),
86+
.err_o ()
8387
);
8488

8589
/////////////////////
@@ -97,14 +101,16 @@ module tl_fifo_sync import tl_pkg::*; #(
97101
) rel_fifo (
98102
.clk_i,
99103
.rst_ni,
100-
.clr_i (1'b0),
101-
.wvalid (host_c_valid),
102-
.wready (host_c_ready),
103-
.wdata (rel_w),
104-
.rvalid (device_c_valid),
105-
.rready (device_c_ready),
106-
.rdata (device_c),
107-
.depth ()
104+
.clr_i (1'b0),
105+
.wvalid_i (host_c_valid),
106+
.wready_o (host_c_ready),
107+
.wdata_i (rel_w),
108+
.rvalid_o (device_c_valid),
109+
.rready_i (device_c_ready),
110+
.rdata_o (device_c),
111+
.full_o (),
112+
.depth_o (),
113+
.err_o ()
108114
);
109115

110116
///////////////////
@@ -122,14 +128,16 @@ module tl_fifo_sync import tl_pkg::*; #(
122128
) gnt_fifo (
123129
.clk_i,
124130
.rst_ni,
125-
.clr_i (1'b0),
126-
.wvalid (device_d_valid),
127-
.wready (device_d_ready),
128-
.wdata (gnt_w),
129-
.rvalid (host_d_valid),
130-
.rready (host_d_ready),
131-
.rdata (host_d),
132-
.depth ()
131+
.clr_i (1'b0),
132+
.wvalid_i (device_d_valid),
133+
.wready_o (device_d_ready),
134+
.wdata_i (gnt_w),
135+
.rvalid_o (host_d_valid),
136+
.rready_i (host_d_ready),
137+
.rdata_o (host_d),
138+
.full_o (),
139+
.depth_o (),
140+
.err_o ()
133141
);
134142

135143
/////////////////////////////
@@ -143,14 +151,16 @@ module tl_fifo_sync import tl_pkg::*; #(
143151
) ack_fifo (
144152
.clk_i,
145153
.rst_ni,
146-
.clr_i (1'b0),
147-
.wvalid (host_e_valid),
148-
.wready (host_e_ready),
149-
.wdata (host_e),
150-
.rvalid (device_e_valid),
151-
.rready (device_e_ready),
152-
.rdata (device_e),
153-
.depth ()
154+
.clr_i (1'b0),
155+
.wvalid_i (host_e_valid),
156+
.wready_o (host_e_ready),
157+
.wdata_i (host_e),
158+
.rvalid_o (device_e_valid),
159+
.rready_i (device_e_ready),
160+
.rdata_o (device_e),
161+
.full_o (),
162+
.depth_o (),
163+
.err_o ()
154164
);
155165

156166
endmodule

ip/tl/tl_fifo_async.core

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ filesets:
99
files_rtl:
1010
depend:
1111
- lowrisc:tl:common
12-
- lowrisc:prim:fifo_async
12+
- lowrisc:prim:fifo
1313
files:
1414
- rtl/tl_fifo_async.sv
1515
file_type: systemVerilogSource

ip/tl/tl_fifo_sync.core

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ filesets:
99
files_rtl:
1010
depend:
1111
- lowrisc:tl:common
12-
- lowrisc:prim:fifo_sync
12+
- lowrisc:prim:fifo
1313
files:
1414
- rtl/tl_fifo_sync.sv
1515
file_type: systemVerilogSource
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright lowRISC contributors (OpenTitan project).
2+
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
`verilator_config
6+
7+
// prim_fifo_sync
8+
// In passthrough mode, clk and reset are not read form within this module
9+
lint_off -rule UNUSED -file "*/rtl/prim_fifo_sync.sv" -match "*clk_i*"
10+
lint_off -rule UNUSED -file "*/rtl/prim_fifo_sync.sv" -match "*rst_ni*"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright lowRISC contributors (OpenTitan project).
2+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# waiver file for prim_fifo
6+
7+
waive -rules {ONE_BIT_MEM_WIDTH} -location {prim_fifo_sync.sv} -msg {Memory 'gen_normal_fifo.storage' has word width which is single bit wide} \
8+
-comment "It is permissible that a FIFO has a wordwidth of 1bit"
9+
10+
waive -rules {INPUT_NOT_READ} -location {prim_fifo_sync.sv} -regexp {Input port '(clk_i|rst_ni)' is not read from, instance.*Depth=0\)} \
11+
-comment "In passthrough mode, clk and reset are not read form within this module"
12+
13+
14+
waive -rules {ASSIGN_SIGN} -location {prim_fifo_async.sv} -msg {Signed target 'i' assigned unsigned value 'PTR_WIDTH - 3'} \
15+
-comment "Parameter PTR_WIDTH is unsigned, but integer i is signed. This is fine. Changing the integer to unsigned might \
16+
cause issues with the for loop never exiting, because an unsigned integer can never become < 0."
17+
18+
waive -rules NOT_READ -location {prim_fifo_async.sv} -regexp {Signal 'nc_decval_msb' is not read} \
19+
-comment "Store temporary values. Not used intentionally"
20+
21+
22+
waive -rules VAR_INDEX_RANGE -location {prim_fifo_*sync.sv} -regexp {maximum value .* may be too large for 'storage'} \
23+
-comment "index is protected by control logic"
24+
25+
waive -rules EXPLICIT_BITLEN -location {prim_fifo_*sync.sv} -regexp {Bit length not specified for constant '1'} \
26+
-comment "index is protected by control logic"
27+
28+
## prim_fifo_async_sram_adapter
29+
waive -rules ARITH_CONTEXT -location {prim_fifo_async_sram_adapter.sv} \
30+
-regexp {(r|w)_wptr_v.*_rptr_v} \
31+
-comment "The pointer value width is determined. Remove the casting for readability"
32+
waive -rules USE_BEFORE_DECL -location {prim_fifo_async_sram_adapter.sv} -msg {'dec2gray' is referenced before its declaration at prim_fifo_async_sram_adapter.sv} \
33+
-comment "dec2gray is a function defined towards the end of the file."
34+
waive -rules USE_BEFORE_DECL -location {prim_fifo_async_sram_adapter.sv} -msg {'gray2dec' is referenced before its declaration at prim_fifo_async_sram_adapter.sv} \
35+
-comment "gray2dec is a function defined towards the end of the file."

vendor/lowrisc_ip/prim/prim_fifo_async.core renamed to vendor/lowrisc_ip/prim/prim_fifo.core

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
11
CAPI=2:
2-
# Copyright lowRISC contributors.
2+
# Copyright lowRISC contributors (OpenTitan project).
33
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
44
# SPDX-License-Identifier: Apache-2.0
55

6-
name: "lowrisc:prim:fifo_async"
7-
description: "Async FIFO"
6+
name: "lowrisc:prim:fifo"
7+
description: "Synchronous and asynchronous fifos"
88
filesets:
99
files_rtl:
1010
depend:
1111
- lowrisc:prim:assert
12+
- lowrisc:prim:util
1213
- lowrisc:prim:flop_2sync
1314
files:
15+
- rtl/prim_fifo_async_sram_adapter.sv
16+
- rtl/prim_fifo_async_simple.sv
1417
- rtl/prim_fifo_async.sv
18+
- rtl/prim_fifo_sync.sv
19+
- rtl/prim_fifo_sync_cnt.sv
1520
file_type: systemVerilogSource
1621

1722
files_verilator_waiver:
1823
depend:
1924
# common waivers
2025
- lowrisc:lint:common
26+
files:
27+
- lint/prim_fifo.vlt
28+
file_type: vlt
2129

2230
files_ascentlint_waiver:
2331
depend:
2432
# common waivers
2533
- lowrisc:lint:common
34+
files:
35+
- lint/prim_fifo.waiver
36+
file_type: waiver
2637

2738
files_veriblelint_waiver:
2839
depend:
2940
# common waivers
3041
- lowrisc:lint:common
31-
- lowrisc:lint:comportable
3242

3343
targets:
3444
default:

vendor/lowrisc_ip/prim/prim_fifo_sync.core

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)