Posts Tagged ‘extract lattice ic dump information’
Read DSP and CPLD Dump Information: Two Clock Domains, One Snapshot
The word dump suggests something simpler than it is. A dump implies a moment captured completely, like a photograph. On a board with two programmable devices, what is captured is two photographs taken at different times, from different angles, with different exposure settings. Each is individually accurate. The pair is not a snapshot.
This matters because a large part of the value in a mixed-device readout comes from the relationship between the two images: the address map the DSP uses, the decoder the CPLD implements, and the handshake between them. Those relationships are exactly what a time-base mismatch can corrupt, and the corruption is invisible in either file.
What the two devices are actually doing
A DSP executes instructions in a pipeline, with memory accesses occurring at specific cycles relative to its clock. A CPLD evaluates combinational logic continuously and updates registers on its own clock edge. Neither is quiescent: by the time a read is completed, the state of both has moved on many times.
| Device | State that changes | Rate |
|---|---|---|
| DSP | Program counter, registers, data memory | Every clock, often tens of MHz |
| DSP external bus | Address, data, strobes | Per access, in bursts |
| CPLD | Registered outputs, internal state | Every clock, often a separate source |
| CPLD combinational paths | Outputs, continuously | Propagation delay, nanoseconds |
The third row is the one that makes a “snapshot” impossible in principle. The CPLD’s clock is frequently derived from a different source than the DSP’s, so the two devices have no fixed phase relationship. Any statement of the form “at this instant the CPLD was asserting this signal” is meaningless without a common reference.
What a dump is actually for
Given that simultaneity is unavailable, the useful question is not what the system was doing at one instant but what each device is configured to do. Configuration is static. It does not drift, and it can be captured in any order.
| Question | Static or dynamic | Capturable by a dump |
|---|---|---|
| What code does the DSP run | Static | Yes |
| What logic does the CPLD implement | Static | Yes |
| What was the DSP doing when the fault occurred | Dynamic | No |
| What address did the DSP read at cycle N | Dynamic | No, unless traced |
| What memory map does the system present | Static, jointly | Yes, by inference |
The fifth row is the payoff and the trap. The memory map is a joint property: the DSP emits an address, the CPLD decodes it into a chip select, and a device responds. It can be reconstructed from the two static images, but only by reasoning about how they fit together, not by assuming the two files were captured in a compatible state.
The order of acquisition, and why it matters
If the devices are read while the system is halted, order does not matter. If they are read while running, it does, and the reason is that one device may reconfigure the other’s environment during the read.
| Situation | Safe order | Why |
|---|---|---|
| System held in reset | Either | Nothing is executing |
| DSP halted, CPLD running | CPLD first, then DSP | The CPLD may be gating DSP access |
| Both running | Neither, without a trace | Reads perturb the system |
| CPLD being reprogrammed by DSP | DSP first, then CPLD | The DSP may rewrite the CPLD |
The fourth row describes a real and underappreciated architecture: a DSP that loads the CPLD’s configuration at boot, usually from a flash image it holds. On such a board the CPLD’s contents are a function of the DSP’s code, and reading the CPLD before the DSP tells you what it was, not what it will be.
Timing information that a dump cannot contain
A great deal of what makes a mixed system work is timing, and timing is precisely what is not in either image.
| Property | In the images | Recoverable by measurement |
|---|---|---|
| Wait states on the DSP bus | Only as constants in code | Yes, with a logic analyser |
| CPLD decode delay | Not present | Yes |
| Setup and hold margins | Not present | Yes, at the pins |
| Clock phase relationship | Not present | Yes |
| Arbitration priority | Partly, as logic | Yes, under contention |
The first row is often the only clue available without instrumentation: a DSP program that inserts a specific number of wait states encodes an assumption about how slow the CPLD’s decode is. Reading that constant tells you what the designer believed, which is not always what the board does.
Reconstructing the joint picture
The workable method is to reconstruct each device’s behaviour separately, then reconcile them against measurements.
| Step | Output | Confirms |
|---|---|---|
| Read DSP program and data | Code and constant tables | What the DSP expects |
| Read CPLD configuration | Equations or fuse map | What the CPLD provides |
| Extract bus constants from DSP code | Address ranges, wait states | The assumed map |
| Decode CPLD address terms | Chip select ranges | The implemented map |
| Compare the two | Discrepancies | Where the assumptions differ |
The fifth step is where real findings appear. A DSP that expects a device at an address the CPLD does not decode is a board with a latent bug, or a board where the CPLD revision does not match the firmware revision. Either is valuable to know before a redesign.
Where the individual reads are covered
The DSP side is treated in reading DSP chip program for the Harvard memory split, and the CPLD side in reading Lattice CPLD embedded firmware. When the two devices are copied rather than merely read, the power-up boundary becomes the dominant problem, which is covered in copying CPLD and MCU software data.
Services at this boundary
Work covers static capture of both devices, bus constant extraction from DSP code, CPLD decode reconstruction, reconciliation of the two into a joint memory map, and instrumented measurement where the timing questions matter. It does not cover producing a simultaneous trace from a dump, because that requires a logic analyser and a trigger, not a read.
The expectation worth setting is that a dump answers “what is configured”, and only measurement answers “what happened”. Confusing the two produces conclusions that are confidently wrong.