[prim] Add stub flops to remove lint warnings
- for prim_mubi_sync/sender modules, when the AsynOn option is 0, the clk/rst_n inputs are used only for assertions.
- this causes the lint tools to throw a CLOCK_USE error as there are no valid loads on the clock.
- this commit adds unused stub logic that makes use of the clock and removes the lint error without having to add to individual waiver files.
Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/csrng/rtl/csrng_core.sv b/hw/ip/csrng/rtl/csrng_core.sv
index 17dc394..8381499 100644
--- a/hw/ip/csrng/rtl/csrng_core.sv
+++ b/hw/ip/csrng/rtl/csrng_core.sv
@@ -876,7 +876,7 @@
prim_mubi8_sync #(
.NumCopies(2),
- .AsyncOn(0)
+ .AsyncOn(1)
) u_prim_mubi8_sync_sw_app_read (
.clk_i,
.rst_ni,
diff --git a/hw/ip/entropy_src/rtl/entropy_src_core.sv b/hw/ip/entropy_src/rtl/entropy_src_core.sv
index d8f79d6..385c2ab 100644
--- a/hw/ip/entropy_src/rtl/entropy_src_core.sv
+++ b/hw/ip/entropy_src/rtl/entropy_src_core.sv
@@ -605,7 +605,7 @@
prim_mubi8_sync #(
.NumCopies(1),
- .AsyncOn(0)
+ .AsyncOn(1)
) u_prim_mubi8_sync_es_fw_over (
.clk_i,
.rst_ni,
@@ -2467,7 +2467,7 @@
prim_mubi8_sync #(
.NumCopies(1),
- .AsyncOn(0)
+ .AsyncOn(1)
) u_prim_mubi8_sync_es_fw_read (
.clk_i,
.rst_ni,
diff --git a/hw/ip/prim/lint/prim_sparse_fsm_flop.waiver b/hw/ip/prim/lint/prim_sparse_fsm_flop.waiver
index e3e2d88..b4845c5 100644
--- a/hw/ip/prim/lint/prim_sparse_fsm_flop.waiver
+++ b/hw/ip/prim/lint/prim_sparse_fsm_flop.waiver
@@ -11,4 +11,7 @@
-comment "The state enum is used only during DV / FPV."
waive -rules {PARAM_NOT_USED} -location {prim_sparse_fsm_flop.sv} -regexp {.*EnableAlertTriggerSVA.*} \
- -comment "The disable parameter is used only during DV / FPV."
\ No newline at end of file
+ -comment "The disable parameter is used only during DV / FPV."
+
+waive -rules {SAME_NAME_TYPE} -location {prim_sparse_fsm_flop.sv} -regexp {.*ResetValue.*} \
+ -comment "The ResetValue parameter is a common name used by many prim types"
diff --git a/hw/ip/prim/rtl/prim_mubi12_sender.sv b/hw/ip/prim/rtl/prim_mubi12_sender.sv
index 8c6100c..ef2ba20 100644
--- a/hw/ip/prim/rtl/prim_mubi12_sender.sv
+++ b/hw/ip/prim/rtl/prim_mubi12_sender.sv
@@ -48,10 +48,18 @@
.out_o(mubi_out[k])
);
end
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for sythesis since it is unloaded.
+ mubi12_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi12False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
end
assign mubi_o = mubi12_t'(mubi_out);
diff --git a/hw/ip/prim/rtl/prim_mubi12_sync.sv b/hw/ip/prim/rtl/prim_mubi12_sync.sv
index 5b2d149..c380142 100644
--- a/hw/ip/prim/rtl/prim_mubi12_sync.sv
+++ b/hw/ip/prim/rtl/prim_mubi12_sync.sv
@@ -105,10 +105,19 @@
assign mubi = mubi_sync;
end
end else begin : gen_no_flops
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for synthesis since it is unloaded.
+ mubi12_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi12False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
+
assign mubi = MuBi12Width'(mubi_i);
end
diff --git a/hw/ip/prim/rtl/prim_mubi16_sender.sv b/hw/ip/prim/rtl/prim_mubi16_sender.sv
index 05ff89d..0f23e96 100644
--- a/hw/ip/prim/rtl/prim_mubi16_sender.sv
+++ b/hw/ip/prim/rtl/prim_mubi16_sender.sv
@@ -48,10 +48,18 @@
.out_o(mubi_out[k])
);
end
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for sythesis since it is unloaded.
+ mubi16_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi16False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
end
assign mubi_o = mubi16_t'(mubi_out);
diff --git a/hw/ip/prim/rtl/prim_mubi16_sync.sv b/hw/ip/prim/rtl/prim_mubi16_sync.sv
index c6c173f..8ee4b2f 100644
--- a/hw/ip/prim/rtl/prim_mubi16_sync.sv
+++ b/hw/ip/prim/rtl/prim_mubi16_sync.sv
@@ -105,10 +105,19 @@
assign mubi = mubi_sync;
end
end else begin : gen_no_flops
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for synthesis since it is unloaded.
+ mubi16_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi16False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
+
assign mubi = MuBi16Width'(mubi_i);
end
diff --git a/hw/ip/prim/rtl/prim_mubi4_sender.sv b/hw/ip/prim/rtl/prim_mubi4_sender.sv
index eab20fd..c96c860 100644
--- a/hw/ip/prim/rtl/prim_mubi4_sender.sv
+++ b/hw/ip/prim/rtl/prim_mubi4_sender.sv
@@ -48,10 +48,18 @@
.out_o(mubi_out[k])
);
end
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for sythesis since it is unloaded.
+ mubi4_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi4False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
end
assign mubi_o = mubi4_t'(mubi_out);
diff --git a/hw/ip/prim/rtl/prim_mubi4_sync.sv b/hw/ip/prim/rtl/prim_mubi4_sync.sv
index 2c73011..8c7d995 100644
--- a/hw/ip/prim/rtl/prim_mubi4_sync.sv
+++ b/hw/ip/prim/rtl/prim_mubi4_sync.sv
@@ -105,10 +105,19 @@
assign mubi = mubi_sync;
end
end else begin : gen_no_flops
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for synthesis since it is unloaded.
+ mubi4_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi4False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
+
assign mubi = MuBi4Width'(mubi_i);
end
diff --git a/hw/ip/prim/rtl/prim_mubi8_sender.sv b/hw/ip/prim/rtl/prim_mubi8_sender.sv
index 65d57fb..38c9030 100644
--- a/hw/ip/prim/rtl/prim_mubi8_sender.sv
+++ b/hw/ip/prim/rtl/prim_mubi8_sender.sv
@@ -48,10 +48,18 @@
.out_o(mubi_out[k])
);
end
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for sythesis since it is unloaded.
+ mubi8_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi8False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
end
assign mubi_o = mubi8_t'(mubi_out);
diff --git a/hw/ip/prim/rtl/prim_mubi8_sync.sv b/hw/ip/prim/rtl/prim_mubi8_sync.sv
index 8a85e7e..bb543a8 100644
--- a/hw/ip/prim/rtl/prim_mubi8_sync.sv
+++ b/hw/ip/prim/rtl/prim_mubi8_sync.sv
@@ -105,10 +105,19 @@
assign mubi = mubi_sync;
end
end else begin : gen_no_flops
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for synthesis since it is unloaded.
+ mubi8_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi8False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
+
assign mubi = MuBi8Width'(mubi_i);
end
diff --git a/util/design/data/prim_mubi_sender.sv.tpl b/util/design/data/prim_mubi_sender.sv.tpl
index f3f60c9..3f34243 100644
--- a/util/design/data/prim_mubi_sender.sv.tpl
+++ b/util/design/data/prim_mubi_sender.sv.tpl
@@ -48,10 +48,18 @@
.out_o(mubi_out[k])
);
end
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for sythesis since it is unloaded.
+ mubi${n_bits}_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi${n_bits}False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
end
assign mubi_o = mubi${n_bits}_t'(mubi_out);
diff --git a/util/design/data/prim_mubi_sync.sv.tpl b/util/design/data/prim_mubi_sync.sv.tpl
index 30ac647..0def042 100644
--- a/util/design/data/prim_mubi_sync.sv.tpl
+++ b/util/design/data/prim_mubi_sync.sv.tpl
@@ -105,10 +105,19 @@
assign mubi = mubi_sync;
end
end else begin : gen_no_flops
- logic unused_clk;
- logic unused_rst;
- assign unused_clk = clk_i;
- assign unused_rst = rst_ni;
+
+ // This unused companion logic helps remove lint errors
+ // for modules where clock and reset are used for assertions only
+ // This logic will be removed for synthesis since it is unloaded.
+ mubi${n_bits}_t unused_logic;
+ always_ff @(posedge clk_i or negedge rst_ni) begin
+ if (!rst_ni) begin
+ unused_logic <= MuBi${n_bits}False;
+ end else begin
+ unused_logic <= mubi_i;
+ end
+ end
+
assign mubi = MuBi${n_bits}Width'(mubi_i);
end