Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
24bd197
use Karamel master branch
tahina-pro Jul 1, 2026
dc47714
advance Karamel
tahina-pro Jul 1, 2026
bf12726
isolate 3d-prelude-verify rule
tahina-pro Jul 1, 2026
7c200e2
use KRML_EXE instead of KRML_HOME
tahina-pro Apr 3, 2026
f678339
(Low* only) Determine path to krmllib, krmlinclude
tahina-pro Jul 1, 2026
f1dd053
$(KRML_HOME)/krml -> $(KRML_EXE)
tahina-pro Jun 27, 2026
e53f145
do not use krml_home in EverCDDL, rely on krml -locate options instead
tahina-pro Jun 27, 2026
8611b1f
remove KRML_HOME from package.sh, do not copy krml misc for now
tahina-pro Jul 1, 2026
e6b7498
remove KRML_HOME from everparse package scripts
tahina-pro Jul 1, 2026
d612f1f
(Low* only) add krmllib to F* include path
tahina-pro Jul 2, 2026
7c2f256
(Low* only) ensure krmllib/C.fst is extracted
tahina-pro Jul 2, 2026
78cff49
remove KRML_HOME from Makefiles
tahina-pro Jul 2, 2026
2d5e81f
(master only) krml has its own opt location
tahina-pro Jul 1, 2026
c5ffcc2
(Low* only) cddl-tool: unify uses of krml_lib
tahina-pro Jul 1, 2026
7e08962
remove KRML_HOME from 3d.exe
tahina-pro Jul 1, 2026
c6423d1
(master only) 3d: karamel has its own opt path
tahina-pro Jul 2, 2026
889e316
remove KRML_HOME from 3d/version.sh
tahina-pro Jul 1, 2026
ae28dd1
run the command krml -locate!
tahina-pro Jun 27, 2026
e3eb1ca
run the command krml -locate in 3d!
tahina-pro Jul 2, 2026
947999d
EverCDDL: remove `krml -locate` tmpfile
tahina-pro Jul 2, 2026
06c2a26
CBOR, COSE snapshot
tahina-pro Jul 2, 2026
165f13c
3D doc snapshot
tahina-pro Jul 2, 2026
dd4775f
KRML_EXE must be an .exe on Windows
tahina-pro Jul 2, 2026
2ca882c
(master only) deps.Makefile: unset KRML_EXE when building Karamel
tahina-pro Jul 2, 2026
835c443
(Low* only) build and install Karamel manually (because of poor handl…
tahina-pro Jul 2, 2026
05c4def
copy karamel misc into the package
tahina-pro Jul 2, 2026
294bfeb
select the x86_64 libgmp10.dll
tahina-pro Jun 25, 2026
575439a
Sys.cygwin -> Sys.win32
tahina-pro Jul 3, 2026
b6e3d33
3D: set KRML_EXE when invoking `make` with Makefile.basic
tahina-pro Jul 3, 2026
6cd68ac
Update hashes
dzomo Jul 3, 2026
bcd9b8e
3D doc, CBOR, COSE snapshot
dzomo Jul 3, 2026
fa78ec5
set KRML_LIBDIR and KRML_INCLUDEDIR directly
tahina-pro Jul 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ lowparse: $(filter src/lowparse/pulse/%,$(ALL_CHECKED_FILES))
endif

# lowparse needed because of .fst behind .fsti for extraction
3d-prelude: $(filter src/3d/prelude/%,$(ALL_CHECKED_FILES)) $(filter-out src/lowparse/LowParse.SLow.% src/lowparse/pulse/%,$(filter src/lowparse/%,$(ALL_CHECKED_FILES)))
3d-prelude-verify: $(filter src/3d/prelude/%,$(ALL_CHECKED_FILES)) $(filter-out src/lowparse/LowParse.SLow.% src/lowparse/pulse/%,$(filter src/lowparse/%,$(ALL_CHECKED_FILES)))

.PHONY: 3d-prelude-verify

3d-prelude: 3d-prelude-verify
+$(MAKE) -C src/3d/prelude

.PHONY: 3d-prelude
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ variables:
`EVERPARSE_USE_OPAMROOT=1`.

* If you want to use your own Karamel, first set
`EVERPARSE_USE_KRML_HOME=1`, then set `KRML_HOME` to the full path
of your clone of the Karamel repository. This will automatically set
`EVERPARSE_USE_KRML_EXE=1`, then set `KRML_EXE` to the full path
of the Karamel executable. This will automatically set
`EVERPARSE_USE_FSTAR_HOME=1`, since the Karamel library must be
compiled with the same F\* as EverParse.

Expand Down
30 changes: 22 additions & 8 deletions deps.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@ EVERPARSE_Z3_VERSION ?= 4.13.3
ifeq (1,$(EVERPARSE_USE_MY_DEPS))
export EVERPARSE_USE_OPAMROOT:=1
export EVERPARSE_USE_FSTAR_EXE:=1
export EVERPARSE_USE_KRML_HOME:=1
export EVERPARSE_USE_KRML_EXE:=1
export EVERPARSE_USE_PULSE_HOME:=1
endif

NEED_KRML :=
ifneq (1,$(EVERPARSE_USE_KRML_HOME))
export KRML_HOME := $(EVERPARSE_OPT_PATH)/karamel
ifneq (1,$(EVERPARSE_USE_KRML_EXE))
ifeq ($(OS),Windows_NT)
export KRML_EXE := $(EVERPARSE_OPT_PATH)/karamel/out/bin/krml.exe
else
export KRML_EXE := $(EVERPARSE_OPT_PATH)/karamel/out/bin/krml
endif
NEED_KRML := $(EVERPARSE_OPT_PATH)/karamel.done
else
export EVERPARSE_USE_FSTAR_EXE:=1
ifeq (,$(KRML_HOME))
ifeq (,$(KRML_EXE))
# TODO: fix Karamel to not require KRML_HOME set
$(error "Inconsistent setup: EVERPARSE_USE_KRML_HOME set but KRML_HOME not set")
$(error "Inconsistent setup: EVERPARSE_USE_KRML_EXE set but KRML_EXE not set")
endif
endif

Expand Down Expand Up @@ -145,9 +149,19 @@ $(EVERPARSE_OPT_PATH)/z3: $(EVERPARSE_OPT_PATH)/FStar/Makefile
mv $@.tmp $@
touch $@

# NOTE: we unset KRML_EXE here so that Karamel's own build (in particular
# krmllib) uses the freshly-built in-tree `krml` (../krml) instead of the
# not-yet-installed $(EVERPARSE_OPT_PATH)/karamel/out/bin/krml that we export
# below for EverParse. Otherwise krmllib's `KRML_EXE ?= ../krml` picks up our
# exported value and fails with "No rule to make target .../out/bin/krml".
$(EVERPARSE_OPT_PATH)/karamel.done: $(EVERPARSE_OPT_PATH)/karamel/Makefile $(NEED_FSTAR) $(NEED_OPAM)
rm -f $@
+$(with_opam) env OTHERFLAGS='--admit_smt_queries true' $(MAKE) -C $(EVERPARSE_OPT_PATH)/karamel
+$(with_opam) env -u KRML_EXE OTHERFLAGS='--admit_smt_queries true' $(MAKE) -C $(EVERPARSE_OPT_PATH)/karamel minimal
+$(with_opam) env -u KRML_EXE OTHERFLAGS='--admit_smt_queries true' KRML_LIBDIR="$(EVERPARSE_OPT_PATH)/karamel/krmllib" KRML_INCLUDEDIR="$(EVERPARSE_OPT_PATH)/karamel/include" KRML_MISCDIR="$(EVERPARSE_OPT_PATH)/karamel/misc" $(MAKE) -C "$(EVERPARSE_OPT_PATH)/karamel/krmllib"
+$(with_opam) env -u KRML_EXE $(MAKE) -C "$(EVERPARSE_OPT_PATH)/karamel" _install PREFIX="$(EVERPARSE_OPT_PATH)/karamel/out"
ifeq ($(OS),Windows_NT)
mv "$(EVERPARSE_OPT_PATH)/karamel/out/bin/krml" "$(EVERPARSE_OPT_PATH)/karamel/out/bin/krml.exe"
endif
touch $@

$(EVERPARSE_OPT_PATH)/pulse.done: $(EVERPARSE_OPT_PATH)/pulse/Makefile $(NEED_FSTAR) $(NEED_OPAM)
Expand All @@ -158,10 +172,10 @@ $(EVERPARSE_OPT_PATH)/pulse.done: $(EVERPARSE_OPT_PATH)/pulse/Makefile $(NEED_FS
env:
@echo export EVERPARSE_USE_OPAMROOT=$(EVERPARSE_USE_OPAMROOT)
@echo export EVERPARSE_USE_FSTAR_EXE=$(EVERPARSE_USE_FSTAR_EXE)
@echo export EVERPARSE_USE_KRML_HOME=$(EVERPARSE_USE_KRML_HOME)
@echo export EVERPARSE_USE_KRML_EXE=$(EVERPARSE_USE_KRML_EXE)
@echo export EVERPARSE_USE_PULSE_HOME=$(EVERPARSE_USE_PULSE_HOME)
@echo export FSTAR_EXE=$(FSTAR_EXE)
@echo export KRML_HOME=$(KRML_HOME)
@echo export KRML_EXE=$(KRML_EXE)
ifeq (,$(NO_PULSE))
@echo export PULSE_HOME=$(PULSE_HOME)
endif
Expand Down
3 changes: 1 addition & 2 deletions doc/3d-snapshot/BoundedSumConst.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ BoundedSumConstValidateBoundedSum(
uint32_t right_refinement = Load32Le(Input + (uint32_t)positionAfterleft);
/* start: checking constraint */
BOOLEAN
right_refinementConstraintIsOk =
left <= (uint32_t)42U && right_refinement <= ((uint32_t)42U - left);
right_refinementConstraintIsOk = left <= 42U && right_refinement <= ((uint32_t)42U - left);
/* end: checking constraint */
positionAfterBoundedSum0 =
EverParseCheckConstraintOk(right_refinementConstraintIsOk,
Expand Down
2 changes: 1 addition & 1 deletion doc/3d-snapshot/BoundedSumWhere.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ BoundedSumWhereValidateBoundedSum(
}
else
{
BOOLEAN preconditionConstraintIsOk = Bound <= (uint32_t)1729U;
BOOLEAN preconditionConstraintIsOk = Bound <= 1729U;
uint64_t
positionAfterPrecondition1 =
EverParseCheckConstraintOk(preconditionConstraintIsOk,
Expand Down
3 changes: 1 addition & 2 deletions doc/3d-snapshot/EnumConstraint.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ EnumConstraintValidateEnumConstraint(
/* reading field_value */
uint32_t x_refinement = Load32Le(Input + (uint32_t)positionAftercol1);
/* start: checking constraint */
BOOLEAN
x_refinementConstraintIsOk = x_refinement == (uint32_t)0U || col == ENUMCONSTRAINT_GREEN;
BOOLEAN x_refinementConstraintIsOk = x_refinement == 0U || col == ENUMCONSTRAINT_GREEN;
/* end: checking constraint */
positionAfterEnumConstraint0 =
EverParseCheckConstraintOk(x_refinementConstraintIsOk,
Expand Down
2 changes: 1 addition & 1 deletion doc/3d-snapshot/Smoker.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SmokerValidateSmoker(
else
{
uint32_t age = Load32Le(Input + (uint32_t)StartPosition);
BOOLEAN ageConstraintIsOk = age >= (uint32_t)21U;
BOOLEAN ageConstraintIsOk = age >= 21U;
uint64_t positionAfterage1 = EverParseCheckConstraintOk(ageConstraintIsOk, positionAfterage);
if (EverParseIsError(positionAfterage1))
{
Expand Down
6 changes: 3 additions & 3 deletions doc/3d-snapshot/SpecializeDep1.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ ValidateWrapper(
uint64_t readOffset = 0ULL;
uint64_t writeOffset = 0ULL;
BOOLEAN failed = FALSE;
BOOLEAN ok = ProbeInit("_WRAPPER.tlv", (uint64_t)Len, Output);
BOOLEAN ok = ProbeInit("_WRAPPER.tlv", (uint64_t)(uint32_t)Len, Output);
if (ok)
{
ProbeTlv((uint32_t)Len - (uint32_t)(uint16_t)5U,
Expand All @@ -562,7 +562,7 @@ ValidateWrapper(
&writeOffset,
&failed,
src64,
(uint64_t)Len,
(uint64_t)(uint32_t)Len,
Output);
}
else
Expand Down Expand Up @@ -711,7 +711,7 @@ ValidateSpecializedWrapper32(
uint64_t readOffset = 0ULL;
uint64_t writeOffset = 0ULL;
BOOLEAN failed = FALSE;
BOOLEAN ok = ProbeInit("___specialized_WRAPPER_32.tlv", (uint64_t)Len, Output);
BOOLEAN ok = ProbeInit("___specialized_WRAPPER_32.tlv", (uint64_t)(uint32_t)Len, Output);
if (ok)
{
Specialized32ProbeTlv((uint32_t)Len - (uint32_t)(uint16_t)5U,
Expand Down
2 changes: 0 additions & 2 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export EVERPARSE_HOME?=$(realpath ..)

FSTAR_EXE ?= fstar.exe

export KRML_HOME?=$(realpath $(EVERPARSE_HOME)/../karamel)

3D=$(EVERPARSE_HOME)/bin/3d.exe --fstar $(FSTAR_EXE)
3D_EXCLUDE=ConstColor.3d
3D_CONFIG=Arch.3d.config
Expand Down
8 changes: 7 additions & 1 deletion fstar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ set -e
unset CDPATH
EVERPARSE_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$EVERPARSE_HOME"/env.sh
exec "$FSTAR_EXE" --z3version $EVERPARSE_Z3_VERSION --include "$KRML_HOME/krmllib" --include "$KRML_HOME/krmllib/obj" --include "$PULSE_HOME/lib/pulse" "$@"
if [[ -z "$KRML_LIB" ]] ; then
KRML_LIB="$("$KRML_EXE" -locate-krmllib)"
fi
if [[ "$OS" = Windows_NT ]] ; then
KRML_LIB="$(cygpath -m "$(echo "$KRML_LIB" | sed 's!\r!!g')")"
fi
exec "$FSTAR_EXE" --z3version $EVERPARSE_Z3_VERSION --include "$KRML_LIB" --include "$KRML_LIB"/obj --include "$PULSE_HOME/lib/pulse" "$@"
2 changes: 1 addition & 1 deletion opt/advance.Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FStar_hash := origin/fstar1
karamel_hash := origin/everparse-fstar1
karamel_hash := origin/master
pulse_hash := origin/fstar1
6 changes: 3 additions & 3 deletions opt/hashes.Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FStar_hash := a22c99321085c847012759d062e718db55aed01d
karamel_hash := 5b4384116d96ca9af7732d2f7d1fe3b5284d421f
pulse_hash := 74bb5a472cf0f0ef5e2eb2262a3411349efa21cc
FStar_hash := de9d045cbfa5d0dc456fbeae04389c3d98a59347
karamel_hash := 11bb8e1ac2f720fb7144b9b768c7251526caa149
pulse_hash := 8b5f45df8ccbccba122742c5ae6e6d2925dde09f
2 changes: 1 addition & 1 deletion share/everparse/tests/lowparse/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ifeq ($(OS),Darwin)
KRML_OPTS += -ccopt -Wno-tautological-constant-out-of-range-compare
endif

KRML=$(KRML_HOME)/krml -fstar $(FSTAR_EXE) $(KRML_OPTS)
KRML=$(KRML_EXE) -fstar $(FSTAR_EXE) $(KRML_OPTS)

EXAMPLES=Example3 ExampleConstInt32le Example2 Example5 Example7 Example8 Example9 Example10 Example11 Example12 ExampleDepLen

Expand Down
7 changes: 3 additions & 4 deletions share/everparse/tests/qd/unit/extracted.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ EVERPARSE_HOME ?= $(realpath ../../../../../..)
EVERPARSE_SRC_PATH ?= $(EVERPARSE_HOME)/src

LOWPARSE_HOME ?= $(EVERPARSE_SRC_PATH)/lowparse
KRML_HOME ?= $(EVERPARSE_HOME)/opt/karamel

include $(EVERPARSE_SRC_PATH)/karamel.Makefile
include $(EVERPARSE_SRC_PATH)/fstar.Makefile

export FSTAR_EXE
export LOWPARSE_HOME
export KRML_HOME

ifdef NO_QD_VERIFY
LAX_EXT=.lax
Expand All @@ -24,7 +23,7 @@ CHECKED_EXT=.checked$(LAX_EXT)

FSTAR_OPTIONS += --odir krml --cache_dir $(CACHE_DIR) $(LAX_OPT) --cache_checked_modules \
--already_cached +Prims,+FStar,+LowStar,+C,+Spec.Loops,+LowParse \
--include $(LOWPARSE_HOME) --include $(LOWPARSE_HOME)/pulse --include $(PULSE_HOME)/lib/pulse --include $(KRML_HOME)/krmllib --include $(KRML_HOME)/krmllib/obj --include .. --cmi --ext context_pruning \
--include $(LOWPARSE_HOME) --include $(LOWPARSE_HOME)/pulse --include $(PULSE_HOME)/lib/pulse --include .. --cmi --ext context_pruning \
--ext 'optimize_let_vc=false' \
--warn_error '@272'

Expand All @@ -37,7 +36,7 @@ KRML_OPTS += -ccopt -Wno-tautological-constant-out-of-range-compare
endif

# -Wno-tautological-overlap-compare because of T32
KRML = $(KRML_HOME)/krml \
KRML = $(KRML_EXE) \
-fstar $(FSTAR_EXE) \
-ccopt "-O3" -ccopt "-ffast-math" \
-ccopt "-Wno-tautological-overlap-compare" \
Expand Down
3 changes: 3 additions & 0 deletions src/3d/Batch.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ module Batch
open HashingOptions
open FStar.All

val krmllib: string -> ML string
val krmlinclude: string -> ML string

val cl_wrapper: unit -> ML string

(* The --print_in_place step has to be performed at source generation
Expand Down
2 changes: 1 addition & 1 deletion src/3d/Main.fst
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ let build_test_exe
end else
if not (Options.get_skip_c_makefiles ())
then begin
OS.run_cmd "make" ["-C"; out_dir; "-f"; "Makefile.basic"; "USER_TARGET=test.exe"; "USER_CFLAGS=-Wno-type-limits"]
OS.run_cmd "make" ["-C"; out_dir; "-f"; "Makefile.basic"; "USER_TARGET=test.exe"; "USER_CFLAGS=-Wno-type-limits"; "KRML_LIBDIR=" ^ Batch.krmllib out_dir; "KRML_INCLUDEDIR=" ^ Batch.krmlinclude out_dir]
end

let build_and_run_test_exe
Expand Down
Loading
Loading