]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
CPU tester updates. (PACK/UNPK, RTD, BSR, history buffer was too small, ignore FPU...
authorToni Wilen <twilen@winuae.net>
Fri, 9 Aug 2019 18:31:23 +0000 (21:31 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 9 Aug 2019 18:31:23 +0000 (21:31 +0300)
cputest.cpp
cputest/main.c
gencpu.cpp

index 397c6f12d68c2d91bcec7142015160db616742af..003a6583970879973a2022744adf2c4fccdff256 100644 (file)
@@ -121,7 +121,7 @@ struct accesshistory
 static int ahcnt, ahcnt2;
 static int noaccesshistory = 0;
 
-#define MAX_ACCESSHIST 32
+#define MAX_ACCESSHIST 48
 static struct accesshistory ahist[MAX_ACCESSHIST];
 static struct accesshistory ahist2[MAX_ACCESSHIST];
 
@@ -1409,6 +1409,19 @@ static int handle_specials_branch(uae_u16 opcode, uaecptr pc, struct instr *dp,
        return 0;
 }
 
+static int handle_specials_pack(uae_u16 opcode, uaecptr pc, struct instr *dp, int *isconstant)
+{
+       // PACK and UNPK has third parameter
+       if (dp->mnemo == i_PACK || dp->mnemo == i_UNPK) {
+               uae_u16 v = rand16();
+               put_word_test(pc, v);
+               *isconstant = 16;
+               return 2;
+       }
+       return 0;
+}
+
+
 static int handle_specials_stack(uae_u16 opcode, uaecptr pc, struct instr *dp, int *isconstant)
 {
        int offset = 0;
@@ -1431,9 +1444,7 @@ static int handle_specials_stack(uae_u16 opcode, uaecptr pc, struct instr *dp, i
                        v = imm_special >> 2;
                        uae_u16 sr = v & 31;
                        sr |= (v >> 5) << 12;
-                       put_word_test(addr, sr);
-                       addr += 2;
-                       offset += 2;
+                       put_word_test(addr + 4, sr);
                        *isconstant = imm_special >= (1 << (4 + 5)) * 4 ? 0 : -1;
                } else if (opcode == 0x4e73) {
                        // RTE
@@ -1479,9 +1490,9 @@ static void execute_ins(uae_u16 opc, uaecptr endpc, uaecptr targetpc)
 {
        uae_u16 opw1 = (opcode_memory[2] << 8) | (opcode_memory[3] << 0);
        uae_u16 opw2 = (opcode_memory[4] << 8) | (opcode_memory[5] << 0);
-       if (opc == 0x6100
-               && opw1 == 0x001e
-//             && opw2 == 0x2770
+       if (opc == 0x61ff  
+               && opw1 == 0x0000
+               && opw2 == 0x9908
                )
                printf("");
 
@@ -1615,7 +1626,6 @@ static int last_exception_len;
 static uae_u8 *save_exception(uae_u8 *p)
 {
        uae_u8 *op = p;
-       int framelen;
        p++;
        uae_u8 *sf = test_memory + test_memory_size + EXTRA_RESERVED_SPACE - exception_stack_frame_size;
        // parse exception and store fields that are unique
@@ -1633,6 +1643,8 @@ static uae_u8 *save_exception(uae_u8 *p)
                *p++ = sf[7];
                switch (frame >> 12)
                {
+               case 0:
+                       break;
                case 2:
                        // instruction address
                        p = store_rel(p, 0, opcode_memory_start, gl(sf + 8), 1);
@@ -1744,6 +1756,8 @@ static void test_mnemo(const TCHAR *path, const TCHAR *mnemo, int opcodesize, in
                opcodecnt++;
                if (isunsupported(dp))
                        return;
+               if ((opcode & 0xf000) == 0xf000 && !currprefs.fpu_model)
+                       return;
                fpumode = currprefs.fpu_model && (opcode & 0xf000) == 0xf000;
        }
 
@@ -1920,6 +1934,8 @@ static void test_mnemo(const TCHAR *path, const TCHAR *mnemo, int opcodesize, in
 
                                        // bcc.x
                                        pc += handle_specials_branch(opc, pc, dp, &isconstant_src);
+                                       // pack
+                                       pc += handle_specials_pack(opc, pc, dp, &isconstant_src);
 
                                        put_word_test(opcode_memory_start, opc);
 
@@ -2595,6 +2611,10 @@ int __cdecl main(int argc, char *argv[])
                        continue;
                }
 
+               if (!currprefs.fpu_model && (opcode & 0xf000) == 0xf000) {
+                       continue;
+               }
+
                if (table->handler != -1) {
                        int idx = table->handler;
                        f = cpufunctbl[idx];
@@ -2624,9 +2644,7 @@ int __cdecl main(int argc, char *argv[])
        x_cp_put_word = put_word_test;
        x_cp_put_byte = put_byte_test;
 
-       if (currprefs.fpu_model) {
-               fpu_reset();
-       }
+       fpu_reset();
 
        starttime = time(0);
 
@@ -2647,15 +2665,17 @@ int __cdecl main(int argc, char *argv[])
 
                        verbose = 0;
                        for (int j = 1; lookuptab[j].name; j++) {
-                               for (int i = 0; i < 8; i++) {
-                                       test_mnemo(path, lookuptab[j].name, i, fpuopcode);
-                               }
+                               test_mnemo(path, lookuptab[j].name, 0, -1);
+                               test_mnemo(path, lookuptab[j].name, 4, -1);
+                               test_mnemo(path, lookuptab[j].name, 6, -1);
+                               test_mnemo(path, lookuptab[j].name, -1, -1);
                        }
                        // illg last. All currently selected CPU model's unsupported opcodes
                        // (illegal instruction, a-line and f-line)
-                       for (int i = 0; i < 8; i++) {
-                               test_mnemo(path, lookuptab[0].name, i, fpuopcode);
-                       }
+                       test_mnemo(path, lookuptab[0].name, 0, -1);
+                       test_mnemo(path, lookuptab[0].name, 4, -1);
+                       test_mnemo(path, lookuptab[0].name, 6, -1);
+                       test_mnemo(path, lookuptab[0].name, -1, -1);
                        break;
                }
 
index 61a1cd1d5a38c03976775e89a9855d8b46ef4fe1..359f7789defdf59dbca568e7caa70af9f5cd5915 100644 (file)
@@ -179,7 +179,7 @@ struct accesshistory
 };
 static int ahcnt;
 
-#define MAX_ACCESSHIST 8
+#define MAX_ACCESSHIST 48
 static struct accesshistory ahist[MAX_ACCESSHIST];
 
 static void endinfo(void)
@@ -690,6 +690,24 @@ static void addinfo(void)
        outbp += strlen(outbp);
 }
 
+struct srbit
+{
+       char *name;
+       int bit;
+};
+static struct srbit srbits[] = {
+       { "T1", 15 },
+       { "T0", 14 },
+       { "M", 13 },
+       { "S", 12 },
+       { "X", 4 },
+       { "N", 3 },
+       { "Z", 2 },
+       { "V", 1 },
+       { "C", 0 },
+       { NULL, 0 }
+};
+
 static void out_regs(struct registers *r, int before)
 {
        for (int i = 0; i < 16; i++) {
@@ -709,15 +727,14 @@ static void out_regs(struct registers *r, int before)
        uae_u16 s = before ? test_sr : r->sr;
        uae_u16 s1 = test_regs.sr;
        uae_u16 s2 = test_sr;
-       sprintf(outbp, "T%c%d S%c%d X%c%d N%c%d Z%c%d V%c%d C%c%d",
-               (s1 & 0x8000) != (s2 & 0x8000) ? '*' : '=', (s & 0x8000) != 0,
-               (s1 & 0x2000) != (s2 & 0x2000) ? '*' : '=', (s & 0x2000) != 0,
-               (s1 & 0x10) != (s2 & 0x10) ? '*' : '=', (s & 0x10) != 0,
-               (s1 & 0x08) != (s2 & 0x08) ? '*' : '=', (s & 0x08) != 0,
-               (s1 & 0x04) != (s2 & 0x04) ? '*' : '=', (s & 0x04) != 0,
-               (s1 & 0x02) != (s2 & 0x02) ? '*' : '=', (s & 0x02) != 0,
-               (s1 & 0x01) != (s2 & 0x01) ? '*' : '=', (s & 0x01) != 0);
-       outbp += strlen(outbp);
+       uae_u16 s3 = before ? s1 : last_registers.sr;
+       for (int i = 0; srbits[i].name; i++) {
+               if (i > 0)
+                       *outbp++ = ' ';
+               uae_u16 mask = 1 << srbits[i].bit;
+               sprintf(outbp, "%s%c%d", srbits[i].name, (s3 & mask) != (s1 & mask) ? '!' : ((s1 & mask) != (s2 & mask) ? '*' : '='), (s & mask) != 0);
+               outbp += strlen(outbp);
+       }
 
        if (!fpu_model) {
                strcat(outbp, "\n");
@@ -855,8 +872,12 @@ static uae_u8 *validate_exception(struct registers *regs, uae_u8 *p, int excnum)
        if (memcmp(exc, sp, exclen)) {
                strcpy(outbp, "Exception stack frame mismatch:\n");
                outbp += strlen(outbp);
-               hexdump(sp, exclen);
+               strcpy(outbp, "Expected: ");
+               outbp += strlen(outbp);
                hexdump(exc, exclen);
+               strcpy(outbp, "Got     : ");
+               outbp += strlen(outbp);
+               hexdump(sp, exclen);
                errors = 1;
        }
        return p;
index 5e5622cfa755ddc4f7fbf27fdb1cc2c166642614..73da02b3946ff5bb5d2086848b5f55511194d9de 100644 (file)
@@ -4376,7 +4376,7 @@ static void gen_opcode (unsigned int opcode)
                        printf ("\tm68k_do_bsr_ce030 (nextpc, s);\n");
                } else if (using_ce) {
                        printf ("\tm68k_do_bsr_ce (nextpc, s);\n");
-               } else if (using_prefetch || using_prefetch_020) {
+               } else if (using_prefetch || using_prefetch_020 || using_test) {
                        printf ("\tm68k_do_bsri (nextpc, s);\n");
                } else {
                        printf ("\tm68k_do_bsr (nextpc, s);\n");