mirror of
https://github.com/D-Modem/courier-emu.git
synced 2026-11-28 12:38:04 -08:00
Clock the C52 at 40.32 MHz, and record ACC in the DSP PC trace
At 20.16 MHz the V.34 answerer's per-sample echo-canceller update (~2080 instructions) overruns the 1964-cycle sample budget, and B's TRN task ran 780 of 1026 passes a frame. At the full oscillator both ends train through phase 3 and 4, and the dialled pair now reaches CONNECT .../LAPM/V42BIS once the answerer runs V.42 detection. The clock is inferred, not measured: TCLKX (DSP pin 96) or CLKMD1/CLKMD2 settles it. The AC01 power-up frame period doubles with it. The PC trace now carries ACC before each instruction (pc << 48 | opcode << 32 | ACC), which is what read J out of a4b2/a4ca. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c25f91ab45
commit
2b89a28dac
5 files changed
+18
-11
No files matched your search
+3
-3
@@ -735,9 +735,9 @@ class NativeC5x:
|
||||
count = int(self.library.courier_c5x_get_pc_trace_count(self.handle))
|
||||
result = []
|
||||
for index in range(count):
|
||||
values = (ctypes.c_uint64 * 2)()
|
||||
self.library.courier_c5x_get_pc_trace(self.handle, index, values, 2)
|
||||
result.append({"pc": int(values[0]), "op": int(values[1])})
|
||||
values = (ctypes.c_uint64 * 3)()
|
||||
self.library.courier_c5x_get_pc_trace(self.handle, index, values, 3)
|
||||
result.append({"pc": int(values[0]), "op": int(values[1]), "acc": int(values[2])})
|
||||
return result
|
||||
|
||||
def mailbox_events(self) -> list[dict[str, int]]:
|
||||
|
||||
@@ -111,7 +111,7 @@ class Timebase:
|
||||
|
||||
# The 40.320 MHz can feeds the ASIC on both 186 boards, and the ASIC clocks the
|
||||
# C52 from it. Stated once because it is the one figure the two boards share.
|
||||
ASIC_DSP_CLOCK_HZ = 20_160_000
|
||||
ASIC_DSP_CLOCK_HZ = 40_320_000 # inferred, not measured: see C5X_CLOCK_HZ
|
||||
|
||||
COURIER_20MHZ = Timebase(
|
||||
name="courier-20.16",
|
||||
|
||||
+3
-2
@@ -465,8 +465,9 @@ void courier_c5x_get_pc_trace(void *handle, std::size_t index, uint64_t *values,
|
||||
if (!handle || !values || count < 2) return;
|
||||
const auto &trace = static_cast<C5xCore *>(handle)->pc_trace();
|
||||
if (index >= trace.size()) return;
|
||||
values[0] = trace[index] >> 16;
|
||||
values[1] = trace[index] & 0xffff;
|
||||
values[0] = trace[index] >> 48;
|
||||
values[1] = (trace[index] >> 32) & 0xffff;
|
||||
if (count >= 3) values[2] = trace[index] & 0xffffffff;
|
||||
}
|
||||
|
||||
void courier_c5x_get_serial_state(void *handle, uint64_t *values, std::size_t count)
|
||||
|
||||
+7
-2
@@ -255,7 +255,11 @@ void C5xCore::set_io_callbacks(IoRead read, IoWrite write)
|
||||
// cancels out of MCLK / (2 x A x B), but the DSP got that much more compute
|
||||
// per sample than it has.
|
||||
static constexpr uint64_t BOARD_OSCILLATOR_HZ = 40'320'000;
|
||||
static constexpr uint64_t C5X_CLOCK_HZ = BOARD_OSCILLATOR_HZ / 2;
|
||||
// The oscillator itself, not half of it. Unmeasured: at 20.16 MHz the V.34
|
||||
// answerer's 70-tap echo-canceller update alone (~2080 instructions a sample)
|
||||
// overruns the 1964-cycle sample budget, so no cost model lets that clock run
|
||||
// it. TCLKX (DSP pin 96, 5.04 vs 10.08 MHz) or CLKMD1/CLKMD2 would settle it.
|
||||
static constexpr uint64_t C5X_CLOCK_HZ = BOARD_OSCILLATOR_HZ;
|
||||
static constexpr uint16_t ASIC_CODEC_TIMING_BASE = 0x0078;
|
||||
|
||||
void C5xCore::set_hybrid_return(uint32_t return_scale, uint32_t delay)
|
||||
@@ -1374,7 +1378,8 @@ void C5xCore::step()
|
||||
(previous_pc >= 0x0200 && previous_pc < 0x0300) ||
|
||||
(previous_pc >= m_trace_first && previous_pc <= m_trace_last)) {
|
||||
if (m_pc_trace.size() >= 512) m_pc_trace.pop_front();
|
||||
m_pc_trace.push_back((uint32_t(previous_pc) << 16) | m_op);
|
||||
m_pc_trace.push_back((uint64_t(previous_pc) << 48) | (uint64_t(m_op) << 32) |
|
||||
uint32_t(m_acc));
|
||||
}
|
||||
(this->*s_opcode_table[m_op >> 8])();
|
||||
if (negotiation_loop && m_pc != previous_pc) m_negotiation_loop_active = false;
|
||||
|
||||
+4
-3
@@ -80,7 +80,7 @@ constexpr uint16_t C5X_SHARED_FIRST = 0x8000, C5X_SHARED_LAST = 0xFEFF;
|
||||
// board's AC01 runs at until the firmware programs its A and B dividers.
|
||||
// Both are frame periods in C5x cycles.
|
||||
inline constexpr unsigned TDM_FRAME_PERIOD_CYCLES = 258;
|
||||
inline constexpr unsigned AC01_POWERUP_FRAME_PERIOD_CYCLES = 2800;
|
||||
inline constexpr unsigned AC01_POWERUP_FRAME_PERIOD_CYCLES = 5600; // 7200 Hz at 40.32 MHz
|
||||
|
||||
class C5xCore {
|
||||
public:
|
||||
@@ -340,7 +340,8 @@ public:
|
||||
const std::vector<DataEvent> &data_events() const { return m_data_events; }
|
||||
uint64_t data_write_count(uint16_t address) const { return m_data_write_counts[address]; }
|
||||
const PortStat &io_port_stat(uint16_t port) const { return m_io_port_stats[port]; }
|
||||
const std::deque<uint32_t> &pc_trace() const { return m_pc_trace; }
|
||||
// Each entry: pc << 48 | opcode << 32 | ACC before the instruction.
|
||||
const std::deque<uint64_t> &pc_trace() const { return m_pc_trace; }
|
||||
// The trace windows. Two are compiled in for the call overlay and the
|
||||
// low-page stub; a third is settable so a caller can watch a handler
|
||||
// elsewhere - 3.1.2's mailbox tag 0x13 enters ee20, which neither
|
||||
@@ -401,7 +402,7 @@ private:
|
||||
std::vector<DataEvent> m_data_events;
|
||||
std::array<uint64_t, 65536> m_data_write_counts{};
|
||||
std::array<PortStat, 65536> m_io_port_stats{};
|
||||
std::deque<uint32_t> m_pc_trace;
|
||||
std::deque<uint64_t> m_pc_trace;
|
||||
uint16_t m_trace_first = 0xFFFF, m_trace_last = 0;
|
||||
bool m_trace_data_writes = false;
|
||||
uint16_t m_trace_filter = 0;
|
||||
|
||||
Reference in new issue
Block a user