From 5c07d14510e397e92f2b6461c20015f09d05a763 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 17 Oct 2018 12:44:22 +0100 Subject: [PATCH] add element width polymorphic algorithm --- simple_v_extension/specification.mdwn | 164 ++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) diff --git a/simple_v_extension/specification.mdwn b/simple_v_extension/specification.mdwn index 9d552b291..592355dcb 100644 --- a/simple_v_extension/specification.mdwn +++ b/simple_v_extension/specification.mdwn @@ -1140,6 +1140,170 @@ during the hardware loop, **not** the offset. Element bitwidth is best covered as its own special section, as it is quite involved and applies uniformly across-the-board. +The effect of setting an element bitwidth is to re-cast the register +table to a completely different width. In c-style terms, on an +RV64 architecture, effectively each register looks like this: + + typedef union { + uint8_t b[8]; + uint16_t s[4]; + uint32_t i[2]; + uint64_t l[1]; + } reg_t; + + // integer table: assume maximum SV 7-bit regfile size + reg_t int_regfile[128]; + +However this hides the fact that setting VL greater than 8, for example, +when the bitwidth is 8, accessing one specific register "spills over" +to the following parts of the register file in a sequential fashion. +So a much more accurate way to reflect this would be: + + typedef union { + uint8_t actual_register_bytes[8]; + uint8_t *b; + uint16_t *s; + uint32_t *i; + uint64_t *l; + uint128_t *d; + } reg_t; + + reg_t int_regfile[128]; + +Where it is up to the implementor to ensure that, towards the end +of the register file, an exception is thrown if attempts to access +beyond the "real" register bytes is ever attempted. + +Now we may pseudo-code an operation where all element bitwidths have +been set to the same size: + + function op_add(rd, rs1, rs2) # add not VADD! + ... + ... +  for (i = 0; i < VL; i++) + if (predval & 1<