Bug 1088

Summary: change ISACaller and correct bug introduced in parser.py where it bypasses FPSCR as a local parameter and a return result
Product: Libre-SOC's first SoC Reporter: Jacob Lifshay <programmerjake>
Component: Source CodeAssignee: Luke Kenneth Casson Leighton <lkcl>
Status: RESOLVED FIXED    
Severity: normal CC: libre-soc-bugs, programmerjake
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Linux   
See Also: https://bugs.libre-soc.org/show_bug.cgi?id=1087
NLnet milestone: --- total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0 parent task for budget allocation:
child tasks for budget allocation: The table of payments (in EUR) for this task; TOML format:

Description Jacob Lifshay 2023-05-24 02:15:10 BST
some conversation for this bug occurred on #1087

opening this bug because I want to continue that conversation without getting it mixed up with changing the pseudocode
Comment 1 Jacob Lifshay 2023-05-24 02:19:31 BST
(In reply to Luke Kenneth Casson Leighton from bug #1087 comment #6)
> done.
> 
> +        # write FPSCR
> +        if name in ['FPSCR', ]:
> +            log("write FPSCR 0x%x" % (output.value))
> +            self.FPSCR.eq(output)
> +            return

assigning to FPSCR from the pseudocode function's return value generally does nothing at all because FPSCR is a python class and is passed by reference and pseudocode generally only assigns to attributes (directly modifying the FPSCR register in the process) rather than the whole FPSCR variable.
Comment 2 Jacob Lifshay 2023-05-24 02:28:36 BST
(In reply to Luke Kenneth Casson Leighton from bug #1087 comment #7)
> to "effect" a "no change", the variable that requires "not to be changed"
> must:
> 
> 1) be passed in as an INPUT parameter

ok, we need this for RT for fcvtfg and FRT in most fp pseudocode, unless fcvt* is changed to always write RT as I proposed in #1087, though we still need it for FRT in most pseudocode.

> 2) not be modified by the pseudocode
> 3) be passed OUT as a return result.
Comment 3 Jacob Lifshay 2023-05-24 04:21:18 BST
(In reply to Jacob Lifshay from comment #2)
> (In reply to Luke Kenneth Casson Leighton from bug #1087 comment #7)
> > to "effect" a "no change", the variable that requires "not to be changed"
> > must:
> > 
> > 1) be passed in as an INPUT parameter
> 
> ok, we need this for RT for fcvtfg and FRT in most fp pseudocode, unless
> fcvt* is changed to always write RT as I proposed in #1087, though we still
> need it for FRT in most pseudocode.

I added a way to add that without needing to use special pseudocode syntax since the ISA WG doesn't need to see all our simulator special case helper annotations -- it uses a html comment:

https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=870f7f23273d1d0d49af9ed09d82c42f2347ef07

commit 870f7f23273d1d0d49af9ed09d82c42f2347ef07
Author: Jacob Lifshay <programmerjake@gmail.com>
Date:   Tue May 23 19:24:34 2023 -0700

    add support for adding extra uninit_regs from html comment
    
    I chose an html comment since it's not part of the proposed pseudocode
    
    like so:
    * blah RT,RA
    Pseudo-code:
    
    <!-- EXTRA_UNINIT_REGS: RT -->
        if rand() then
            RT <- 42 + (RA)
Comment 4 Luke Kenneth Casson Leighton 2023-05-24 09:43:16 BST
already completed.