Skip to content

Commit 9ed9f40

Browse files
Small remaining fixes to get symbexec tests running, disabling bigstep shortcutting for now
1 parent 1c36fa5 commit 9ed9f40

24 files changed

+287
-197
lines changed

hol/p4Syntax.sig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ val mk_arch_frame_list_regular : term -> term
298298

299299
val dest_actx :
300300
term ->
301-
term * term * term * term * term * term * term * term * term * term
301+
term * term * term * term * term * term * term * term * term * term * term * term * term
302302
val dest_astate : term -> term * term * term * term
303303
val mk_astate : term * term * term * term -> term
304304
val dest_aenv : term -> term * term * term * term

hol/p4Syntax.sml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ val (arch_frame_list_regular_tm, mk_arch_frame_list_regular, dest_arch_frame_li
377377

378378
fun dest_actx actx =
379379
case spine_pair actx of
380-
[ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_fun_map, func_map] => (ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_fun_map, func_map)
380+
[ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_fun_map, func_map, get_oracle_index, set_oracle_index, random_oracle] => (ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_fun_map, func_map, get_oracle_index, set_oracle_index, random_oracle)
381381
| _ => raise (ERR "dest_actx" ("Unsupported actx shape: "^(term_to_string actx)))
382382
;
383383
fun dest_astate astate =

hol/p4_testLib.sig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ val eval_and_print_rest : string -> term -> term -> int -> term
2222
val eval_under_assum :
2323
hol_type -> term -> term -> term list -> term list -> thm -> int -> thm
2424
val eval_under_assum_break : term -> term -> term list -> thm -> int list -> thm
25-
val dest_ascope : term -> term * term * term * term
25+
val dest_ascope : term -> term * term * term * term * term
2626
val dest_actx :
2727
term ->
28-
term * term * term * term * term * term * term * term * term * term
28+
term * term * term * term * term * term * term * term * term * term * term * term * term
2929
val debug_arch_from_step :
3030
string ->
3131
term ->
3232
term ->
3333
int ->
34-
(term * term * term * term * term * term * term * term * term * term)
34+
(term * term * term * term * term * term * term * term * term * term * term * term * term)
3535
* ((term * term * term * term) * term * term * term)
3636
val debug_frames_from_step :
3737
string ->
3838
term ->
3939
term ->
4040
int ->
41-
(term * term * term * term * term * term) *
41+
(term * term * term * term * term * term * term * term * term) *
4242
(term * term * term * term)
4343
val the_final_state : thm -> term
4444
val the_final_state_hyp_imp : thm -> term * term

hol/p4_testLib.sml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,10 @@ fun dest_ascope ascope =
376376
let
377377
val (counter, ascope') = dest_pair ascope
378378
val (ext_obj_map, ascope'') = dest_pair ascope'
379-
val (v_map, ctrl) = dest_pair ascope''
379+
val (v_map, ascope''') = dest_pair ascope''
380+
val (ctrl, oracle_index) = dest_pair ascope'''
380381
in
381-
(counter, ext_obj_map, v_map, ctrl)
382+
(counter, ext_obj_map, v_map, ctrl, oracle_index)
382383
end
383384
;
384385

@@ -394,9 +395,12 @@ fun dest_actx actx =
394395
val (copyin_pbl, actx'''''') = dest_pair actx'''''
395396
val (copyout_pbl, actx''''''') = dest_pair actx''''''
396397
val (apply_table_f, actx'''''''') = dest_pair actx'''''''
397-
val (ext_map, func_map) = dest_pair actx''''''''
398+
val (ext_map, actx''''''''') = dest_pair actx''''''''
399+
val (func_map, actx'''''''''') = dest_pair actx'''''''''
400+
val (get_oracle_index, actx''''''''''') = dest_pair actx''''''''''
401+
val (set_oracle_index, random_oracle) = dest_pair actx'''''''''''
398402
in
399-
(ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_map, func_map)
403+
(ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_map, func_map, get_oracle_index, set_oracle_index, random_oracle)
400404
end
401405
;
402406

@@ -435,7 +439,7 @@ fun debug_arch_from_step arch actx astate nsteps =
435439
val (aenv, g_scope_list, arch_frame_list, status) = dest_astate astate'
436440
(* Use the below to debug, e.g. using the executable semantics in p4_exec_semScript.sml: *)
437441
(* val (i, in_out_list, in_out_list', scope) = dest_aenv aenv *)
438-
(* val (ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_map, func_map) = dest_actx actx *)
442+
(* val (ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_map, func_map, get_oracle_index, set_oracle_index, random_oracle) = dest_actx actx *)
439443
in
440444
(dest_actx actx, (dest_aenv aenv, g_scope_list, arch_frame_list, status))
441445
end
@@ -448,7 +452,7 @@ fun debug_arch_from_step_alt arch actx astate nsteps =
448452
val (aenv, g_scope_list, arch_frame_list, status) = dest_astate astate'
449453
(* Use the below to debug, e.g. using the executable semantics in p4_exec_semScript.sml: *)
450454
(* val (i, in_out_list, in_out_list', scope) = dest_aenv aenv *)
451-
(* val (ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_map, func_map) = dest_actx actx *)
455+
(* val (ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_map, func_map, get_oracle_index, set_oracle_index, random_oracle) = dest_actx actx *)
452456
in
453457
(actx, list_mk_pair [aenv, g_scope_list, arch_frame_list, status])
454458
end
@@ -461,12 +465,12 @@ fun debug_frames_from_step arch actx astate nsteps =
461465
val astate' = eval_and_print_result arch actx astate nsteps
462466
val (aenv, g_scope_list, arch_frame_list, status) = dest_astate astate'
463467
val (i, in_out_list, in_out_list', scope) = dest_aenv aenv
464-
val (ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_map, func_map) = dest_actx actx
468+
val (ab_list, pblock_map, ffblock_map, input_f, output_f, copyin_pbl, copyout_pbl, apply_table_f, ext_map, func_map, get_oracle_index, set_oracle_index, random_oracle) = dest_actx actx
465469
val (pbl_x, pbl_el) = dest_arch_block_pbl $ rhs $ concl $ EVAL ``EL (^i) (^ab_list)``
466470
val (pbl_type, params, b_func_map, decl_list, pars_map, tbl_map) = dest_pblock $ optionSyntax.dest_some $ rhs $ concl $ EVAL ``ALOOKUP (^pblock_map) (^pbl_x)``
467471
val frame_list = dest_arch_frame_list_regular arch_frame_list
468472
in
469-
((apply_table_f, ext_map, func_map, b_func_map, pars_map, tbl_map), (scope, g_scope_list, frame_list, status))
473+
((apply_table_f, ext_map, func_map, b_func_map, pars_map, tbl_map, get_oracle_index, set_oracle_index, random_oracle), (scope, g_scope_list, frame_list, status))
470474
end
471475
;
472476

hol/p4_v1modelLib.sig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ val v1model_ffblock_map : term
2525
val v1model_ext_map : term
2626
val v1model_func_map : term
2727

28-
val dest_v1model_ascope : term -> term * term * term * term
28+
val dest_v1model_ascope : term -> term * term * term * term * term
2929

3030
val dest_v1model_register_construct_inner : term -> term * term * term * term
3131
val is_v1model_register_construct_inner : term -> bool
3232
val mk_v1model_register_construct_inner : term * term * term * term -> term
3333
val v1model_register_construct_inner_tm : term
3434

35-
val dest_v1model_register_read_inner : term -> term * term * term
35+
val dest_v1model_register_read_inner : term -> term * term * term * term * term
3636
val is_v1model_register_read_inner : term -> bool
37-
val mk_v1model_register_read_inner : term * term * term -> term
37+
val mk_v1model_register_read_inner : term * term * term * term * term -> term
3838
val v1model_register_read_inner_tm : term
3939

4040
val dest_v1model_register_write_inner : term -> term * term * term

hol/p4_v1modelLib.sml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ open p4Syntax p4_coreLib;
88

99
open p4Theory p4_coreTheory p4_v1modelTheory;
1010

11+
fun dest_quinop c e tm =
12+
case with_exn strip_comb tm e of
13+
(t, [t1, t2, t3, t4, t5]) =>
14+
if same_const t c then (t1, t2, t3, t4, t5) else raise e
15+
| _ => raise e;
16+
fun list_of_quintuple (a, b, c, d, e) = [a, b, c, d, e];
17+
fun mk_quinop tm = HolKernel.list_mk_icomb tm o list_of_quintuple;
18+
val syntax_fns5 = HolKernel.syntax_fns {n = 5, dest = dest_quinop, make = mk_quinop};
19+
1120
val v1model_arch_ty = ``:v1model_ascope``;
1221

1322
(* Architectural constants *)
@@ -88,17 +97,18 @@ fun dest_v1model_ascope v1model_ascope =
8897
let
8998
val (ext_counter, v1model_ascope') = dest_pair v1model_ascope
9099
val (ext_obj_map, v1model_ascope'') = dest_pair v1model_ascope'
91-
val (v_map, ctrl) = dest_pair v1model_ascope''
100+
val (v_map, v1model_ascope''') = dest_pair v1model_ascope''
101+
val (ctrl, oracle_index) = dest_pair v1model_ascope'''
92102
in
93-
(ext_counter, ext_obj_map, v_map, ctrl)
103+
(ext_counter, ext_obj_map, v_map, ctrl, oracle_index)
94104
end
95105
;
96106

97107
val (v1model_register_construct_inner_tm, mk_v1model_register_construct_inner, dest_v1model_register_construct_inner, is_v1model_register_construct_inner) =
98108
syntax_fns4 "p4_v1model" "v1model_register_construct_inner";
99109

100110
val (v1model_register_read_inner_tm, mk_v1model_register_read_inner, dest_v1model_register_read_inner, is_v1model_register_read_inner) =
101-
syntax_fns3 "p4_v1model" "v1model_register_read_inner";
111+
syntax_fns5 "p4_v1model" "v1model_register_read_inner";
102112

103113
val (v1model_register_write_inner_tm, mk_v1model_register_write_inner, dest_v1model_register_write_inner, is_v1model_register_write_inner) =
104114
syntax_fns3 "p4_v1model" "v1model_register_write_inner";
File renamed without changes.
File renamed without changes.
File renamed without changes.

hol/symb_exec/p4_convLib.sml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ fun same_const_disj_list [] tm = K false tm
7474

7575
(* Customized CBV_CONV for HOL4P4 evaluation *)
7676
local
77+
(* TODO: Add back in when including p4_bigstep again
7778
val list_of_thys = ["p4_aux", "p4_core", "p4_v1model", "p4_ebpf", "p4_vss", "p4_bigstep"]
79+
*)
80+
val list_of_thys = ["p4_aux", "p4_core", "p4_v1model", "p4_ebpf", "p4_vss"]
7881

7982
fun filtered_thm_names name =
8083
(not $ String.isSuffix "_aux" name) andalso

0 commit comments

Comments
 (0)