Skip to content

Conversation

@charlie-rivos
Copy link
Contributor

The passes for parsing $pseudo_op and $import are currently swapped, resulting in incorrect behavior. Pseudo ops are defined as:

"The pseudo op is only added to the overall dictionary is the dependent instruction is not present in the dictionary, else its skipped."

However, this is not the case if the dependent instruction has been imported.

Take the following examples:

rv_pseudo

$pseudo_op rv_op::op pseudo rd rs1 rs2 bs 29..25=0b11000 14..12=0 6..0=0x33

rv_import

$import rv_op::op

rv_op

op rd rs1 rs2 bs 29..25=0b11000 14..12=0 6..0=0x33

If we parse rv_pseudo and rv_op, the output is the single instruction "op". This is expected, as op is the "dependent instruction" and thus the pseudo is not included.

If we instead parse rv_pseudo and rv_import, the output is instead "op" and "pseudo". However, he output in this case should be the same as if the instruction was directly included. The "pseudo" instruction should not be included.

This change simply swaps the pseudo_ops and import passes, causing the behavior in both of these cases to be consistent with each other.

The passes for parsing $pseudo_op and $import are currently swapped,
resulting in incorrect behavior. Pseudo ops are defined as:

"The pseudo op is only added to the overall dictionary is the dependent instruction is not present in the dictionary, else its skipped."

However, this is not the case if the dependent instruction has been
imported.

Take the following examples:

rv_pseudo
```
$pseudo_op rv_op::op pseudo rd rs1 rs2 bs 29..25=0b11000 14..12=0 6..0=0x33
```

rv_import
```
$import rv_op::op
```

rv_op
```
op rd rs1 rs2 bs 29..25=0b11000 14..12=0 6..0=0x33
```

If we parse rv_pseudo and rv_op, the output is the single instruction
"op". This is expected, as op is the "dependent instruction" and thus
the pseudo is not included.

If we instead parse rv_pseudo and rv_import, the output is instead "op"
and "pseudo". However, he output in this case should be the same as if the
instruction was directly included. The "pseudo" instruction should not
be included.

This change simply swaps the pseudo_ops and import passes, causing the
behavior in both of these cases to be consistent with each other.

Signed-off-by: Charlie Jenkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant