ProcessorTests
ProcessorTests copied to clipboard
68000: Suggestion for additional DIVS/DIVU test cases
I believe there are currently no test cases for either DIVS or DIVU where the quotient is zero. If I modify my 68k DIVS and DIVU implementations to hardcode the Z flag to false, it still passes all of the DIVS and DIVU test cases.
I noticed this because I had a silly bug in my implementation where I was setting the Z flag based on the final 32-bit value written back to the register, when as I understand it the correct behavior is to set the Z flag purely based on the 16-bit quotient.
As an example, here is a mostly hand-crafted test case for DIVU that failed in my implementation before the bugfix (minus the bus transactions which I don't currently have a way to generate easily):
{
"name": "80c1 [DIVU D1, D0] xxxx",
"initial": {
"d0": 1,
"d1": 5,
"d2": 0,
"d3": 0,
"d4": 0,
"d5": 0,
"d6": 0,
"d7": 0,
"a0": 0,
"a1": 0,
"a2": 0,
"a3": 0,
"a4": 0,
"a5": 0,
"a6": 0,
"usp": 2763053352,
"ssp": 2048,
"sr": 9985,
"pc": 3072,
"prefetch": [
32961,
40692
],
"ram": [
[
3077,
228
],
[
3076,
74
]
]
},
"final": {
"d0": 65536,
"d1": 5,
"d2": 0,
"d3": 0,
"d4": 0,
"d5": 0,
"d6": 0,
"d7": 0,
"a0": 0,
"a1": 0,
"a2": 0,
"a3": 0,
"a4": 0,
"a5": 0,
"a6": 0,
"usp": 2763053352,
"ssp": 2048,
"sr": 9988,
"pc": 3074,
"prefetch": [
40692,
19098
],
"ram": [
[
3077,
228
],
[
3076,
74
]
]
},
"length": 136,
"transactions": []
}