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.

APPENDIX D. CIRCUIT LAYOUT CASE STUDIES 306<br />

}<br />

cin = false.<br />

(a, b) ; zip 2 ; converse (pi1) ; col (n, fadd clk) ; (cin, ans) at (0,0).<br />

/∗ Repeating cell for cubical matrix multiplier ∗/<br />

block matmultcell (int n) (wire clk) (wire x in[n], wire y in[n], wire z in[n]) ∼<br />

(wire z out[n], wire y out[n], wire x out[n]) {<br />

x out = x in.<br />

y out = y in.<br />

((x in, y in), z in) ; fst (mult n) ; add n clk; z out at (0,0).<br />

}<br />

/∗∗ Transpose a matrix ∗/<br />

block word transpose (int bits) (int n, int m) (‘a v1[n][m][bits ]) ∼ (‘a v2[m][n][ bits ]) {<br />

int i , j.<br />

for i = 0..n−1 {<br />

for j = 0..m−1 {<br />

v2[j ][ i ] = v1[i ][ j].<br />

} . } .<br />

}<br />

/∗∗ Matrix multiplier ∗/<br />

block matmult (wire clk) (int bits) (int x, int y, int z)<br />

(wire mat1[y][z ][ bits ], wire mat2[z][x][ bits ]) ∼ (wire mat3[y][x][ bits ]) {<br />

wire emptymat[y][x][bits].<br />

wire mat trans[z][y][ bits ].<br />

int i , j, k.<br />

for i = 0..y−1 { for j = 0..x−1 { for k = 0..bits−1 { emptymat[i][j][ k] = false. } . } . } .<br />

mat1 ; word transpose bits (y, z) ; mat trans at (0,0).<br />

(mat trans, mat2, emptymat) ;<br />

cube (x, y, z, matmultcell bits clk) ;<br />

converse (tplapl 2) ;<br />

pi1 ;<br />

mat3 at (0,0).<br />

}<br />

D.3.2 Theory cube cell<br />

theory cube_cell = apr + lsh + swap + fst + rsh + apl + converse + snd:<br />

section {* Temporary definitions to support tplapl in Isabelle *}<br />

constdefs<br />

tplapr2_struct :: "((’a*’b)*’c)=>(’a*’b*’c)=>bool"<br />

"tplapr2_struct == (% ((a, b), c) (d, e, f). a = d & b = e & f = c)"<br />

tplapr2 :: "(((’a*’b)*’c)=>(’a*’b*’c)=>bool,((’a*’b)*’c)=>(’a*’b*’c)=>int)block"<br />

"tplapr2 == (| Def = tplapr2_struct, Height = % a b. (0::int), Width = % a b.<br />

(0::int) |)"<br />

tplapl2_struct :: "(’a*(’b*’c))=>(’a*’b*’c)=>bool"<br />

"tplapl2_struct == (% (a, (b, c)) (d, e, f). a = d & b = e & c = f)"<br />

tplapl2 :: "((’a*(’b*’c))=>(’a*’b*’c)=>bool,(’a*(’b*’c))=>(’a*’b*’c)=>int)block"<br />

"tplapl2 == (| Def = tplapl2_struct, Height = % a b. (0::int), Width = % a b.<br />

(0::int) |)"<br />

section {* Function definitions *}<br />

consts

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

Saved successfully!

Ooh no, something went wrong!