summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Campbell2018-12-19 11:17:15 +0000
committerBrian Campbell2018-12-19 17:55:26 +0000
commit502e0010ae4dfe24dde9dba0174d62540f9fc993 (patch)
treeb7b4b87c9fceffead5c18f27545d6ac825648dab
parent66b55de7e24ab546aff3eba17d21b86d47306a6d (diff)
Coq: add zeros library function (used by MIPS)
-rw-r--r--lib/coq/Sail2_operators_mwords.v7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/coq/Sail2_operators_mwords.v b/lib/coq/Sail2_operators_mwords.v
index e37e9d26..809f9d89 100644
--- a/lib/coq/Sail2_operators_mwords.v
+++ b/lib/coq/Sail2_operators_mwords.v
@@ -172,6 +172,13 @@ Definition zero_extend {a} (v : mword a) (n : Z) `{ArithFact (n >= a)} : mword n
Definition sign_extend {a} (v : mword a) (n : Z) `{ArithFact (n >= a)} : mword n := exts_vec n v.
+Definition zeros (n : Z) `{ArithFact (n >= 0)} : mword n.
+refine (cast_to_mword (Word.wzero (Z.to_nat n)) _).
+unwrap_ArithFacts.
+apply Z2Nat.id.
+auto with zarith.
+Defined.
+
Lemma truncate_eq {m n} : m >= 0 -> m <= n -> (Z.to_nat n = Z.to_nat m + (Z.to_nat n - Z.to_nat m))%nat.
intros.
assert ((Z.to_nat m <= Z.to_nat n)%nat).