Registers of the ISA can be declared specifiying the bitfield where the register code is set. The syntax to declare a register is:
register <name>[<size>] = <bitfield-specification>
<name>
should start with a letter followed by any
combination of [a-z][A-Z][0-9]_
characters.<size>
is a literal number that specifies the
size of the register in bits.<bitfield-specification>
is the specification to
what bitfield is used to set this register code and what value is set on
this bitfield to specify the usage of this register.bitfield Reg[4]
register r2[32] = Reg{2}
It’s a 32 bit register named r2
where they code is set
on a Reg
bitfield, and it’s code is 2
.
bitfield Reg[4] {
size[1]
code[3]
}
register rdx[64] = Reg {
size = 1,
code = 2,
}
It’s a 64 bit register named rdx
where they code is set
on a Reg
bitfield, and the bitfield’s fields are set to
size = 1
and code = 2
respectivaly. It’s
equivalent to Reg{10}
.