From 3372e73a06fc3ed2ef59dfeb2e80dbc8eb8098fd Mon Sep 17 00:00:00 2001 From: lkcl Date: Tue, 4 Apr 2023 23:39:44 +0100 Subject: [PATCH] --- openpower/sv/svp64.mdwn | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openpower/sv/svp64.mdwn b/openpower/sv/svp64.mdwn index d704266f6..4874e4f51 100644 --- a/openpower/sv/svp64.mdwn +++ b/openpower/sv/svp64.mdwn @@ -186,15 +186,20 @@ from Figure 97, Book I, Section 6.3, Page 258: ``` #pragma pack typedef union { + uint8_t actual_bytes[8]; + // all of these are very deliberately unbounded arrays + // that intentionally "wrap" into subsequent actual_bytes... uint8_t bytes[]; // elwidth 8 uint16_t hwords[]; // elwidth 16 uint32_t words[]; // elwidth 32 uint64_t dwords[]; // elwidth 64 - uint8_t actual_bytes[8]; + } el_reg_t; + // ... here, as packed statically-defined GPRs. elreg_t int_regfile[128]; + // use element 0 as the destination void get_register_element(el_reg_t* el, int gpr, int element, int width) { switch (width) { case 64: el->dwords[0] = int_regfile[gpr].dwords[element]; @@ -203,6 +208,8 @@ from Figure 97, Book I, Section 6.3, Page 258: case 8 : el->bytes[0] = int_regfile[gpr].bytes[element]; } } + + // use element 0 as the source void set_register_element(el_reg_t* el, int gpr, int element, int width) { switch (width) { case 64: int_regfile[gpr].dwords[element] = el->dwords[0]; -- 2.30.2