Commit bec2745f authored by Connor Abbott's avatar Connor Abbott

fix format 2 encoding

Based on my original notes.
parent b0e1917d
......@@ -1539,18 +1539,22 @@ class Clause:
quadword = BitArray(128)
i1 = instructions.pop(0)
i2 = instructions.pop(0) if instructions else None
if i2:
tag = 0b00100
elif immediates:
tag = 0b00000
if not i2:
# Format 2.1
if immediates:
tag = 0b00000011
else:
tag = 0b01000011
quadword[0:3] = i1[0:3]
quadword[45:120] = i1[3:78]
quadword[120:128] = tag
else:
tag = 0b01000
if i2:
# Format 2.2
tag = 0b00100
quadword[0:45] = i2[33:78]
quadword[45:120] = i1[3:78]
quadword[120:125] = tag
quadword[125:128] = i1[0:3]
quadword[45:120] = i1[3:78]
quadword[120:125] = tag
quadword[125:128] = i1[0:3]
encoded.append(quadword)
if not i2:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment