Skip to content

Conditional field activation: field enable masks for CUS_NOP #20

@metasmile

Description

@metasmile

Goal

Add conditional field activation to ev's constraint model. Required for CVA6 XIF's CUS_NOP which has no rd, rs1, or rs2 operands — those fields are don't-care when opcode=NOP.

Background

CVA6 cvxif_custom_instr.sv uses set_rand_mode() to disable randomization of rd/rs1/rs2 for specific instructions. CUS_NOP (funct3=001, funct7=0) has has_rd=0, has_rs1=0, has_rs2=0, meaning all operand fields must be 0. ev's current model requires every field to have a value; there is no mechanism to express "when opcode=NOP, rs1/rs2/rd are inactive (forced to 0)."

Design considerations

A conditional field activation mechanism could work as a new constraint type:

- type: enable_mask
  field: "opcode"
  value: 0x7B  # CUS_NOP encoding
  disable: ["rs1", "rs2", "rd"]

Or as a field attribute:

fields:
  rs1:
    range: [0, 31]
    enable_when:
      field: "opcode"
      ne: 0x7B  # NOP opcode

Deliverables

  1. Design and implement field enable masks in ConstraintSpec
  2. Add enable_mask (or equivalent) constraint type
  3. Update domain expansion to conditionally deactivate fields
  4. Update C harness generation in spike.rs to emit if (is_nop) { enc[IDX_rs1] = 0; } style code
  5. Create a CUS_NOP test case in an updated CVA6 fixture

References

  • cva6/verif/env/corev-dv/custom/cvxif_custom_instr.svset_rand_mode() for NOP
  • cva6_xif_ref.xif.yaml — current flat model
  • CUS_NOP: funct3=001, funct7=0, rd=0, rs1=0, rs2=0

Parent Issue

#13 — Phase 2: Spike simulation backend and CVA6 XIF exhaustive verification

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions