1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00
CLK/OSBindings/Mac/Clock SignalTests/68000 Comparative Tests
Thomas Harte a28c52c250 Fixes A7-relative JSRs.
I completely withdraw my earlier statement re: the test cases.
2020-01-04 22:22:33 -05:00
..
abcd_sbcd.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
add_sub.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
addi_subi_cmpi.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
addq_subq.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
addx_subx.json Introduces further comparative tests, prompting a new CHK fix. 2020-01-01 19:11:36 -05:00
bcc.json Introduces further comparative tests, prompting a new CHK fix. 2020-01-01 19:11:36 -05:00
btst_bchg_bclr_bset.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
chk.json Introduces further comparative tests, prompting a new CHK fix. 2020-01-01 19:11:36 -05:00
cmp.json Introduces further comparative tests, prompting a new CHK fix. 2020-01-01 19:11:36 -05:00
dbcc_scc.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
divu_divs.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
eor_and_or.json After rerunning all tests, adds some notes on questionable results. 2020-01-04 16:31:45 -05:00
eori_andi_ori.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
exg.json Introduces further comparative tests, prompting a new CHK fix. 2020-01-01 19:11:36 -05:00
ext.json
jmp_jsr.json Introduces further comparative tests, prompting a new CHK fix. 2020-01-01 19:11:36 -05:00
lea.json Introduces further comparative tests, prompting a new CHK fix. 2020-01-01 19:11:36 -05:00
link_unlk.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
lslr_aslr_roxlr_rolr.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
move_tofrom_srccr.json Further expands test coverage. 2020-01-01 20:00:37 -05:00
move.json
movem.json
movep.json
moveq.json Further expands test coverage. 2020-01-01 20:00:37 -05:00
mulu_muls.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
nbcd_pea.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
neg_not.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
negx_clr.json Renames all files that test multiple opcodes; introduces DIV and MUL tests. 2020-01-03 22:43:24 -05:00
readme.md Fixes A7-relative JSRs. 2020-01-04 22:22:33 -05:00
rtr.json
rts.json Further expands test coverage. 2020-01-01 20:00:37 -05:00
swap.json
tas.json Further expands test coverage. 2020-01-01 20:00:37 -05:00
tst.json

68000 Comparative Tests

Tests contained in this folder are original to Clock Signal. All are in JSON format so there's no need to write and maintain a specialised parser.

Tests assume a test machine consisting of a vanilla 68000 with 16mb of RAM. For each test the 68000 should be started from power on and allowed to execute a single instruction.

Each file contains an array of dictionaries. Each dictionary is a single test. It includes a name, initial memory contents and register state, and any changes to memory that occur during the test plus the final register state.

Both the initial and final memory arrays are in the form:

[address, value, address, value ..., -1]

All tests are randomly generated, and the end results were achieved empirically using a believed-good 68000 emulation. Nothing here is intelligent or crafted, this merely an attempt to get a lot of coverage with limited effort.

Methodology

Neither the file names nor the test names are necessarily accurate; the process taken for generating tests was:

  • look up instruction encoding for instruction in the 68000 Programmer's Reference Manual, starting from page 8-5 (p561 of the PDF I'm using);
  • those encodings will look something like: ORI -> 0000 0000 SS MMM RRR where SS = size, MMM = mode, RRR = register;
  • therefore, generate the 256 possible 16-bit words that match that pattern and for each one that passes a does-this-instruction-exist test, produce a test case.

However, the 68000 isn't fully orthogonal in its instruction encodings — in the ORI example above, some modes and some sizes are illegal, and those opcodes are used for other instructions. But my test generator isn't smart enough to spot that — it just spots that what it's generating is a real instruction, and therefore produces a test.

As a result, the tests labelled ORI will include all valid ORIs, plus some other instructions. I didn't consider this worth fixing, as it acts to increase my testing base.

I follow every generated opcode with three words of mostly-random data; this data — and almost all other random numbers — never have the lowest bit set, and supply 00 where the size field would be if they got used for an An + Xn + d addressing mode.

Similarly, all initial register contents are random except that the lowest bit is never set, just in case any of them is used to calculate an address for a word or longword.

So the output is very scattergun approach, with a lot of redundancy.

Questionable Results

I am presently unconvinced by the results for the N flag on many of the [A/S/N]BCD results, as these often seem to conflict with Bart Trzynadlowski's 68knotes.txt.

This emulator seems not yet to generate values for the undocumented flags of DIVU and DIVS that match those listed here, but that's through lack of documentation. The objective here is to test my implementation of behaviour I am able to find descriptions of against other people's implementations of that same behaviour, to flush out errors in my comprehension and implementation.