Closed ThomasPluck closed 1 year ago
Merging #155 (0456198) into main (137333c) will decrease coverage by
0.02%
. The diff coverage is68.00%
.
@@ Coverage Diff @@
## main #155 +/- ##
==========================================
- Coverage 87.19% 87.18% -0.02%
==========================================
Files 109 109
Lines 9568 9607 +39
==========================================
+ Hits 8343 8376 +33
- Misses 1225 1231 +6
Impacted Files | Coverage Δ | |
---|---|---|
hdl21/sliceable.py | 84.00% <0.00%> (ø) |
|
hdl21/elab/elaborators/arrays.py | 67.92% <45.83%> (+0.65%) |
:arrow_up: |
hdl21/instance.py | 86.28% <70.00%> (-2.54%) |
:arrow_down: |
hdl21/tests/test_hdl21.py | 96.22% <100.00%> (+0.07%) |
:arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
See #3, RIP :headstone:
This PR introduces "sliceable" arrays as well as symmetric slicing logic, (ie.
s[0]=t
now means something) first described in #1 and #3, which I've found a need for in my own Hdl21 programs.Summary:
Instance
s called.instances
, with the following properties:__setattr__
sets a globalconn
, as well as modifies all underlyingInstance
sconn
s.__getattr__
is inherited from_Instance
base class.__getitem__
returns the appropriateInstance
from the.instances
attribute__setitem__
is similar to_Instance
base class but specifically targetting slices and index provided.ArrayFlattener
simply reinstantiates the needed instances and clones the connections of eachInstance
in.instances
.__setitem__
tosliceable
decorator to enable symmetric slicing, simply adds exterior slice to internal_slices
decorator attribute (eg.s[0]=t
impliess._slice = [val=t, index=0]
) - this needs much more testing.test_instance_array_indexing
to capture this idea.Tasks:
InstanceArray
s and more elaborate constructions