]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/ng_assembly/emulator/model/HCS08_model.ma
mod change (-x)
[helm.git] / matita / matita / contribs / ng_assembly / emulator / model / HCS08_model.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 (* ********************************************************************** *)
16 (*                          Progetto FreeScale                            *)
17 (*                                                                        *)
18 (*   Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it              *)
19 (*   Sviluppo: 2008-2010                                                  *)
20 (*                                                                        *)
21 (* ********************************************************************** *)
22
23 include "emulator/status/status.ma".
24
25 (* *********************************** *)
26 (* IMPOSTAZIONI SPECIFICHE DEI MODELLI *)
27 (* *********************************** *)
28
29 (* modelli di HCS08 *)
30 ninductive HCS08_model : Type ≝
31   MC9S08AW60 : HCS08_model
32 | MC9S08GB60 : HCS08_model
33   (*..*).
34
35 (* memoria degli HCS08 *)
36 ndefinition memory_type_of_FamilyHCS08 ≝
37 λm:HCS08_model.match m with
38  [ MC9S08AW60 ⇒
39   [  (* astraggo molto *)
40 (* 0x0000-0x006F,0x1800-0x185F: sarebbe memory mapped IO *)
41 (* 0x0070-0x086F *)   triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x7,x0〉〉〉 〈〈x0,x8〉:〈x0,x0〉〉 MEM_READ_WRITE (* 2048B RAM *)
42 (* 0x0870-0x17FF *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x8〉:〈x7,x0〉〉〉 〈〈x0,xF〉:〈x9,x0〉〉 MEM_READ_ONLY  (* 3984B FLASH *)
43 (* 0x1860-0xFFFF *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x1,x8〉:〈x6,x0〉〉〉 〈〈xE,x7〉:〈xA,x0〉〉 MEM_READ_ONLY  (* 59296B FLASH *) ]
44  | MC9S08GB60 ⇒
45   [  (* astraggo molto *)
46 (* 0x0000-0x006F,0x1800-0x185F: sarebbe memory mapped IO *)
47 (* 0x0080-0x107F *)   triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x8,x0〉〉〉 〈〈x1,x0〉:〈x0,x0〉〉 MEM_READ_WRITE (* 4096B RAM *)
48 (* 0x1080-0x17FF *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x1,x0〉:〈x8,x0〉〉〉 〈〈x0,x7〉:〈x8,x0〉〉 MEM_READ_ONLY  (* 1920B FLASH *)
49 (* 0x182C-0xFFFF *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x1,x8〉:〈x2,xC〉〉〉 〈〈xE,x7〉:〈xD,x4〉〉 MEM_READ_ONLY  (* 59348B FLASH *) ]
50  (* etc... *)
51  ].
52
53 (* parametrizzati i non deterministici rispetto a tutti i valori casuali
54    che verranno dati dall'esterno di tipo byte8 (ndby1-2) e bool (ndbo1-5).
55    l'ACCENSIONE e' totalmente equivalente ad un reset causato da calo di tensione
56    (reset V-low), la memoria ed il check possono essere passati *)
57 ndefinition start_of_model_HCS08 ≝
58 λmcu:HCS08_model.λt:memory_impl.
59 λmem:aux_mem_type t.λchk:aux_chk_type t.
60 λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool.
61  mk_any_status HCS08 t
62   (mk_alu_HC08
63    (* acc_low: ? *) ndby1
64    (* indw_low: ? *) ndby2
65    (* indx_high: reset *)  〈x0,x0〉
66    (* sp: reset *) 〈〈x0,x0〉:〈xF,xF〉〉
67    (* pc: reset+fetch *) (mk_word16 (mem_read_abs t mem 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈xF,xF〉:〈xF,xE〉〉〉) 
68                                     (mem_read_abs t mem 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈xF,xF〉:〈xF,xF〉〉〉))
69    (* V: ? *) ndbo1
70    (* H: ? *) ndbo2
71    (* I: reset *) true
72    (* N: ? *) ndbo3
73    (* Z: ? *) ndbo4
74    (* C: ? *) ndbo5
75    (* IRQ: ? *) irqfl)
76    (* mem *) mem
77    (* chk *) chk
78    (* clk: reset *) (None ?).
79
80 (* cio' che non viene resettato mantiene il valore precedente: nella documentazione
81    viene riportato come "unaffected"/"indeterminate"/"unpredictable"
82    il soft RESET e' diverso da un calo di tensione e la ram non variera' *)
83 ndefinition reset_of_model_HCS08 ≝
84 λt:memory_impl.λs:any_status HCS08 t.
85  (mk_any_status HCS08 t
86   (mk_alu_HC08
87    (* acc_low: inv. *) (acc_low_reg_HC08 (alu ? t s))
88    (* indx_low: inv. *) (indX_low_reg_HC08 (alu ? t s))
89    (* indx_high: reset *) 〈x0,x0〉
90    (* sp: reset *) 〈〈x0,x0〉:〈xF,xF〉〉
91    (* pc: reset+fetch *) (mk_word16 (mem_read_abs t (mem_desc ? t s) 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈xF,xF〉:〈xF,xE〉〉〉)
92                                     (mem_read_abs t (mem_desc ? t s) 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈xF,xF〉:〈xF,xE〉〉〉))
93    (* V: inv. *) (v_flag_HC08 (alu ? t s))
94    (* H: inv. *) (h_flag_HC08 (alu ? t s))
95    (* I: reset *) true
96    (* N: inv. *) (n_flag_HC08 (alu ? t s))
97    (* Z: inv. *) (z_flag_HC08 (alu ? t s))
98    (* C: inv. *) (c_flag_HC08 (alu ? t s))
99    (* IRQ: inv *) (irq_flag_HC08 (alu ? t s)))
100    (* mem: inv. *) (mem_desc ? t s)
101    (* chk: inv. *) (chk_desc ? t s)
102    (* clk: reset *) (None ?)).