]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma
freescale porting
[helm.git] / helm / software / matita / contribs / ng_assembly2 / emulator / opcodes / pseudo.ma
diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma
new file mode 100755 (executable)
index 0000000..10b8252
--- /dev/null
@@ -0,0 +1,96 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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 "emulator/opcodes/Freescale_pseudo.ma".
+include "emulator/opcodes/Freescale_instr_mode.ma".
+include "emulator/opcodes/IP2022_pseudo.ma".
+include "emulator/opcodes/IP2022_instr_mode.ma".
+include "emulator/opcodes/byte_or_word.ma".
+include "common/list.ma".
+
+(* ********************************************** *)
+(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *)
+(* ********************************************** *)
+
+(* enumerazione delle ALU *)
+ninductive mcu_type: Type ≝
+  HC05   : mcu_type
+| HC08   : mcu_type
+| HCS08  : mcu_type
+| RS08   : mcu_type
+| IP2022 : mcu_type.
+
+ndefinition eq_mcutype ≝
+λm1,m2:mcu_type.
+ match m1 with
+  [ HC05 ⇒ match m2 with [ HC05 ⇒ true | _ ⇒ false ]
+  | HC08 ⇒ match m2 with [ HC08 ⇒ true | _ ⇒ false ]
+  | HCS08 ⇒ match m2 with [ HCS08 ⇒ true | _ ⇒ false ]
+  | RS08 ⇒ match m2 with [ RS08 ⇒ true | _ ⇒ false ]
+  | IP2022 ⇒ match m2 with [ IP2022 ⇒ true | _ ⇒ false ]
+  ].
+
+ndefinition aux_pseudo_type ≝
+λmcu:mcu_type.match mcu with
+ [ HC05 ⇒ Freescale_pseudo
+ | HC08 ⇒ Freescale_pseudo
+ | HCS08 ⇒ Freescale_pseudo
+ | RS08 ⇒ Freescale_pseudo
+ | IP2022 ⇒ IP2022_pseudo
+ ].
+
+ndefinition aux_im_type ≝
+λmcu:mcu_type.match mcu with
+ [ HC05 ⇒ Freescale_instr_mode
+ | HC08 ⇒ Freescale_instr_mode
+ | HCS08 ⇒ Freescale_instr_mode
+ | RS08 ⇒ Freescale_instr_mode
+ | IP2022 ⇒ IP2022_instr_mode
+ ].
+
+(* ********************************************* *)
+(* STRUMENTI PER LE DIMOSTRAZIONI DI CORRETTEZZA *)
+(* ********************************************* *)
+
+ndefinition aux_table_type ≝ λmcu:mcu_type.Prod4T (aux_pseudo_type mcu) (aux_im_type mcu) byte8_or_word16 byte8.
+
+ndefinition pseudo_is_comparable ≝
+λmcu:mcu_type.match mcu with
+ [ HC05 ⇒ Freescalepseudo_is_comparable
+ | HC08 ⇒ Freescalepseudo_is_comparable
+ | HCS08 ⇒ Freescalepseudo_is_comparable
+ | RS08 ⇒ Freescalepseudo_is_comparable
+ | IP2022 ⇒ IP2022pseudo_is_comparable
+ ].
+
+(* come suggerire di unificare?
+   carr (pseudo_is_comparable M) = aux_pseudo_type M *)
+
+(* su tutta la lista quante volte compare lo pseudocodice *)
+nlet rec get_pseudo_count (m:mcu_type) (o:aux_pseudo_type m) (c:word16) (l:list (aux_table_type m)) on l ≝
+ match l with
+  [ nil ⇒ c
+  | cons hd tl ⇒ match eqc ? o (fst4T … hd) with
+   [ true ⇒ get_pseudo_count m o (succc ? c) tl
+   | false ⇒ get_pseudo_count m o c tl
+   ]
+  ].