test_parameter_bounds_match_the_hdl =================================== .. py:module:: test_parameter_bounds_match_the_hdl .. autoapi-nested-parse:: A parameter bound stated twice is a bound that can disagree with itself. The registry declares what a tile's parameters may be; the tile's own elaboration guard declares the same thing in SystemVerilog, because Verilog cannot read the registry. Both are necessary. Nothing made them agree, so the registry could offer a K the tile refuses to elaborate, or -- worse -- accept one the tile elaborates into something unmeasured. The tiles state their bounds in a small set of conventional forms, which is what makes this checkable. A form this cannot parse is listed explicitly rather than skipped silently: an unparsed guard is an unchecked guard, and a holdout list that nobody can see is how the last audit went stale. Attributes ---------- .. autoapisummary:: test_parameter_bounds_match_the_hdl._HDL_DIR test_parameter_bounds_match_the_hdl._RANGE_FORMS test_parameter_bounds_match_the_hdl._CHOICE_FORMS test_parameter_bounds_match_the_hdl.UNPARSED_GUARDS Functions --------- .. autoapisummary:: test_parameter_bounds_match_the_hdl._guard_bounds test_parameter_bounds_match_the_hdl._parameterized_cores test_parameter_bounds_match_the_hdl._magnitude test_parameter_bounds_match_the_hdl.test_declared_bounds_match_the_tiles_elaboration_guard test_parameter_bounds_match_the_hdl.test_unparsed_guards_are_declared_and_still_exist test_parameter_bounds_match_the_hdl.test_the_python_mirror_of_the_top_k_bound_matches_the_registry Module Contents --------------- .. py:data:: _HDL_DIR .. py:data:: _RANGE_FORMS .. py:data:: _CHOICE_FORMS .. py:data:: UNPARSED_GUARDS .. py:function:: _guard_bounds(source: str) -> tuple[dict[str, tuple[int, int]], dict[str, tuple[int, ...]]] (ranges, choices) keyed by parameter name, read from `$error` text. .. py:function:: _parameterized_cores() -> list[tuple[str, dau_core.cores.CoreDefinition]] .. py:function:: _magnitude(parameter, value: int) -> int What the tile's guard is a bound ON. An element-type parameter carries a type encoding, and a guard reading "must divide 128 and lie in [8, 64]" bounds the type's WIDTH -- the encoding itself is not a quantity anything is measured in. For a plain signed integer the two coincide (int32 encodes as 32), which is exactly why this has to be explicit: it would otherwise appear to work until the first fixed-point or float type was declared, and then compare 4128 against a bound about bits. .. py:function:: test_declared_bounds_match_the_tiles_elaboration_guard() -> None .. py:function:: test_unparsed_guards_are_declared_and_still_exist() -> None The holdout list must not outlive its holdouts, in either direction. .. py:function:: test_the_python_mirror_of_the_top_k_bound_matches_the_registry() -> None `TOP_K_MAX` is a third copy of the same number: the compiler rejects an out-of-envelope limit against it, the registry prices against its maximum, and the tile refuses to elaborate outside its guard.