Verification of Parameterised FPGA Circuit Descriptions with Layout ...

Verification of Parameterised FPGA Circuit Descriptions with Layout ... Verification of Parameterised FPGA Circuit Descriptions with Layout ...

24.04.2013 Views

CHAPTER 5. SPECIALISATION 116 b a cout cin Figure 5.6: Full adder cell These layout theorems can be proved for each self-specialising block and then these proofs combined to verify the size correctness of an entire circuit. This once again neatly decomposes a potentially large verification task into many small and easy parts. For example, for the xor2 gate in Figure 5.4 the width correctness theorem can be stated and proved easily: ∀ a b c. Width xor2spec a b c ≤ Width xor2gen a b c ⇒ ∀ a b c. if(a, 1, 0) ≤ 1 ⇒ 1 ≤ 1 ∧ 0 ≤ 1 ⇒ True 5.3 Optimal Distributed Specialisation Reviewing the effectiveness of our self-specialising blocks on a real circuit we discover that it is necessary to address some shortcomings with the basic approach. 5.3.1 Specialising a Ripple Adder We will demonstrate distributed specialisation in Quartz using a simple ripple adder circuit. This is composed of full adder cells as shown in Figure 5.6 and described in Quartz as shown in Figure 5.7. The full adder is implemented using two xor gates and a multiplexer, which is described separately using two 2-input and gates, an or and an inverter. This description is not designed for any particular target architecture however, and what matters is the effect on this circuit of specialising it. As can be seen in Figure 5.7 the full-adder block accepts only hardware wires for inputs cin ans

CHAPTER 5. SPECIALISATION 117 block fadd ((‘a a, wire b), wire cin) ∼ (wire cout, wire ans) { wire xored ab. (a,b) ; xor2 ; xored ab at (0, height((a, cin) ; mux2 xored ab ;cout)). (cin, xored ab) ;xor2 ; ans at (width((a,b) ; xor2 ; xored ab), height((a, cin) ; mux2 xored ab ;cout)). (a, cin) ; mux2 xored ab ;cout at (0,0). } Figure 5.7: Quartz description for a full adder Resource Standard A=111 A=100 A=001 xor gates 6 3 3 3 and gates 6 3 3 3 inverters 2 6 4 4 or gates 3 3 3 3 Total gates 17 15 13 13 Saving - 12% 29% 29% Total transistors 106 72 68 68 Saving - 32% 35% 35% Table 5.1: Using distributed specialisation to specialise a ripple adder and b but input a is more flexible and, since it is connected to overloaded self-specialising blocks, can be of either wire or bool type. This allows the a input to be specialised by supplying a static value. The full adder blocks can be combined together using the col combinator to create a ripple adder. We can then use the Quartz compiler to synthesise a netlist for this design with either two dynamic inputs or one dynamic and one statically specialised input. Table 5.1 compares 3-bit versions of the standard ripple adder and three specialised versions. The first point to observe from these results is that the distributed specialisation has produced a significant saving in on-chip resources, though more so in terms of transistors by converting complex functions into simpler ones than by eliminating logic entirely. However, it is also obvious that this result is not optimal - for example, adding “100” should be implementable as a single full-adder with all other blocks reduced to wiring, an arrangement that only requires 6 gates using this fadd block. The reason our distributed specialisation system produces such poor results is the Quartz typing system and can be seen in the code describing distributed specialisation of the and2 block, or the or2 block shown in Figure 5.8. These two blocks either connect their output to

CHAPTER 5. SPECIALISATION 116<br />

b<br />

a<br />

cout<br />

cin<br />

Figure 5.6: Full adder cell<br />

These layout theorems can be proved for each self-specialising block and then these pro<strong>of</strong>s<br />

combined to verify the size correctness <strong>of</strong> an entire circuit. This once again neatly decomposes<br />

a potentially large verification task into many small and easy parts. For example, for the<br />

xor2 gate in Figure 5.4 the width correctness theorem can be stated and proved easily:<br />

∀ a b c. Width xor2spec a b c ≤ Width xor2gen a b c<br />

⇒ ∀ a b c. if(a, 1, 0) ≤ 1<br />

⇒ 1 ≤ 1 ∧ 0 ≤ 1 ⇒ True<br />

5.3 Optimal Distributed Specialisation<br />

Reviewing the effectiveness <strong>of</strong> our self-specialising blocks on a real circuit we discover that it<br />

is necessary to address some shortcomings <strong>with</strong> the basic approach.<br />

5.3.1 Specialising a Ripple Adder<br />

We will demonstrate distributed specialisation in Quartz using a simple ripple adder circuit.<br />

This is composed <strong>of</strong> full adder cells as shown in Figure 5.6 and described in Quartz as shown<br />

in Figure 5.7. The full adder is implemented using two xor gates and a multiplexer, which is<br />

described separately using two 2-input and gates, an or and an inverter. This description is<br />

not designed for any particular target architecture however, and what matters is the effect<br />

on this circuit <strong>of</strong> specialising it.<br />

As can be seen in Figure 5.7 the full-adder block accepts only hardware wires for inputs cin<br />

ans

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!