diff options
| author | Alasdair Armstrong | 2018-12-13 19:06:50 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-12-13 19:06:50 +0000 |
| commit | 7bbed580db0abeaa1acaa47610f01571ffe75ff4 (patch) | |
| tree | f7bf50fef4e7314604ad07645a562ae19b1fbfc6 /lib | |
| parent | 976ce06c640a61838276f8b31a9f13dbe8d6e4ec (diff) | |
Fix issue with sizeof-rewriting and monomorphisation
Sizeof-rewriting could introduce extra arguments to functions that
instantiate_simple_equations could fill in with overly complicated
types, causing unification to fail when building lem.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mono_rewrites.sail | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/mono_rewrites.sail b/lib/mono_rewrites.sail index 9e837e10..0825f9d0 100644 --- a/lib/mono_rewrites.sail +++ b/lib/mono_rewrites.sail @@ -63,7 +63,7 @@ function slice_slice_concat (xs, i, l, ys, i', l') = { extzv(xs) << l' | extzv(ys) } -val slice_zeros_concat : forall 'n 'p 'q 'r, 'r = 'p + 'q & 'n >= 0 & 'p >= 0 & 'q >= 0 & 'r >= 0. +val slice_zeros_concat : forall 'n 'p 'q 'r, 'r == 'p + 'q & 'n >= 0 & 'p >= 0 & 'q >= 0 & 'r >= 0. (bits('n), int, atom('p), atom('q)) -> bits('r) effect pure function slice_zeros_concat (xs, i, l, l') = { @@ -82,13 +82,15 @@ function subrange_subrange_eq (xs, i, j, ys, i', j') = { xs == ys } -val subrange_subrange_concat : forall 'n 'o 'p 'm 'q 'r 's, 's = 'o - ('p - 1) + 'q - ('r - 1) & 'n >= 0 & 'm >= 0. +val subrange_subrange_concat : forall 'n 'o 'p 'm 'q 'r 's, 's == 'o - ('p - 1) + 'q - ('r - 1) & 'n >= 0 & 'm >= 0. (bits('n), atom('o), atom('p), bits('m), atom('q), atom('r)) -> bits('s) effect pure function subrange_subrange_concat (xs, i, j, ys, i', j') = { let xs = (xs & slice_mask(j,i-j+1)) >> j in let ys = (ys & slice_mask(j',i'-j'+1)) >> j' in - extzv(xs) << (i' - j' + 1) | extzv(ys) + // We need to avoid sizeof-rewriting + // extzv(xs) << (i' - j' + 1) | extzv(ys) + extz_vec(i - (j - 1) + i' - (j' - 1), xs) << (i' - j' + 1) | extz_vec(i - (j - 1) + i' - (j' - 1), ys) } val place_subrange : forall 'n 'm, 'n >= 0 & 'm >= 0. |
