Skip to content

[BUG] FPU-to-Integer Trace Mislogging #3122

@canxin121

Description

@canxin121

Is there an existing CVA6 bug for this?

  • I have searched the existing bug issues

Bug Description

Issue Overview

  • In the CVA6 execution reports, mixed float/integer instructions such as flt.h and fcvt.wu.h are logged as if they wrote to the floating-point destination, even though they actually write to an integer register.
  • The core still updates the correct integer register; subsequent integer instructions observe the new value, but the trace attributes the write to the wrong register file.

Reproduction Steps

  1. Use the two minimal assembly snippets listed below (Scenario A and Scenario B).
  2. Inspect the tail of each log, locate the flt.h and fcvt.wu.h entries, and compare them with the descriptions in this report.

Expected vs. Observed

  • Expected: The trace should report an update to the integer destination register (x23, x21, …) with the correct value.
  • Observed: The trace instead shows the corresponding floating-point register (f23, f21, …) being updated while the integer register retains its stale value in the log.

Evidence

  • Scenario A’s trace line for flt.h x23, f17, f19 states that f23 was written with 0x0, and makes no mention of x23.

  • The next line, addi x19, x23, 0, sets x19 = 0, proving that x23 actually received the new value despite the missing log entry.

  • Scenario B reports fcvt.wu.h x21, f18, dyn as writing f21 = 0xffffffffffffffff, again ignoring x21.

  • The subsequent addi x19, x21, 0 writes x19 = 0xffffffffffffffff, confirming that the integer register was updated while the trace misattributes the writeback.

  • Scenario A’s log line states “flt.h x23, f17, f19f23=0x0,” and the next line “addi x19, x23, 0” records x19 = 0.

  • Scenario B’s log line states “fcvt.wu.h x21, f18, dynf21=0xffffffffffffffff,” followed immediately by “addi x19, x21, 0” recording x19 = 0xffffffffffffffff.

Instruction Snippets

Scenario A

li x2, 0xfff0000000000000
fmv.d.x f17, x2
li x2, 0xffffffffffff7e00
fmv.d.x f19, x2
li x23, 0xfffffffe
li x19, 0x0
flt.h x23, f17, f19
addi x19, x23, 0

got

core   0: 0x00000000800008c4 (0xa5389bd3) DASM(a5389bd3)
3 0x00000000800008c4 (0xa5389bd3) f23 0x0000000000000000
core   0: 0x00000000800008c8 (0x000089de) DASM(000089de)
3 0x00000000800008c8 (0x89de) x19 0x0000000000000000

Scenario B

li x2, 0xadf4a72d3abbcacf
fmv.d.x f18, x2
li x21, 0x0
li x19, 0x0
fcvt.wu.h x21, f18, dyn
addi x19, x21, 0

got

core   0: 0x00000000800008a8 (0xc4197ad3) DASM(c4197ad3)
3 0x00000000800008a8 (0xc4197ad3) f21 0xffffffffffffffff
core   0: 0x00000000800008ac (0x000089d6) DASM(000089d6)
3 0x00000000800008ac (0x89d6) x19 0xffffffffffffffff

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type:BugFor bugs in the RTL, Documentation, Verification environment or Tool and Build system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions