A first host-to-DSP write attempt wrote the four data registers and observed
nothing. The supervisor's own mailbox interrupt at 0fda9 explains why, and the
DSP's dispatcher at 839b explains it better still.
The wire format was never the problem. What was missing is the commit: bit 0
of port 1c is the board's standing request, and the interrupt answers it by
writing the status back with that bit still set, clearing it first only on the
path that had nothing to send. An idle unit reads 1c as fd forever because the
supervisor in command mode never has traffic.
With the commit supplied, a tag is repeatable and predictable. Tag 07's
handler is three instructions and reports 8031; tag 62 reports 8069; the tags
that reach the bare ret at 8222 are a null control. Every prediction was fixed
from the disassembly before the runs and held in both directions, and tag 62
even returned its own saturation constant.
That also refutes the shape the emulator models. A mailbox tag is a command
index into a 121-entry jump table bounded at 7f, not a destination address, so
writing an arbitrary DSP data cell through it was never possible. Only 27
handlers store the host's word at all, each at one fixed address, and none of
them is an index either program reader uses. host_write() is kept as a way to
seed modelled state, with a comment saying it is not the board's protocol.
The 60/62 window's producer is now identified as the DSP: 84b7 is out *, 0060
followed by a status bit 2 that the supervisor's interrupt answers by calling
its chain vector. Acknowledging that bit is what pumps it, and pumping tag 46's
streamer returned sixteen words whose first four are DSP program memory,
matching the flash image at addresses predicted beforehand and reproducing
across two runs. So a readback channel exists and works end to end.
What is missing is a reader whose address the host can choose. Both known ones
are shut: 032a's readers compute an unmasked program address but both writers
clamp it below the six-entry jump table it indexes, and 03db's only writer
stores ae12's return, which is a six-way priority encoder and so cannot exceed
five whatever feeds it - tested on hardware by unmasking its one host-writable
AND term, ffb1, which left the index at zero.
The hardware also corrected a reading: tblr *+ post-increments the auxiliary
register, not the accumulator, so tag 46's paired table reads fetch one address
twice rather than consecutive words.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
PDWSR gives each 16K block of program and data space a two-bit field, IOWSR
gives each pair of I/O ports one - or each 8K block when CWSR's BIG bit is set
- and CWSR decides whether a field means 0/1/2/3 wait states or 0/1/3/7
(SPRU056D sections 9.4.1 to 9.4.3, tables 9-5 and 9-10). Both families write
CWSR 0x0010: BIG set, every space on the plain scale. So:
2.1/2.2 PDWSR 0x000a program 0x0000..0x7fff 2 wait states
IOWSR 0x0001 io 0x0000..0x1fff 1
2.3.x PDWSR 0x2000 data 0x8000..0xbfff 2 wait states
IOWSR 0x0101 io 0x0000..0x1fff 1, io 0x8000..0x9fff 1
and the 2.3.x I/O block that gets a wait state is the one holding port 0x8057,
which its very first instruction writes.
Wait states only apply off-chip, so a non-zero field is the firmware stating it
expects external memory there. The 2.1/2.2 boards put program 0x0000..0x7fff
off-chip, exactly the span of the 30,172-word segment the supervisor downloads,
so the download lives in external program RAM at 0x0000. Table 8-3 makes that
decisive for MP/MC: microcomputer mode would put 4K of on-chip ROM under
0x0000..0x0fff where wait states do nothing, so MP/MC is high. The pin now
defaults high for that reason rather than by convention, and the flat program
space this harness always had turns out to be right for a stated reason.
The map itself was wrong for this part and is corrected against tables 8-3 and
8-10. The C52 has no SARAM at all, which makes PMST.RAM and PMST.OVLY
don't-cares here, so those regions are gone; B0 moving into program 0xfe00
under CNF is modelled; and data is off-chip only from 0x0800 up with reserved
gaps at 0x0080..0x00ff and 0x0500..0x07ff. PDWSR, IOWSR and CWSR are stored and
read back rather than ignored, and reported decoded.
That last region change pays for itself immediately. About 700,000 data
accesses a run land in the reserved windows, and they are the frame-block cells
[0x00ca] to [0x00cd] - the line-DAC source and the gate. On silicon those
addresses hold no storage, which confirms from the part's own memory map what
the vector-table search concluded from the other end.
263 tests pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The core parsed MP/MC, OVLY and RAM out of PMST and acted on none of them, so
program and data space were flat 64K arrays and where the download lands was
implied rather than stated. Both spaces now decode: program is on-chip ROM
below 0x1000 when MP/MC is low, SARAM at 0x1000 under PMST.RAM, external
otherwise; data is memory-mapped registers below 0x0060, DARAM at B2 0x0060,
B0 0x0100 unless CNF moves it, and B1 0x0300, SARAM at 0x0800 under PMST.OVLY,
external otherwise.
MP/MC is a pin, not something an image records, so it is supplied to the core
through courier_c5x_set_mpmc_pin and defaults to low - the level this core has
always presented when the firmware reads PMST back, and the firmware does read
it. Over a 1.5M-instruction run either level ends at the same PC, so the bit
costs almost nothing in behaviour.
No XMF carries an on-chip ROM, so with none supplied the ROM window still
answers from the downloaded image exactly as before and the fetches are counted
instead. Over a 12M-instruction ATA that is 693,322 of 14,536,050 program
fetches - 4.8% of the run comes out of a window that would be on-chip ROM in
microcomputer mode. courier_c5x_load_rom takes a dump if one ever appears.
Until then dsp_bridge.dsp_memory_map reports the mode bits, the per-region
counts and the hole count on every run, so the assumption is in the output.
One thing the accounting surfaces: OVLY and RAM read zero for most of a run.
The reset code sets them with OPL #0x00b0, @07 and they are cleared again by
the same stores that zero IMR, IFR and PMST from 0xb626, 0xb65f, 0xb667,
0xb677 and 0xb67c. Firmware does not switch the part out of microcomputer mode
and turn off its on-chip RAM mid-run on purpose, so those sites are more
evidence that the addresses the low bank computes land in the wrong place.
263 tests pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Decoding a C5x image statically floods, because any word decodes; taking the
instruction boundaries from a run does not. On that basis the whole of what the
C52 executes in steady state is 167 instructions, one pass is 169, and the loop
head is at 0x0cb1 - inside the bank the supervisor downloads. So the datapump
is resident and running rather than waiting to be entered, and it is using
about 6% of the cycles a 25 MHz part has per 9.6 kHz sample.
It idles behind one bit. Every pass ends with BIT *, 4 on [0x00cc] and a
CC 0xb4d4 taken on the result, and [0x00cc] reads zero on every sample of every
run, so 0xb4d4 is never entered. Setting that bit by hand is the first thing
that has moved it: line-DAC writes go 14,102 to 15,515, non-zero samples 1 to
10, and the parked PC leaves the resident bank at 0x8195 for 0x0bda3 in the
downloaded one. [0x00cc] is the datapump's own status word rather than an input
latch - tracing writes into the frame block shows it zeroed every sample from
four of its own sites, one cell above the DAC source at [0x00cb].
The receiver is gated off rather than listening. Feeding the ASIC line input
2100, 1800 or 980 Hz at the confirmed 9.6 kHz cadence, or noise, instead of
silence leaves every counter identical, including [0x00cc] and the parked PC.
Two core defects turned up on that path. TREG0 is memory-mapped at 0x0c on a
C5x and this core did not map it, so LT wrote m_treg0 while a data-space read
of 0x0c saw a cell nothing updated - its neighbours TREG1, TREG2 and DBMR were
all mapped already. That is fixed here; it is not on the idle loop, so no
measurement above moves. The BIO pin is still unimplemented, and the condition
helper answers "BIO low" false unconditionally, which makes all 711 candidate
sites in the image dead - but none is reached, idle or with the gate forced, so
it costs nothing today.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>