Bug 467 - PartitionedSignal needs to work with Arrays
Summary: PartitionedSignal needs to work with Arrays
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Source Code (show other bugs)
Version: unspecified
Hardware: Other Linux
: --- enhancement
Assignee: Luke Kenneth Casson Leighton
Depends on:
Blocks: 132
  Show dependency treegraph
Reported: 2020-08-18 15:03 BST by Luke Kenneth Casson Leighton
Modified: 2020-12-18 18:21 GMT (History)
1 user (show)

See Also:
NLnet milestone: ---
total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0
parent task for budget allocation:
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:


Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kenneth Casson Leighton 2020-08-18 15:03:11 BST
PartitionedSignal is a dynamic SIMD version of Signal.  it has a partition "context" associated with it which is also a Signal.

32 bit partitioned signal:

ppts:     1    2    3 
sig : 0xNN 0xNN 0xNN 0xNN

this 32 bit PartitionedSignal may be 1x32, 2x16, 4x8, or any other permutation including 24-8.

Array accesses of Signals work very simply by allocating a pmux.

a = Array([Signal(4), Signal(4)])
b = Signal(2)

however Array has no concept of PartitionedSignal and will completely fail to produce the right action.

ppts = PartitionPoints(4)

a = Array([PartitionedSignal(16, ppts),
           PartitionedSignal(16, ppts)])
b = PartitionedSignal(8, ppts)
a[b].eq(5) # fails 

the reason this fails is because "b" is not a Signal of 8 bits, it is *dynamically interpreted* depending on the current context at runtime of its partition.


* the partition may be set to "all closed", indicating that b is 4x 2-bit AND
* a Array items are 4x 4-bit 

Then if:

* first part of b may be 0b00
* second part of b may be 0b01
* third part of b may be 0b01
* first part of b may be 0b00

this indicates that ***FOUR*** separate and distinct pmux operations shall take place, ***NOT*** one, as follows:

* a[0b00][0:3].eq(5) # from 1st b part
* a[0b01][4:7].eq(5) # from 2nd b part
* a[0b01][8:11].eq(5) # from 3rd b part
* a[0b00][12:15].eq(5) # from 4th b part

this because the partition is set to 4x 4 bit and therefore a's PartitionedSignals are treated as 4 completely independent 4 bit Arrays (i.e. they are SIMD)

if however the partitions are 8-8 and b is as follows

* b first part is 0b0000
* b second part is 0b0001


* a[0b0000][0:7].eq(5) # from 1st b
* a[0b0001][8:15].eq(5) # from 2nd b

this because b is now subdivided into 2x 4 bit parts, therefore when used as an array index it splits A elements into 2x 8 bit ***INDEPENDENTLY INDEXED*** parallel 8 bit SIMD arrays.

lastly and only if the partitions are entirely open (clear) may the array a and the index b be considered "scalar signals"

* b may be set to 0b00000001

therefore the following is actioned:

* a[0b00000001][0:15].eq(5)

the assignment RHS may also be another PartitionedSignal (only ever with the same partition context) and consequently the parts of a on LHS are dynamically assigned the parts of the RHS.

at no time may partition contexts be shared (mixed)