Posts Tagged ‘read pld ic heximal content’

PostHeaderIcon Read PLD Binary Into Sum-of-Products: The Actual Conversion

A fuse array is a set of connection bits. An equation is a statement about logic. The transformation between them looks mechanical and is mostly mechanical, but it contains three decision points where a choice has to be made, and each choice affects whether the result is useful.

The three are: how product terms are grouped into outputs, whether a macrocell’s feedback is taken from the register or the pin, and how far to simplify. The first two are determined by the device architecture and can be answered definitively. The third is a judgement, and getting it wrong produces equations that are correct and unreadable, or readable and subtly wrong.

Grouping: from bits to product terms

The AND array is organised so that each output’s OR gate receives a fixed number of product terms, in a fixed order. Reading the array therefore produces, for each output, a list of terms; each term is a set of input connections.

Array region Maps to
A block of fuses feeding one OR input One product term
The set of terms feeding one OR gate One output equation
Fuses outside any product term row Unused, or belonging to another function
The polarity fuse for a macrocell Whether the final sum is inverted

The third row matters because arrays are rarely fully used. Unused product terms are typically programmed to a contradiction — a term that can never be true, such as a variable ANDed with its complement — so that they contribute nothing to the OR. Recognising that pattern prevents a reconstruction from containing dozens of impossible terms.

Pattern in a product term Meaning
A signal and its complement both present Contradiction; term is disabled
No signals connected at all Term is always true; suspect a misread
All signals in the row present Term is a constant product
Exactly one signal from each input group Well-formed term

Feedback: the decision that changes everything

A macrocell can feed its output back into the array from two places, and on some devices the choice is a configuration bit. This single bit determines whether the device implements combinational logic or a state machine.

Feedback source Behaviour Typical use
From the output pin Combinational; the term sees the current output Glue logic
From the register Sequential; the term sees the stored state State machines, counters
From the pin, with the register unused Purely combinational Simple decoding
Neither, output only The cell drives a pin and feeds nothing Output expansion

The second row is what turns a list of equations into a state machine. Once the feedback is known to come from the register, the equations become next-state functions, and the register bits become the state vector. Getting this wrong produces an equation set that describes a device with feedback loops but no memory, which is a device that would oscillate.

Simplification: how far to go

The fuse array contains whatever the original tool produced after its own minimisation. Simplifying further is possible and not always desirable.

Level Result Risk
No simplification Exact terms as programmed Unreadable, but faithful
Algebraic factoring Fewer literals, same terms None; preserves structure
Full minimisation Fewest terms possible Loses intentional redundancy
Minimisation plus don’t-care exploitation Smallest form Changes behaviour in unused states

The third and fourth rows are where correctness can be lost. A term that appears redundant may have been placed to eliminate a static hazard, and removing it produces equations that are logically equivalent in steady state and produce glitches in transition. On a device driving a clock or an asynchronous input, a glitch is a functional difference.

The fourth row is more dangerous still: minimisation that exploits don’t-care conditions produces a function that agrees with the original only for the input combinations the designer cared about. That is usually fine and occasionally catastrophic, and the difference cannot be determined from the array alone.

The readable output

What a customer receives should be equations in a form that can be read, checked and re-implemented.

“ o1 = (!a & b & c) # (a & !c) # (b & fb1) o2 = (a & b) # (!a & !b & fb2) fb1 = o1 fb2 = o1 & !o2 “

Two conventions make such a set usable. The first is naming feedback nets explicitly rather than inlining them, because inlining obscures the state structure. The second is preserving the original term order where possible, because a designer reading a reconstruction uses structure as a memory aid.

Convention Benefit
Feedback nets named State structure visible
Terms in original order Matches the designer’s mental model
Inversions marked at the term, not the output Matches how the array is programmed
Disabled terms omitted with a note Avoids clutter without hiding anything

Verification

The equation set can be checked without any knowledge of the original design, by compiling it back and comparing.

Test Proves
Recompile to the same device and compare fuse arrays Exact equivalence
Simulate all input combinations and compare Functional equivalence
Compare against measured board behaviour The reconstruction matches reality

The second test is exhaustive and cheap on a device with twenty inputs, which covers most of this class. A million combinations evaluated in simulation settles the question completely.

Where the surrounding steps are

The array readout itself is covered in reading PLD binary source code, which also fixes the terminology. The container format is in reading the JED format. Where the device implements a controller rather than glue, the equation set becomes a state machine, and attacking CPLD source code covers that next step.

Services at this boundary

Work covers fuse array decoding, product term grouping, feedback resolution with explicit configuration bit evidence, simplification at a stated level, and exhaustive equivalence checking. It does not cover recovering the original text, and it does not cover guaranteeing that a simplified form preserves behaviour in states the original never reached.

The three decisions should be recorded in the deliverable, because each one is a place where a different analyst could reasonably have chosen differently.