1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 (* ********************************************************************** *)
16 (* Progetto FreeScale *)
18 (* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *)
19 (* Sviluppo: 2008-2010 *)
21 (* ********************************************************************** *)
23 include "emulator/read_write/RS08_read_write.ma".
24 include "emulator/read_write/IP2022_read_write.ma".
26 (* in caso di RS08/IP2022 si dirotta sul filtro, altrimenti si legge direttamente *)
27 ndefinition memory_filter_read ≝
28 λm:mcu_type.λt:memory_impl.match m return λm:mcu_type.any_status m t → word32 → option byte8 with
29 [ HC05 ⇒ λs:any_status HC05 t.λaddr:word32.
30 mem_read t (mem_desc ? t s) (chk_desc ? t s) addr
31 | HC08 ⇒ λs:any_status HC08 t.λaddr:word32.
32 mem_read t (mem_desc ? t s) (chk_desc ? t s) addr
33 | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word32.
34 mem_read t (mem_desc ? t s) (chk_desc ? t s) addr
35 | RS08 ⇒ λs:any_status RS08 t.λaddr:word32.
36 RS08_memory_filter_read t s addr
37 | IP2022 ⇒ λs:any_status IP2022 t.λaddr:word32.
38 IP2022_memory_filter_read t s addr
41 ndefinition memory_filter_read_bit ≝
42 λm:mcu_type.λt:memory_impl.match m return λm:mcu_type.any_status m t → word32 → oct → option bool with
43 [ HC05 ⇒ λs:any_status HC05 t.λaddr:word32.λsub:oct.
44 mem_read_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub
45 | HC08 ⇒ λs:any_status HC08 t.λaddr:word32.λsub:oct.
46 mem_read_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub
47 | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word32.λsub:oct.
48 mem_read_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub
49 | RS08 ⇒ λs:any_status RS08 t.λaddr:word32.λsub:oct.
50 RS08_memory_filter_read_bit t s addr sub
51 | IP2022 ⇒ λs:any_status IP2022 t.λaddr:word32.λsub:oct.
52 IP2022_memory_filter_read_bit t s addr sub
55 ndefinition memory_filter_write ≝
56 λm:mcu_type.λt:memory_impl.match m
57 return λm:mcu_type.any_status m t → word32 → aux_mod_type → byte8 → option (any_status m t) with
58 [ HC05 ⇒ λs:any_status HC05 t.λaddr:word32.λflag:aux_mod_type.λval:byte8.
59 opt_map … (mem_update t (mem_desc ? t s) (chk_desc ? t s) addr val)
60 (λmem.Some ? (set_mem_desc ? t s mem))
61 | HC08 ⇒ λs:any_status HC08 t.λaddr:word32.λflag:aux_mod_type.λval:byte8.
62 opt_map … (mem_update t (mem_desc ? t s) (chk_desc ? t s) addr val)
63 (λmem.Some ? (set_mem_desc ? t s mem))
64 | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word32.λflag:aux_mod_type.λval:byte8.
65 opt_map … (mem_update t (mem_desc ? t s) (chk_desc ? t s) addr val)
66 (λmem.Some ? (set_mem_desc ? t s mem))
67 | RS08 ⇒ λs:any_status RS08 t.λaddr:word32.λflag:aux_mod_type.λval:byte8.
68 RS08_memory_filter_write t s addr val
69 | IP2022 ⇒ λs:any_status IP2022 t.λaddr:word32.λflag:aux_mod_type.λval:byte8.
70 IP2022_memory_filter_write t s addr flag val
73 ndefinition memory_filter_write_bit ≝
74 λm:mcu_type.λt:memory_impl.match m
75 return λm:mcu_type.any_status m t → word32 → oct → bool → option (any_status m t) with
76 [ HC05 ⇒ λs:any_status HC05 t.λaddr:word32.λsub:oct.λval:bool.
77 opt_map … (mem_update_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub val)
78 (λmem.Some ? (set_mem_desc ? t s mem))
79 | HC08 ⇒ λs:any_status HC08 t.λaddr:word32.λsub:oct.λval:bool.
80 opt_map … (mem_update_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub val)
81 (λmem.Some ? (set_mem_desc ? t s mem))
82 | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word32.λsub:oct.λval:bool.
83 opt_map … (mem_update_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub val)
84 (λmem.Some ? (set_mem_desc ? t s mem))
85 | RS08 ⇒ λs:any_status RS08 t.λaddr:word32.λsub:oct.λval:bool.
86 RS08_memory_filter_write_bit t s addr sub val
87 | IP2022 ⇒ λs:any_status IP2022 t.λaddr:word32.λsub:oct.λval:bool.
88 IP2022_memory_filter_write_bit t s addr sub val