Skip to content

Commit 60dead5

Browse files
committed
[topgen] Support ipgen_params for clkmgr
Signed-off-by: Robert Schilling <[email protected]>
1 parent 220d068 commit 60dead5

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

util/ipgen/clkmgr_gen.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from basegen.typing import ConfigT, ParamsT
1111
from topgen.clocks import Clocks, ClockSignal
12-
from topgen.lib import find_module
12+
from topgen.lib import find_module, get_ipgen_params
1313

1414

1515
class ClockMeasureConfig(NamedTuple):
@@ -47,7 +47,9 @@ def get_clkmgr_params(top: ConfigT) -> ParamsT:
4747
with_alert_handler = find_module(top['module'],
4848
'alert_handler') is not None
4949

50-
return {
50+
clkmgr = find_module(top["module"], "clkmgr")
51+
ipgen_params = get_ipgen_params(clkmgr)
52+
ipgen_params.update({
5153
"src_clks":
5254
OrderedDict({name: vars(obj)
5355
for name, obj in clocks.srcs.items()}),
@@ -68,7 +70,8 @@ def get_clkmgr_params(top: ConfigT) -> ParamsT:
6870
len(clocks.groups),
6971
"with_alert_handler":
7072
with_alert_handler,
71-
}
73+
})
74+
return ipgen_params
7275

7376

7477
def get_all_srcs(src_clks: ConfigT, derived_clks: ConfigT) -> ConfigT:

util/topgen.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from topgen.clocks import Clocks
4242
from topgen.gen_dv import gen_dv
4343
from topgen.gen_top_docs import gen_top_docs
44-
from topgen.lib import find_module, find_modules, load_cfg, write_file_secure
44+
from topgen.lib import find_module, find_modules, load_cfg, write_file_secure, get_ipgen_params
4545
from topgen.merge import (
4646
amend_alert, amend_interrupt, amend_pinmux_io, amend_racl,
4747
amend_reset_request, amend_resets, amend_wkup, commit_alert_modules,
@@ -284,11 +284,6 @@ def generate_ipgen(top: ConfigT, module: ConfigT, params: ParamsT,
284284
ipgen_render(module["template_type"], topname, params, out_path)
285285

286286

287-
def get_ipgen_params(module: ConfigT) -> ParamsT:
288-
"""Return ipgen params, if defined for this module"""
289-
return deepcopy(module.get("ipgen_params", {}))
290-
291-
292287
def _get_alert_handler_params(top: ConfigT, name: str) -> ParamsT:
293288
"""Returns parameters for alert_hander ipgen from top config."""
294289
# default values

util/topgen/lib.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import hjson
1515
from basegen.lib import Name
16-
from basegen.typing import ConfigT
16+
from basegen.typing import ConfigT, ParamsT
1717
from mako.template import Template
1818
from reggen.ip_block import IpBlock
1919
from version_file import VersionInformation
@@ -667,6 +667,11 @@ def is_ipgen(module: ConfigT) -> bool:
667667
return module.get('attr') in ["ipgen"]
668668

669669

670+
def get_ipgen_params(module: ConfigT) -> ParamsT:
671+
"""Return ipgen params, if defined for this module"""
672+
return deepcopy(module.get("ipgen_params", {}))
673+
674+
670675
def is_top_reggen(module: ConfigT) -> bool:
671676
"""Returns an indication where a particular module is NOT generated
672677
and requires top level specific reggen

0 commit comments

Comments
 (0)