Posts Tagged ‘fpga copy’

PostHeaderIcon FPGA Cracking Delivers Pin-Level Equivalence, Not RTL

The word “crack” applied to an FPGA promises something the technology cannot give. A configuration bitstream is a set of lookup-table masks and routing switch states. Recovering the design that produced it means solving for the source of those masks, and that problem has no unique solution: many netlists map to the same bitstream, and the mapping destroys the information needed to choose between them.

What can be delivered is different and, for most customers, more valuable. It is a replacement implementation that behaves identically at every pin, with timing measured rather than assumed. That is what a product needs when the original part goes end-of-life, and it does not require the original design.

Why the bitstream is a dead end

A lookup table with four inputs implements sixteen truth-table entries. The bitstream stores those sixteen bits. Recovering the function means choosing a Boolean expression that matches them, and there are astronomically many such expressions. Synthesis chose one; the bitstream does not record which.

Routing is worse. The switch states record which wires are connected, and the connections are physical adjacency in a fabric rather than logical nets. Several routes exist for almost every net, and which one was used carries no information about the designer’s intent.

Bitstream content What it records What it does not record
LUT masks The function of each cell How the function was expressed
Routing switches Which wires are joined Which net each wire belonged to
Flip-flop configuration Register or combinational Register names or roles
IO settings Drive strength, standard Signal names, direction intent

The consequence is that any “recovered netlist” is one of many consistent with the bitstream, and there is no way to tell which. For a design of any size the recovered netlist is also unreadable: thousands of anonymous cells with anonymous connections, in a form that no engineer would have written and that no engineer can maintain.

What equivalence actually means

Pin-level equivalence is a precise claim, and it is worth defining before promising it.

Two implementations are equivalent at the pins if, for every legal input sequence applied at the input pins and every clock condition within specification, the output pins produce the same values at the same times. The “same times” is what makes this harder than functional equivalence; a replacement that produces the right values one clock late is not equivalent for a circuit that samples them.

Level Claim Achievable
Bit-identical bitstream Same configuration No
Identical netlist Same gates and nets No
Functional equivalence Same outputs, timing ignored Sometimes
Pin-level equivalence Same outputs at the same times Yes, with measurement
Source equivalence Same RTL No

The fourth row is the deliverable. It is achievable because it is a statement about observable behaviour, and observable behaviour can be measured exhaustively for small designs and sampled representatively for large ones.

Establishing the behaviour

The method is black-box characterisation, and its cost is set by the size of the input space rather than by the complexity of the design.

For a purely combinational design with n inputs, exhaustive characterisation means 2^n input vectors. At n equal to sixteen that is 65,536 vectors and a few seconds; at n equal to twenty-four it is 16.7 million and a few hours; beyond about twenty-eight it becomes impractical and sampling is required.

Inputs Vectors Time at 1 M vectors/s Method
8 256 Instant Exhaustive
16 65,536 Instant Exhaustive
24 16.7 M Seconds Exhaustive
28 268 M Minutes Exhaustive, at the limit
32+ 4.3 G Hours to days Sampled plus structural

For sequential designs the state space matters more than the input space. A design with eight state bits and sixteen inputs has a reachable set that may be far smaller than the product, and the characterisation is a state exploration rather than a vector sweep.

Sampling is not a compromise if it is done with knowledge of the function. A video pipeline has structure — blanking intervals, sync patterns, active regions — and characterising it means covering each region rather than covering the input space. A bus interface has protocol states, and characterising it means driving each state transition.

Timing is half the problem

A replacement that produces correct values with the wrong latency fails in ways that are difficult to diagnose, because the system it feeds may appear to work intermittently.

The timing that has to be measured is not the clock frequency. It is the input-to-output delay for each path, including the setup and hold requirements at the inputs and the valid window at the outputs. Those are properties of the original implementation, and a replacement built from a faster part will violate them in the direction of being too fast, which is just as broken as being too slow.

Timing property How it is measured Why it matters
Input to output delay Edge-to-edge at each pin pair Downstream setup and hold
Setup and hold at inputs Sweep the input edge relative to clock Sampling margin
Output valid window Probe with varying load Bus timing
Clock to output Measure against the clock pin Synchronous interfaces

The measurement has to be made in the target system, not on a bench, because the load and the trace lengths are part of the timing. A characterisation performed with a 10 pF probe on a bench and applied to a board with 40 pF of load will be wrong by an amount that depends on the drive strength, which is itself unknown for the original part.

What characterisation cannot see

Pin-level equivalence is a claim about the outside of the device, and there are four things on the inside that it cannot reach.

Internal state is the first. A design with registers that are never observable at a pin — a counter that affects nothing visible, a state machine whose unreachable states differ — has behaviour that no amount of pin stimulation reveals. In practice this matters less than it sounds, because unobservable state cannot affect the system the device is embedded in; if it did, it would be observable.

The second is analogue behaviour. A CPLD or FPGA with an embedded analogue block, a temperature-sensing input or an on-die oscillator has characteristics that depend on the silicon rather than on the configuration. A replacement built on a different process will not match them, and no characterisation can specify what to match to.

Hidden element Observable at pins What it costs
Unreachable state bits No Nothing, if truly unobservable
Analogue blocks Partially Requires a second characterisation
On-die oscillator As a frequency Tolerance may not be reproducible
Configuration access path Yes, as a port Must be reimplemented or disabled

The fourth row is a design decision rather than a measurement problem. A device that is configured at boot from an external source has a configuration path that the original product used; a replacement must either implement the same path or be configured before installation. Choosing the second changes the manufacturing flow, and that is a conversation to have at quotation time rather than at delivery.

Where this is commercially the right answer

Three situations make pin-level equivalence the correct deliverable, and all three are common.

The original part is end-of-life and the product must continue to ship. There is no design to recover, because the customer often owns it — what is missing is a device to put it in. The work is a port, and a port needs the behaviour, not the source.

The customer is a second source and does not have the design. This is the classic case, and it is also the case where the legal position needs to be established before the technical work begins; the constraints are set out in cloning an IC program.

The design exists but its documentation does not, and reverse engineering the documentation from a working unit is cheaper than reconstructing it from interviews. This happens after acquisitions and after staff departures more often than anyone admits.

Situation Is the design available Deliverable
End of life, customer owns design Yes, as RTL A port, not a crack
Second source, no design No Pin-level model
Documentation lost No, but knowledge exists Reconstructed specification
Failure analysis Irrelevant Behavioural model for test

What the service produces

The output is a behavioural model plus a measured timing specification: a black-box implementation that reproduces the pin behaviour, a test bench that drives the characterisation vectors and compares against the recorded responses, and a timing report per interface.

The test bench is the part that makes the deliverable verifiable. A replacement without a test bench is an assertion; a replacement with one can be checked by the customer against their own units, and the check is repeatable.

We decline one category without discussion: requests for recovered RTL from a bitstream. That is not a matter of effort or budget; the information is not in the file, and the reason is set out in reading an FPGA bitstream. Where the device is a combined processor and fabric, the software half is genuinely recoverable and the split between the two is described in reading SoC FPGA firmware. Where the configuration lives in an external flash rather than on the die, the first step is the read described in extracting FPGA configuration. Where the device is a CPLD rather than an FPGA, the same reasoning applies to a much smaller fabric, and the limits are set out in CPLD recovery.