[prim] Rework how primgen.py writes out parameter lists for instantiations This commit changes primgen.sv to put just a single parameter per line and to skip parameter lists completely if empty. This prevents many lint errors. Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
diff --git a/hw/ip/prim/util/primgen.py b/hw/ip/prim/util/primgen.py index 1bed076..9fa3611 100755 --- a/hw/ip/prim/util/primgen.py +++ b/hw/ip/prim/util/primgen.py
@@ -233,11 +233,14 @@ def _instance_sv(prim_name, techlib, parameters): - s = "prim_{techlib}_{prim_name} #(\n" - s += ", ".join(".{p}({p})".format(p=p) for p in parameters) - s += ") u_impl_{techlib} (\n" \ - " .*\n" \ - ");\n" + if not parameters: + s = " prim_{techlib}_{prim_name} u_impl_{techlib} (\n" + else: + s = " prim_{techlib}_{prim_name} #(\n" + s += ",\n".join(" .{p}({p})".format(p=p) for p in parameters) + s += "\n ) u_impl_{techlib} (\n" + s += " .*\n" \ + " );\n" return s.format(prim_name=prim_name, techlib=techlib) @@ -252,9 +255,9 @@ # Don't output the if/else blocks if there no alternatives exist. # We still want the generate block to keep hierarchical path names # stable, even if more than one techlib is found. - s = " if (1) begin : gen_generic\n" + s = " if (1) begin : gen_generic\n" s += _instance_sv(prim_name, "generic", parameters) + "\n" - s += "end" + s += " end" return s nr_techlibs = len(techlibs_generic_last)