]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests7.ma
Additional contribs.
[helm.git] / helm / software / matita / contribs / ng_assembly / freescale_tests / micro_tests7.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 (* RS08 X,D[X],TNY *)
33 (* *************** *)
34
35 ndefinition mTest_RS08_TNY_source ≝ let m ≝ RS08 in source_to_byte8 m (
36 (* testa la logica RS08 X,D[X] le modalita' TNY *)
37 (* NB: il meccanismo utilizzato e' quello complesso dell'RS08
38        fare riferimento alle spiegazioni in STATUS/LOAD_WRITE *)
39 (* X=20 PS=0 *)
40 (* [0x3800] 3clk *) (compile m ? ADD (maTNY xD) I) @       (* ... +[0x000D]=0x0C *)
41 (* [0x3801] 3clk *) (compile m ? ADD (maTNY xE) I) @       (* ... +D[X]=[0x0020]=0x1F *)
42 (* [0x3802] 3clk *) (compile m ? ADD (maTNY xF) I) @       (* ... +X=0x20 *)
43 (* [0x3803] 3clk *) (compile m ? ADD (maDIR1 〈xC,xF〉) I) @ (* ... +X=0x20 *)
44 (* [0x3805] 3clk *) (compile m ? ADD (maDIR1 〈xC,xE〉) I)   (* ... +[0x000E]=0x0D *)
45 (* [0x3807] si puo' quindi enunciare che dopo 15 clk
46             A<-0x78 PC<-0x3807 *)
47 ).
48
49 (* creazione del processore+caricamento+impostazione registri *)
50 ndefinition mTest_RS08_TNY_status ≝
51 λt:memory_impl.
52  setweak_x_map RS08 t (* X<-0x20 *)
53  (setweak_ps_map RS08 t (* PS<-0x00 *)
54  (set_pc_reg RS08 t (* PC<-mTest_RS08_prog *)
55   (start_of_mcu_version_RS08 
56    MC9RS08KA2 t
57    (load_from_source_at t (* carica mTest_bytes in RAM:mTest_RS08_RAM *)
58     (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_RS08_prog *)
59      mTest_RS08_TNY_source mTest_RS08_prog)
60     mTest_bytes 〈〈x0,x0〉:〈x0,x1〉〉)
61    (build_memory_type_of_mcu_version (FamilyRS08 MC9RS08KA2) 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_RS08_prog)
65   (mk_byte8 x0 x0))
66   (mk_byte8 x2 x0).
67
68 (* dimostrazione senza svolgimento degli stati, immediata *)
69 nlemma ok_mTest_RS08_TNY_full :
70  ∀t:memory_impl.
71  execute RS08 t (TickOK ? (mTest_RS08_TNY_status t)) nat15 =
72  TickOK ? (set_acc_8_low_reg RS08 t (* nuovo A *)
73            (set_pc_reg RS08 t (mTest_RS08_TNY_status t) (* nuovo PC *)
74             (mk_word16 〈x3,x8〉 〈x0,x7〉))
75              (mk_byte8 x7 x8)).
76  #t; nelim t;
77  napply refl_eq.
78 nqed.