Bug 358 - new MCU-ALU test picked up RC / OE / CR handling issue
Summary: new MCU-ALU test picked up RC / OE / CR handling issue
Status: RESOLVED FIXED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Source Code (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- enhancement
Assignee: Michael Nolan
URL:
Depends on:
Blocks: 305
  Show dependency treegraph
 
Reported: 2020-05-30 20:47 BST by Luke Kenneth Casson Leighton
Modified: 2020-06-02 00:24 BST (History)
1 user (show)

See Also:
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kenneth Casson Leighton 2020-05-30 20:47:48 BST
yippee!  a new unit test (test_alu_compunit.py) just picked up that
we are using rc from Decode2ExecuteType in the wrong way.  as RC and
OE are both of type "Data", the test needs to be on "rc_ok" enabled.

i think.

the symptoms: test_alu_compunit.py fails because CR0 is not being
outputted on OP_CMP.  as in: cr0.ok is not being set.

it's not being set because in CommonOutputStage:
        comb += self.o.cr0.data.eq(cr0)
        comb += self.o.cr0.ok.eq(op.rc.rc & op.rc.rc_ok) # CR0 to be set

op.rc.rc & op.rc.rc_ok is *zero*, and yet the test in test_output_caller.py
(and test_alu_compunit.py) is this:

    def check_extra_alu_outputs(self, alu, dec2, sim, code):
        rc = yield dec2.e.rc.data
        if rc:
             ....
Comment 1 Luke Kenneth Casson Leighton 2020-05-30 20:48:10 BST
michael, any clues?
Comment 2 Luke Kenneth Casson Leighton 2020-05-30 21:39:40 BST
ah.  just as in the unit tests which check if OP_CMP* is enabled, this was missing in CommonOutputStage.

however this highlights something else: the destination for CR output needs to be implicitly set to CR0 when RC is enabled, otherwise the output stage has ni idea where to put the result.
Comment 3 Luke Kenneth Casson Leighton 2020-05-30 22:22:51 BST
(In reply to Luke Kenneth Casson Leighton from comment #2)

> however this highlights something else: the destination for CR output needs
> to be implicitly set to CR0 when RC is enabled, otherwise the output stage
> has no idea where to put the result.

... which is in decode2.cr_out bitfield.
so the unit tests need to be modified to check if cr out ok is set, rather than use RC or the OP_CMP* test.