[libre-riscv-dev] partitioned signals and Cat

Jacob Lifshay programmerjake at gmail.com
Mon Feb 10 19:19:10 GMT 2020


On Sat, Feb 8, 2020, 15:15 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:

> well, dang, i just realised that with Cat and changing the size of Signals
> in general by fixed amounts, partitioning got *seriously* complicated.
>
> take for example the seemingly innocuous task of extending a Signal by 2
> bits using Cat(x, 0, 0)
>
> this is really straightforward to assign to another Signal that is 2 bits
> longer.  length += 2.
>
> for a PartitionedSignal that goes out the window, because if the partitions
> are open, it's a 64 + 2 bit Signal, and if the partitions are closed, it's
> 8x 8+2 bit Signals.
>
> some serious thought is going to have to go into this.  possibly to the
> extent of mirroring the nmigen ArrayProxy infrastructure.
>
> any ideas?
>

Require signals combined using Cat to have the same partition order
(partition point enable flags, but not partition sizes). it would work like
this:

numbers in [ ] are partition sizes, letters are single bits:
all partitions split:
Cat([4, 4, 8], [1, 1, 1]) => [5, 5, 9]
bits (msb to lsb): Cat(abcdefgh_ijkl_mnop, q_r_s) => qabcdefgh_rijkl_smnop

first two partitions combined:
Cat([4 + 4, 8], [1 + 1, 1]) => [10, 9]
bits (msb to lsb): Cat(abcdefgh_ijklmnop, q_rs) => qabcdefgh_rsijklmnop

all partitions combined:
Cat([4 + 4 + 8], [1 + 1 + 1]) => [19]
bits (msb to lsb): Cat(abcdefghijklmnop, qrs) => qrsabcdefghijklmnop

Jacob


More information about the libre-riscv-dev mailing list