Skip to content

Can't describe instructions with overlapping match strings discriminated by "not" constraints #1061

@ThinkOpenly

Description

@ThinkOpenly

Describe the bug
There is a need to describe sspush and sspopchk, but their respective match strings ostensibly overlap:

sspush  : 1100111-----00000100000001110011
sspopchk: 110011011100-----100000001110011

But the not constraint for each distinguishes the two unambiguously, as the first string's variable must be 1 or 5, not 28 (11100) and the second string's variable must be 1 or 5, not 0 (00000).

To Reproduce
With sspush defined with:

encoding:
  match: "1100111-----00000100000001110011"
  variables:
    - name: xs2
      location: 24-20
      # prettier-ignore
      not: [ 0, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 ]

and sspopchk defined with:

encoding:
  match: "110011011100-----100000001110011"
  variables:
    - name: xs1
      location: 19-15
      # prettier-ignore
      not: [ 0, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 ]

Text output/Error Messages

/workspace/riscv-unified-db/backends/cpp_hart_gen/lib/decode_tree.rb:122:in `block in construct_decode_tree': undefined method `match?' for nil:NilClass (NoMethodError)

      if inst_format.reverse[cur_range].match?(/^[01]+$/)
                                       ^^^^^^^

Additional context
These two instructions are currently represented with incorrect mnemonics as in sspush.x1 and sspush.x5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions