From: Toni Wilen Date: Fri, 9 Aug 2019 18:31:23 +0000 (+0300) Subject: CPU tester updates. (PACK/UNPK, RTD, BSR, history buffer was too small, ignore FPU... X-Git-Tag: 4300~159 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=b8e9df7be424906694b7335d5625105f1142eab5;p=francis%2Fwinuae.git CPU tester updates. (PACK/UNPK, RTD, BSR, history buffer was too small, ignore FPU instructions if no FPU enabled) --- diff --git a/cputest.cpp b/cputest.cpp index 397c6f12..003a6583 100644 --- a/cputest.cpp +++ b/cputest.cpp @@ -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; } diff --git a/cputest/main.c b/cputest/main.c index 61a1cd1d..359f7789 100644 --- a/cputest/main.c +++ b/cputest/main.c @@ -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; diff --git a/gencpu.cpp b/gencpu.cpp index 5e5622cf..73da02b3 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -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");