immediate be directly actual fields. the immediate has to be
"de-constructed" before fitting into its places, d0 d1 and d2
# |0 |6 |7|8|9 |10 |11|12|13 |15|16|17 |26|27 |31 |
# | PO | FRS | d1 | d0 | XO |d2 |
PO = 22
- XO = 0b000011
+ XO = 0b00011
Rc = 0
(FRS, imm) = fields
+ # first split imm into d1, d0 and d2. sigh
+ d2 = (imm & 1) # LSB (0)
+ d1 = (imm >> 1) & 0b11111 # bits 1-5
+ d0 = (imm >> 6) # MSBs 6-15
return instruction(
(PO , 0 , 5),
(FRS, 6 , 10),
- (imm, 11, 26),
+ (d1, 11, 15),
+ (d0, 16, 26),
(XO , 27, 30),
- (Rc , 31, 31),
+ (d2 , 31, 31),
)