[Libre-soc-bugs] [Bug 458] New: PartitionedSignal needs nmigen constructs "m.If", Switch etc
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Tue Aug 18 01:06:55 BST 2020
https://bugs.libre-soc.org/show_bug.cgi?id=458
Bug ID: 458
Summary: PartitionedSignal needs nmigen constructs "m.If",
Switch etc
Product: Libre-SOC's first SoC
Version: unspecified
Hardware: Other
OS: Linux
Status: CONFIRMED
Severity: enhancement
Priority: ---
Component: Source Code
Assignee: lkcl at lkcl.net
Reporter: lkcl at lkcl.net
CC: libre-soc-bugs at lists.libre-soc.org
NLnet milestone: ---
PartitionedSignal is a dynamic SIMD version of Signal. it needs to work with
the following constructs:
* m.If / Elif / Else
* m.Switch / Case
* Arrays
without PartitionedSignal, SIMD has to be done as follows:
with m.If(partition == 64):
operations treating Signals at full 64 bit
with m.Elif(partition == 2x32bit):
for i in range(2):
exactly the same code as 64 bit
except now it is repeated twice,
first on the low 32 bits and then
on the hi 32
and that repetition continues right the way down to 8 bit, complicating design
massively.
PartitionedSignal hides that entirely, as far as arithmetic and logic
operations are concerned (__lt__, __or__, see bug #132)
where things break down is this:
ppts = PartitionPoints(64, 8)
x = PartitionedSignal(64, partition=ppts)
with m.If(x == 5):
... do something.
the reason it breaks down is because PartitionedSignal.__eq__ does *not* return
a single bit object, it returns a *dynamic multi-bit* object that dynamically
reflects the current state of the partitioning.
example:
* partition points is set to 8 breaks
* this subdivides the 64 bit signal into 8 separate 8 bit values
* comparison against a constant (5) creates EIGHT separate 8-bit comparisons
* those 8 comparisons are bundled together
when the partitions are cleared to indicate that the 64 bits are to be treated
as a single 64 bit value, the comparison "5" is done against the entire 64 bit,
however the answer still goes into the same 8 bit object used when the
partition was set to 8x8bit.
the m.If construct cannot cope with this.
the current workaround is to completely avoid using m.If entirely and to use a
special PartitionedMux construct, PMux, instead.
this however is less than ideal.
similar logic applies to Switch/Case. Arrays need some discussion.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list