Skip to content

BUG with Packed Load Upper Immediate Instructions (Incorrect immediate width) #2326

Description

@mattiamirigaldi

PLUI.H, PLUI.W: Packed Load Upper Immediate (Halfword and Word).
Spike incorrectly processes the 10-bit immediate for the plui instructions. It applies the wrong shift amount (appearing to shift an 8-bit value by 8 or 24, rather than shifting a 10-bit value by 6 or 22).
Furthermore Spike fails to properly sign-extend 10-bit immediates when the MSB (bit 9) is set.

Example 1: plui.h (Positive Immediate)

  • Input: imm = 0xCC
  • Operation: imm[9:0] << 60xCC << 6 = 0x3300
  • Expected result: 0x3300330033003300
  • Spike result: 0xcc00cc00cc00cc00

Example 2: plui.h (Sign-Extended Immediate)

  • Input: imm = 0x3CC
  • Operation: sign_extend(16, 0x3CC << 6)sign_extend(16, 0xF300) = 0xF300
  • Expected result: 0xf300f300f300f300
  • Spike result: 0xccc0ccc0ccc0ccc0

Example 3: plui.w (Positive Immediate)

  • Input: imm = 0xCC
  • Operation: imm[9:0] << 220xCC << 22 = 0x33000000
  • Expected result: 0x3300000033000000
  • Spike result: 0xcc000000cc000000

Example 4: plui.w (Sign-Extended Immediate)

  • Input: imm = 0x3CC
  • Operation: sign_extend(32, 0x3CC << 22)sign_extend(32, 0xF3000000) = 0xF3000000
  • Expected result: 0xf3000000f3000000
  • Spike result: 0xccc00000ccc00000

Possible Cause: Spike is treating the immediate as an 8-bit value rather than a 10-bit value.


Spike hash : de82903

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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