Skip to content

Zalasr instruction assembly does not accept an immediate #1024

@ThinkOpenly

Description

@ThinkOpenly

I may be reading things wrong, but my interpretation of the Sail code for the LOAD and STORE instructions in model/riscv_insts_base.sail is that they include mnemonics with the various suffixes actually defined by the Zalasr extension, which is not yet ratified. These instructions are:

  • l{b,h,w,d}.{aq,aqrl}
  • s{b,h,w,d}.{rl,aqrl}

The specified syntax in Sail is:

  • LOAD:
    mapping clause assembly = LOAD(imm, rs1, rd, is_unsigned, width, aq, rl)
    <-> "l" ^ size_mnemonic(width) ^ maybe_u(is_unsigned) ^ maybe_aqrl(aq, rl) ^ spc() ^ reg_name(rd) ^ sep() ^ hex_bits_signed_12(imm) ^ "(" ^ reg_name(rs1) ^ ")"
  • STORE:
    mapping clause assembly = STORE(imm, rs2, rs1, width, aq, rl)
    <-> "s" ^ size_mnemonic(width) ^ maybe_aqrl(aq, rl) ^ spc() ^ reg_name(rs2) ^ sep() ^ hex_bits_signed_12(imm) ^ opt_spc() ^ "(" ^ opt_spc() ^ reg_name(rs1) ^ opt_spc() ^ ")"

The Zalasr syntax is currently shown here:

[Note to self: even though it appears to allow invalid mnemonics like "load-release" and "store-acquire", these are actually rejected in function clause execute (LOAD[...] match vmem_read[...] which eventually uses read_kind_of_flags and write_kind_of_flags to reject these.]

There is a basic issue that I see with the current Sail implementation: this syntax includes the generic (non-Zalasr) instructions that accepts an immediate offset value, but the Zalasr instructions apparently do not (per the links above), and the syntax does not exclude that case.

Zalasr is not ratified, adding a complication, but it is currently in "freeze" state.

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