Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions scripts/opentitan/cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,29 +553,42 @@ def main():
ot_dir = abspath(ot_dir)
log.info("OT directory: '%s'", ot_dir)
log.info("Variant: '%s'", topvar)
if not args.lifecycle:
lcpath = joinpath(ot_dir, 'hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv')
else:
lcpath = args.lifecycle
top_dir = joinpath(ot_dir, 'hw', top)

lcfilename = 'lc_ctrl_state_pkg.sv'
lcpath = args.lifecycle
if not lcpath:
lc_constant_locations = [
joinpath(top_dir, f'rtl/autogen/dev/{lcfilename}'),
joinpath(top_dir, f'rtl/autogen/{lcfilename}'),
joinpath(ot_dir, f'hw/ip/lc_ctrl/rtl/{lcfilename}'),
]
for maybe_lcpath in lc_constant_locations:
if isfile(maybe_lcpath):
lcpath = maybe_lcpath
break
if not lcpath:
argparser.error(f"Unknown location for '{lcfilename}'")
if not isfile(lcpath):
argparser.error(f"No such file '{lcpath}'")
log.debug(f"'{lcfilename}' location: '%s'", lcpath)

if not args.otpconst:
ocfilename = 'otp_ctrl_part_pkg.sv'
ocpath = args.otpconst
if not ocpath:
otp_constant_locations = [
joinpath(
ot_dir, "hw", top, "ip_autogen/otp_ctrl/rtl/otp_ctrl_part_pkg.sv"
),
joinpath(ot_dir, 'hw/ip/otp_ctrl/rtl/otp_ctrl_part_pkg.sv'),
joinpath(top_dir, f'ip_autogen/otp_ctrl/rtl/{ocfilename}'),
joinpath(ot_dir, f'hw/ip/otp_ctrl/rtl/{ocfilename}'),
]
ocpath = None
for maybe_ocpath in otp_constant_locations:
if isfile(maybe_ocpath):
ocpath = maybe_ocpath
break
else:
ocpath = args.otpconst
if ocpath is None or not isfile(lcpath):
if not ocpath:
argparser.error(f"Unknown location for '{ocfilename}'")
if not isfile(ocpath):
argparser.error(f"No such file '{ocpath}'")
log.debug(f"'{ocfilename}' location: '%s'", ocpath)

cfg.load_lifecycle(lcpath)
cfg.load_otp_constants(ocpath)
Expand Down
Loading