summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Campbell2017-10-13 17:32:13 +0100
committerBrian Campbell2017-10-13 17:32:13 +0100
commit2b4d8c715d2d8facfa376c7ee7a790ddd6d263f9 (patch)
tree28bdfac2cbd1d0ea6ac7e0513a7200832d464db3 /src
parent185ce63c05c0d3352f33ac20fff77dd52d3d563a (diff)
Make Sail_values.repeat total, and remove duplicate
Diffstat (limited to 'src')
-rw-r--r--src/gen_lib/sail_operators.lem5
-rw-r--r--src/gen_lib/sail_values.lem2
2 files changed, 1 insertions, 6 deletions
diff --git a/src/gen_lib/sail_operators.lem b/src/gen_lib/sail_operators.lem
index 7b117726..32d06caf 100644
--- a/src/gen_lib/sail_operators.lem
+++ b/src/gen_lib/sail_operators.lem
@@ -445,11 +445,6 @@ let arith_op_vec_range_no0 op sign size (Vector _ _ is_inc as l) r =
let mod_VIV = arith_op_vec_range_no0 hardware_mod false 1
-val repeat : forall 'a. list 'a -> integer -> list 'a
-let rec repeat xs n =
- if n = 0 then []
- else xs ++ repeat xs (n-1)
-
(* Assumes decreasing bit vectors *)
let duplicate (bit, length) =
Vector (repeat [bit] length) (length - 1) false
diff --git a/src/gen_lib/sail_values.lem b/src/gen_lib/sail_values.lem
index ae8a0a5b..b0de85e0 100644
--- a/src/gen_lib/sail_values.lem
+++ b/src/gen_lib/sail_values.lem
@@ -21,7 +21,7 @@ let list_append (l, r) = l ++ r
val repeat : forall 'a. list 'a -> integer -> list 'a
let rec repeat xs n =
- if n = 0 then []
+ if n <= 0 then []
else xs ++ repeat xs (n-1)
let duplicate_to_list (bit, length) = repeat [bit] length