Skip to content

Commit

Permalink
[topgen] Only create rstmgr if there an instance
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Schilling <[email protected]>
  • Loading branch information
Razer6 committed Nov 29, 2024
1 parent 2b8de27 commit 8b90b79
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
5 changes: 3 additions & 2 deletions util/topgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,9 @@ def _process_top(
if lib.find_module(completecfg['module'], 'pwrmgr'):
generate_pwrmgr(completecfg, out_path)

# Generate rstmgr
generate_rstmgr(completecfg, out_path)
# Generate rstmgr if there is an instance
if lib.find_module(completecfg['module'], 'rstmgr'):
generate_rstmgr(completecfg, out_path)

# Generate ac_range_check
generate_ac_range_check(completecfg, out_path)
Expand Down
2 changes: 1 addition & 1 deletion util/topgen/c_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from reggen.interrupt import IntrType

from .c import TopGenC
from .lib import find_module, Name
from .lib import find_module, Name


class TestPeripheral:
Expand Down
4 changes: 3 additions & 1 deletion util/topgen/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,9 @@ def __init__(self, top_info, name_to_block: Dict[str, IpBlock], enum_type, array
if find_module(self.top['module'], 'pwrmgr'):
self._init_pwrmgr_wakeups()
self._init_pwrmgr_reset_requests()
self._init_rstmgr_sw_rsts()
# Only generate rstmgr mappings if there is a rstmgr
if find_module(self.top['module'], 'rstmgr'):
self._init_rstmgr_sw_rsts()
# Only generate clkmgr mappings if there is a clkmgr
if find_module(self.top['module'], 'clkmgr'):
self._init_clkmgr_clocks()
Expand Down
3 changes: 3 additions & 0 deletions util/topgen/templates/toplevel.h.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ has_pwrmgr = lib.find_module(top['module'], 'pwrmgr')
has_pinmux = lib.find_module(top['module'], 'pinmux')
has_alert_handler = lib.find_module(top['module'], 'alert_handler')
has_clkmgr = lib.find_module(top['module'], 'clkmgr')
has_rstmgr = lib.find_module(top['module'], 'rstmgr')
%>\

#ifndef ${helper.header_macro_prefix}_TOP_${top["name"].upper()}_H_
Expand Down Expand Up @@ -198,11 +199,13 @@ ${helper.muxed_pads.render()}
*/
${helper.pwrmgr_wakeups.render()}
% endif
% if has_rstmgr:

/**
* Reset Manager Software Controlled Resets
*/
${helper.rstmgr_sw_rsts.render()}
% endif
% if has_pwrmgr:

/**
Expand Down
3 changes: 3 additions & 0 deletions util/topgen/templates/toplevel.rs.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ has_pwrmgr = lib.find_module(top['module'], 'pwrmgr')
has_pinmux = lib.find_module(top['module'], 'pinmux')
has_alert_handler = lib.find_module(top['module'], 'alert_handler')
has_clkmgr = lib.find_module(top['module'], 'clkmgr')
has_rstmgr = lib.find_module(top['module'], 'rstmgr')
%>\
${helper.file_header.render()}
// This file was generated automatically.
Expand Down Expand Up @@ -155,9 +156,11 @@ ${helper.muxed_pads.render(gen_cast=True)}
/// Power Manager Wakeup Signals
${helper.pwrmgr_wakeups.render()}
% endif
% if has_rstmgr:

/// Reset Manager Software Controlled Resets
${helper.rstmgr_sw_rsts.render()}
% endif
% if has_pwrmgr:

/// Power Manager Reset Request Signals
Expand Down
9 changes: 0 additions & 9 deletions util/topgen/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,6 @@ def check_clocks_resets(top, ipobjs, ip_idxs, xbarobjs, xbar_idxs):

error = 0

# there should only be one each of pwrmgr/clkmgr/rstmgr
pwrmgrs = [m for m in top['module'] if m['type'] == 'pwrmgr']
clkmgrs = [m for m in top['module'] if m['type'] == 'clkmgr']
rstmgrs = [m for m in top['module'] if m['type'] == 'rstmgr']

if len(pwrmgrs) == 1 * len(clkmgrs) == 1 * len(rstmgrs) != 1:
log.error("Incorrect number of pwrmgr/clkmgr/rstmgr")
error += 1

# all defined clock/reset nets
reset_nets = [reset['name'] for reset in top['resets']['nodes']]
clock_srcs = list(top['clocks'].all_srcs.keys())
Expand Down

0 comments on commit 8b90b79

Please sign in to comment.