summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/coq/Makefile4
-rw-r--r--lib/isabelle/Makefile17
-rw-r--r--lib/rts.c15
-rw-r--r--lib/rts.h3
4 files changed, 29 insertions, 10 deletions
diff --git a/lib/coq/Makefile b/lib/coq/Makefile
index a5f2874b..6dd962d1 100644
--- a/lib/coq/Makefile
+++ b/lib/coq/Makefile
@@ -1,8 +1,8 @@
-BBV_DIR=../../../bbv/theories
+BBV_DIR?=../../../bbv
SRC=Sail2_prompt_monad.v Sail2_prompt.v Sail2_impl_base.v Sail2_instr_kinds.v Sail2_operators_bitlists.v Sail2_operators_mwords.v Sail2_operators.v Sail2_values.v Sail2_state_monad.v Sail2_state.v Sail2_string.v Sail2_real.v
-COQ_LIBS = -R . Sail -R "$(BBV_DIR)" bbv
+COQ_LIBS = -R . Sail -R "$(BBV_DIR)/theories" bbv
TARGETS=$(SRC:.v=.vo)
diff --git a/lib/isabelle/Makefile b/lib/isabelle/Makefile
index 57459b82..039a81f1 100644
--- a/lib/isabelle/Makefile
+++ b/lib/isabelle/Makefile
@@ -7,7 +7,9 @@ EXTRA_THYS = Sail2_state_monad_lemmas.thy Sail2_state_lemmas.thy \
Sail2_prompt_monad_lemmas.thy \
Sail2_operators_mwords_lemmas.thy Hoare.thy
-RISCV_DIR = ../../riscv
+LEM_ISA_LIB?=$(shell opam config var lem:share)/isabelle-lib
+
+SAIL_RISCV ?= ../../../sail-riscv
.PHONY: all heap-img clean
@@ -16,16 +18,15 @@ all: thys
thys: $(THYS)
heap-img: thys $(EXTRA_THYS) ROOT
- @echo '*** To build a heap image with the Sail library, please'
- @echo '*** add this directory to your ROOTS file'
- @echo '*** (e.g. $$HOME/.isabelle/Isabelle<version>/ROOTS)'
- @echo '*** and add the isabelle binary to your PATH.'
- isabelle build -b Sail
+ifeq ($(wildcard $(LEM_ISA_LIB)/ROOT),)
+ $(error isabelle-lib directory of Lem not found. Please set the LEM_ISA_LIB environment variable)
+endif
+ isabelle build -d $(LEM_ISA_LIB) -D .
manual: heap-img manual/Manual.thy manual/ROOT manual/document/root.tex
cp output/document/session_graph.pdf manual/document/Sail_session_graph.pdf
- make -C $(RISCV_DIR) Riscv_duopod.thy
- isabelle build -d manual -d $(RISCV_DIR) Sail-Manual
+ make -C $(SAIL_RISCV) riscv_duopod
+ isabelle build -d $(LEM_ISA_LIB) -d . -d $(SAIL_RISCV)/generated_definitions/isabelle -D manual
Sail2_instr_kinds.thy: ../../src/lem_interp/sail2_instr_kinds.lem
lem -isa -outdir . -auxiliary_level none -lib ../../src/lem_interp -lib ../../src/gen_lib $<
diff --git a/lib/rts.c b/lib/rts.c
index bc0d4732..eacf0a70 100644
--- a/lib/rts.c
+++ b/lib/rts.c
@@ -238,6 +238,21 @@ bool write_ram(const mpz_t addr_size, // Either 32 or 64
return true;
}
+sbits fast_read_ram(const int64_t data_size,
+ const uint64_t addr)
+{
+ uint64_t r = 0;
+
+ uint64_t byte;
+ for(uint64_t i = (uint64_t) data_size; i > 0; --i) {
+ byte = read_mem(addr + (i - 1));
+ r = r << 8;
+ r = r + byte;
+ }
+ sbits res = {.len = data_size * 8, .bits = r };
+ return res;
+}
+
void read_ram(lbits *data,
const mpz_t addr_size,
const mpz_t data_size_mpz,
diff --git a/lib/rts.h b/lib/rts.h
index f5e5e3b1..c7c1259f 100644
--- a/lib/rts.h
+++ b/lib/rts.h
@@ -65,6 +65,9 @@ void read_ram(lbits *data,
const lbits hex_ram,
const lbits addr_bv);
+sbits fast_read_ram(const int64_t data_size,
+ const uint64_t addr_bv);
+
unit write_tag_bool(const fbits, const bool);
bool read_tag_bool(const fbits);