Managing Logic Transformations Final
Managing Logic Transformations Final
Abstract
This paper discusses the effect of sequential changes on functional verification. Sequential
transformations are typically done at system-level and RTL design to improve power, timing
and area. Several sequential transformations to datapath and control logic are shown.
Sequential changes are avoided late in the design process because of their impact on
functional verification. Consequently, designers tend to favor datapath and control logic
modifications that least disturbs testbenches. However “verification limited design” ties the
hands of engineers and sometimes sequential changes can not be avoided. This paper
introduces a novel solution, sequential equivalence checking, as well as suggestions to
improve testbench robustness to minimize impact of sequential changes on functional
verification.
Design confidence increases as a function of the number of unique test sequences and
completeness of system-level testing. As RTL modifications subside, functional
verification investments compound, yielding a “tested” module. At this point, simulation
test suites take days or weeks to complete and are most sensitive to design change.
Assurance in functional verification takes billions of simulation vectors to achieve. It is
no wonder that designers become resistant to change as deadlines near.
But what happens when initial place and route results indicate the design does not meet
system timing or power goals? Upon evaluation, the designer may conclude that an
overhaul to the datapath, and perhaps control logic is required! This may be a simple
change or a major rewrite. Fear sets in with the realization of how much work is required
to re-verify the modified design and that the changes will depreciate all previous
functional verification investment.
Under these circumstances most engineers go for the least invasive change possible.
However, this can create problems: fixes that are simple in a global context become
complex in a local implementation or fixes that minimize risk may not completely meet
the system criteria and require multiple iterations of change. Any change to the RTL, no
matter how small, has the potential to introduce subtle side effects.
The design described in figure 1 takes four input values. It outputs the average of the
four values and absolute difference between input value 3 and the average. It is fully
described by the RTL code, schematic and state timing diagram. The Average4 design
representation in figure 1 has one level of state, namely the registers on the output.
Changing the design to read the input values serially modifies the state and timing. This
serial transformation is an example of a simple sequential modification. Figure 2 shows a
serial input implementation of the Average4 design. Notice the added registers to store
the inputs, finite state machine (FSM) and corresponding latency in the output.
As the scope of change increases so does the likelihood of introducing subtle side effects.
Consequently significant modifications, like sequential changes are avoided late in the
design process even if they give the greatest savings. This avoidance creates a serious
limitation in converging towards power-optimal designs because accurate power
estimation requires capacitance information from place and route.
The next example demonstrates a sequential change in the Average4 control logic to
improve power. Power is reduced by employing resource sharing and modifying the state
machine encoding to iterate around a single adder and register. Figure 3 shows a power
optimized version of the Average4 design.
if (state==2'b00)
xsum_in <= x3_in;
else if (state==2'b01)
xsum_in <= xsum_in + x3_in;
else // state==10
begin
xavg_next = (xsum_in + x3_in)>>2;
xavg_out <= xavg_next;
if (xavg_next >= x3_in)
xdif_out <= xavg_next - x3_in;
else
xdif_out <= x3_in - xavg_next;
end
end
Power management begins at the system-level. System-level models run sufficiently fast
to enable booting an operating system and running application traces. This gives accurate
estimation of switching activity. System-level models are then refined into RTL
implementation. RTL models have the same functionality and can take into account
physical implementation details like capacitance to further analysis dynamic power. The
existence of a functionally accurate system-level model allows for sequential equivalence
checking between system-level descriptions and RTL implementations.
Consider one of the least invasive RTL changes to improve timing, datapath logic re-
timing around pipeline flip-flops. This sequential change solves marginal timing issues
and is unlikely to affect simulation testbenches. However, traditional combinational
equivalence checkers can not handle re-timed logic because the flip-flops are no longer
considered equivalent design points.
In figure 4, we have re-timed combinational logic around the state elements in the
Average4 design. For simplification purposes the cycle length in the timing waveform is
shorten and the detailed register placement between adders, subtractors, comparators and
mux logic is omitted from the diagram. The net result from these changes is increased
overall system performance with the same functionality as the original Average4 design.
When simple re-timing will not achieve timing closure, more ambitious sequential
changes are required. In such cases, it may be necessary to increase pipeline stages.
The nature of re-timing RTL control logic poses some of the toughest verification
problems; corner case bugs are often introduced. For example, it is anecdotally known
that sequential re-timing of control logic that manages instruction level parallelism and
multithreading in CPU design has resulted in live-lock and other errors which are not
only difficult to debug, but also hard to simulate. A simulation based verification
methodology would have to account for latency and throughput differences as well as be
augmented with directed and random tests to account for sequential changes to control
logic.
To avoid re-validating test suites to account for extra delay in output, testbenches should
be written with latency programmable or insensitive interfaces. Designers must plan
SLEC verifies micro-architectural optimizations for power, timing and area do not
introduce functional side effects. Since formal methods yield high coverage, sequential
equivalence checking gives designers confidence to make changes late in the design
process. Instead of relying on test benches or properties, sequential equivalence checking
uses a golden RTL model or system-level reference design written in Verilog, VHDL,
SystemC or C/C++. Unlike combinational equivalence checkers, SLEC proves
functional equivalence across levels of sequential and data abstraction. Sequential
changes like re-timing and resource sharing require only minor changes to setup
parameters to reflect new timing information.
Conclusion
Micro-architectural optimizations for power, timing and area often result in sequential
changes to RTL datapath and control logic. Sequential changes have a sizable impact on
functional verification. Not only do they require careful re-verification of the entire
design but they can also invalidate simulation testbench results. Design teams find
themselves pulled between achieving system-level requirements, minimizing design
change and functional verification completeness.
Sequential changes late in the design process are becoming more common. Designers
should improve their functional verification by encapsulating testbench interfaces and
utilize sequential equivalence checking. Sequential equivalence checking verifies designs
without using testbenches, quickly identifies design side effects and natively handles
designs with sequential differences. This dramatically improves designer productivity
when making system optimizations, giving users confidence and eliminating
‘verification-limited design’.