]> matita.cs.unibo.it Git - helm.git/blobdiff - 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
diff --git a/helm/software/matita/contribs/ng_assembly/emulator/status/HC05_status.ma b/helm/software/matita/contribs/ng_assembly/emulator/status/HC05_status.ma
new file mode 100755 (executable)
index 0000000..4e73b57
--- /dev/null
@@ -0,0 +1,90 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+(* ********************************************************************** *)
+(*                          Progetto FreeScale                            *)
+(*                                                                        *)
+(*   Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it              *)
+(*   Sviluppo: 2008-2010                                                  *)
+(*                                                                        *)
+(* ********************************************************************** *)
+
+include "num/word16.ma".
+
+(* *********************************** *)
+(* STATUS INTERNO DEL PROCESSORE (ALU) *)
+(* *********************************** *)
+
+(* ALU dell'HC05 *)
+nrecord alu_HC05: Type ≝
+ {
+ (* A: registo accumulatore *)
+ acc_low_reg_HC05 : byte8;
+ (* X: registro indice *)
+ indX_low_reg_HC05 : byte8;
+ (* SP: registo stack pointer *)
+ sp_reg_HC05 : word16;
+ (* modificatori di SP: per esempio e' definito come 0000000011xxxxxxb *)
+ (* la logica della sua costruzione e' quindi (SP∧mask)∨fix *)
+ (* totalmente racchiusa nella ALU, bastera' fare get(set(SP)) *)
+ sp_mask_HC05 : word16;
+ sp_fix_HC05 : word16;
+ (* PC: registro program counter *)
+ pc_reg_HC05 : word16;
+ (* modificatore di PC: per esempio e' definito come 00xxxxxxxxxxxxxxb *)
+ (* la logica della sua costruzione e' quindi (PC∧mask) *)
+ (* totalmente racchiusa nella ALU, bastera' fare get(set(PC)) *)
+ pc_mask_HC05 : word16;
+ (* H: flag semi-carry (somma nibble basso) *)
+ h_flag_HC05 : bool;
+ (* I: flag mascheramento degli interrupt mascherabili: 1=mascherati *)
+ i_flag_HC05 : bool;
+ (* N: flag segno/negativita' *)
+ n_flag_HC05 : bool;
+ (* Z: flag zero *)
+ z_flag_HC05 : bool;
+ (* C: flag carry *)
+ c_flag_HC05 : bool;
+ (* IRQ: flag che simula il pin esterno IRQ *)
+ irq_flag_HC05 : bool
+ }.
+
+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)}"
+ non associative with precedence 80 for
+ @{ 'mk_alu_HC05 $acclow $indxlow $sp $spm $spf $pc $pcm $hfl $ifl $nfl $zfl $cfl $irqfl }.
+interpretation "mk_alu_HC05" 'mk_alu_HC05 acclow indxlow sp spm spf pc pcm hfl ifl nfl zfl cfl irqfl =
+ (mk_alu_HC05 acclow indxlow sp spm spf pc pcm hfl ifl nfl zfl cfl irqfl).
+
+(* ***************** *)
+(* CONFRONTO FRA ALU *)
+(* ***************** *)
+
+(* confronto registro per registro dell'HC05 *)
+ndefinition eq_HC05_alu ≝
+λalu1,alu2:alu_HC05.
+ (eq_b8 (acc_low_reg_HC05 alu1) (acc_low_reg_HC05 alu2)) ⊗
+ (eq_b8 (indX_low_reg_HC05 alu1) (indX_low_reg_HC05 alu2)) ⊗
+ (eq_w16 (sp_reg_HC05 alu1) (sp_reg_HC05 alu2)) ⊗
+ (eq_w16 (sp_mask_HC05 alu1) (sp_mask_HC05 alu2)) ⊗
+ (eq_w16 (sp_fix_HC05 alu1) (sp_fix_HC05 alu2)) ⊗
+ (eq_w16 (pc_reg_HC05 alu1) (pc_reg_HC05 alu2)) ⊗
+ (eq_w16 (pc_mask_HC05 alu1) (pc_mask_HC05 alu2)) ⊗
+ (eq_bool (h_flag_HC05 alu1) (h_flag_HC05 alu2)) ⊗
+ (eq_bool (i_flag_HC05 alu1) (i_flag_HC05 alu2)) ⊗
+ (eq_bool (n_flag_HC05 alu1) (n_flag_HC05 alu2)) ⊗
+ (eq_bool (z_flag_HC05 alu1) (z_flag_HC05 alu2)) ⊗
+ (eq_bool (c_flag_HC05 alu1) (c_flag_HC05 alu2)) ⊗
+ (eq_bool (irq_flag_HC05 alu1) (irq_flag_HC05 alu2)).