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

APPENDIX C. PLACED COMBINATOR LIBRARIES 232 . 0 ’t31=>bool,int=>’t31=>’t31=>int) block)) (d::(’t31)vector) (r::(’t31)vector). [| n >= 0 ; ALL (qs148::int) (qs149 ::’t31) (qs150::’t31). 0 bool,int=>’t31=>’t31=>int) block)) (d::(’t31)vector) (r::(’t31)vector). [| n >= 0 ; ALL (qs148::int) (qs149 ::’t31) (qs150::’t31). 0 bool,int=>’t31=>’t31=>int)block)) (d::(’ t31)vector) (r::(’t31)vector). [| n >= 0 ; if n = 0 then d = r else Def (d ;;; converse $ (apr $ (n - 1)) ;; [[ imap $ (n - 1, R), R $ n ]] ;; apr $ (n - 1) ;;; r) ; ALL (qs148::int) (qs149::’t31) (qs150::’t31). 0

APPENDIX C. PLACED COMBINATOR LIBRARIES 233 /∗∗ Row of R blocks with left inputs connected to right outputs of previous block. Supply increasing integer parameter from 0 to n−1. ∗/ block irow (int n, block R int (‘a, ‘b) ∼ (‘c, ‘a)) (‘a l , ‘b t[n]) ∼ (‘c b[n], ‘a r) attributes { height = if(n==0, 0, height((l, t) ; snd (converse (apr (n − 1))) ; beside (irow (n−1, R), R n) ; fst (apr (n−1)) ; (b, r))). width = if(n==0, 0, width((l, t) ;snd (converse (apr (n − 1))) ; beside (irow (n−1, R), R n) ; fst (apr (n−1)) ; (b, r))). } { // Wires: l = left, t = top, b = bottom, r = right assert (n >= 0) ”n >= 0 is required”. if (n == 0) { l = r. } // b and t are empty vectors anyway else { (l , t) ; snd (converse (apr (n − 1))) ; beside (irow (n−1, R), R n) ; fst (apr (n−1)) ; (b, r) at (0,0). } . } theory irow = fst + beside + apr + converse + snd: section {* Function definitions *} consts struct:: "nat=>((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’ t109*’t107)=>int)block)=>’t107=>(’t108)vector=>(’t109)vector=>’t107=>bool" height:: "nat=>((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’ t109*’t107)=>int)block)=>’t107=>(’t108)vector=>(’t109)vector=>’t107=>int" width:: "nat=>((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’ t109*’t107)=>int)block)=>’t107=>(’t108)vector=>(’t109)vector=>’t107=>int" irow:: "((int*((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’ t109*’t107)=>int)block))=>(’t107*(’t108)vector)=>((’t109)vector*’t107)=>bool, (int*((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’t109*’ t107)=>int)block))=>(’t107*(’t108)vector)=>((’t109)vector*’t107)=>int)block" defs irow_def: "irow == (| Def = % (n, R) (l, t) (b, r). struct (int2nat n) R l t b r, Height = % (n, R) (l, t) (b, r). height (int2nat n) R l t b r, Width = % (n, R) (l, t) (b, r). width (int2nat n) R l t b r |)" primrec "struct 0 R l t b r = (l = r)" "struct (Suc n) R l t b r = Def beside (((| Def = % (l, t) (b, r). struct n R l t b r, Height = % a b. arbitrary, Width = % a b. arbitrary|)), R $ (int (Suc n))) (l, (t, t)) ((b, b< int n>), r)" primrec "height 0 R l t b r = 0" "height (Suc n) R l t b r = Height beside (((| Def = % a b. arbitrary,

APPENDIX C. PLACED COMBINATOR LIBRARIES 233<br />

/∗∗ Row <strong>of</strong> R blocks <strong>with</strong> left inputs connected to right outputs <strong>of</strong> previous block.<br />

Supply increasing integer parameter from 0 to n−1. ∗/<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))) ; beside (irow (n−1, R),<br />

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

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

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 />

theory irow = fst + beside + apr + converse + snd:<br />

section {* Function definitions *}<br />

consts<br />

struct:: "nat=>((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’<br />

t109*’t107)=>int)block)=>’t107=>(’t108)vector=>(’t109)vector=>’t107=>bool"<br />

height:: "nat=>((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’<br />

t109*’t107)=>int)block)=>’t107=>(’t108)vector=>(’t109)vector=>’t107=>int"<br />

width:: "nat=>((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’<br />

t109*’t107)=>int)block)=>’t107=>(’t108)vector=>(’t109)vector=>’t107=>int"<br />

irow:: "((int*((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’<br />

t109*’t107)=>int)block))=>(’t107*(’t108)vector)=>((’t109)vector*’t107)=>bool,<br />

(int*((int=>(’t107*’t108)=>(’t109*’t107)=>bool,int=>(’t107*’t108)=>(’t109*’<br />

t107)=>int)block))=>(’t107*(’t108)vector)=>((’t109)vector*’t107)=>int)block"<br />

defs<br />

irow_def: "irow == (| Def = % (n, R) (l, t) (b, r). struct (int2nat n) R l t b r,<br />

Height = % (n, R) (l, t) (b, r). height (int2nat n) R l t b r, Width = % (n,<br />

R) (l, t) (b, r). width (int2nat n) R l t b r |)"<br />

primrec<br />

"struct 0 R l t b r = (l = r)"<br />

"struct (Suc n) R l t b r =<br />

Def beside<br />

(((| Def = % (l, t) (b, r). struct n R l t b r,<br />

Height = % a b. arbitrary,<br />

Width = % a b. arbitrary|)),<br />

R $ (int (Suc n))) (l, (t, t)) ((b, b<<br />

int n>), r)"<br />

primrec<br />

"height 0 R l t b r = 0"<br />

"height (Suc n) R l t b r =<br />

Height beside<br />

(((| Def = % a b. arbitrary,

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

Saved successfully!

Ooh no, something went wrong!