PostHeaderIcon Extract Lattice CPLD Source Code: Extraction Ends Where Interpretation Begins

Two words describe most of the work on programmable logic, and they are used interchangeably by people who buy the work and distinguished carefully by people who do it. Extraction is transport. Reverse engineering is interpretation. One moves an artefact from a device into a file. The other turns that file into an explanation.

The reason the distinction matters commercially is that extraction has a binary outcome and interpretation does not. An extracted fuse map is either correct or it is not, and correctness is testable against the device’s own checksum. An interpretation is better or worse, complete or partial, and its quality is a matter of judgement. Mixing the two into a single quotation guarantees an argument at delivery, because the two halves have different definitions of done.

What extraction delivers

Extraction produces the configured state of the device, in a container, with enough metadata to prove it is complete. That is the whole deliverable.

Component Why it is part of extraction
Fuse bits The configuration itself
Device identification Determines bit ordering and count
Fuse count Detects truncation
Checksum Proves the read is self-consistent
UES contents Part of the array, and often meaningful
Read method record Needed if the result is ever disputed

The last item is unusual in a technical deliverable and worth defending. If a fuse map is challenged, the first question is how it was obtained, and a record of the route — session, optical, electrical — settles arguments that no amount of re-reading can.

Where the boundary actually falls

The boundary is not “file versus no file”. It is the point where a bit acquires a meaning that requires assumptions. Decoding a fuse map into per-macrocell equations requires only architecture knowledge: which bit is which product term input, for this device, in this package. No assumption is involved, and the result is verifiable by recompiling.

Moving from equations to a description of behaviour requires assumptions. A term that appears in several outputs might be a shared enable or might be a coincidence of minimisation. A register might be a state bit or a pipeline stage. Those are interpretations, and different analysts will produce different ones from the same equations.

Artefact Requires Verifiable by
Fuse map Nothing beyond a correct read Device checksum
Per-macrocell equations Device architecture Recompilation to the same map
Behavioural description Assumptions about intent Simulation against captured vectors
Reconstructed HDL Design decisions Rewriting, not recovery

The third row is extraction’s ceiling and interpretation’s floor. Everything above it is a different service.

Why “source code” is in the URL

The phrase in the URL reflects what customers ask for, not what exists. On a CPLD, source code would mean the HDL or the schematic that was synthesised. That artefact is not present in the device in any form, because synthesis is a many-to-one mapping. Two designs that differ in structure but not in behaviour produce the same fuse map.

So an extraction service that advertises source code recovery is advertising one of two things: an equation-level netlist described in a source-like syntax, or a rewrite based on the netlist. Both are legitimate. Neither is the original file, and a customer who expects to diff the result against their old repository will be surprised.

The practical workflow

The sequence that avoids surprises runs in one direction and does not skip steps.

Step Output Gate
Identify the device Part number, revision, package Confirmed against marking and ID
Acquire the pattern Raw fuse bits Read completes without truncation
Validate Fuse count and checksum Matches device expectation
Decode Per-macrocell equations Recompiles to an equivalent map
Interpret Behavioural notes Reviewed against system behaviour
Report Deliverable plus limits Signed off with the boundary stated

The gate at step three is the one that is most often skipped and most often regretted. A truncated read produces a fuse map that decodes into equations, and the equations produce a design that almost works. Almost-working designs consume more engineering time than missing ones, because the failure is intermittent and the cause is invisible.

Reading a protected part

If the read inhibit is set, extraction becomes a physical problem, and the objective changes: the goal is to obtain the array contents, not to make the device usable. Those are compatible only if the physical route is non-destructive to the array, which for optical methods it is not — the package and often the passivation are removed, and the device does not survive as a working part.

This is worth stating plainly because customers sometimes ask for the part back. It is also why the decision to go physical has to be made deliberately rather than as a fallback: an attempt to clear the protection logically usually erases the array instead, which converts a recoverable sample into a blank one. The three possible endings of that attempt, and how to predict which one a given device will produce, are set out in cracking Lattice CPLD embedded firmware. Reading Lattice CPLD embedded firmware covers what the read yields on an unprotected device, and reversing Lattice CPLD source code covers the interpretation step that begins where this page ends.

Equipment and its limits

Session extraction needs a programmer that speaks the device’s protocol and a fixture that makes reliable contact. Optical extraction needs sample preparation, an imaging system and the patience to stitch a large field of view. Electrical probing needs a positioned probe and a device whose internal nodes are large enough to land on.

Each has a density ceiling. Session extraction has none in practice, because the protocol scales. Optical extraction gets harder as geometry shrinks, and the practical limit moves every generation. Probing is limited to structures that can be resolved and landed on, which excludes most modern parts.

Services at this boundary

Work covers device identification, session and physical extraction, fuse map validation, per-macrocell decoding, and a written statement of where extraction stopped and interpretation began. It does not cover delivering original HDL, and it does not cover returning a decapsulated device to service.

The sentence to keep is that extraction has one correct answer and interpretation has several. Quoting them together hides that difference until the invoice.

Comments are closed.