]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/emulator/status/HC05_status.ma
(no commit message)
[helm.git] / helm / software / matita / contribs / ng_assembly / emulator / status / HC05_status.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 "num/word16.ma".
24
25 (* *********************************** *)
26 (* STATUS INTERNO DEL PROCESSORE (ALU) *)
27 (* *********************************** *)
28
29 (* ALU dell'HC05 *)
30 nrecord alu_HC05: Type ≝
31  {
32  (* A: registo accumulatore *)
33  acc_low_reg_HC05 : byte8;
34  (* X: registro indice *)
35  indX_low_reg_HC05 : byte8;
36  (* SP: registo stack pointer *)
37  sp_reg_HC05 : word16;
38  (* modificatori di SP: per esempio e' definito come 0000000011xxxxxxb *)
39  (* la logica della sua costruzione e' quindi (SP∧mask)∨fix *)
40  (* totalmente racchiusa nella ALU, bastera' fare get(set(SP)) *)
41  sp_mask_HC05 : word16;
42  sp_fix_HC05 : word16;
43  (* PC: registro program counter *)
44  pc_reg_HC05 : word16;
45  (* modificatore di PC: per esempio e' definito come 00xxxxxxxxxxxxxxb *)
46  (* la logica della sua costruzione e' quindi (PC∧mask) *)
47  (* totalmente racchiusa nella ALU, bastera' fare get(set(PC)) *)
48  pc_mask_HC05 : word16;
49  
50  (* H: flag semi-carry (somma nibble basso) *)
51  h_flag_HC05 : bool;
52  (* I: flag mascheramento degli interrupt mascherabili: 1=mascherati *)
53  i_flag_HC05 : bool;
54  (* N: flag segno/negativita' *)
55  n_flag_HC05 : bool;
56  (* Z: flag zero *)
57  z_flag_HC05 : bool;
58  (* C: flag carry *)
59  c_flag_HC05 : bool;
60  
61  (* IRQ: flag che simula il pin esterno IRQ *)
62  irq_flag_HC05 : bool
63  }.
64
65 notation "{hvbox('A_Reg' ≝ acclow ; break 'X_Reg' ≝ indxlow ; break 'Sp_Reg' ≝ sp ; break 'Sp_Mask' ≝ spm ; break 'Sp_Fix' ≝ spf ; break 'Pc_Reg' ≝ pc ; break 'Pc_Mask' ≝ pcm ; break 'H_Flag' ≝ hfl ; break 'I_Flag' ≝ ifl ; break 'N_Flag' ≝ nfl ; break 'Z_Flag' ≝ zfl ; break 'C_Flag' ≝ cfl ; break 'IRQ_Flag' ≝ irqfl)}"
66  non associative with precedence 80 for
67  @{ 'mk_alu_HC05 $acclow $indxlow $sp $spm $spf $pc $pcm $hfl $ifl $nfl $zfl $cfl $irqfl }.
68 interpretation "mk_alu_HC05" 'mk_alu_HC05 acclow indxlow sp spm spf pc pcm hfl ifl nfl zfl cfl irqfl =
69  (mk_alu_HC05 acclow indxlow sp spm spf pc pcm hfl ifl nfl zfl cfl irqfl).
70
71 (* ***************** *)
72 (* CONFRONTO FRA ALU *)
73 (* ***************** *)
74
75 (* confronto registro per registro dell'HC05 *)
76 ndefinition eq_HC05_alu ≝
77 λalu1,alu2:alu_HC05.
78  (eq_b8 (acc_low_reg_HC05 alu1) (acc_low_reg_HC05 alu2)) ⊗
79  (eq_b8 (indX_low_reg_HC05 alu1) (indX_low_reg_HC05 alu2)) ⊗
80  (eq_w16 (sp_reg_HC05 alu1) (sp_reg_HC05 alu2)) ⊗
81  (eq_w16 (sp_mask_HC05 alu1) (sp_mask_HC05 alu2)) ⊗
82  (eq_w16 (sp_fix_HC05 alu1) (sp_fix_HC05 alu2)) ⊗
83  (eq_w16 (pc_reg_HC05 alu1) (pc_reg_HC05 alu2)) ⊗
84  (eq_w16 (pc_mask_HC05 alu1) (pc_mask_HC05 alu2)) ⊗
85  (eq_bool (h_flag_HC05 alu1) (h_flag_HC05 alu2)) ⊗
86  (eq_bool (i_flag_HC05 alu1) (i_flag_HC05 alu2)) ⊗
87  (eq_bool (n_flag_HC05 alu1) (n_flag_HC05 alu2)) ⊗
88  (eq_bool (z_flag_HC05 alu1) (z_flag_HC05 alu2)) ⊗
89  (eq_bool (c_flag_HC05 alu1) (c_flag_HC05 alu2)) ⊗
90  (eq_bool (irq_flag_HC05 alu1) (irq_flag_HC05 alu2)).