|
16 | 16 | from basegen.typing import ConfigT, ParamsT |
17 | 17 | from mako.template import Template |
18 | 18 | from reggen.ip_block import IpBlock |
| 19 | +from reggen.lib import check_bool |
19 | 20 | from version_file import VersionInformation |
20 | 21 |
|
21 | 22 | # Ignore flake8 warning as the function is used in the template |
@@ -760,6 +761,27 @@ def get_io_enum_literal(sig: Dict, prefix: str) -> str: |
760 | 761 | return name.as_camel_case() |
761 | 762 |
|
762 | 763 |
|
| 764 | +def get_params(top: ConfigT, module: ConfigT) -> List[str]: |
| 765 | + """Return the parameters for a given module including implicit parameters |
| 766 | + but excluding RACL parameters, which are handled in a separate template. |
| 767 | + """ |
| 768 | + param_items = [] |
| 769 | + alert_info = top["alert_connections"].get("module_" + module["name"], {}) |
| 770 | + has_racl_params = bool(module.get("racl_mappings")) |
| 771 | + if alert_info: |
| 772 | + param_items.append((".AlertAsyncOn", alert_info["async_expr"])) |
| 773 | + if alert_info or module.get("template_type") == "alert_handler": |
| 774 | + param_items.append((".AlertSkewCycles", "top_pkg::AlertSkewCycles")) |
| 775 | + for param in module["param_list"]: |
| 776 | + is_exposed = check_bool(param.get("expose", False), f"expose field of {param['name']}") |
| 777 | + has_random_type = param.get("randtype") |
| 778 | + param_key = "name_top" if (is_exposed or has_random_type) else "default" |
| 779 | + param_items.append((f".{param['name']}", param[param_key])) |
| 780 | + |
| 781 | + has_params = has_racl_params or len(param_items) > 0 |
| 782 | + return has_params, param_items |
| 783 | + |
| 784 | + |
763 | 785 | def make_bit_concatenation(sig_name: str, indices: List[int], |
764 | 786 | end_indent: int) -> str: |
765 | 787 | '''Return SV code for concatenating certain indices from a signal |
|
0 commit comments