source: src/LIN/joint_LTL_LIN_semantics.ma @ 1411

Last change on this file since 1411 was 1411, checked in by sacerdot, 8 years ago
  1. sem_params2 splitted into sem_params1 + sem_params2 to take out the semantics of the extended statements
  2. pointer call semantics given in RTL/semantics
File size: 3.8 KB
Line 
1include "LIN/joint_LTL_LIN.ma".
2include "joint/SemanticUtils.ma".
3
4(*CSC: re-organize to take succ_pc out of lin_more_sem_params? *)
5definition 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 it hw_register_env empty_hw_register_env 0 it 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
23definition 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
28definition ltl_lin_init_locals : unit → hw_register_env → hw_register_env ≝ λ_.λe.e.
29definition 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.
34definition 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(* The following implementation only works for functions that return 32 bits *)
39definition ltl_lin_result_regs:
40 ∀succT,succ,pointer_of_label,codeT,lookup.
41 ∀globals. genv globals (mk_params globals succT ltl_lin_params1 (codeT globals) (lookup globals)) →
42 state (ltl_lin_sem_params succT succ pointer_of_label) → res (list Register) ≝
43 λ_.λ_.λ_.λ_.λ_.λ_.λ_.λ_. OK … RegisterRets.
44
45(*CSC: XXXX, for external functions only*)
46axiom 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).
47axiom 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)).
48
49definition 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)))
50 ≝ λsuccT,succ,pointer_of_label,p,globals,ge,abs. ⊥.
51@abs qed.
52
53definition ltl_lin_more_sem_params2:
54 ∀succT,succ,pointer_of_label,codeT,lookup,fetch.
55 ∀globals. more_sem_params2 … (mk_params globals succT ltl_lin_params1 (codeT globals) (lookup globals)) ≝
56 λsuccT,succ,pointer_of_label,codeT,lookup,fetch,globals.
57  mk_more_sem_params2 …
58   (mk_more_sem_params1 … (ltl_lin_more_sem_params … succ pointer_of_label)
59    (fetch globals) (load_ra …) (ltl_lin_result_regs …)
60    ltl_lin_init_locals (ltl_lin_save_frame …) (ltl_lin_pop_frame …)
61    (ltl_lin_fetch_external_args …) (ltl_lin_set_result …)) (ltl_lin_exec_extended …).
62
63definition ltl_lin_fullexec ≝
64 λsuccT,succ,pointer_of_label,codeT,lookup,fetch.
65  joint_fullexec … (λp. ltl_lin_more_sem_params2 succT succ pointer_of_label codeT lookup fetch (prog_var_names … p)).
Note: See TracBrowser for help on using the repository browser.