(no commit message)
[libreriscv.git] / 3d_gpu / architecture / dynamic_simd / shape.mdwn
1 # SimdShape
2
3 A logical extension of the nmigen `ast.Shape` concept, `SimdShape`
4 provides sufficient context to both define overrides for individual lengths
5 on a per-mask basis as well as sufficient information to "upcast"
6 back to a SimdSignal, in exactly the same way that c++ virtual base
7 class upcasting works when RTTI (Run Time Type Information) works.
8
9 By deriving from `ast.Shape` both `width` and `signed` are provided
10 already leaving the `SimdShape` class with the responsibility to
11 additionally define lengths for each mask basis. This is best illustrated
12 with an example.
13
14 The Libre-SOC IEEE754 ALUs need to be converted to SIMD Partitioning
15 but without massive disruptive code-duplication or intrusive explicit
16 coding as outlined in the worst of the techniques documented in
17 [[dynamic_simd]]. This in turn implies that Signals need to be declared
18 for both mantissa and exponent that **change width to non-power-of-two
19 sizes** depending on Partition Mask Context.
20
21 Mantissa:
22
23 * when the context is 1xFP64 the mantissa is 54 bits (excluding guard
24 rounding and sticky)
25 * when the context is 2xFP32 there are **two** mantissas of 23 bits
26 * when the context is 4xFP16 there are **four** mantissas of 10 bits
27 * when the context is 4xBF16 there are four mantissas of 5 bits.
28