gen/fhdl/instance: Add instance description.

This commit is contained in:
Florent Kermarrec 2023-11-03 11:53:32 +01:00
parent 079a0a7b75
commit 18c0541e6a
1 changed files with 13 additions and 3 deletions

View File

@ -11,7 +11,17 @@ from migen.fhdl.specials import *
# LiteX Instance Verilog Generation ----------------------------------------------------------------
def _instance_generate_verilog(instance, ns, add_data_file):
r = instance.of + " "
r = ""
# Instance Description.
# ---------------------
r += "//" + "-"*78 + "\n"
r += f"// Instance {ns.get_name(instance)} of {instance.of} Module.\n"
r += "//" + "-"*78 + "\n"
# Instance Name.
# --------------
r += instance.of + " "
# Instance Parameters.
# --------------------
@ -23,7 +33,7 @@ def _instance_generate_verilog(instance, ns, add_data_file):
if not first:
r += ",\n"
first = False
r += "\t." + p.name + "("
r += f"\t.{p.name}("
# Constant.
if isinstance(p.value, Constant):
r += verilog_printexpr(ns, p.value)[0]
@ -35,7 +45,7 @@ def _instance_generate_verilog(instance, ns, add_data_file):
r += p.value
# String.
elif isinstance(p.value, str):
r += "\"" + p.value + "\""
r += f"\"{p.value}\""
else:
raise TypeError
r += ")"