[Libre-soc-bugs] [Bug 980] Implement C-based Power ISA pseudocode compiler

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Dec 4 00:24:18 GMT 2023


https://bugs.libre-soc.org/show_bug.cgi?id=980

--- Comment #16 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #15)
> (btw please drop functions. they were not added and should not have beem
> added by jacob. please drop "def" from the AST and modify pyfnwriter
> and appendix pseudocode to not support functions.  this means
> separating each "function" into an explicit separate pseudocode file)

PowerISA very much has functions (though they don't use the def keyword):
Book I Appendix A

Round Integer( sign, frac0:64, gbit, rbit, xbit, round_mode ):
    inc <- 0
    if round_mode = 0b00 then do /* Round to Nearest */
        if sign || frac64 || gbit || rbit || xbit = 0bU11UU then inc <- 1
        if sign || frac64 || gbit || rbit || xbit = 0bU011U then inc <- 1
        if sign || frac64 || gbit || rbit || xbit = 0bU01U1 then inc <- 1
    end
    if round_mode = 0b10 then do /* Round toward +Infinity */
        if sign || frac64 || gbit || rbit || xbit = 0b0U1UU then inc <- 1
        if sign || frac64 || gbit || rbit || xbit = 0b0UU1U then inc <- 1
        if sign || frac64 || gbit || rbit || xbit = 0b0UUU1 then inc <- 1
    end
    if round_mode = 0b11 then do /* Round toward -Infinity */
        if sign || frac64 || gbit || rbit || xbit = 0b1U1UU then inc <- 1
        if sign || frac64 || gbit || rbit || xbit = 0b1UU1U then inc <- 1
        if sign || frac64 || gbit || rbit || xbit = 0b1UUU1 then inc <- 1
    end
    frac0:64 <- frac0:64 + inc
    FPSCRFR <- inc
    FPSCRFI <- gbit | rbit | xbit
    return

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list