24.04.2013 Views

Verification of Parameterised FPGA Circuit Descriptions with Layout ...

Verification of Parameterised FPGA Circuit Descriptions with Layout ...

Verification of Parameterised FPGA Circuit Descriptions with Layout ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 4. VERIFYING CIRCUIT LAYOUTS 94<br />

block irow (int n, block R int (‘a, ‘b) ∼ (‘c, ‘a)) (‘a l , ‘b t[n]) ∼ (‘c b[n], ‘a r)<br />

attributes {<br />

height = if(n==0, 0, height((l, t) ; snd (converse (apr (n − 1))) ;<br />

beside (irow (n−1, R), R n) ; fst (apr (n−1)) ; (b, r))).<br />

width = if(n==0, 0, width((l, t) ;snd (converse (apr (n − 1))) ;<br />

beside (irow (n−1, R), R n) ; fst (apr (n−1)) ; (b, r))).<br />

} {<br />

// Wires: l = left , t = top, b = bottom, r = right<br />

assert (n >= 0) ”n >= 0 is required”.<br />

if (n == 0) { l = r. } // b and t are empty vectors anyway<br />

else {<br />

(l , t) ;<br />

snd (converse (apr (n − 1))) ;<br />

beside (irow (n−1, R), R n) ;<br />

fst (apr (n−1)) ;<br />

(b, r) at (0,0).<br />

} .<br />

}<br />

Figure 4.14: Recursive definition <strong>of</strong> irow n R<br />

We investigate pro<strong>of</strong>s <strong>of</strong> two different versions <strong>of</strong> the index operators: defined iteratively and<br />

defined recursively. Recursively defined versions <strong>of</strong> some index operators are <strong>of</strong> particular<br />

interest because these versions can be used to represent less regular circuit descriptions.<br />

Iterative versions <strong>of</strong> the index operators are defined a very similar way to the standard prelude<br />

operators, and the pro<strong>of</strong> infrastructure developed and tested on the prelude works well for<br />

them - all iterative definitions are proved fully automatically.<br />

Recursive definitions are slightly more complex and we will examine irow n R as an example.<br />

Figure 4.14 gives the recursive definition <strong>of</strong> this combinator.<br />

The first step in verifying this layout is to generate the theory definitions using the compiler as<br />

normal, however we must then re-jig the definitions to use Isabelle’s primrec rather than recdef<br />

constructs (see Section 4.5.2). This process could be performed automatically. The recursive<br />

width function definition for the irow block after this process is given in Figure 4.15. Because<br />

the width function recurses over the natural number n, when the parameter is supplied to<br />

the R block the conversion function “int” must be used to convert the natural number to an<br />

integer.<br />

Similarly, the definition <strong>of</strong> the irow uses the int2nat function we define in the IntAlgebra

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

Saved successfully!

Ooh no, something went wrong!