Closed dan-fritchman closed 1 year ago
@ThomasPluck - please check out the changes to Scalar
here:
https://github.com/dan-fritchman/Hdl21/blob/e060483c1289c64a4db3a77af97f48fc2a322710/hdl21/scalar.py
This is how I would prefer that Scalar
type/ "thing" to work - more like Union[Prefixed, Literal]
than "wrapper thereof".
It means that all the call sites throughout PDKs like this:
@h.paramclass
class Params:
xyx = h.Param(dtype=h.Scalar, desc="", default=h.Scalar(inner=1 * µ))
Need to become:
@h.paramclass
class Params:
xyx = h.Param(dtype=h.Scalar, desc="", default=1 * µ)
(Note the latter version always worked; now just have to use it; Scalar
is not a constructible thing.)
I know you've got PDK changes brewing. This should just effect those call-sites - presumably all of which are parameter-defaults - and nothing else. (I think.)
You ready for this to go in?
Or wanna get PDK changes merged first?
Sure, this can go in and I'll refactor Scalar
calls.
Error discovered in a couple tests having scrubbed out h.Scalar
calls:
if not isinstance(orig, h.Scalar):
> raise TypeError(f"Invalid Scalar parameter {orig}")
E TypeError: Invalid Scalar parameter number=Decimal('0.42') prefix=<Prefix.MICRO: -6>
Is this something that you'd like to build an exception for, or would you prefer to keep this type definition strict?
Yep, I noticed the same, example here: https://github.com/dan-fritchman/Hdl21/blob/1cf539ed660c7c4ce5ae58cd169004206d72a497/pdks/Sky130/sky130/pdk_logic.py#L369
I think that's the right approach, and consistent with the idea that Scalar "is" Union[Prefixed, Literal]
.
Codecov Report
96.53% <0.00%> (-0.44%)
100.00% <ø> (ø)
0.00% <0.00%> (ø)
84.26% <40.00%> (+0.29%)
96.69% <50.00%> (-3.31%)
86.51% <66.66%> (-0.07%)
75.91% <66.66%> (+1.04%)
85.18% <80.95%> (+21.05%)
80.56% <83.33%> (+7.38%)
93.33% <84.00%> (-2.42%)
... and 1 file with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more