mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
fhdl/verilog: add option to display which comb blocks are run
This is a debug hack to help find combinatorial loops in designs.
This commit is contained in:
parent
0b62e573ae
commit
398ece8fe2
1 changed files with 7 additions and 4 deletions
|
@ -132,7 +132,7 @@ def _printheader(f, ios, name, ns):
|
||||||
r += "\n"
|
r += "\n"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def _printcomb(f, ns):
|
def _printcomb(f, ns, display_run):
|
||||||
r = ""
|
r = ""
|
||||||
if f.comb.l:
|
if f.comb.l:
|
||||||
# Generate a dummy event to get the simulator
|
# Generate a dummy event to get the simulator
|
||||||
|
@ -147,7 +147,7 @@ def _printcomb(f, ns):
|
||||||
|
|
||||||
groups = group_by_targets(f.comb)
|
groups = group_by_targets(f.comb)
|
||||||
|
|
||||||
for g in groups:
|
for n, g in enumerate(groups):
|
||||||
if len(g[1]) == 1 and isinstance(g[1][0], _Assign):
|
if len(g[1]) == 1 and isinstance(g[1][0], _Assign):
|
||||||
r += "assign " + _printnode(ns, _AT_BLOCKING, 0, g[1][0])
|
r += "assign " + _printnode(ns, _AT_BLOCKING, 0, g[1][0])
|
||||||
else:
|
else:
|
||||||
|
@ -157,6 +157,8 @@ def _printcomb(f, ns):
|
||||||
r += syn_on
|
r += syn_on
|
||||||
|
|
||||||
r += "always @(*) begin\n"
|
r += "always @(*) begin\n"
|
||||||
|
if display_run:
|
||||||
|
r += "\t$display(\"Running comb block #" + str(n) + "\");\n"
|
||||||
for t in g[0]:
|
for t in g[0]:
|
||||||
r += "\t" + ns.get_name(t) + " <= " + str(t.reset) + ";\n"
|
r += "\t" + ns.get_name(t) + " <= " + str(t.reset) + ";\n"
|
||||||
r += _printnode(ns, _AT_NONBLOCKING, 1, _StatementList(g[1]))
|
r += _printnode(ns, _AT_NONBLOCKING, 1, _StatementList(g[1]))
|
||||||
|
@ -237,7 +239,8 @@ def _printinit(f, ios, ns):
|
||||||
def convert(f, ios=set(), name="top",
|
def convert(f, ios=set(), name="top",
|
||||||
clk_signal=None, rst_signal=None,
|
clk_signal=None, rst_signal=None,
|
||||||
return_ns=False,
|
return_ns=False,
|
||||||
memory_handler=verilog_mem_behavioral.handler):
|
memory_handler=verilog_mem_behavioral.handler,
|
||||||
|
display_run=False):
|
||||||
if clk_signal is None:
|
if clk_signal is None:
|
||||||
clk_signal = Signal(name_override="sys_clk")
|
clk_signal = Signal(name_override="sys_clk")
|
||||||
ios.add(clk_signal)
|
ios.add(clk_signal)
|
||||||
|
@ -252,7 +255,7 @@ def convert(f, ios=set(), name="top",
|
||||||
|
|
||||||
r = "/* Machine-generated using Migen */\n"
|
r = "/* Machine-generated using Migen */\n"
|
||||||
r += _printheader(f, ios, name, ns)
|
r += _printheader(f, ios, name, ns)
|
||||||
r += _printcomb(f, ns)
|
r += _printcomb(f, ns, display_run)
|
||||||
r += _printsync(f, ns, clk_signal, rst_signal)
|
r += _printsync(f, ns, clk_signal, rst_signal)
|
||||||
r += _printinstances(f, ns, clk_signal, rst_signal)
|
r += _printinstances(f, ns, clk_signal, rst_signal)
|
||||||
r += _printmemories(f, ns, memory_handler, clk_signal)
|
r += _printmemories(f, ns, memory_handler, clk_signal)
|
||||||
|
|
Loading…
Reference in a new issue