Skip to content

Commit 3759ebb

Browse files
authored
Fix compilation of the Lean backend (#914)
Sail needs to give some of the implicit arguments to Lean because they are not deducible from the type of the arguments.
1 parent 26148de commit 3759ebb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

model/riscv_insts_vext_utils.sail

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@ function write_velem_quad(vd, SEW, input, i) = {
191191
write_single_element(SEW, 4 * i + j, vd, slice(input, j * SEW, SEW));
192192
}
193193

194-
/* Extracts 8 consecutive vector elements starting from index 8*i and returns a vector */
195-
val get_velem_oct_vec : forall 'n 'm 'p, 'n > 0 & 8 <= 'm <= 64 & 'p >= 0 & 8 * 'p + 7 < 'n. (vector('n, bits('m)), int('p)) -> vector(8, bits('m))
196-
function get_velem_oct_vec(v, i) = [ v[8 * i + 7], v[8 * i + 6], v[8 * i + 5], v[8 * i + 4], v[8 * i + 3], v[8 * i + 2], v[8 * i + 1], v[8 * i] ]
194+
/* Extracts 8 consecutive vector elements starting from index 8*i and returns a
195+
* vector. The parameter n is implicit to help proof the proof assistant
196+
* backends infer its value. */
197+
val get_velem_oct_vec : forall 'n 'm 'p, 'n > 0 & 8 <= 'm <= 64 & 'p >= 0 & 8 * 'p + 7 < 'n. (implicit('n), vector('n, bits('m)), int('p)) -> vector(8, bits('m))
198+
function get_velem_oct_vec(n, v, i) = [ v[8 * i + 7], v[8 * i + 6], v[8 * i + 5], v[8 * i + 4], v[8 * i + 3], v[8 * i + 2], v[8 * i + 1], v[8 * i] ]
197199

198200
/* Writes each of the 8 elements from the input vector to the vector register vd, starting at position 8 * i */
199201
val write_velem_oct_vec : forall 'p 'n, 8 <= 'n <= 64 & 'p >= 0. (vregidx, int('n), vector(8, bits('n)), int('p)) -> unit
@@ -490,8 +492,9 @@ function count_leadingzeros (sig, len) = {
490492
len - idx - 1
491493
}
492494

493-
val vrev8 : forall 'n 'm, 'n >= 0 & 'm >= 0. (vector('n, bits('m * 8))) -> vector('n, bits('m * 8))
494-
function vrev8(input) = {
495+
/* The parameter m is implicit to help proof the proof assistant backends infer its value. */
496+
val vrev8 : forall 'n 'm, 'n >= 0 & 'm >= 0. (implicit('m), vector('n, bits('m * 8))) -> vector('n, bits('m * 8))
497+
function vrev8(m, input) = {
495498
var output : vector('n, bits('m * 8)) = input;
496499
foreach (i from 0 to ('n - 1)) {
497500
output[i] = rev8(input[i]);

0 commit comments

Comments
 (0)