fhdl/verilog: Remove blocking_assign (not used with LiteX).

This commit is contained in:
Florent Kermarrec 2021-10-15 15:20:01 +02:00
parent fe2998a19c
commit 3b78fd928d
2 changed files with 10 additions and 26 deletions

View File

@ -189,7 +189,6 @@ class SimVerilatorToolchain:
trace_fst = False, trace_fst = False,
trace_start = 0, trace_start = 0,
trace_end = -1, trace_end = -1,
regular_comb = False,
interactive = True, interactive = True,
pre_run_callback = None): pre_run_callback = None):
@ -205,10 +204,7 @@ class SimVerilatorToolchain:
platform.finalize(fragment) platform.finalize(fragment)
# Generate verilog # Generate verilog
v_output = platform.get_verilog(fragment, v_output = platform.get_verilog(fragment, name=build_name)
name = build_name,
regular_comb = regular_comb,
blocking_assign = True)
named_sc, named_pc = platform.resolve_signals(v_output.ns) named_sc, named_pc = platform.resolve_signals(v_output.ns)
v_file = build_name + ".v" v_file = build_name + ".v"
v_output.write(v_file) v_output.write(v_file)

View File

@ -374,7 +374,7 @@ def _print_module(f, ios, name, ns, attr_translate):
# COMBINATORIAL LOGIC # # COMBINATORIAL LOGIC #
# ------------------------------------------------------------------------------------------------ # # ------------------------------------------------------------------------------------------------ #
def _print_combinatorial_logic_sim(f, ns, blocking_assign): def _print_combinatorial_logic_sim(f, ns):
r = "" r = ""
if f.comb: if f.comb:
from collections import defaultdict from collections import defaultdict
@ -394,17 +394,13 @@ def _print_combinatorial_logic_sim(f, ns, blocking_assign):
r += "assign " + _print_node(ns, _AT_BLOCKING, 0, stmts[0]) r += "assign " + _print_node(ns, _AT_BLOCKING, 0, stmts[0])
else: else:
r += "always @(*) begin\n" r += "always @(*) begin\n"
if blocking_assign:
r += "\t" + ns.get_name(t) + " = " + _print_expression(ns, t.reset)[0] + ";\n"
r += _print_node(ns, _AT_BLOCKING, 1, stmts, t)
else:
r += "\t" + ns.get_name(t) + " <= " + _print_expression(ns, t.reset)[0] + ";\n" r += "\t" + ns.get_name(t) + " <= " + _print_expression(ns, t.reset)[0] + ";\n"
r += _print_node(ns, _AT_NONBLOCKING, 1, stmts, t) r += _print_node(ns, _AT_NONBLOCKING, 1, stmts, t)
r += "end\n" r += "end\n"
r += "\n" r += "\n"
return r return r
def _print_combinatorial_logic_synth(f, ns, blocking_assign): def _print_combinatorial_logic_synth(f, ns):
r = "" r = ""
if f.comb: if f.comb:
groups = group_by_targets(f.comb) groups = group_by_targets(f.comb)
@ -414,11 +410,6 @@ def _print_combinatorial_logic_synth(f, ns, blocking_assign):
r += "assign " + _print_node(ns, _AT_BLOCKING, 0, g[1][0]) r += "assign " + _print_node(ns, _AT_BLOCKING, 0, g[1][0])
else: else:
r += "always @(*) begin\n" r += "always @(*) begin\n"
if blocking_assign:
for t in g[0]:
r += "\t" + ns.get_name(t) + " = " + _print_expression(ns, t.reset)[0] + ";\n"
r += _print_node(ns, _AT_BLOCKING, 1, g[1])
else:
for t in g[0]: for t in g[0]:
r += "\t" + ns.get_name(t) + " <= " + _print_expression(ns, t.reset)[0] + ";\n" r += "\t" + ns.get_name(t) + " <= " + _print_expression(ns, t.reset)[0] + ";\n"
r += _print_node(ns, _AT_NONBLOCKING, 1, g[1]) r += _print_node(ns, _AT_NONBLOCKING, 1, g[1])
@ -470,7 +461,6 @@ class DummyAttrTranslate(dict):
def convert(f, ios=set(), name="top", def convert(f, ios=set(), name="top",
special_overrides = dict(), special_overrides = dict(),
attr_translate = DummyAttrTranslate(), attr_translate = DummyAttrTranslate(),
blocking_assign = False,
regular_comb = True): regular_comb = True):
# Create ConvOutput. # Create ConvOutput.
@ -534,11 +524,9 @@ def convert(f, ios=set(), name="top",
# Combinatorial Logic. # Combinatorial Logic.
if regular_comb: if regular_comb:
verilog += _print_combinatorial_logic_synth(f, ns, verilog += _print_combinatorial_logic_synth(f, ns)
blocking_assign = blocking_assign
)
else: else:
verilog += _print_combinatorial_logic_sim(f, ns, blocking_assign=blocking_assign) verilog += _print_combinatorial_logic_sim(f, ns)
# Synchronous Logic. # Synchronous Logic.
verilog += _print_synchronous_logic(f, ns) verilog += _print_synchronous_logic(f, ns)