Merge pull request #1690 from bunnie/asic-target

add an option to generate without reg initializers (asic targets)
This commit is contained in:
enjoy-digital 2023-05-17 16:53:51 +02:00 committed by GitHub
commit be1d64acaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -421,7 +421,7 @@ def _print_module(f, ios, name, ns, attr_translate):
return r
def _print_signals(f, ios, name, ns, attr_translate):
def _print_signals(f, ios, name, ns, attr_translate, asic=False):
sigs = list_signals(f) | list_special_ios(f, ins=True, outs=True, inouts=True)
special_outs = list_special_ios(f, ins=False, outs=True, inouts=True)
inouts = list_special_ios(f, ins=False, outs=False, inouts=True)
@ -434,7 +434,10 @@ def _print_signals(f, ios, name, ns, attr_translate):
if sig in wires:
r += "wire " + _print_signal(ns, sig) + ";\n"
else:
r += "reg " + _print_signal(ns, sig) + " = " + _print_expression(ns, sig.reset)[0] + ";\n"
if asic:
r += "reg " + _print_signal(ns, sig) + ";\n" # ASICs can't assign an initial value to a reg, it is always X
else:
r += "reg " + _print_signal(ns, sig) + " = " + _print_expression(ns, sig.reset)[0] + ";\n"
return r
# ------------------------------------------------------------------------------------------------ #
@ -532,6 +535,8 @@ def convert(f, ios=set(), name="top", platform=None,
# Sim parameters.
time_unit = "1ns",
time_precision = "1ps",
# Generate for ASIC simulation (i.e. capture X-on-init for regs)
asic = False,
):
# Build Logic.
@ -618,7 +623,7 @@ def convert(f, ios=set(), name="top", platform=None,
# Module Signals.
verilog += _print_separator("Signals")
verilog += _print_signals(f, ios, name, ns, attr_translate)
verilog += _print_signals(f, ios, name, ns, attr_translate, asic)
# Combinatorial Logic.
verilog += _print_separator("Combinatorial Logic")