TDEB Top Bar

Trending
Semiconductor Industry News — The Digital Electronics Blog
Follow Us

TDEB Masthead

The Semiconductor Hub

Semiconductors.  Chips and Systems.  Innovation.

Indexed by leading Search Engines, AI and referenced by Engineers worldwide 500+ Articles 10M+ Pageviews 30+ Reports 50+ Citations

Logic Density: Estimating Resources Before RTL Coding

The Editor's Desk
by
0
Share Facebook X LinkedIn WhatsApp Email

Question: How do you find the resources a design will consume at the design stage, before RTL coding? Is it necessary to draw the low-level gate elements to calculate the logic gate consumption? Designers do not usually draw detailed low-level diagrams to calculate resource utilization, so how do you approximately find the resources used in a design?

Answer: The main purpose of this exercise is generally to find the number of flops (or synchronous elements) in the logic. Even before RTL coding one can get a basic idea of the flop count by listing the state elements, the registers for counters, the retiming stages and so on. Then, based on the type of circuitry, we estimate how much combinational logic there will be between flops (for example, in a pipelined design it will be less), again as some percentage of the sequential elements. At this stage we do not try to include buffers or inverters for load or for different fanouts; they can all be treated as part of the combinational logic.

Finally, an approximate number can be inferred giving the number of gates (depending on the technology library) for the RTL module.

Why estimate logic density early

An early estimate answers practical questions long before synthesis can: will the block fit in the FPGA you plan to use, roughly how much die area will an ASIC block take, how much power will it burn, and is the architecture reasonable or wildly oversized? A number that is within 20 to 30 percent is good enough for these decisions, and it takes hours instead of weeks.

How the estimate works, step by step

  1. Count the storage. Go through the block diagram and add up every bit that is held from one clock to the next: data registers, pipeline stages, counters, state machine registers, FIFO pointers, configuration registers. Small memories (FIFOs, buffers) are listed separately, because they will become RAM blocks or memory macros, not flops.
  2. Classify the logic between the flops. A deep pipeline has little logic per stage. A control block with wide comparisons, or a datapath with adders and multipliers, has much more.
  3. Add the arithmetic explicitly. Adders, multipliers and wide multiplexers are large and predictable, so estimate them by width rather than as a percentage.
  4. Apply a ratio for the rest. Estimate the remaining glue logic as a multiple of the flop count, using a ratio from a similar past design if you have one.
  5. Convert to the target unit. For an ASIC, convert to gate equivalents and then to area using the library. For an FPGA, convert to LUTs and flip-flops and compare with the device.
  6. Add margin. Early estimates miss things: debug logic, test logic, late feature requests. Leave headroom.

Where estimates go wrong

  • Forgetting memories, or counting a 1 Kbit FIFO as 1,024 flops when it will be a RAM block.
  • Ignoring the width of multipliers. Multiplier size grows with the product of the two operand widths, so doubling both widths roughly quadruples it.
  • Counting a state machine by its states rather than its encoded bits.
  • Using an ASIC gate ratio for an FPGA, or the reverse. FPGA logic is counted in LUTs, which absorb several gates each.
  • Adding no margin, then running out of room late in the project.

Interview angle

When asked this question, interviewers want to hear that you start from the flops, not from gates; that you treat arithmetic and memories separately; and that you know the unit of the target technology (gate equivalents for ASICs, LUTs and flip-flops for FPGAs). Walking through a short example with numbers, like the one below, makes the answer convincing.

Deep dive: the numbers and details

This part holds the units, a worked estimate with numbers and the FPGA conversion. Skip it if the overview is all you need. The ratios used below are example assumptions for illustration, not library data; replace them with figures from your own library or past designs.

The units: gate equivalents

ASIC logic is usually counted in gate equivalents (GE), where one GE is the area of a two-input NAND gate in the target library. Every other cell is expressed as a multiple of that area, so a block of 50,000 GE in a library where a NAND2 occupies a known area converts directly into square micrometers. Flip-flops are several GE each and the exact figure depends on the cell (with or without reset, scan and enable), so read it from your library's area table.

Worked example: a small datapath block

Suppose the block is a 4-stage pipeline that processes 32-bit samples, with a 16x16 multiplier, a 32-bit accumulator, a small control FSM and some configuration registers. Assume for this example that one flop is 6 GE, that glue logic is 1.5 times the flop GE in pipeline stages, and that a ripple adder costs about 7 GE per bit (a full adder per bit).

ItemCountGE eachGE
Pipeline registers (4 stages x 32 bits)128 flops6768
Accumulator register32 flops6192
Configuration registers64 flops6384
Control FSM (6 states, binary, 3 bits) and counters (8 bits)11 flops666
Sequential subtotal235 flops1,410
32-bit accumulator adder32 bits7224
16x16 array multiplier (about 16 x 16 = 256 adder cells)256 cells71,792
Glue logic (1.5 x sequential)2,115
Total before margin5,541
With 25 percent marginabout 6,900

Two lessons come out of the table. First, the multiplier alone is about a third of the block before margin, which is why arithmetic is estimated separately and not as a percentage of flops. Second, the flops are about a quarter of the total, so a block's flop count gives a quick order of magnitude even before the rest is worked out.

Converting to an FPGA

In an FPGA the unit changes. In the AMD 7 series, for example, four 6-input LUTs and their eight flip-flops, with multiplexers and carry logic, form a slice, and two slices form a configurable logic block (AMD UG474, CLB overview). A 6-input LUT can implement any function of six inputs, so it absorbs what would be several gates in an ASIC.

For the block above, the 235 flops map almost one for one onto FPGA flip-flops, which is about 30 slices' worth of flip-flops at eight per slice. The multiplier would normally go into a dedicated DSP block rather than LUTs, and the 32-bit adder uses the slice carry chain, roughly one LUT per bit. The glue logic depends heavily on how many inputs each function has; one starting assumption is about one LUT per flip-flop for control-heavy logic and fewer for pure pipelines, which you then correct the ratio from your first synthesis run.

Sanity checks once RTL exists

  • Run a quick synthesis as soon as the first RTL compiles and compare the flop count with your estimate. A large mismatch usually means a missed memory or an unintended register.
  • Track the ratio of combinational to sequential area for each block. It becomes your calibrated ratio for the next estimate.
  • Check the utilization report of the FPGA tool for LUT, flip-flop, block RAM and DSP use separately. A design can run out of any one of them first.

Further reading

The Editor's Desk
About the Author
The Editor's Desk
Share Facebook X LinkedIn WhatsApp Email

Post a Comment

0 Comments

Your comments will be moderated before it appears here.

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn more
Ok, Go it!