From: Jacob Lifshay Date: Thu, 26 Nov 2020 04:46:55 +0000 (-0800) Subject: add instruction decode modes and opcode byte highlighting X-Git-Tag: convert-csv-opcode-to-binary~1655 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=72938150138ad7f289b53958445a1d1e0f9768fb;p=libreriscv.git add instruction decode modes and opcode byte highlighting --- diff --git a/openpower/sv/16_bit_compressed/demo.mdwn b/openpower/sv/16_bit_compressed/demo.mdwn index 64d8dc580..d51cfd81a 100644 --- a/openpower/sv/16_bit_compressed/demo.mdwn +++ b/openpower/sv/16_bit_compressed/demo.mdwn @@ -103,218 +103,218 @@ Note that bit numbering goes from 0 to 31 in the prefix, then 0 to 31 in the suf ## Big-Endian Machine Code -| Address | Byte | PC | Instruction | -|---------|-----------------------------------|-------------------------------------|--------------------------------------------------------| -| 0x1000 |
0x38
|
0x1000
|
addi r3, r4, 5
| -| 0x1001 |
0x64
|
0x1000
|
addi r3, r4, 5
| -| 0x1002 |
0x00
|
0x1000
|
addi r3, r4, 5
| -| 0x1003 |
0x05
|
0x1000
|
addi r3, r4, 5
| -| 0x1004 |
0x06
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1005 |
0x00
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1006 |
0xDE
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1007 |
0xAD
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1008 |
0x38
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1009 |
0x65
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x100A |
0xBE
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x100B |
0xEF
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x100C |
0x00
|
0x100C
|
x.placeholder
| -| 0x100D |
0x00
|
0x100C
|
x.placeholder
| -| 0x100E |
0x00
|
0x100C
|
x.placeholder
| -| 0x100F |
0x02
|
0x100C
|
x.placeholder
| -| 0x1010 |
0x00
|
0x100C
|
x.placeholder
| -| 0x1011 |
0x00
|
0x100C
|
x.placeholder
| -| 0x1012 |
0x38
|
0x1012
|
addi r3, r4, 5
| -| 0x1013 |
0x64
|
0x1012
|
addi r3, r4, 5
| -| 0x1014 |
0x00
|
0x1012
|
addi r3, r4, 5
| -| 0x1015 |
0x05
|
0x1012
|
addi r3, r4, 5
| -| 0x1016 |
0x06
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x1017 |
0x00
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x1018 |
0x89
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x1019 |
0xAB
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101A |
0x38
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101B |
0x65
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101C |
0xCD
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101D |
0xEF
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101E |
0x00
|
0x101E
|
x.placeholder
| -| 0x101F |
0x00
|
0x101E
|
x.placeholder
| -| 0x1020 |
0x00
|
0x101E
|
x.placeholder
| -| 0x1021 |
0x02
|
0x101E
|
x.placeholder
| -| 0x1022 |
0x00
|
0x101E
|
x.placeholder
| -| 0x1023 |
0x00
|
0x101E
|
x.placeholder
| -| 0x1024 |
0x14
|
0x1024
|
h.add r3, r4
| -| 0x1025 |
0x02
|
0x1024
|
h.add r3, r4
| -| 0x1026 |
0x38
|
0x1026
|
addi r3, r6, 7
| -| 0x1027 |
0x66
|
0x1026
|
addi r3, r6, 7
| -| 0x1028 |
0x00
|
0x1026
|
addi r3, r6, 7
| -| 0x1029 |
0x07
|
0x1026
|
addi r3, r6, 7
| -| 0x102A |
0x14
|
0x102A
|
hs.add r3, r31
| -| 0x102B |
0x0F
|
0x102A
|
hs.add r3, r31
| -| 0x102C |
0x04
|
0x102C
|
c.add r3, r30
| -| 0x102D |
0x0C
|
0x102C
|
c.add r3, r30
| -| 0x102E |
0x84
|
0x102E
|
cst.add r3, r29
| -| 0x102F |
0x0B
|
0x102E
|
cst.add r3, r29
| -| 0x1030 |
0x06
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1031 |
0x00
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1032 |
0x12
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1033 |
0x34
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1034 |
0x38
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1035 |
0x7F
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1036 |
0x56
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1037 |
0x78
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1038 |
0x04
|
0x1038
|
c.add r3, r5
| -| 0x1039 |
0x04
|
0x1038
|
c.add r3, r5
| -| 0x103A |
0x04
|
0x103A
|
c.add r3, r3
| -| 0x103B |
0x00
|
0x103A
|
c.add r3, r3
| -| 0x103C |
0x04
|
0x103C
|
cs.add r3, r6
| -| 0x103D |
0x07
|
0x103C
|
cs.add r3, r6
| -| 0x103E |
0x38
|
0x103E
|
addi r3, r3, 0x23
| -| 0x103F |
0x63
|
0x103E
|
addi r3, r3, 0x23
| -| 0x1040 |
0x00
|
0x103E
|
addi r3, r3, 0x23
| -| 0x1041 |
0x23
|
0x103E
|
addi r3, r3, 0x23
| -| 0x1042 |
0x38
|
0x1042
|
addi r3, r10, 0xA
| -| 0x1043 |
0x6A
|
0x1042
|
addi r3, r10, 0xA
| -| 0x1044 |
0x00
|
0x1042
|
addi r3, r10, 0xA
| -| 0x1045 |
0x0A
|
0x1042
|
addi r3, r10, 0xA
| -| 0x1046 |
0x14
|
0x1046
|
hs.add r3, r5
| -| 0x1047 |
0x05
|
0x1046
|
hs.add r3, r5
| -| 0x1048 |
0x84
|
0x1048
|
cst.add r3, r4
| -| 0x1049 |
0x03
|
0x1048
|
cst.add r3, r4
| -| 0x104A |
0x14
|
0x104A
|
hs.add r3, r6
| -| 0x104B |
0x07
|
0x104A
|
hs.add r3, r6
| -| 0x104C |
0x84
|
0x104C
|
cst.add r3, r28
| -| 0x104D |
0x09
|
0x104C
|
cst.add r3, r28
| -| 0x104E |
0x14
|
0x104E
|
h.add r3, r29
| -| 0x104F |
0x0A
|
0x104E
|
h.add r3, r29
| -| 0x1050 |
0x84
|
0x1050
|
cst.add r3, r30
| -| 0x1051 |
0x0D
|
0x1050
|
cst.add r3, r30
| -| 0x1052 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1053 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1054 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1055 |
0x02
|
0x1052
|
x.placeholder
| -| 0x1056 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1057 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1058 |
0x84
|
0x1058
|
cst.add r3, r31
| -| 0x1059 |
0x0F
|
0x1058
|
cst.add r3, r31
| -| 0x105A |
0x38
|
0x105A
|
addi r3, r15, 0xF
| -| 0x105B |
0x6F
|
0x105A
|
addi r3, r15, 0xF
| -| 0x105C |
0x00
|
0x105A
|
addi r3, r15, 0xF
| -| 0x105D |
0x0F
|
0x105A
|
addi r3, r15, 0xF
| -| 0x105E |
0x04
|
0x105E
|
cs.add r3, r4
| -| 0x105F |
0x03
|
0x105E
|
cs.add r3, r4
| -| 0x1060 |
0x38
|
0x1060
|
addi r3, r10, 0xF
| -| 0x1061 |
0x6A
|
0x1060
|
addi r3, r10, 0xF
| -| 0x1062 |
0x00
|
0x1060
|
addi r3, r10, 0xF
| -| 0x1063 |
0x0F
|
0x1060
|
addi r3, r10, 0xF
| -| 0x1064 |
0x38
|
0x1064
|
addi r3, r11, 0xF
| -| 0x1065 |
0x6B
|
0x1064
|
addi r3, r11, 0xF
| -| 0x1066 |
0x00
|
0x1064
|
addi r3, r11, 0xF
| -| 0x1067 |
0x0F
|
0x1064
|
addi r3, r11, 0xF
| +| Address | Byte | PC | Mode | Instruction | +|---------|-----------------------------------|---------------------------------------|----------------------------------------------|--------------------------------------------------------| +| 0x1000 |
0x38
|
0x1000+0
|
Standard
|
addi r3, r4, 5
| +| 0x1001 |
0x64
|
0x1000+1
|
Standard
|
addi r3, r4, 5
| +| 0x1002 |
0x00
|
0x1000+2
|
Standard
|
addi r3, r4, 5
| +| 0x1003 |
0x05
|
0x1000+3
|
Standard
|
addi r3, r4, 5
| +| 0x1004 |
0x06
|
0x1004+0
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1005 |
0x00
|
0x1004+1
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1006 |
0xDE
|
0x1004+2
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1007 |
0xAD
|
0x1004+3
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1008 |
0x38
|
0x1004+4
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1009 |
0x65
|
0x1004+5
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x100A |
0xBE
|
0x1004+6
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x100B |
0xEF
|
0x1004+7
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x100C |
0x00
|
0x100C+0
|
Standard
|
x.placeholder
| +| 0x100D |
0x00
|
0x100C+1
|
Standard
|
x.placeholder
| +| 0x100E |
0x00
|
0x100C+2
|
Standard
|
x.placeholder
| +| 0x100F |
0x02
|
0x100C+3
|
Standard
|
x.placeholder
| +| 0x1010 |
0x00
|
0x100C+4
|
Standard
|
x.placeholder
| +| 0x1011 |
0x00
|
0x100C+5
|
Standard
|
x.placeholder
| +| 0x1012 |
0x38
|
0x1012+0
|
Standard
|
addi r3, r4, 5
| +| 0x1013 |
0x64
|
0x1012+1
|
Standard
|
addi r3, r4, 5
| +| 0x1014 |
0x00
|
0x1012+2
|
Standard
|
addi r3, r4, 5
| +| 0x1015 |
0x05
|
0x1012+3
|
Standard
|
addi r3, r4, 5
| +| 0x1016 |
0x06
|
0x1016+0
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x1017 |
0x00
|
0x1016+1
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x1018 |
0x89
|
0x1016+2
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x1019 |
0xAB
|
0x1016+3
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101A |
0x38
|
0x1016+4
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101B |
0x65
|
0x1016+5
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101C |
0xCD
|
0x1016+6
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101D |
0xEF
|
0x1016+7
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101E |
0x00
|
0x101E+0
|
Standard
|
x.placeholder
| +| 0x101F |
0x00
|
0x101E+1
|
Standard
|
x.placeholder
| +| 0x1020 |
0x00
|
0x101E+2
|
Standard
|
x.placeholder
| +| 0x1021 |
0x02
|
0x101E+3
|
Standard
|
x.placeholder
| +| 0x1022 |
0x00
|
0x101E+4
|
Standard
|
x.placeholder
| +| 0x1023 |
0x00
|
0x101E+5
|
Standard
|
x.placeholder
| +| 0x1024 |
0x14
|
0x1024+0
|
Standard
|
h.add r3, r4
| +| 0x1025 |
0x02
|
0x1024+1
|
Standard
|
h.add r3, r4
| +| 0x1026 |
0x38
|
0x1026+0
|
Standard
|
addi r3, r6, 7
| +| 0x1027 |
0x66
|
0x1026+1
|
Standard
|
addi r3, r6, 7
| +| 0x1028 |
0x00
|
0x1026+2
|
Standard
|
addi r3, r6, 7
| +| 0x1029 |
0x07
|
0x1026+3
|
Standard
|
addi r3, r6, 7
| +| 0x102A |
0x14
|
0x102A+0
|
Standard
|
hs.add r3, r31
| +| 0x102B |
0x0F
|
0x102A+1
|
Standard
|
hs.add r3, r31
| +| 0x102C |
0x04
|
0x102C+0
|
Compressed
|
c.add r3, r30
| +| 0x102D |
0x0C
|
0x102C+1
|
Compressed
|
c.add r3, r30
| +| 0x102E |
0x84
|
0x102E+0
|
Compressed
|
cst.add r3, r29
| +| 0x102F |
0x0B
|
0x102E+1
|
Compressed
|
cst.add r3, r29
| +| 0x1030 |
0x06
|
0x1030+0
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1031 |
0x00
|
0x1030+1
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1032 |
0x12
|
0x1030+2
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1033 |
0x34
|
0x1030+3
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1034 |
0x38
|
0x1030+4
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1035 |
0x7F
|
0x1030+5
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1036 |
0x56
|
0x1030+6
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1037 |
0x78
|
0x1030+7
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1038 |
0x04
|
0x1038+0
|
Compressed
|
c.add r3, r5
| +| 0x1039 |
0x04
|
0x1038+1
|
Compressed
|
c.add r3, r5
| +| 0x103A |
0x04
|
0x103A+0
|
Compressed
|
c.add r3, r3
| +| 0x103B |
0x00
|
0x103A+1
|
Compressed
|
c.add r3, r3
| +| 0x103C |
0x04
|
0x103C+0
|
Compressed
|
cs.add r3, r6
| +| 0x103D |
0x07
|
0x103C+1
|
Compressed
|
cs.add r3, r6
| +| 0x103E |
0x38
|
0x103E+0
|
Standard
|
addi r3, r3, 0x23
| +| 0x103F |
0x63
|
0x103E+1
|
Standard
|
addi r3, r3, 0x23
| +| 0x1040 |
0x00
|
0x103E+2
|
Standard
|
addi r3, r3, 0x23
| +| 0x1041 |
0x23
|
0x103E+3
|
Standard
|
addi r3, r3, 0x23
| +| 0x1042 |
0x38
|
0x1042+0
|
Standard
|
addi r3, r10, 0xA
| +| 0x1043 |
0x6A
|
0x1042+1
|
Standard
|
addi r3, r10, 0xA
| +| 0x1044 |
0x00
|
0x1042+2
|
Standard
|
addi r3, r10, 0xA
| +| 0x1045 |
0x0A
|
0x1042+3
|
Standard
|
addi r3, r10, 0xA
| +| 0x1046 |
0x14
|
0x1046+0
|
Standard
|
hs.add r3, r5
| +| 0x1047 |
0x05
|
0x1046+1
|
Standard
|
hs.add r3, r5
| +| 0x1048 |
0x84
|
0x1048+0
|
Compressed
|
cst.add r3, r4
| +| 0x1049 |
0x03
|
0x1048+1
|
Compressed
|
cst.add r3, r4
| +| 0x104A |
0x14
|
0x104A+0
|
Std. Then Comp.
|
hs.add r3, r6
| +| 0x104B |
0x07
|
0x104A+1
|
Std. Then Comp.
|
hs.add r3, r6
| +| 0x104C |
0x84
|
0x104C+0
|
Compressed
|
cst.add r3, r28
| +| 0x104D |
0x09
|
0x104C+1
|
Compressed
|
cst.add r3, r28
| +| 0x104E |
0x14
|
0x104E+0
|
Std. Then Comp.
|
h.add r3, r29
| +| 0x104F |
0x0A
|
0x104E+1
|
Std. Then Comp.
|
h.add r3, r29
| +| 0x1050 |
0x84
|
0x1050+0
|
Compressed
|
cst.add r3, r30
| +| 0x1051 |
0x0D
|
0x1050+1
|
Compressed
|
cst.add r3, r30
| +| 0x1052 |
0x00
|
0x1052+0
|
Std. Then Comp.
|
x.placeholder
| +| 0x1053 |
0x00
|
0x1052+1
|
Std. Then Comp.
|
x.placeholder
| +| 0x1054 |
0x00
|
0x1052+2
|
Std. Then Comp.
|
x.placeholder
| +| 0x1055 |
0x02
|
0x1052+3
|
Std. Then Comp.
|
x.placeholder
| +| 0x1056 |
0x00
|
0x1052+4
|
Std. Then Comp.
|
x.placeholder
| +| 0x1057 |
0x00
|
0x1052+5
|
Std. Then Comp.
|
x.placeholder
| +| 0x1058 |
0x84
|
0x1058+0
|
Compressed
|
cst.add r3, r31
| +| 0x1059 |
0x0F
|
0x1058+1
|
Compressed
|
cst.add r3, r31
| +| 0x105A |
0x38
|
0x105A+0
|
Std. Then Comp.
|
addi r3, r15, 0xF
| +| 0x105B |
0x6F
|
0x105A+1
|
Std. Then Comp.
|
addi r3, r15, 0xF
| +| 0x105C |
0x00
|
0x105A+2
|
Std. Then Comp.
|
addi r3, r15, 0xF
| +| 0x105D |
0x0F
|
0x105A+3
|
Std. Then Comp.
|
addi r3, r15, 0xF
| +| 0x105E |
0x04
|
0x105E+0
|
Compressed
|
cs.add r3, r4
| +| 0x105F |
0x03
|
0x105E+1
|
Compressed
|
cs.add r3, r4
| +| 0x1060 |
0x38
|
0x1060+0
|
Standard
|
addi r3, r10, 0xF
| +| 0x1061 |
0x6A
|
0x1060+1
|
Standard
|
addi r3, r10, 0xF
| +| 0x1062 |
0x00
|
0x1060+2
|
Standard
|
addi r3, r10, 0xF
| +| 0x1063 |
0x0F
|
0x1060+3
|
Standard
|
addi r3, r10, 0xF
| +| 0x1064 |
0x38
|
0x1064+0
|
Standard
|
addi r3, r11, 0xF
| +| 0x1065 |
0x6B
|
0x1064+1
|
Standard
|
addi r3, r11, 0xF
| +| 0x1066 |
0x00
|
0x1064+2
|
Standard
|
addi r3, r11, 0xF
| +| 0x1067 |
0x0F
|
0x1064+3
|
Standard
|
addi r3, r11, 0xF
| ## Little-Endian Machine Code -| Address | Byte | PC | Instruction | -|---------|-----------------------------------|-------------------------------------|--------------------------------------------------------| -| 0x1000 |
0x05
|
0x1000
|
addi r3, r4, 5
| -| 0x1001 |
0x00
|
0x1000
|
addi r3, r4, 5
| -| 0x1002 |
0x64
|
0x1000
|
addi r3, r4, 5
| -| 0x1003 |
0x38
|
0x1000
|
addi r3, r4, 5
| -| 0x1004 |
0xAD
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1005 |
0xDE
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1006 |
0x00
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1007 |
0x06
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1008 |
0xEF
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x1009 |
0xBE
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x100A |
0x65
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x100B |
0x38
|
0x1004
|
paddi r3, r5, 0xDEADBEEF
| -| 0x100C |
0x02
|
0x100C
|
x.placeholder
| -| 0x100D |
0x00
|
0x100C
|
x.placeholder
| -| 0x100E |
0x00
|
0x100C
|
x.placeholder
| -| 0x100F |
0x00
|
0x100C
|
x.placeholder
| -| 0x1010 |
0x64
|
0x1012
|
addi r3, r4, 5
| -| 0x1011 |
0x38
|
0x1012
|
addi r3, r4, 5
| -| 0x1012 |
0x00
|
0x100C
|
x.placeholder
| -| 0x1013 |
0x00
|
0x100C
|
x.placeholder
| -| 0x1014 |
0x00
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x1015 |
0x06
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x1016 |
0x05
|
0x1012
|
addi r3, r4, 5
| -| 0x1017 |
0x00
|
0x1012
|
addi r3, r4, 5
| -| 0x1018 |
0x65
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x1019 |
0x38
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101A |
0xAB
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101B |
0x89
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101C |
0x00
|
0x101E
|
x.placeholder
| -| 0x101D |
0x00
|
0x101E
|
x.placeholder
| -| 0x101E |
0xEF
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x101F |
0xCD
|
0x1016
|
paddi r3, r5, 0x89ABCDEF
| -| 0x1020 |
0x00
|
0x101E
|
x.placeholder
| -| 0x1021 |
0x00
|
0x101E
|
x.placeholder
| -| 0x1022 |
0x02
|
0x101E
|
x.placeholder
| -| 0x1023 |
0x00
|
0x101E
|
x.placeholder
| -| 0x1024 |
0x66
|
0x1026
|
addi r3, r6, 7
| -| 0x1025 |
0x38
|
0x1026
|
addi r3, r6, 7
| -| 0x1026 |
0x02
|
0x1024
|
h.add r3, r4
| -| 0x1027 |
0x14
|
0x1024
|
h.add r3, r4
| -| 0x1028 |
0x0F
|
0x102A
|
hs.add r3, r31
| -| 0x1029 |
0x14
|
0x102A
|
hs.add r3, r31
| -| 0x102A |
0x07
|
0x1026
|
addi r3, r6, 7
| -| 0x102B |
0x00
|
0x1026
|
addi r3, r6, 7
| -| 0x102C |
0x0B
|
0x102E
|
cst.add r3, r29
| -| 0x102D |
0x84
|
0x102E
|
cst.add r3, r29
| -| 0x102E |
0x0C
|
0x102C
|
c.add r3, r30
| -| 0x102F |
0x04
|
0x102C
|
c.add r3, r30
| -| 0x1030 |
0x34
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1031 |
0x12
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1032 |
0x00
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1033 |
0x06
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1034 |
0x78
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1035 |
0x56
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1036 |
0x7F
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1037 |
0x38
|
0x1030
|
paddi r3, r31, 0x12345678
| -| 0x1038 |
0x00
|
0x103A
|
c.add r3, r3
| -| 0x1039 |
0x04
|
0x103A
|
c.add r3, r3
| -| 0x103A |
0x04
|
0x1038
|
c.add r3, r5
| -| 0x103B |
0x04
|
0x1038
|
c.add r3, r5
| -| 0x103C |
0x63
|
0x103E
|
addi r3, r3, 0x23
| -| 0x103D |
0x38
|
0x103E
|
addi r3, r3, 0x23
| -| 0x103E |
0x07
|
0x103C
|
cs.add r3, r6
| -| 0x103F |
0x04
|
0x103C
|
cs.add r3, r6
| -| 0x1040 |
0x6A
|
0x1042
|
addi r3, r10, 0xA
| -| 0x1041 |
0x38
|
0x1042
|
addi r3, r10, 0xA
| -| 0x1042 |
0x23
|
0x103E
|
addi r3, r3, 0x23
| -| 0x1043 |
0x00
|
0x103E
|
addi r3, r3, 0x23
| -| 0x1044 |
0x05
|
0x1046
|
hs.add r3, r5
| -| 0x1045 |
0x14
|
0x1046
|
hs.add r3, r5
| -| 0x1046 |
0x0A
|
0x1042
|
addi r3, r10, 0xA
| -| 0x1047 |
0x00
|
0x1042
|
addi r3, r10, 0xA
| -| 0x1048 |
0x07
|
0x104A
|
hs.add r3, r6
| -| 0x1049 |
0x14
|
0x104A
|
hs.add r3, r6
| -| 0x104A |
0x03
|
0x1048
|
cst.add r3, r4
| -| 0x104B |
0x84
|
0x1048
|
cst.add r3, r4
| -| 0x104C |
0x0A
|
0x104E
|
h.add r3, r29
| -| 0x104D |
0x14
|
0x104E
|
h.add r3, r29
| -| 0x104E |
0x09
|
0x104C
|
cst.add r3, r28
| -| 0x104F |
0x84
|
0x104C
|
cst.add r3, r28
| -| 0x1050 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1051 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1052 |
0x0D
|
0x1050
|
cst.add r3, r30
| -| 0x1053 |
0x84
|
0x1050
|
cst.add r3, r30
| -| 0x1054 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1055 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1056 |
0x02
|
0x1052
|
x.placeholder
| -| 0x1057 |
0x00
|
0x1052
|
x.placeholder
| -| 0x1058 |
0x6F
|
0x105A
|
addi r3, r15, 0xF
| -| 0x1059 |
0x38
|
0x105A
|
addi r3, r15, 0xF
| -| 0x105A |
0x0F
|
0x1058
|
cst.add r3, r31
| -| 0x105B |
0x84
|
0x1058
|
cst.add r3, r31
| -| 0x105C |
0x03
|
0x105E
|
cs.add r3, r4
| -| 0x105D |
0x04
|
0x105E
|
cs.add r3, r4
| -| 0x105E |
0x0F
|
0x105A
|
addi r3, r15, 0xF
| -| 0x105F |
0x00
|
0x105A
|
addi r3, r15, 0xF
| -| 0x1060 |
0x0F
|
0x1060
|
addi r3, r10, 0xF
| -| 0x1061 |
0x00
|
0x1060
|
addi r3, r10, 0xF
| -| 0x1062 |
0x6A
|
0x1060
|
addi r3, r10, 0xF
| -| 0x1063 |
0x38
|
0x1060
|
addi r3, r10, 0xF
| -| 0x1064 |
0x0F
|
0x1064
|
addi r3, r11, 0xF
| -| 0x1065 |
0x00
|
0x1064
|
addi r3, r11, 0xF
| -| 0x1066 |
0x6B
|
0x1064
|
addi r3, r11, 0xF
| -| 0x1067 |
0x38
|
0x1064
|
addi r3, r11, 0xF
| \ No newline at end of file +| Address | Byte | PC | Mode | Instruction | +|---------|-----------------------------------|---------------------------------------|----------------------------------------------|--------------------------------------------------------| +| 0x1000 |
0x05
|
0x1000+3
|
Standard
|
addi r3, r4, 5
| +| 0x1001 |
0x00
|
0x1000+2
|
Standard
|
addi r3, r4, 5
| +| 0x1002 |
0x64
|
0x1000+1
|
Standard
|
addi r3, r4, 5
| +| 0x1003 |
0x38
|
0x1000+0
|
Standard
|
addi r3, r4, 5
| +| 0x1004 |
0xAD
|
0x1004+3
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1005 |
0xDE
|
0x1004+2
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1006 |
0x00
|
0x1004+1
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1007 |
0x06
|
0x1004+0
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1008 |
0xEF
|
0x1004+7
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x1009 |
0xBE
|
0x1004+6
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x100A |
0x65
|
0x1004+5
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x100B |
0x38
|
0x1004+4
|
Standard
|
paddi r3, r5, 0xDEADBEEF
| +| 0x100C |
0x02
|
0x100C+3
|
Standard
|
x.placeholder
| +| 0x100D |
0x00
|
0x100C+2
|
Standard
|
x.placeholder
| +| 0x100E |
0x00
|
0x100C+1
|
Standard
|
x.placeholder
| +| 0x100F |
0x00
|
0x100C+0
|
Standard
|
x.placeholder
| +| 0x1010 |
0x64
|
0x1012+1
|
Standard
|
addi r3, r4, 5
| +| 0x1011 |
0x38
|
0x1012+0
|
Standard
|
addi r3, r4, 5
| +| 0x1012 |
0x00
|
0x100C+5
|
Standard
|
x.placeholder
| +| 0x1013 |
0x00
|
0x100C+4
|
Standard
|
x.placeholder
| +| 0x1014 |
0x00
|
0x1016+1
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x1015 |
0x06
|
0x1016+0
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x1016 |
0x05
|
0x1012+3
|
Standard
|
addi r3, r4, 5
| +| 0x1017 |
0x00
|
0x1012+2
|
Standard
|
addi r3, r4, 5
| +| 0x1018 |
0x65
|
0x1016+5
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x1019 |
0x38
|
0x1016+4
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101A |
0xAB
|
0x1016+3
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101B |
0x89
|
0x1016+2
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101C |
0x00
|
0x101E+1
|
Standard
|
x.placeholder
| +| 0x101D |
0x00
|
0x101E+0
|
Standard
|
x.placeholder
| +| 0x101E |
0xEF
|
0x1016+7
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x101F |
0xCD
|
0x1016+6
|
Standard
|
paddi r3, r5, 0x89ABCDEF
| +| 0x1020 |
0x00
|
0x101E+5
|
Standard
|
x.placeholder
| +| 0x1021 |
0x00
|
0x101E+4
|
Standard
|
x.placeholder
| +| 0x1022 |
0x02
|
0x101E+3
|
Standard
|
x.placeholder
| +| 0x1023 |
0x00
|
0x101E+2
|
Standard
|
x.placeholder
| +| 0x1024 |
0x66
|
0x1026+1
|
Standard
|
addi r3, r6, 7
| +| 0x1025 |
0x38
|
0x1026+0
|
Standard
|
addi r3, r6, 7
| +| 0x1026 |
0x02
|
0x1024+1
|
Standard
|
h.add r3, r4
| +| 0x1027 |
0x14
|
0x1024+0
|
Standard
|
h.add r3, r4
| +| 0x1028 |
0x0F
|
0x102A+1
|
Standard
|
hs.add r3, r31
| +| 0x1029 |
0x14
|
0x102A+0
|
Standard
|
hs.add r3, r31
| +| 0x102A |
0x07
|
0x1026+3
|
Standard
|
addi r3, r6, 7
| +| 0x102B |
0x00
|
0x1026+2
|
Standard
|
addi r3, r6, 7
| +| 0x102C |
0x0B
|
0x102E+1
|
Compressed
|
cst.add r3, r29
| +| 0x102D |
0x84
|
0x102E+0
|
Compressed
|
cst.add r3, r29
| +| 0x102E |
0x0C
|
0x102C+1
|
Compressed
|
c.add r3, r30
| +| 0x102F |
0x04
|
0x102C+0
|
Compressed
|
c.add r3, r30
| +| 0x1030 |
0x34
|
0x1030+3
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1031 |
0x12
|
0x1030+2
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1032 |
0x00
|
0x1030+1
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1033 |
0x06
|
0x1030+0
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1034 |
0x78
|
0x1030+7
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1035 |
0x56
|
0x1030+6
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1036 |
0x7F
|
0x1030+5
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1037 |
0x38
|
0x1030+4
|
Std. Then Comp.
|
paddi r3, r31, 0x12345678
| +| 0x1038 |
0x00
|
0x103A+1
|
Compressed
|
c.add r3, r3
| +| 0x1039 |
0x04
|
0x103A+0
|
Compressed
|
c.add r3, r3
| +| 0x103A |
0x04
|
0x1038+1
|
Compressed
|
c.add r3, r5
| +| 0x103B |
0x04
|
0x1038+0
|
Compressed
|
c.add r3, r5
| +| 0x103C |
0x63
|
0x103E+1
|
Standard
|
addi r3, r3, 0x23
| +| 0x103D |
0x38
|
0x103E+0
|
Standard
|
addi r3, r3, 0x23
| +| 0x103E |
0x07
|
0x103C+1
|
Compressed
|
cs.add r3, r6
| +| 0x103F |
0x04
|
0x103C+0
|
Compressed
|
cs.add r3, r6
| +| 0x1040 |
0x6A
|
0x1042+1
|
Standard
|
addi r3, r10, 0xA
| +| 0x1041 |
0x38
|
0x1042+0
|
Standard
|
addi r3, r10, 0xA
| +| 0x1042 |
0x23
|
0x103E+3
|
Standard
|
addi r3, r3, 0x23
| +| 0x1043 |
0x00
|
0x103E+2
|
Standard
|
addi r3, r3, 0x23
| +| 0x1044 |
0x05
|
0x1046+1
|
Standard
|
hs.add r3, r5
| +| 0x1045 |
0x14
|
0x1046+0
|
Standard
|
hs.add r3, r5
| +| 0x1046 |
0x0A
|
0x1042+3
|
Standard
|
addi r3, r10, 0xA
| +| 0x1047 |
0x00
|
0x1042+2
|
Standard
|
addi r3, r10, 0xA
| +| 0x1048 |
0x07
|
0x104A+1
|
Std. Then Comp.
|
hs.add r3, r6
| +| 0x1049 |
0x14
|
0x104A+0
|
Std. Then Comp.
|
hs.add r3, r6
| +| 0x104A |
0x03
|
0x1048+1
|
Compressed
|
cst.add r3, r4
| +| 0x104B |
0x84
|
0x1048+0
|
Compressed
|
cst.add r3, r4
| +| 0x104C |
0x0A
|
0x104E+1
|
Std. Then Comp.
|
h.add r3, r29
| +| 0x104D |
0x14
|
0x104E+0
|
Std. Then Comp.
|
h.add r3, r29
| +| 0x104E |
0x09
|
0x104C+1
|
Compressed
|
cst.add r3, r28
| +| 0x104F |
0x84
|
0x104C+0
|
Compressed
|
cst.add r3, r28
| +| 0x1050 |
0x00
|
0x1052+1
|
Std. Then Comp.
|
x.placeholder
| +| 0x1051 |
0x00
|
0x1052+0
|
Std. Then Comp.
|
x.placeholder
| +| 0x1052 |
0x0D
|
0x1050+1
|
Compressed
|
cst.add r3, r30
| +| 0x1053 |
0x84
|
0x1050+0
|
Compressed
|
cst.add r3, r30
| +| 0x1054 |
0x00
|
0x1052+5
|
Std. Then Comp.
|
x.placeholder
| +| 0x1055 |
0x00
|
0x1052+4
|
Std. Then Comp.
|
x.placeholder
| +| 0x1056 |
0x02
|
0x1052+3
|
Std. Then Comp.
|
x.placeholder
| +| 0x1057 |
0x00
|
0x1052+2
|
Std. Then Comp.
|
x.placeholder
| +| 0x1058 |
0x6F
|
0x105A+1
|
Std. Then Comp.
|
addi r3, r15, 0xF
| +| 0x1059 |
0x38
|
0x105A+0
|
Std. Then Comp.
|
addi r3, r15, 0xF
| +| 0x105A |
0x0F
|
0x1058+1
|
Compressed
|
cst.add r3, r31
| +| 0x105B |
0x84
|
0x1058+0
|
Compressed
|
cst.add r3, r31
| +| 0x105C |
0x03
|
0x105E+1
|
Compressed
|
cs.add r3, r4
| +| 0x105D |
0x04
|
0x105E+0
|
Compressed
|
cs.add r3, r4
| +| 0x105E |
0x0F
|
0x105A+3
|
Std. Then Comp.
|
addi r3, r15, 0xF
| +| 0x105F |
0x00
|
0x105A+2
|
Std. Then Comp.
|
addi r3, r15, 0xF
| +| 0x1060 |
0x0F
|
0x1060+3
|
Standard
|
addi r3, r10, 0xF
| +| 0x1061 |
0x00
|
0x1060+2
|
Standard
|
addi r3, r10, 0xF
| +| 0x1062 |
0x6A
|
0x1060+1
|
Standard
|
addi r3, r10, 0xF
| +| 0x1063 |
0x38
|
0x1060+0
|
Standard
|
addi r3, r10, 0xF
| +| 0x1064 |
0x0F
|
0x1064+3
|
Standard
|
addi r3, r11, 0xF
| +| 0x1065 |
0x00
|
0x1064+2
|
Standard
|
addi r3, r11, 0xF
| +| 0x1066 |
0x6B
|
0x1064+1
|
Standard
|
addi r3, r11, 0xF
| +| 0x1067 |
0x38
|
0x1064+0
|
Standard
|
addi r3, r11, 0xF
| \ No newline at end of file diff --git a/openpower/sv/16_bit_compressed/demo_assembler.sh b/openpower/sv/16_bit_compressed/demo_assembler.sh index a9db541be..09de5dfb8 100755 --- a/openpower/sv/16_bit_compressed/demo_assembler.sh +++ b/openpower/sv/16_bit_compressed/demo_assembler.sh @@ -41,20 +41,24 @@ small_regs[29]=5 small_regs[30]=6 small_regs[31]=7 colors=("800" "880" "080" "088" "008" "808") +bright_colors=("F00" "FF0" "0F0" "0FF" "00F" "F0F") +modes=("Standard" "Compressed" "Std. Then Comp.") pc=0x1000 +mode=0 initial_pc=$((pc)) last_pc=$((pc)) last_color=0 bytes=() function out_byte_text() { local s - printf -v s '| %4s | %6s | %-30s |' "$1" "$2" "$3" - bytes+=("$s") + printf -v s ' %s |' "$@" + bytes+=("|$s") } function out_byte() { local a b printf -v a '0x%02X' $(($1)) - printf -v b '0x%04X' $((pc)) + printf -v b '0x%04X+%i' $((pc)) $((${#bytes[@]} + initial_pc - pc)) + local m="${modes[mode]}" local l="$line" if ((${#colors[@]} != 0)); then if ((last_pc != pc)); then @@ -63,11 +67,15 @@ function out_byte() { ((last_color %= ${#colors[@]})) fi local color="${colors[last_color]}" + if ((${#bytes[@]} + initial_pc - pc == 1)); then + color="${bright_colors[last_color]}" + fi a="
$a
" b="
$b
" + m="
$m
" l="
$l
" fi - out_byte_text "$a" "$b" "$l" + out_byte_text "$a" "$b" "$m" "$l" } function out_16() { out_byte $(($1 >> 8)) @@ -89,6 +97,7 @@ for line in "${lines[@]}"; do fi arg1s="${small_regs[arg1]}" arg2s="${small_regs[arg2]}" + next_mode=$((mode)) case "$opcode" in addi) out_32 $((14 << 31 - 5 | arg1 << 31 - 10 | arg2 << 31 - 15 | arg3 & 0xFFFF)) @@ -111,6 +120,7 @@ for line in "${lines[@]}"; do hs.add) out_16 $((5 << 15 - 5 | arg1s << 15 - 11 | arg2s << 15 - 14 | 1)) ((pc += 2)) + next_mode=1 ;; c.add) out_16 $((1 << 15 - 5 | arg1s << 15 - 11 | arg2s << 15 - 14)) @@ -119,10 +129,12 @@ for line in "${lines[@]}"; do cs.add) out_16 $((1 << 15 - 5 | arg1s << 15 - 11 | arg2s << 15 - 14 | 1)) ((pc += 2)) + next_mode=0 ;; cst.add) out_16 $((1 << 15 | 1 << 15 - 5 | arg1s << 15 - 11 | arg2s << 15 - 14 | 1)) ((pc += 2)) + next_mode=2 ;; *) echo "invalid opcode: $opcode" @@ -130,6 +142,11 @@ for line in "${lines[@]}"; do exit 1 ;; esac + if (( mode == 2 )); then + next_mode=1 + fi + #printf "pc=0x%X mode=%i next_mode=%i\n" $((pc)) $((mode)) $((next_mode)) + mode=$((next_mode)) done while ((${#bytes[@]} % 4 != 0)); do out_byte_text "" "" "" @@ -140,8 +157,8 @@ function write() { local endian_bits=$(($2)) echo "## $endian Machine Code" echo - echo "| Address | Byte | PC | Instruction |" - echo "|---------|------|--------|--------------------------------|" + echo "| Address | Byte | PC | Mode | Instruction |" + echo "|---------|------|----|------|-------------|" for((i=0;i<${#bytes[@]};i++)); do printf "| 0x%04X %s\n" $((i + initial_pc)) "${bytes[i ^ endian_bits]}" done