]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests3.ma
Additional contribs.
[helm.git] / helm / software / matita / contribs / ng_assembly / freescale_tests / micro_tests3.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 ROL/ROR *)
33 (* ************* *)
34
35 ndefinition mTest_HCS08_ROL_ROR_source ≝ let m ≝ HCS08 in source_to_byte8 m (
36 (* testa la logica di ROL/ROR e le modalita' IMM2,INHx *)
37 (* BEFORE: A=0x00 H:X=0x0000 PC=0x1860 Z=true *)
38 (* [0x1860] 3clk *) (compile m ? LDHX (maIMM2 〈〈x1,x2〉:〈x3,x4〉〉) I) @
39 (* [0x1863] 2clk *) (compile m ? LDA (maIMM1 〈x5,x6〉) I) @
40 (* [0x1865] 1clk *) (compile m ? ROL maINHA I) @
41 (* [0x1866] 1clk *) (compile m ? ROL maINHX I) @
42 (* [0x1867] 1clk *) (compile m ? ROR maINHA I) @
43 (* [0x1868] 1clk *) (compile m ? ROR maINHX I) @
44 (* [0x1869] 1clk *) (compile m ? CLR maINHA I) @
45 (* [0x186A] 1clk *) (compile m ? CLR maINHX I) @
46 (* [0x186B] 1clk *) (compile m ? CLR maINHH I)
47 (* [0x186C] si puo' quindi enunciare che dopo 3+2+1+1+1+1+1+1+1=12 clk *)
48 (*          PC<-0x186C *)
49 ).
50
51 (* creazione del processore+caricamento+impostazione registri *)
52 ndefinition mTest_HCS08_ROL_ROR_status ≝
53 λt:memory_impl.
54  set_z_flag HCS08 t (* Z<-true *)
55   (setweak_indX_16_reg HCS08 t (* H:X<-0x0000 *)
56    (set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *)
57     (start_of_mcu_version_HCS08
58      MC9S08AW60 t
59      (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_HCS08_prog *)
60       mTest_HCS08_ROL_ROR_source mTest_HCS08_prog)
61      (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t)
62      (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *)
63      false false false false false false) (* non deterministici tutti a 0 *)
64     mTest_HCS08_prog)
65    (mk_word16 (mk_byte8 x0 x0) (mk_byte8 x0 x0)))
66   true.
67
68 (* dimostrazione senza svolgimento degli stati, immediata *)
69 nlemma ok_mTest_HCS08_ROL_ROR_full :
70  ∀t:memory_impl.
71  execute HCS08 t (TickOK ? (mTest_HCS08_ROL_ROR_status t)) nat12 =
72  TickOK ? (set_pc_reg HCS08 t (* nuovo PC *)
73            (mTest_HCS08_ROL_ROR_status t) (mk_word16 〈x1,x8〉 〈x6,xC〉)).
74  #t; nelim t;
75  napply refl_eq.
76 nqed.