Open pjsoberoi opened 2 months ago
The fact that you say you can't use attach
values for it is interesting, but it's a solvable problem. One way to duplicate the register name in the operands would be to use a string, which would work fine as long as it was always a0, and not possibly some other register:
:add a0, "a0" is opcode_00_16=0b1111111111 & a0 {}
Another way would be to use a sub-constructor:
a0_: a0 is a0 { export a0; }
:add a0, a0_ is opcode_00_16=0b1111111111 & a0 & a0_ {}
A third way is to not worry about the correctness of the display and just use a single a0:
:add a0 is opcode_00_16=0b1111111111 & a0 {}
@GhidorahRex : Thank you for the quick response. The sub-constructor is the closest to what I want, I'll attempt to use that.
Taking a step back, I would consider this a bug in SLEIGH. The above instruction is a valid instruction and should be able to be represented in SLEIGH. We should be allowed to have duplicate register names IMHO.
I would like to support an instruction similar to the following:
The instruction is 16-bits. It references register a0 twice. This fails in the Sleigh compiler with:
I am unable to use attach variables (take my word for it, I admit I'm doing weird stuff). I don't want to define the entire instruction as a mnemonic. I need a0 to be a register. Basically I need it to work like this:
But with a0 twice. As the first instruction is a valid instruction there has to be a way right? Thanks in advance.