1 | include "LIN/joint_LTL_LIN.ma". |
---|
2 | include "joint/SemanticUtils.ma". |
---|
3 | |
---|
4 | (*CSC: re-organize to take succ_pc out of lin_more_sem_params? *) |
---|
5 | definition ltl_lin_more_sem_params: ∀succT,succ,pointer_of_label. more_sem_params (mk_params_ ltl_lin_params__ succT) := |
---|
6 | λsuccT,succ,pointer_of_label. |
---|
7 | mk_more_sem_params ? |
---|
8 | unit hw_register_env succ |
---|
9 | hwreg_store hwreg_retrieve (λ_.hwreg_store RegisterA) (λe.λ_.hwreg_retrieve e RegisterA) |
---|
10 | (λ_.hwreg_store RegisterB) (λe.λ_.hwreg_retrieve e RegisterB) |
---|
11 | (λ_.hwreg_store RegisterDPL) (λe.λ_.hwreg_retrieve e RegisterDPL) |
---|
12 | (λ_.hwreg_store RegisterDPH) (λe.λ_.hwreg_retrieve e RegisterDPH) |
---|
13 | (λlocals,dest_src. |
---|
14 | match dest_src with |
---|
15 | [ from_acc reg ⇒ |
---|
16 | do v ← hwreg_retrieve locals RegisterA ; |
---|
17 | hwreg_store reg v locals |
---|
18 | | to_acc reg ⇒ |
---|
19 | do v ← hwreg_retrieve locals reg ; |
---|
20 | hwreg_store RegisterA v locals ]) |
---|
21 | pointer_of_label. |
---|
22 | |
---|
23 | definition ltl_lin_sem_params: |
---|
24 | ∀succT,succ,pointer_of_label. sem_params ≝ |
---|
25 | λsuccT,succ,pointer_of_label.mk_sem_params … (ltl_lin_more_sem_params succT succ pointer_of_label). |
---|
26 | |
---|
27 | |
---|
28 | definition ltl_lin_init_locals : unit → hw_register_env → hw_register_env ≝ λ_.λe.e. |
---|
29 | definition ltl_lin_pop_frame: |
---|
30 | ∀succT,succ,pointer_of_label,codeT,lookup. |
---|
31 | ∀globals. genv globals (mk_params globals succT ltl_lin_params1 (codeT globals) (lookup globals)) → |
---|
32 | state … (ltl_lin_sem_params succT succ pointer_of_label) → res (state … (ltl_lin_sem_params … succ pointer_of_label)) ≝ |
---|
33 | λ_.λ_.λ_.λ_.λ_.λ_.λ_.λt.OK … t. |
---|
34 | definition ltl_lin_save_frame: |
---|
35 | ∀succT,succ,pointer_of_label. address → nat → unit → nat → unit → state … (ltl_lin_sem_params succT succ pointer_of_label) → res (state … (ltl_lin_sem_params … succ pointer_of_label)) ≝ |
---|
36 | λ_.λ_.λ_.λl.λ_.λ_.λ_.λ_.λst.save_ra … st l. |
---|
37 | |
---|
38 | definition ltl_lin_more_sem_params1 : ∀succT,succ,pointer_of_label.more_sem_params1 … ltl_lin_params1 ≝ |
---|
39 | λsuccT,succ,pointer_of_label. |
---|
40 | mk_more_sem_params1 ? ltl_lin_params1 (ltl_lin_more_sem_params succT succ pointer_of_label) |
---|
41 | ltl_lin_init_locals (ltl_lin_save_frame …). |
---|
42 | |
---|
43 | (*CSC: XXXXX, for is_final only *) |
---|
44 | axiom ltl_lin_fetch_result: |
---|
45 | ∀succT,succ,pointer_of_label,codeT,lookup. |
---|
46 | ∀globals. genv globals (mk_params globals succT ltl_lin_params1 (codeT globals) (lookup globals)) → |
---|
47 | state (ltl_lin_sem_params succT succ pointer_of_label) → res (list beval). |
---|
48 | |
---|
49 | (*CSC: XXXX, for external functions only*) |
---|
50 | axiom ltl_lin_fetch_external_args: ∀succT,succ,pointer_of_label.external_function → state (ltl_lin_sem_params succT succ pointer_of_label) → res (list val). |
---|
51 | axiom ltl_lin_set_result: ∀succT,succ,pointer_of_label.list val → state (ltl_lin_sem_params succT succ pointer_of_label) → res (state (ltl_lin_sem_params … succ pointer_of_label)). |
---|
52 | |
---|
53 | definition ltl_lin_exec_extended: ∀succT,succ,pointer_of_label.∀p.∀globals. genv globals (p globals) → False → succT → state (ltl_lin_sem_params succT succ pointer_of_label) → IO io_out io_in (trace × (state (ltl_lin_sem_params … succ pointer_of_label))) |
---|
54 | ≝ λsuccT,succ,pointer_of_label,p,globals,ge,abs. ⊥. |
---|
55 | @abs qed. |
---|
56 | |
---|
57 | definition ltl_lin_more_sem_params2: |
---|
58 | ∀succT,succ,pointer_of_label,codeT,lookup,fetch. |
---|
59 | ∀globals. more_sem_params2 … (mk_params globals succT ltl_lin_params1 (codeT globals) (lookup globals)) ≝ |
---|
60 | λsuccT,succ,pointer_of_label,codeT,lookup,fetch,globals. |
---|
61 | mk_more_sem_params2 … (ltl_lin_more_sem_params1 … succ pointer_of_label) |
---|
62 | (fetch globals) (load_ra …) (ltl_lin_fetch_result …) (ltl_lin_pop_frame …) |
---|
63 | (ltl_lin_fetch_external_args …) (ltl_lin_set_result …) (ltl_lin_exec_extended …). |
---|
64 | |
---|
65 | definition ltl_lin_fullexec ≝ |
---|
66 | λsuccT,succ,pointer_of_label,codeT,lookup,fetch. |
---|
67 | joint_fullexec … (λp. ltl_lin_more_sem_params2 succT succ pointer_of_label codeT lookup fetch (prog_var_names … p)). |
---|