|BCD Encoding Question
|Page 1 of 1|
|Author:||aboxer [ Tue Apr 03, 2012 8:41 pm ]|
|Post subject:||BCD Encoding Question|
Neither the M68000PRM, the M68000_Users_Manual nor Google shed
any light on what a BCD instruction like ABCD should do when it encounters
an illegal encoding (>9 hex). I don't see it listed as an exception anywhere.
I can see that the Easy68k simulator treats A-F like 10-15. Does anybody
know if that is the official specified behavior? Or maybe it is just the
unspecified behavior of some implementation.
|Author:||clive [ Tue Apr 03, 2012 9:37 pm ]|
I don't think it's explicitly called out, but the real 68K doesn't fault, and the behaviour is controlled by the BCD unit, which as I recall deals with the nibbles and if the value >= $A then it adds in $6 to roll it into the next nibble or carry.
You could examine some of the more precise emulators (game) like Cyclone, or try it on some real 68K silicon, as a byte operating instruction the test space is relatively small, which also might shed some like on the "undefined" flag behaviour.
Emulators like StarSim just use the ADC;DAA pairing of the x86 so would inherit that's behaviour. Which is basically a two step process looking at the low order nibble, and then the high.
|Author:||aboxer [ Wed Apr 04, 2012 6:17 pm ]|
Your description of real silicon behavior matches the behavior of Easy68k.
I don't have access to a 68k chip so Easy68k is my "golden reference" for
verifying a verilog 68k design until I find a case where it is wrong.
Thanks for the help.
|Page 1 of 1||All times are UTC|
|Powered by phpBB® Forum Software © phpBB Group