Posts Tagged ‘cpld decode’
CPLD: Crack or Redesign? The Economic Threshold
A CPLD is the most recoverable programmable device in common use. The array is small, the geometry is relaxed, the fuse map is a coordinate table, and the equations that produced it can be recovered exactly. On the face of it, cracking is always cheaper than redesigning.
That conclusion is wrong about half the time, and the reason is that reading the array is the easy part. What a CPLD encodes is not only logic but timing, and timing is a consequence of how the logic was placed rather than of what it computes. A recovered equation set that is functionally identical will still produce a board that fails if it propagates faster or slower than the original.
What comes back from a CPLD
The deliverable of a CPLD read is a JEDEC file: a list of fuse coordinates and their states. That is a complete description of the programmed device, and everything else is interpretation.
From the fuse map, the product terms can be extracted, and each output’s function can be written as a sum of products. For a small device this is mechanical and exact. The result is a set of equations that is provably equivalent to the original at the logic level.
| Recovered artefact | Fidelity | Notes |
|---|---|---|
| Fuse map | Exact | The file the programmer wrote |
| Product terms | Exact | Direct interpretation of the map |
| Boolean equations | Exact at logic level | Minimal or as-programmed form |
| Macrocell configuration | Exact | Registered, latched, or combinatorial |
| Placement and routing | Lost | Not represented in the fuse map |
| Timing | Lost, but measurable | A property of the route |
The fifth and sixth rows are the ones that decide the commercial question. Placement is not in the file, and timing follows from placement, so a recovered design must be re-placed and its timing re-established by measurement.
Where the cost actually goes
The cost of a CPLD recovery breaks into three parts, and the first is the smallest.
Reading the array is hours, including the setup. Recovering the equations is hours to a day, depending on whether the design is combinatorial or has registers and state. Both are bounded and predictable.
Re-establishing timing is the open-ended part. It requires measuring the original device’s propagation delays in the customer’s circuit, then constraining the new implementation to match, then verifying that it does. If the original design had a marginal path — and marginal paths are exactly why some products have intermittent faults — the measurement is ambiguous and the reconstruction inherits the ambiguity.
| Phase | Duration | Predictability |
|---|---|---|
| Read the array | Hours | High |
| Recover equations | Hours to one day | High |
| Measure timing in circuit | One to three days | Medium |
| Implement and constrain | Two to five days | Medium |
| Verify equivalence | Two to four days | Low |
The bottom three rows dominate. A recovery quoted on the basis of the first two is quoted at perhaps a fifth of its true cost.
The complexity threshold
Redesign from a specification becomes the better option when the design is simple enough that the specification can be written from observation.
The threshold is not a fixed number of macrocells, but it sits in a recognisable region. Below roughly thirty used macrocells with purely combinatorial logic, the device is almost always doing address decoding, signal gating or level translation, and an engineer can write that from a truth table in a day. Above roughly a hundred macrocells with registered state, the design has behaviour that is expensive to specify and cheap to read.
| Design shape | Macrocells | Crack | Redesign |
|---|---|---|---|
| Glue logic, decoding | Under 30 | Days | One day |
| Registered state machine | 30–100 | Days | One to two weeks |
| Multiple interacting machines | 100–200 | One to two weeks | Three to six weeks |
| Timing-critical interface | Any size | Weeks | Weeks, plus risk |
The fourth row is the case where neither option is comfortable, and it is more common than the table suggests. A CPLD that implements a bus interface with tight setup and hold requirements is a device whose value is entirely in its timing, and both routes require measuring the original. Cracking has the advantage that the function is known, and redesign has the advantage that the timing can be specified rather than reverse engineered.
Why redesign is sometimes the safer answer
Two considerations push toward redesign even when cracking is cheaper.
The first is legal clarity. A recovered design is a reproduction of someone’s work, and the position depends on who owns what. A design written from a functional specification is a new work, and the question becomes whether the function itself is protected rather than whether the implementation was copied. This is not a technical argument, but it frequently decides the route; the boundaries are discussed in cloning an IC program.
The second is maintainability. A recovered equation set is correct and unreadable. It has no names, no structure and no comments, and the engineer who inherits it cannot tell which term implements which requirement. A redesign is worse in fidelity and better in every respect that matters after delivery.
| Criterion | Crack | Redesign |
|---|---|---|
| Fidelity to original | Exact logic | Approximate until verified |
| Time to first working unit | Days | Weeks |
| Understandability | Poor | Good |
| Legal exposure | Depends on ownership | Lower |
| Future modification | Difficult | Normal |
When the array is protected
Everything above assumes the fuse map can be read. When a security bit is set, it cannot, and the comparison changes shape rather than merely becoming more expensive.
A protected CPLD requires a physical read: decapsulation, imaging of the array, and reconstruction of the fuse states from the image. The device does not survive, which means the reading has to be complete on the first attempt, because there is no second sample of that particular unit.
| Route | Duration | Device survives | Consequence for the comparison |
|---|---|---|---|
| Unprotected read | Hours | Yes | Crack is cheap, compare on timing |
| Protected, physical read | Weeks | No | Crack plus a timing campaign |
| Protected, redesign from behaviour | Weeks | Yes | Redesign becomes competitive |
| Protected and simple | Days | Yes | Redesign is clearly better |
The third row is the interesting one. A protected device that cannot be read can still be characterised at its pins, and for a small combinatorial design that characterisation is a complete specification. The economic threshold therefore moves: protection makes redesign more attractive not because cracking is impossible, but because the gap in cost has narrowed.
For a design above about a hundred macrocells, the physical read remains the only route to the equations, and the customer is choosing between a device that no longer exists and a specification that takes a month to write.
What a real assessment looks like
The assessment takes a day and produces a recommendation with a number attached.
It begins with the device identification: which family, how many macrocells, whether the array is readable. A device with a security bit set moves to the physical route, and the comparison changes entirely because the cost of reading is no longer hours.
It then reads the array where possible and counts the used macrocells and the number of registered outputs. Those two numbers place the design in the table above, and the placement is the recommendation.
It finishes with a timing measurement on the customer’s board: the propagation delay from each input to each output that matters. That measurement is what allows a fixed-price quotation for either route, because it converts the open-ended part into a known quantity.
| Finding | Recommendation |
|---|---|
| Small combinatorial, readable | Redesign from a truth table |
| Registered, 30–100 macrocells | Recover equations, re-time |
| Large state machine | Recover, expect a timing campaign |
| Security bit set | Physical read, then the same choice |
| Timing marginal in the original | Either, with an explicit risk note |
The service at this layer
We quote both routes rather than one, because a customer who is told only that recovery is possible will choose it and then discover the timing campaign. The quotation separates reading, equation recovery, timing measurement and verification, so that the customer can see which part of the cost is open-ended.
Where the recommendation is redesign, we say so even though it is the cheaper job for us in the short term. A recovered design that the customer cannot maintain is a design that comes back, and the second engagement costs more than the honesty did.
The mechanics of the read itself, including what a fuse map contains and how it converts to equations, are set out in reading PLD binary into equations and extracting PLD source code. Where the array is protected rather than readable, the route changes to the physical one in extracting IC flash, and the economics change with it because the device no longer survives.