mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-24 13:30:26 +00:00
More PPC instruction tests.
This commit is contained in:
parent
aad75266f7
commit
b007dbc743
@ -45,6 +45,30 @@ def gen_ppc_opcode(opc_str, imm):
|
||||
return (0x1F << 26) + (3 << 21) + (3 << 16) + (0x2CA << 1)
|
||||
elif opc_str == "ADDZEO.":
|
||||
return (0x1F << 26) + (3 << 21) + (3 << 16) + (0x2CA << 1) + 1
|
||||
elif opc_str == "AND":
|
||||
return (0x1F << 26) + (3 << 21) + (3 << 16) + (4 << 11) + (0x1C << 1)
|
||||
elif opc_str == "AND.":
|
||||
return (0x1F << 26) + (3 << 21) + (3 << 16) + (4 << 11) + (0x1C << 1) + 1
|
||||
elif opc_str == "ANDC":
|
||||
return (0x1F << 26) + (3 << 21) + (3 << 16) + (4 << 11) + (0x3C << 1)
|
||||
elif opc_str == "ANDC.":
|
||||
return (0x1F << 26) + (3 << 21) + (3 << 16) + (4 << 11) + (0x3C << 1) + 1
|
||||
elif opc_str == "ANDI.":
|
||||
return (0x1C << 26) + (3 << 21) + (3 << 16) + (imm & 0xFFFF)
|
||||
elif opc_str == "ANDIS.":
|
||||
return (0x1D << 26) + (3 << 21) + (3 << 16) + (imm & 0xFFFF)
|
||||
elif opc_str == "CMP":
|
||||
return (0x1F << 26) + (3 << 16) + (4 << 11)
|
||||
elif opc_str == "CMPI":
|
||||
return (0x0B << 26) + (0 << 21) + (3 << 16) + (imm & 0xFFFF)
|
||||
elif opc_str == "CMPL":
|
||||
return (0x1F << 26) + (3 << 16) + (4 << 11) + (0x20 << 1)
|
||||
elif opc_str == "CMPLI":
|
||||
return (0x0A << 26) + (0 << 21) + (3 << 16) + (imm & 0xFFFF)
|
||||
elif opc_str == "CNTLZW":
|
||||
return (0x1F << 26) + (3 << 21) + (3 << 16) + (0x1A << 1)
|
||||
elif opc_str == "CNTLZW.":
|
||||
return (0x1F << 26) + (3 << 21) + (3 << 16) + (0x1A << 1) + 1
|
||||
|
||||
|
||||
def find_imm(line):
|
||||
@ -102,5 +126,5 @@ with open("instruction_tests_console.txt", "r") as in_file:
|
||||
out_file.write("\n")
|
||||
|
||||
lineno += 1
|
||||
if lineno > 152:
|
||||
if lineno > 266:
|
||||
break
|
||||
|
@ -151,7 +151,6 @@ ADDZEO. :: rD 0xFFFFFFFF | rA 0xFFFFFFFF | XER: 0x00000000 | CR: 0x80000000
|
||||
ADDZEO. :: rD 0xFFFFFFFF | rA 0xFFFFFFFF | XER: 0x00000000 | CR: 0x80000000
|
||||
ADDZEO. :: rD 0x00000001 | rA 0x00000001 | XER: 0x00000000 | CR: 0x40000000
|
||||
ADDZEO. :: rD 0x00000000 | rA 0x00000000 | XER: 0x00000000 | CR: 0x20000000
|
||||
AND Variants
|
||||
AND :: rD 0x00000000 | rA 0x00000000 | rB 0x00000000 | XER: 0x00000000 | CR: 0x00000000
|
||||
AND :: rD 0x00000000 | rA 0x00000000 | rB 0x00000001 | XER: 0x00000000 | CR: 0x00000000
|
||||
AND :: rD 0x00000001 | rA 0x00000001 | rB 0x00000001 | XER: 0x00000000 | CR: 0x00000000
|
||||
@ -182,7 +181,6 @@ ANDIS. :: rD 0x00000000 | rA 0x00000000 | imm 0x00000001 | XER: 0x00000000 | C
|
||||
ANDIS. :: rD 0x00000000 | rA 0x00000001 | imm 0x00000001 | XER: 0x00000000 | CR: 0x20000000
|
||||
ANDIS. :: rD 0x00000000 | rA 0xFFFFFFFF | imm 0x00000000 | XER: 0x00000000 | CR: 0x20000000
|
||||
ANDIS. :: rD 0x00010000 | rA 0xFFFFFFFF | imm 0x00000001 | XER: 0x00000000 | CR: 0x40000000
|
||||
CMP Variants
|
||||
CMP :: rA 0x00000000 | rB 0x00000000 | XER: 0x00000000 | CR: 0x20000000
|
||||
CMP :: rA 0x00000000 | rB 0x00000001 | XER: 0x00000000 | CR: 0x80000000
|
||||
CMP :: rA 0x00000001 | rB 0x00000000 | XER: 0x00000000 | CR: 0x40000000
|
||||
@ -203,7 +201,6 @@ CMPLI :: rA 0x00000000 | imm 0x00000001 | XER: 0x00000000 | CR: 0x80000000
|
||||
CMPLI :: rA 0x00000001 | imm 0x00000000 | XER: 0x00000000 | CR: 0x40000000
|
||||
CMPLI :: rA 0x00007FFF | imm 0x00007FFF | XER: 0x00000000 | CR: 0x20000000
|
||||
CMPLI :: rA 0x00002FFF | imm 0x00001FFF | XER: 0x00000000 | CR: 0x40000000
|
||||
CNTLZW Variants
|
||||
CNTLZW :: rD 0x0000001F | rA 0x00000001 | XER: 0x00000000 | CR: 0x00000000
|
||||
CNTLZW :: rD 0x0000001E | rA 0x00000002 | XER: 0x00000000 | CR: 0x00000000
|
||||
CNTLZW :: rD 0x0000001D | rA 0x00000004 | XER: 0x00000000 | CR: 0x00000000
|
||||
|
@ -151,3 +151,117 @@ ADDZEO.,0x7C630595,rD=0xFFFFFFFF,rA=0xFFFFFFFF,XER=0x00000000,CR=0x80000000
|
||||
ADDZEO.,0x7C630595,rD=0xFFFFFFFF,rA=0xFFFFFFFF,XER=0x00000000,CR=0x80000000
|
||||
ADDZEO.,0x7C630595,rD=0x00000001,rA=0x00000001,XER=0x00000000,CR=0x40000000
|
||||
ADDZEO.,0x7C630595,rD=0x00000000,rA=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
AND,0x7C632038,rD=0x00000000,rA=0x00000000,rB=0x00000000,XER=0x00000000,CR=0x00000000
|
||||
AND,0x7C632038,rD=0x00000000,rA=0x00000000,rB=0x00000001,XER=0x00000000,CR=0x00000000
|
||||
AND,0x7C632038,rD=0x00000001,rA=0x00000001,rB=0x00000001,XER=0x00000000,CR=0x00000000
|
||||
AND,0x7C632038,rD=0x00000000,rA=0xFFFFFFFF,rB=0x00000000,XER=0x00000000,CR=0x00000000
|
||||
AND,0x7C632038,rD=0x00000001,rA=0xFFFFFFFF,rB=0x00000001,XER=0x00000000,CR=0x00000000
|
||||
AND.,0x7C632039,rD=0x00000000,rA=0x00000000,rB=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
AND.,0x7C632039,rD=0x00000000,rA=0x00000000,rB=0x00000001,XER=0x00000000,CR=0x20000000
|
||||
AND.,0x7C632039,rD=0x00000001,rA=0x00000001,rB=0x00000001,XER=0x00000000,CR=0x40000000
|
||||
AND.,0x7C632039,rD=0x00000000,rA=0xFFFFFFFF,rB=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
AND.,0x7C632039,rD=0x00000001,rA=0xFFFFFFFF,rB=0x00000001,XER=0x00000000,CR=0x40000000
|
||||
ANDC,0x7C632078,rD=0x00000000,rA=0x00000000,rB=0x00000000,XER=0x00000000,CR=0x00000000
|
||||
ANDC,0x7C632078,rD=0x00000000,rA=0x00000000,rB=0x00000001,XER=0x00000000,CR=0x00000000
|
||||
ANDC,0x7C632078,rD=0x00000000,rA=0x00000001,rB=0x00000001,XER=0x00000000,CR=0x00000000
|
||||
ANDC,0x7C632078,rD=0xFFFFFFFF,rA=0xFFFFFFFF,rB=0x00000000,XER=0x00000000,CR=0x00000000
|
||||
ANDC,0x7C632078,rD=0xFFFFFFFE,rA=0xFFFFFFFF,rB=0x00000001,XER=0x00000000,CR=0x00000000
|
||||
ANDC.,0x7C632079,rD=0x00000000,rA=0x00000000,rB=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
ANDC.,0x7C632079,rD=0x00000000,rA=0x00000000,rB=0x00000001,XER=0x00000000,CR=0x20000000
|
||||
ANDC.,0x7C632079,rD=0x00000000,rA=0x00000001,rB=0x00000001,XER=0x00000000,CR=0x20000000
|
||||
ANDC.,0x7C632079,rD=0xFFFFFFFF,rA=0xFFFFFFFF,rB=0x00000000,XER=0x00000000,CR=0x80000000
|
||||
ANDC.,0x7C632079,rD=0xFFFFFFFE,rA=0xFFFFFFFF,rB=0x00000001,XER=0x00000000,CR=0x80000000
|
||||
ANDI.,0x70630000,rD=0x00000000,rA=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
ANDI.,0x70630001,rD=0x00000000,rA=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
ANDI.,0x70630001,rD=0x00000001,rA=0x00000001,XER=0x00000000,CR=0x40000000
|
||||
ANDI.,0x70630000,rD=0x00000000,rA=0xFFFFFFFF,XER=0x00000000,CR=0x20000000
|
||||
ANDI.,0x70630001,rD=0x00000001,rA=0xFFFFFFFF,XER=0x00000000,CR=0x40000000
|
||||
ANDIS.,0x74630000,rD=0x00000000,rA=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
ANDIS.,0x74630001,rD=0x00000000,rA=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
ANDIS.,0x74630001,rD=0x00000000,rA=0x00000001,XER=0x00000000,CR=0x20000000
|
||||
ANDIS.,0x74630000,rD=0x00000000,rA=0xFFFFFFFF,XER=0x00000000,CR=0x20000000
|
||||
ANDIS.,0x74630001,rD=0x00010000,rA=0xFFFFFFFF,XER=0x00000000,CR=0x40000000
|
||||
CMP,0x7C032000,rA=0x00000000,rB=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
CMP,0x7C032000,rA=0x00000000,rB=0x00000001,XER=0x00000000,CR=0x80000000
|
||||
CMP,0x7C032000,rA=0x00000001,rB=0x00000000,XER=0x00000000,CR=0x40000000
|
||||
CMP,0x7C032000,rA=0x7FFFFFFF,rB=0x7FFFFFFF,XER=0x00000000,CR=0x20000000
|
||||
CMP,0x7C032000,rA=0xFFFFFFFF,rB=0xFFFFFFFF,XER=0x00000000,CR=0x20000000
|
||||
CMPI,0x2C030000,rA=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
CMPI,0x2C030001,rA=0x00000000,XER=0x00000000,CR=0x80000000
|
||||
CMPI,0x2C030000,rA=0x00000001,XER=0x00000000,CR=0x40000000
|
||||
CMPI,0x2C037FFF,rA=0x00007FFF,XER=0x00000000,CR=0x20000000
|
||||
CMPI,0x2C031FFF,rA=0x00002FFF,XER=0x00000000,CR=0x40000000
|
||||
CMPL,0x7C032040,rA=0x00000000,rB=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
CMPL,0x7C032040,rA=0x00000000,rB=0x00000001,XER=0x00000000,CR=0x80000000
|
||||
CMPL,0x7C032040,rA=0x00000001,rB=0x00000000,XER=0x00000000,CR=0x40000000
|
||||
CMPL,0x7C032040,rA=0x7FFFFFFF,rB=0x7FFFFFFF,XER=0x00000000,CR=0x20000000
|
||||
CMPL,0x7C032040,rA=0xFFFFFFFF,rB=0xFFFFFFFF,XER=0x00000000,CR=0x20000000
|
||||
CMPLI,0x28030000,rA=0x00000000,XER=0x00000000,CR=0x20000000
|
||||
CMPLI,0x28030001,rA=0x00000000,XER=0x00000000,CR=0x80000000
|
||||
CMPLI,0x28030000,rA=0x00000001,XER=0x00000000,CR=0x40000000
|
||||
CMPLI,0x28037FFF,rA=0x00007FFF,XER=0x00000000,CR=0x20000000
|
||||
CMPLI,0x28031FFF,rA=0x00002FFF,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW,0x7C630034,rD=0x0000001F,rA=0x00000001,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000001E,rA=0x00000002,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000001D,rA=0x00000004,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000001C,rA=0x00000008,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000001B,rA=0x00000010,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000001A,rA=0x00000020,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000019,rA=0x00000040,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000018,rA=0x00000080,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000017,rA=0x00000100,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000016,rA=0x00000200,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000015,rA=0x00000400,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000014,rA=0x00000800,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000013,rA=0x00001000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000012,rA=0x00002000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000011,rA=0x00004000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000010,rA=0x00008000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000000F,rA=0x00010000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000000E,rA=0x00020000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000000D,rA=0x00040000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000000C,rA=0x00080000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000000B,rA=0x00100000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x0000000A,rA=0x00200000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000009,rA=0x00400000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000008,rA=0x00800000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000007,rA=0x01000000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000006,rA=0x02000000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000005,rA=0x04000000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000004,rA=0x08000000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000003,rA=0x10000000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000002,rA=0x20000000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000001,rA=0x40000000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW,0x7C630034,rD=0x00000000,rA=0x80000000,XER=0x00000000,CR=0x00000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000001F,rA=0x00000001,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000001E,rA=0x00000002,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000001D,rA=0x00000004,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000001C,rA=0x00000008,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000001B,rA=0x00000010,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000001A,rA=0x00000020,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000019,rA=0x00000040,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000018,rA=0x00000080,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000017,rA=0x00000100,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000016,rA=0x00000200,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000015,rA=0x00000400,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000014,rA=0x00000800,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000013,rA=0x00001000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000012,rA=0x00002000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000011,rA=0x00004000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000010,rA=0x00008000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000000F,rA=0x00010000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000000E,rA=0x00020000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000000D,rA=0x00040000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000000C,rA=0x00080000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000000B,rA=0x00100000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x0000000A,rA=0x00200000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000009,rA=0x00400000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000008,rA=0x00800000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000007,rA=0x01000000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000006,rA=0x02000000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000005,rA=0x04000000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000004,rA=0x08000000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000003,rA=0x10000000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000002,rA=0x20000000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000001,rA=0x40000000,XER=0x00000000,CR=0x40000000
|
||||
CNTLZW.,0x7C630035,rD=0x00000000,rA=0x80000000,XER=0x00000000,CR=0x20000000
|
||||
|
Can't render this file because it has a wrong number of fields in line 85.
|
@ -4,7 +4,6 @@
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
//#include "ppcdisasm.h"
|
||||
#include "../ppcemu.h"
|
||||
|
||||
using namespace std;
|
||||
@ -17,8 +16,6 @@ void read_test_data()
|
||||
{
|
||||
string line, token;
|
||||
int i, lineno;
|
||||
//PPCDisasmContext ctx;
|
||||
//vector<PPCDisasmContext> tstvec;
|
||||
uint32_t opcode, dest, src1, src2, check_xer, check_cr;
|
||||
|
||||
ifstream tfstream("ppcinttests.csv");
|
||||
@ -43,7 +40,7 @@ void read_test_data()
|
||||
tokens.push_back(token);
|
||||
}
|
||||
|
||||
if (tokens.size() < 6) {
|
||||
if (tokens.size() < 5) {
|
||||
cout << "Too few values in line " << lineno << ". Skipping..." << endl;
|
||||
continue;
|
||||
}
|
||||
@ -85,7 +82,7 @@ void read_test_data()
|
||||
|
||||
ntested++;
|
||||
|
||||
if ((ppc_state.ppc_gpr[3] != dest) ||
|
||||
if ((tokens[0].rfind("CMP") && (ppc_state.ppc_gpr[3] != dest)) ||
|
||||
(ppc_state.ppc_spr[SPR::XER] != check_xer) ||
|
||||
(ppc_state.ppc_cr != check_cr)) {
|
||||
cout << "Mismatch: instr=" << tokens[0] << ", src1=0x" << hex << src1
|
||||
@ -94,7 +91,7 @@ void read_test_data()
|
||||
<< check_xer << ", CR=0x" << hex << check_cr << endl;
|
||||
cout << "got: dest=0x" << hex << ppc_state.ppc_gpr[3] << ", XER=0x"
|
||||
<< hex << ppc_state.ppc_spr[SPR::XER] << ", CR=0x" << hex
|
||||
<< ppc_state.ppc_cr << endl;
|
||||
<< ppc_state.ppc_cr << endl << endl;
|
||||
|
||||
nfailed++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user