Skip to content

Commit

Permalink
[primgen] Fix parameters in a primgen template
Browse files Browse the repository at this point in the history
It turns out that the existing code would give something of this form:

    module prim_foo #(param1, param2) (arg1, arg2);
      parameter prim_pkg::impl_e Impl = `PRIM_DEFAULT_IMPL;
    endmodule

Unfortunately, SystemVerilog doesn't actually allow you to declare two
lists of parameters like this. The presence of the #(param1, param2)
list means that the Impl line gets turned into a localparam.

Annoyingly, JasperGold prints out a warning (telling the
user that what they expected to be a parameter is now a localparam).
This patch changes the generated code to match: Impl is now declared
as a localparam, so JasperGold needn't tell us!

Signed-off-by: Rupert Swarbrick <[email protected]>
  • Loading branch information
rswarbrick committed Dec 22, 2023
1 parent 78dee87 commit 1dd2af1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hw/ip/prim/rtl/prim_onehot_check.sv
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ module prim_onehot_check #(
`ifndef PRIM_DEFAULT_IMPL
`define PRIM_DEFAULT_IMPL prim_pkg::ImplGeneric
`endif
parameter prim_pkg::impl_e Impl = `PRIM_DEFAULT_IMPL;
localparam prim_pkg::impl_e Impl = `PRIM_DEFAULT_IMPL;

logic unused_assert_connected;
// TODO(#13337): only check generic for now. The path of this prim in other Impl may differ
Expand Down
2 changes: 1 addition & 1 deletion hw/ip/prim/util/primgen/abstract_prim.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ${module_header_params}
${module_header_ports}
);
% if num_techlibs > 1:
parameter prim_pkg::impl_e Impl = `PRIM_DEFAULT_IMPL;
localparam prim_pkg::impl_e Impl = `PRIM_DEFAULT_IMPL;
% endif

${instances}
Expand Down

0 comments on commit 1dd2af1

Please sign in to comment.