Skip to content

Align AGU SrcRType encoding with LinxISA v0.58.5 #193

Description

@zhoubot

Architecture gap

PTO-SPEC currently decodes register-offset AGU SrcRType as 0=unchanged, 1=.sw, 2=.uw, 3=.neg. LinxISA v0.58.5 Sail and compiler output use the shared arithmetic modifier encoding 0=.sw, 1=.uw, 2=.neg, 3=unchanged.

A real add_i32_lat ELF emits lw [t#1, t#2<<2] with raw SrcRType=3. PTO therefore negates index 1 on the second loop iteration and loads the wrong address.

Proposed architecture decision

Adopt the LinxISA v0.58.5 arithmetic modifier mapping for every register-offset AGU form:

  • 00: sign-extend low 32 bits (.sw)
  • 01: zero-extend low 32 bits (.uw)
  • 10: negate the full XLEN value (.neg)
  • 11: unchanged (omitted modifier)

Keep modifier-before-shift ordering and all existing fault/atomicity rules. Update owning ASL/contracts and add exact encoded loop/address regressions.

Evidence

  • LinxISA Sail: apply_srcrtype_arith64 in isa/sail/model/lib/common.sail
  • LinxISA Sail exec_lw applies that helper before shamt
  • Compiler ELF instruction 0x179c2f89 decodes as LW with SrcRType=3, plain disassembly
  • PTO focused two-iteration ELF-shaped test passes iteration 0 and loads zero at iteration 1 under the current mapping

Target: 0.58.5. This issue is architecture-only; hosted runner and sidecar behavior remain in PTO-ISA/asl-model docs.

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