Special/fuzzy-logic instructions trap instead of executing #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The following CPU12 instructions are decoded but, on execution, hit the
Trap()fallback (M68HC12.cs:585-590): a warning is logged and the CPUvectors to the unimplemented-opcode trap vector
$FFF8instead of executingthe instruction:
MAXA/MINA— 8-bit unsigned max/min into accumulator AEMAXD/EMIND— 16-bit unsigned max/min into accumulator DMAXM/MINM— 8-bit unsigned max/min into memoryEMAXM/EMINM— 16-bit unsigned max/min into memoryTBL/ETBL— table lookup and interpolateEMACS— extended multiply and accumulate (signed 16x16 to 32-bit)WAV— weighted average (fuzzy logic)REV/REVW— fuzzy-logic rule evaluationMEM— membership function (fuzzy logic)Current behavior
Trap()(M68HC12.cs:601) logsUnimplemented opcode trap at 0x...andservices the
$FFF8vector, pushing a 9-byte interrupt frame. Execution ofprograms that use any of these instructions is therefore broken, not just
unaccelerated.
Impact
Firmware using the CPU12's fuzzy-logic instruction set (a headline feature of
the architecture) or the max/min / table-lookup helpers crashes into the trap
handler. This is the single largest functional gap in the port.
Affected files
src/Infrastructure/src/Emulator/Peripherals/Peripherals/CPU/M68HC12/M68HC12.cs(ExecuteOneInstructionswitch,M68HC12.cs:585-590)src/Infrastructure/src/Emulator/Main/Tests/UnitTests/Desired behavior
Each instruction executes with the register/memory and CCR effects given in
the CPU12RG summary (
docs/m68hc12/02-instruction-set.md,docs/m68hc12/reference/CPU12RG-instruction-set-summary.txt, and thehcs12_instruction_set.mdtable at the repo root).REV/REVW/MEM/WAVare the fuzzy-logic primitives and carry "?" (undefined) CCR semantics that
must be matched per the manual.
Acceptance criteria
representative set of inputs.
registered in
UnitTests.csproj(non-globbing).Suggested approach
docs/m68hc12/reference/gdb-sim-m68hc11-interp.cimplement every one of these and are the best behavioral cross-check — but
they are GPL; consult as reference only, do not copy (Renode is BSD).
MAXA/MINA/EMAXD/EMINDare straightforward compares;MAXM/MINM/EMAXM/EMINMread-modify-write memory.
TBL/ETBLinterpolate between two table entriesusing the fraction register.
EMACSreads/writes a 32-bit accumulator inmemory.
MEM/REV/REVW/WAVoperate over the fuzzy-logic rule table in memorywith
X/Y/Dpointers.existing
ComputeEffectiveAddress/ReadOperandByte/ReadOperandWordhelpers.