Verification of Parameterised FPGA Circuit Descriptions with Layout ...
Verification of Parameterised FPGA Circuit Descriptions with Layout ... Verification of Parameterised FPGA Circuit Descriptions with Layout ...
CHAPTER 4. VERIFYING CIRCUIT LAYOUTS 82 SB ′ :: BlockEnv → Block → (SizeFunc × SizeFunc) SB ′ β block bid d1 . . . dn ∼ r attributes { height = h. width = w. } { τ1 id1 . . . τp idp. stmts } = let m = S ′ βstmts in (λd1 . . .dn r. let (id1, . . . , idp) = (ι(id1, . . .,idp). m) in w, λd1 . . . dn r. let (id1, . . . , idp) = (ι(id1, . . . , idp). m) in h) Figure 4.9: Converting Quartz size expressions into QuartzLayout size functions automatic. Figure 4.8 gives the definition of the function Bβ which gives the semantics of a block as a logical predicate. This function gives Quartz a formal semantics in HOL, using an environment β which maps block identifiers to their definitions. The function in Figure 4.8 is implemented in the Quartz compiler layout processing module. The only difference between the formal definition and the compiler implementation is that the function B ′ β is not executed, instead the modelling of block instantiation within QuartzLayout (Section 4.4.2) is used. For example, the semantics of the map n R combinator, as generated by the compiler, are described by: λ(n, R)io. ∀j. (0 ≤ j ∧ j ≤ n − 1) −→ B ′ βR(i[j], o[j]) In Isabelle’s ASCII syntax this is written as (note that “o” has been replaced with “o ” since “o” is a reserved keyword in Isabelle/HOL): % (n, R) i o . ALL (j::int). ((0
CHAPTER 4. VERIFYING CIRCUIT LAYOUTS 83 Isabelle defines arbitrary recursive functions using the recdef construct however functions defined this way require termination to be proved automatically and this is difficult for the theorem prover to do because of the way Quartz blocks are defined. Unfortunately recdef is a closed box and it is not possible to manually direct the proof and recdef compilation process to generate useful results. Luckily Isabelle does provide a (less general) recursive construct called primrec for imple- menting recursion over data structures. This can be used with the natural numbers type to write recursive equations for Quartz blocks in the form R0 = g and Rn+1 = f(Rn). This is limited to cases where the recursion of the block is controlled by a single integer parameter that decreases to zero, however this comfortably describes most recursively defined Quartz blocks. We have carried out the translation from recdef to primrec manually, however there is no reason why the process could not be automated. 4.5.3 Generating Proof Obligations The Quartz compiler also generates a series of proof obligations that check the correctness of a layout specification. The correctness theorems are split into three groups, representing proofs for validity, containment and intersection. These theorems are contained within the same theory file that defines the block’s semantic definition, height and width functions. This ensures that the theory of a block can only be loaded to support that of a block dependent on it once it has itself been proved correct. All theorems are universally quantified across all domain and range signals. Validity theorems are the simplest and are proved under the assumption that the size functions of all higher- order block parameters are also valid. Assertion pre-conditions asserted within the block’s body are also assumed and can be used in the proof. The general format of the height validity theorem for a block B of type d1 . . . dn ∼ r is:
- Page 41 and 42: CHAPTER 2. BACKGROUND AND RELATED W
- Page 43 and 44: CHAPTER 2. BACKGROUND AND RELATED W
- Page 45 and 46: CHAPTER 3. GENERATING PARAMETERISED
- Page 47 and 48: CHAPTER 3. GENERATING PARAMETERISED
- Page 49 and 50: CHAPTER 3. GENERATING PARAMETERISED
- Page 51 and 52: CHAPTER 3. GENERATING PARAMETERISED
- Page 53 and 54: CHAPTER 3. GENERATING PARAMETERISED
- Page 55 and 56: CHAPTER 3. GENERATING PARAMETERISED
- Page 57 and 58: CHAPTER 3. GENERATING PARAMETERISED
- Page 59 and 60: CHAPTER 3. GENERATING PARAMETERISED
- Page 61 and 62: CHAPTER 3. GENERATING PARAMETERISED
- Page 63 and 64: CHAPTER 3. GENERATING PARAMETERISED
- Page 65 and 66: CHAPTER 3. GENERATING PARAMETERISED
- Page 67 and 68: CHAPTER 3. GENERATING PARAMETERISED
- Page 69 and 70: CHAPTER 3. GENERATING PARAMETERISED
- Page 71 and 72: CHAPTER 3. GENERATING PARAMETERISED
- Page 73 and 74: CHAPTER 3. GENERATING PARAMETERISED
- Page 75 and 76: Chapter 4 Verifying Circuit Layouts
- Page 77 and 78: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 79 and 80: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 81 and 82: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 83 and 84: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 85 and 86: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 87 and 88: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 89 and 90: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 91: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 95 and 96: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 97 and 98: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 99 and 100: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 101 and 102: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 103 and 104: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 105 and 106: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 107 and 108: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 109 and 110: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 111 and 112: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 113 and 114: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 115 and 116: CHAPTER 4. VERIFYING CIRCUIT LAYOUT
- Page 117 and 118: Chapter 5 Specialisation In this ch
- Page 119 and 120: CHAPTER 5. SPECIALISATION 109 opera
- Page 121 and 122: CHAPTER 5. SPECIALISATION 111 // Ha
- Page 123 and 124: CHAPTER 5. SPECIALISATION 113 circu
- Page 125 and 126: CHAPTER 5. SPECIALISATION 115 const
- Page 127 and 128: CHAPTER 5. SPECIALISATION 117 block
- Page 129 and 130: CHAPTER 5. SPECIALISATION 119 Modif
- Page 131 and 132: CHAPTER 5. SPECIALISATION 121 Buffe
- Page 133 and 134: CHAPTER 5. SPECIALISATION 123 a fas
- Page 135 and 136: CHAPTER 5. SPECIALISATION 125 block
- Page 137 and 138: CHAPTER 5. SPECIALISATION 127 y y y
- Page 139 and 140: CHAPTER 5. SPECIALISATION 129 with
- Page 141 and 142: CHAPTER 6. LAYOUT CASE STUDIES 131
CHAPTER 4. VERIFYING CIRCUIT LAYOUTS 83<br />
Isabelle defines arbitrary recursive functions using the recdef construct however functions<br />
defined this way require termination to be proved automatically and this is difficult for the<br />
theorem prover to do because <strong>of</strong> the way Quartz blocks are defined. Unfortunately recdef is a<br />
closed box and it is not possible to manually direct the pro<strong>of</strong> and recdef compilation process<br />
to generate useful results.<br />
Luckily Isabelle does provide a (less general) recursive construct called primrec for imple-<br />
menting recursion over data structures. This can be used <strong>with</strong> the natural numbers type to<br />
write recursive equations for Quartz blocks in the form R0 = g and Rn+1 = f(Rn). This is<br />
limited to cases where the recursion <strong>of</strong> the block is controlled by a single integer parameter<br />
that decreases to zero, however this comfortably describes most recursively defined Quartz<br />
blocks.<br />
We have carried out the translation from recdef to primrec manually, however there is no<br />
reason why the process could not be automated.<br />
4.5.3 Generating Pro<strong>of</strong> Obligations<br />
The Quartz compiler also generates a series <strong>of</strong> pro<strong>of</strong> obligations that check the correctness<br />
<strong>of</strong> a layout specification. The correctness theorems are split into three groups, representing<br />
pro<strong>of</strong>s for validity, containment and intersection. These theorems are contained <strong>with</strong>in the<br />
same theory file that defines the block’s semantic definition, height and width functions. This<br />
ensures that the theory <strong>of</strong> a block can only be loaded to support that <strong>of</strong> a block dependent<br />
on it once it has itself been proved correct.<br />
All theorems are universally quantified across all domain and range signals. Validity theorems<br />
are the simplest and are proved under the assumption that the size functions <strong>of</strong> all higher-<br />
order block parameters are also valid. Assertion pre-conditions asserted <strong>with</strong>in the block’s<br />
body are also assumed and can be used in the pro<strong>of</strong>. The general format <strong>of</strong> the height validity<br />
theorem for a block B <strong>of</strong> type d1 . . . dn ∼ r is: