]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests6.ma
Additional contribs.
[helm.git] / helm / software / matita / contribs / ng_assembly / freescale_tests / micro_tests6.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 (*   Ultima modifica: 05/08/2009                                          *)
20 (*                                                                        *)
21 (* ********************************************************************** *)
22
23 include "freescale_tests/micro_tests_tools.ma".
24 include "freescale/multivm.ma".
25 include "freescale/status_lemmas.ma".
26
27 (* ****************************************** *)
28 (* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *)
29 (* ****************************************** *)
30
31 (* ******************* *)
32 (* HCS08 BRSETn/BRCLRn *)
33 (* ******************* *)
34
35 ndefinition mTest_HCS08_BRSETn_BRCLRn_source ≝ let m ≝ HCS08 in source_to_byte8 m (
36 (* testa la logica di BRSETn/BRCLRn e le modalita' DIRn_and_IMM1 *)
37 (* BEFORE: va a testare [0x00C5]=0x55 PC=0x1860 *)
38 (* [0x1860] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o0 〈xC,x5〉 〈x0,x1〉) I) @
39 (* [0x1863] 1clk *) (compile m ? NOP maINH I) @
40 (* [0x1864] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o1 〈xC,x5〉 〈x0,x1〉) I) @
41 (* [0x1867] 1clk *) (compile m ? NOP maINH I) @
42 (* [0x1868] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o2 〈xC,x5〉 〈x0,x1〉) I) @
43 (* [0x186B] 1clk *) (compile m ? NOP maINH I) @
44 (* [0x186C] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o3 〈xC,x5〉 〈x0,x1〉) I) @
45 (* [0x186F] 1clk *) (compile m ? NOP maINH I) @
46 (* [0x1870] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o4 〈xC,x5〉 〈x0,x1〉) I) @
47 (* [0x1873] 1clk *) (compile m ? NOP maINH I) @
48 (* [0x1874] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o5 〈xC,x5〉 〈x0,x1〉) I) @
49 (* [0x1877] 1clk *) (compile m ? NOP maINH I) @
50 (* [0x1878] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o6 〈xC,x5〉 〈x0,x1〉) I) @
51 (* [0x187B] 1clk *) (compile m ? NOP maINH I) @
52 (* [0x187C] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o7 〈xC,x5〉 〈x0,x1〉) I) @
53 (* [0x187F] 1clk *) (compile m ? NOP maINH I) @
54
55 (* [0x1880] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o0 〈xC,x5〉 〈x0,x1〉) I) @
56 (* [0x1883] 1clk *) (compile m ? NOP maINH I) @
57 (* [0x1884] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o1 〈xC,x5〉 〈x0,x1〉) I) @
58 (* [0x1887] 1clk *) (compile m ? NOP maINH I) @
59 (* [0x1888] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o2 〈xC,x5〉 〈x0,x1〉) I) @
60 (* [0x188B] 1clk *) (compile m ? NOP maINH I) @
61 (* [0x188C] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o3 〈xC,x5〉 〈x0,x1〉) I) @
62 (* [0x188F] 1clk *) (compile m ? NOP maINH I) @
63 (* [0x1890] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o4 〈xC,x5〉 〈x0,x1〉) I) @
64 (* [0x1893] 1clk *) (compile m ? NOP maINH I) @
65 (* [0x1894] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o5 〈xC,x5〉 〈x0,x1〉) I) @
66 (* [0x1897] 1clk *) (compile m ? NOP maINH I) @
67 (* [0x1898] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o6 〈xC,x5〉 〈x0,x1〉) I) @
68 (* [0x189B] 1clk *) (compile m ? NOP maINH I) @
69 (* [0x189C] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o7 〈xC,x5〉 〈x0,x1〉) I) @
70 (* [0x189F] 1clk *) (compile m ? NOP maINH I)
71
72 (* [0x18A0] si puo' quindi enunciare che dopo 80+8=88 clk
73             (vengono eseguiti 16*5 test, meta' BRSETn/BRCLRn saltano *) 
74 (*          PC<-0x18A0 *)
75 ).
76
77 (* creazione del processore+caricamento+impostazione registri *)
78 ndefinition mTest_HCS08_BRSETn_BRCLRn_status ≝
79 λt:memory_impl.
80  set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *)
81   (start_of_mcu_version_HCS08
82    MC9S08AW60 t
83    (load_from_source_at t
84     (load_from_source_at t (zero_memory t) (* carica mTest_bytes in RAM:mTest_HCS08_RAM *)
85       mTest_HCS08_BRSETn_BRCLRn_source mTest_HCS08_prog) (* carica source in ROM:mTest_HCS08_prog *)
86      mTest_bytes mTest_HCS08_RAM)
87    (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t)
88    (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *)
89    false false false false false false) (* non deterministici tutti a 0 *)
90   mTest_HCS08_prog.
91
92 (* dimostrazione senza svolgimento degli stati, immediata *)
93 nlemma ok_mTest_HCS08_BRSETn_BRCLRn_full :
94  ∀t:memory_impl.
95  execute HCS08 t (TickOK ? (mTest_HCS08_BRSETn_BRCLRn_status t)) nat88 =
96  TickOK ? (set_pc_reg HCS08 t (mTest_HCS08_BRSETn_BRCLRn_status t) (* nuovo PC *)
97            (mk_word16 〈x1,x8〉 〈xA,x0〉)).
98  #t; nelim t;
99  napply refl_eq.
100 nqed.