]> matita.cs.unibo.it Git - helm.git/blob - matitaB/matita/contribs/ng_assembly/emulator/model/RS08_model.ma
618b2ace0caba93794e4675d6ee5a3079a8779f9
[helm.git] / matitaB / matita / contribs / ng_assembly / emulator / model / RS08_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 RS08 *)
30 ninductive RS08_model : Type ≝
31   MC9RS08KA1 : RS08_model
32 | MC9RS08KA2 : RS08_model.
33
34 (* memoria dei RS08 *)
35 ndefinition memory_type_of_FamilyRS08 ≝
36 λm:RS08_model.match m with
37  [ MC9RS08KA1 ⇒
38   [
39 (* 0x0000-0x000E *)   triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x0,x0〉〉〉 〈〈x0,x0〉:〈x0,xF〉〉 MEM_READ_WRITE (* 15B RAM *)
40 (* 0x0010-0x001E *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x1,x0〉〉〉 〈〈x0,x0〉:〈x0,xF〉〉 MEM_READ_WRITE (* 15B MEMORY MAPPED IO *)
41 (* 0x0020-0x004F *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x2,x0〉〉〉 〈〈x0,x0〉:〈x3,x0〉〉 MEM_READ_WRITE (* 48B RAM *)
42 (* 0x00C0-0x00FF *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈xC,x0〉〉〉 〈〈x0,x0〉:〈x4,x0〉〉 MEM_READ_WRITE (* 64B RAM PAGING *)
43 (* 0x0200-0x023F *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x2〉:〈x0,x0〉〉〉 〈〈x0,x0〉:〈x4,x0〉〉 MEM_READ_WRITE (* 64B MEMORY MAPPED IO *)
44 (* 0x3C00-0x3FFF *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x3,xC〉:〈x0,x0〉〉〉 〈〈x0,x4〉:〈x0,x0〉〉 MEM_READ_ONLY  (* 1024B FLASH *) ]
45   | MC9RS08KA2 ⇒
46    [ 
47 (* 0x0000-0x000E *)   triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x0,x0〉〉〉 〈〈x0,x0〉:〈x0,xF〉〉 MEM_READ_WRITE (* 15B RAM *)
48 (* 0x0010-0x001E *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x1,x0〉〉〉 〈〈x0,x0〉:〈x0,xF〉〉 MEM_READ_WRITE (* 15B MEMORY MAPPED IO *)
49 (* 0x0020-0x004F *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x2,x0〉〉〉 〈〈x0,x0〉:〈x3,x0〉〉 MEM_READ_WRITE (* 48B RAM *)
50 (* 0x00C0-0x00FF *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈xC,x0〉〉〉 〈〈x0,x0〉:〈x4,x0〉〉 MEM_READ_WRITE (* 64B RAM PAGING *)
51 (* 0x0200-0x023F *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x2〉:〈x0,x0〉〉〉 〈〈x0,x0〉:〈x4,x0〉〉 MEM_READ_WRITE (* 64B MEMORY MAPPED IO *)
52 (* 0x3800-0x3FFF *) ; triple … 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x3,x8〉:〈x0,x0〉〉〉 〈〈x0,x8〉:〈x0,x0〉〉 MEM_READ_ONLY  (* 2048B FLASH *) ]
53   ].
54
55 (* parametrizzati i non deterministici rispetto a tutti i valori casuali
56    che verranno dati dall'esterno di tipo byte8 (ndby1-2) e bool (ndbo1-5).
57    l'ACCENSIONE e' totalmente equivalente ad un reset causato da calo di tensione
58    (reset V-low), la memoria ed il check possono essere passati *)
59 ndefinition start_of_model_RS08 ≝
60 λmcu:RS08_model.λt:memory_impl.
61 λmem:aux_mem_type t.λchk:aux_chk_type t.
62 λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool.
63  (mk_any_status RS08 t
64   (mk_alu_RS08
65    (* acc_low: reset *)  〈x0,x0〉
66    (* pc: reset *) 〈〈x3,xF〉:〈xF,xD〉〉
67    (* pcm *) 〈〈x3,xF〉:〈xF,xF〉〉
68    (* spc: reset *) 〈〈x3,xF〉:〈xF,xD〉〉
69    (* xm: reset *) 〈x0,x0〉
70    (* psm: *) 〈x8,x0〉
71    (* Z: reset *) false
72    (* C: reset *) false)
73    (* mem *) mem
74    (* chk *) chk
75    (* clk: reset *) (None ?)).
76
77 (* cio' che non viene resettato mantiene il valore precedente: nella documentazione
78    viene riportato come "unaffected"/"indeterminate"/"unpredictable"
79    il soft RESET e' diverso da un calo di tensione e la ram non variera' *)
80 ndefinition reset_of_model_RS08 ≝
81 λt:memory_impl.λs:any_status RS08 t.
82  (mk_any_status RS08 t
83   (mk_alu_RS08
84    (* acc_low: reset *) 〈x0,x0〉
85    (* pc: reset *) 〈〈x3,xF〉:〈xF,xD〉〉
86    (* pcm *) (pc_mask_RS08 (alu ? t s))
87    (* spc: reset *) 〈〈x3,xF〉:〈xF,xD〉〉
88    (* xm: reset *) 〈x0,x0〉
89    (* psm: reset *) 〈x8,x0〉
90    (* Z: reset *) false
91    (* C: reset *) false)
92    (* mem: inv. *) (mem_desc ? t s)
93    (* chk: inv. *) (chk_desc ? t s)
94    (* clk: reset *) (None ?)).