Skip to content

[BUG] CGetOffset and CSetEqualExact give wrong result #42

@Andreas-Bur

Description

@Andreas-Bur

Is there an existing CVA6 bug for this?

  • I have searched the existing bug issues

Bug Description

I encountered the case where cgetoffset gives the wrong result when operating on a register previously written to by csrrw. Here a small PoC:
In the end register x4 has value 0x000fffffffffffff instead of 0xffffffffffffffff.

  .section ".text.init","ax",@progbits
  .globl _start
_start:

# Init FPU

  lui x11, 2
  csrrw x11, mstatus, x11
  addi x11, x0, 0
  csrrw x11, fcsr, x11

# Program start

  li x1, -1
  csrrw x2,sscratch,x1
  csrrw x3,sscratch,x2
  cgetoffset x4, c3
  cgetoffset x5, c1

# Dump capability registers

  cspecialrw c29, 29, c0
  fence
  csc c1, 48(c29) # Writes 0x0000000000010004ffffffffffffffff
  fence
  csc c2, 48(c29) # Writes 0x00000000000100040000000000000000
  fence
  csc c3, 48(c29) # Writes 0x0000000000010004ffffffffffffffff
  fence
  csc c4, 48(c29) # Writes 0x0000000000010004000fffffffffffff instead of 0x0000000000010004ffffffffffffffff
  fence
  csc c5, 48(c29) # Writes 0x0000000000010004ffffffffffffffff
  fence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions