test_parameter_bounds_match_the_hdl

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

_HDL_DIR

_RANGE_FORMS

_CHOICE_FORMS

UNPARSED_GUARDS

Functions

_guard_bounds(source) → tuple[dict[str, tuple[int, int]], dict[str, tuple[int, ...]]]

(ranges, choices) keyed by parameter name, read from $error text.

_parameterized_cores() → list[tuple[str, dau_core.cores.CoreDefinition]]

_magnitude(parameter, value) → int

What the tile's guard is a bound ON.

test_declared_bounds_match_the_tiles_elaboration_guard() → None

test_unparsed_guards_are_declared_and_still_exist() → None

The holdout list must not outlive its holdouts, in either direction.

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

Module Contents

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
test_parameter_bounds_match_the_hdl._guard_bounds(source: str) → tuple[dict[str, tuple[int, int]], dict[str, tuple[int, ...]]]

(ranges, choices) keyed by parameter name, read from $error text.

test_parameter_bounds_match_the_hdl._parameterized_cores() → list[tuple[str, dau_core.cores.CoreDefinition]]
test_parameter_bounds_match_the_hdl._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.

test_parameter_bounds_match_the_hdl.test_declared_bounds_match_the_tiles_elaboration_guard() → None
test_parameter_bounds_match_the_hdl.test_unparsed_guards_are_declared_and_still_exist() → None

The holdout list must not outlive its holdouts, in either direction.

test_parameter_bounds_match_the_hdl.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.