From c70ecb50a457d251ef1cd61960a641d491febed7 Mon Sep 17 00:00:00 2001 From: Cosimo Oliboni Date: Wed, 5 Aug 2009 08:35:30 +0000 Subject: [PATCH] freescale porting, work in progress --- .../matita/contribs/ng_assembly/depends | 23 +- .../ng_assembly/freescale/memory_abs.ma | 231 +++ .../ng_assembly/freescale/memory_bits.ma | 227 +++ .../ng_assembly/freescale/memory_func.ma | 91 ++ .../ng_assembly/freescale/memory_struct.ma | 624 ++++++++ .../ng_assembly/freescale/memory_trees.ma | 231 +++ .../contribs/ng_assembly/freescale/opcode.ma | 180 +++ .../ng_assembly/freescale/opcode_base.ma | 330 +++++ .../freescale/opcode_base_lemmas.ma | 127 ++ .../freescale/opcode_base_lemmas1.ma | 126 ++ .../opcode_base_lemmas_instrmode1.ma | 930 ++++++++++++ .../opcode_base_lemmas_instrmode2.ma | 707 +++++++++ .../freescale/opcode_base_lemmas_opcode1.ma | 970 +++++++++++++ .../freescale/opcode_base_lemmas_opcode2.ma | 384 +++++ .../contribs/ng_assembly/freescale/status.ma | 1275 +++++++++++++++++ .../ng_assembly/freescale/table_HC05.ma | 377 +++++ .../ng_assembly/freescale/table_HC05_tests.ma | 94 ++ .../ng_assembly/freescale/table_HC08.ma | 474 ++++++ .../ng_assembly/freescale/table_HC08_tests.ma | 123 ++ .../ng_assembly/freescale/table_HCS08.ma | 486 +++++++ .../freescale/table_HCS08_tests.ma | 118 ++ .../ng_assembly/freescale/table_RS08.ma | 395 +++++ .../ng_assembly/freescale/table_RS08_tests.ma | 78 + .../ng_assembly/freescale/translation.ma | 249 ++++ 24 files changed, 8847 insertions(+), 3 deletions(-) create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/memory_abs.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/memory_bits.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/memory_func.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/memory_struct.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/memory_trees.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/opcode.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/opcode_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas1.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_instrmode1.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_instrmode2.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_opcode1.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_opcode2.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/status.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/table_HC05.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/table_HC05_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/table_HC08.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/table_HC08_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/table_HCS08.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/table_HCS08_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/table_RS08.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/table_RS08_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly/freescale/translation.ma diff --git a/helm/software/matita/contribs/ng_assembly/depends b/helm/software/matita/contribs/ng_assembly/depends index adad69897..41b4315f8 100644 --- a/helm/software/matita/contribs/ng_assembly/depends +++ b/helm/software/matita/contribs/ng_assembly/depends @@ -1,5 +1,5 @@ -num/oct_lemmas.ma num/bool_lemmas.ma num/oct.ma common/nat.ma num/bool.ma +num/oct_lemmas.ma num/bool_lemmas.ma num/oct.ma num/word32.ma num/word16.ma test_errori.ma common/list_lemmas.ma common/list.ma @@ -9,25 +9,42 @@ common/ascii_lemmas1.ma common/ascii.ma num/word16_lemmas.ma num/byte8_lemmas.ma num/word16.ma common/prod.ma num/bool.ma common/ascii_lemmas2.ma common/ascii_lemmas1.ma num/bool_lemmas.ma +freescale/opcode.ma common/list.ma freescale/opcode_base.ma common/list_utility_lemmas.ma common/list_lemmas.ma common/list_utility.ma common/string_lemmas.ma common/ascii_lemmas2.ma common/list_utility_lemmas.ma common/string.ma -num/bool_lemmas.ma num/bool.ma common/nat_lemmas.ma common/nat.ma num/bool_lemmas.ma +num/bool_lemmas.ma num/bool.ma +freescale/table_RS08.ma common/list.ma freescale/opcode_base.ma common/option_lemmas.ma common/option.ma num/bool_lemmas.ma num/exadecim_lemmas.ma num/bool_lemmas.ma num/exadecim.ma +freescale/opcode_base.ma num/word16.ma num/exadecim.ma common/prod.ma num/bool.ma num/oct.ma num/quatern.ma +freescale/table_HC05_tests.ma freescale/opcode.ma freescale/table_HC05.ma common/theory.ma +freescale/table_HCS08.ma common/list.ma freescale/opcode_base.ma +freescale/table_HC08_tests.ma freescale/opcode.ma freescale/table_HC08.ma num/quatern.ma num/bool.ma +freescale/table_RS08_tests.ma freescale/opcode.ma freescale/table_RS08.ma +freescale/opcode_base_lemmas_instrmode1.ma freescale/opcode_base.ma num/bitrigesim_lemmas.ma num/exadecim_lemmas.ma num/oct_lemmas.ma +freescale/opcode_base_lemmas_instrmode2.ma freescale/opcode_base_lemmas_instrmode1.ma +freescale/opcode_base_lemmas_opcode1.ma freescale/opcode_base.ma num/bool_lemmas.ma num/oct.ma num/bool.ma +freescale/opcode_base_lemmas_opcode2.ma freescale/opcode_base_lemmas_opcode1.ma num/byte8_lemmas.ma num/byte8.ma num/exadecim_lemmas.ma +freescale/table_HCS08_tests.ma freescale/opcode.ma freescale/table_HCS08.ma +freescale/table_HC05.ma common/list.ma freescale/opcode_base.ma +freescale/opcode_base_lemmas.ma freescale/opcode_base.ma num/bool_lemmas.ma +common/option.ma num/bool.ma num/byte8.ma num/bitrigesim.ma num/exadecim.ma num/quatern_lemmas.ma num/bool_lemmas.ma num/quatern.ma -common/option.ma num/bool.ma common/prod_lemmas.ma common/prod.ma num/bool_lemmas.ma num/bool.ma common/theory.ma +freescale/table_HC08.ma common/list.ma freescale/opcode_base.ma num/word16.ma num/byte8.ma common/string.ma common/ascii.ma common/list_utility.ma common/ascii.ma num/bool.ma common/list.ma common/theory.ma +freescale/opcode_base_lemmas1.ma freescale/opcode_base_lemmas_instrmode2.ma freescale/opcode_base_lemmas_opcode2.ma num/word16_lemmas.ma common/list_utility.ma common/list.ma common/nat_lemmas.ma common/option.ma +freescale/translation.ma common/option.ma freescale/table_HC05.ma freescale/table_HC08.ma freescale/table_HCS08.ma freescale/table_RS08.ma num/bitrigesim_lemmas.ma num/bitrigesim.ma num/bool_lemmas.ma diff --git a/helm/software/matita/contribs/ng_assembly/freescale/memory_abs.ma b/helm/software/matita/contribs/ng_assembly/freescale/memory_abs.ma new file mode 100755 index 000000000..9c6e11cea --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/memory_abs.ma @@ -0,0 +1,231 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/memory_func.ma". +include "freescale/memory_trees.ma". +include "freescale/memory_bits.ma". + +(* ********************************************* *) +(* ASTRAZIONE DALL'IMPLEMENTAZIONE DELLA MEMORIA *) +(* ********************************************* *) + +(* tipi di implementazione della memoria *) +ninductive memory_impl : Type ≝ + MEM_FUNC: memory_impl +| MEM_TREE: memory_impl +| MEM_BITS: memory_impl. + +(* ausiliario per il tipo della memoria *) +ndefinition aux_mem_type ≝ +λt:memory_impl.match t with + [ MEM_FUNC ⇒ word16 → byte8 + | MEM_TREE ⇒ Array16T (Array16T (Array16T (Array16T byte8))) + | MEM_BITS ⇒ Array16T (Array16T (Array16T (Array16T (Array8T bool)))) + ]. + +(* ausiliario per il tipo del checker *) +ndefinition aux_chk_type ≝ +λt:memory_impl.match t with + [ MEM_FUNC ⇒ word16 → memory_type + | MEM_TREE ⇒ Array16T (Array16T (Array16T (Array16T memory_type))) + | MEM_BITS ⇒ Array16T (Array16T (Array16T (Array16T (Array8T memory_type)))) + ]. + +(* unificazione di out_of_bound_memory *) +ndefinition out_of_bound_memory ≝ +λt:memory_impl. + match t + return λt.aux_chk_type t + with + [ MEM_FUNC ⇒ mf_out_of_bound_memory + | MEM_TREE ⇒ mt_out_of_bound_memory + | MEM_BITS ⇒ mb_out_of_bound_memory + ]. + +(* unificazione di zero_memory *) +ndefinition zero_memory ≝ +λt:memory_impl. + match t + return λt.aux_mem_type t + with + [ MEM_FUNC ⇒ mf_zero_memory + | MEM_TREE ⇒ mt_zero_memory + | MEM_BITS ⇒ mb_zero_memory + ]. + +(* unificazione della lettura senza chk: mem_read_abs mem addr *) +ndefinition mem_read_abs ≝ +λt:memory_impl. + match t + return λt.aux_mem_type t → word16 → byte8 + with + [ MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. + λaddr:word16. + m addr + | MEM_TREE ⇒ λm:aux_mem_type MEM_TREE. + λaddr:word16. + mt_visit byte8 m addr + | MEM_BITS ⇒ λm:aux_mem_type MEM_BITS. + λaddr:word16. + byte8_of_bits (mt_visit (Array8T bool) m addr) + ]. + +(* unificazione del chk *) +ndefinition chk_get ≝ +λt:memory_impl.λc:aux_chk_type t.λaddr:word16. + match t + return λt.aux_chk_type t → word16 → Array8T memory_type + with + [ MEM_FUNC ⇒ mf_chk_get + | MEM_TREE ⇒ mt_chk_get + | MEM_BITS ⇒ mb_chk_get + ] c addr. + +(* unificazione della lettura con chk: mem_read mem chk addr *) +ndefinition mem_read ≝ +λt:memory_impl.λm:aux_mem_type t.λc:aux_chk_type t.λaddr:word16. + match t + return λt.aux_mem_type t → aux_chk_type t → word16 → option byte8 + with + [ MEM_FUNC ⇒ mf_mem_read + | MEM_TREE ⇒ mt_mem_read + | MEM_BITS ⇒ mb_mem_read + ] m c addr. + +(* unificazione della lettura di bit con chk: mem_read mem chk addr sub *) +ndefinition mem_read_bit ≝ +λt:memory_impl. + match t + return λt.aux_mem_type t → aux_chk_type t → word16 → oct → option bool + with + [ MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. + λc:aux_chk_type MEM_FUNC. + λaddr:word16. + λo:oct. + opt_map … (mf_mem_read m c addr) + (λb.Some ? (getn_array8T o bool (bits_of_byte8 b))) + | MEM_TREE ⇒ λm:aux_mem_type MEM_TREE. + λc:aux_chk_type MEM_TREE. + λaddr:word16. + λo:oct. + opt_map … (mt_mem_read m c addr) + (λb.Some ? (getn_array8T o bool (bits_of_byte8 b))) + | MEM_BITS ⇒ λm:aux_mem_type MEM_BITS. + λc:aux_chk_type MEM_BITS. + λaddr:word16. + λo:oct. + mb_mem_read_bit m c addr o + ]. + +(* unificazione della scrittura con chk: mem_update mem chk addr val *) +ndefinition mem_update ≝ +λt:memory_impl.λm:aux_mem_type t.λc:aux_chk_type t.λaddr:word16.λv:byte8. + match t + return λt.aux_mem_type t → Array8T memory_type → word16 → byte8 → option (aux_mem_type t) + with + [ MEM_FUNC ⇒ mf_mem_update + | MEM_TREE ⇒ mt_mem_update + | MEM_BITS ⇒ mb_mem_update + ] m (chk_get t c addr) addr v. + +(* unificazione della scrittura di bit con chk: mem_update mem chk addr sub val *) +ndefinition mem_update_bit ≝ +λt:memory_impl. + match t + return λt.aux_mem_type t → aux_chk_type t → word16 → oct → bool → option (aux_mem_type t) + with + [ MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. + λc:aux_chk_type MEM_FUNC. + λaddr:word16. + λo:oct. + λv:bool. + opt_map … (mf_mem_read m c addr) + (λb.mf_mem_update m (chk_get MEM_FUNC c addr) addr (byte8_of_bits (setn_array8T o bool (bits_of_byte8 b) v))) + | MEM_TREE ⇒ λm:aux_mem_type MEM_TREE. + λc:aux_chk_type MEM_TREE. + λaddr:word16. + λo:oct. + λv:bool. + opt_map … (mt_mem_read m c addr) + (λb.mt_mem_update m (chk_get MEM_TREE c addr) addr (byte8_of_bits (setn_array8T o bool (bits_of_byte8 b) v))) + | MEM_BITS ⇒ λm:aux_mem_type MEM_BITS. + λc:aux_chk_type MEM_BITS. + λaddr:word16. + λo:oct. + λv:bool. + mb_mem_update_bit m c addr o v + ]. + +(* unificazione del caricamento: load_from_source_at old_mem source addr *) +ndefinition load_from_source_at ≝ +λt:memory_impl.λm:aux_mem_type t.λl:list byte8.λaddr:word16. + match t + return λt.aux_mem_type t → list byte8 → word16 → aux_mem_type t + with + [ MEM_FUNC ⇒ mf_load_from_source_at + | MEM_TREE ⇒ mt_load_from_source_at + | MEM_BITS ⇒ mb_load_from_source_at + ] m l addr. + +(* unificazione dell'impostazione della memoria: chk_update_ranged chk inf sup v *) +ndefinition check_update_ranged ≝ +λt:memory_impl. + match t + return λt.aux_chk_type t → word16 → word16 → memory_type → aux_chk_type t + with + [ MEM_FUNC ⇒ λc:aux_chk_type MEM_FUNC. + λinf,sup:word16. + λv:memory_type. + mf_check_update_ranged c inf sup v + | MEM_TREE ⇒ λc:aux_chk_type MEM_TREE. + λinf,sup:word16. + λv:memory_type. + mt_update_ranged memory_type c inf sup v + | MEM_BITS ⇒ λc:aux_chk_type MEM_BITS. + λinf,sup:word16. + λv:memory_type. + mt_update_ranged (Array8T memory_type) c inf sup (array_8T memory_type v v v v v v v v) + ]. + +(* unificazione dell'impostazione dei bit: chk_update_bit chk addr sub v *) +(* NB: dove non esiste la granularita' del bit, lascio inalterato *) +ndefinition check_update_bit ≝ +λt:memory_impl. + match t + return λt.aux_chk_type t → word16 → oct → memory_type → aux_chk_type t + with + [ MEM_FUNC ⇒ λc:aux_chk_type MEM_FUNC. + λaddr:word16. + λo:oct. + λv:memory_type. + c + | MEM_TREE ⇒ λc:aux_chk_type MEM_TREE. + λaddr:word16. + λo:oct. + λv:memory_type. + c + | MEM_BITS ⇒ λc:aux_chk_type MEM_BITS. + λaddr:word16. + λo:oct. + λv:memory_type. + mb_chk_update_bit c addr o v + ]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/memory_bits.ma b/helm/software/matita/contribs/ng_assembly/freescale/memory_bits.ma new file mode 100755 index 000000000..defef9be3 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/memory_bits.ma @@ -0,0 +1,227 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/memory_trees.ma". + +(* ********************* *) +(* MEMORIA E DESCRITTORE *) +(* ********************* *) + +(* tutta la memoria non installata *) +ndefinition mb_out_of_bound_memory ≝ +let base ≝ array_8T memory_type MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND + MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND in +let lev4 ≝ array_16T ? + base base base base base base base base + base base base base base base base base + in +let lev3 ≝ array_16T ? + lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 + lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 + in +let lev2 ≝ array_16T ? + lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 + lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 + in +let lev1 ≝ array_16T ? + lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 + lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 + in +lev1. + +(* tutta la memoria a 0 *) +ndefinition mb_zero_memory ≝ +let base ≝ array_8T bool false false false false false false false false in +let lev4 ≝ array_16T ? + base base base base base base base base + base base base base base base base base + in +let lev3 ≝ array_16T ? + lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 + lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 + in +let lev2 ≝ array_16T ? + lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 + lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 + in +let lev1 ≝ array_16T ? + lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 + lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 + in +lev1. + +(* scrivi bit controllando il tipo di memoria *) +ndefinition mb_mem_update_bit ≝ +λmem:Array16T (Array16T (Array16T (Array16T (Array8T bool)))). +λchk:Array16T (Array16T (Array16T (Array16T (Array8T memory_type)))). +λaddr:word16.λsub:oct.λv:bool. + match getn_array8T sub memory_type (mt_visit (Array8T memory_type) chk addr) with + (* ROM? ok, ma il valore viene perso *) + [ MEM_READ_ONLY ⇒ Some ? mem + (* RAM? ok *) + | MEM_READ_WRITE ⇒ Some ? (mt_update (Array8T bool) mem addr (setn_array8T sub bool (mt_visit (Array8T bool) mem addr) v)) + (* NON INSTALLATA? no *) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +(* scrivi tipo di bit *) +ndefinition mb_chk_update_bit ≝ +λchk:Array16T (Array16T (Array16T (Array16T (Array8T memory_type)))). +λaddr:word16.λsub:oct.λv:memory_type. + mt_update (Array8T memory_type) chk addr (setn_array8T sub memory_type (mt_visit (Array8T memory_type) chk addr) v). + +(* leggi bit controllando il tipo di memoria *) +ndefinition mb_mem_read_bit ≝ +λmem:Array16T (Array16T (Array16T (Array16T (Array8T bool)))). +λchk:Array16T (Array16T (Array16T (Array16T (Array8T memory_type)))). +λaddr:word16.λsub:oct. + match getn_array8T sub memory_type (mt_visit (Array8T memory_type) chk addr) with + (* ROM? ok, ma il valore viene perso *) + [ MEM_READ_ONLY ⇒ Some ? (getn_array8T sub bool (mt_visit (Array8T bool) mem addr)) + (* RAM? ok *) + | MEM_READ_WRITE ⇒ Some ? (getn_array8T sub bool (mt_visit (Array8T bool) mem addr)) + (* NON INSTALLATA? no *) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +ndefinition mb_chk_get ≝ +λchk:Array16T (Array16T (Array16T (Array16T (Array8T memory_type)))).λaddr:word16. +let c ≝ mt_visit (Array8T memory_type) chk addr in +array_8T ? (getn_array8T o7 ? c) (getn_array8T o6 ? c) + (getn_array8T o5 ? c) (getn_array8T o4 ? c) + (getn_array8T o3 ? c) (getn_array8T o2 ? c) + (getn_array8T o1 ? c) (getn_array8T o0 ? c). + +(* scrivi controllando il tipo di memoria *) +(* NB: devono esistere tutti i bit *) +ndefinition mb_mem_update ≝ +λmem:Array16T (Array16T (Array16T (Array16T (Array8T bool)))). +λchk:Array8T memory_type. +λaddr:word16.λv:byte8. +let old_value ≝ mt_visit (Array8T bool) mem addr in +let new_value ≝ bits_of_byte8 v in +let newbit0 ≝ match getn_array8T o0 memory_type chk with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o0 bool old_value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o0 bool new_value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit1 ≝ match getn_array8T o1 memory_type chk with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o1 bool old_value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o1 bool new_value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit2 ≝ match getn_array8T o2 memory_type chk with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o2 bool old_value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o2 bool new_value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit3 ≝ match getn_array8T o3 memory_type chk with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o3 bool old_value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o3 bool new_value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit4 ≝ match getn_array8T o4 memory_type chk with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o4 bool old_value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o4 bool new_value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit5 ≝ match getn_array8T o5 memory_type chk with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o5 bool old_value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o5 bool new_value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit6 ≝ match getn_array8T o6 memory_type chk with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o6 bool old_value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o6 bool new_value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit7 ≝ match getn_array8T o7 memory_type chk with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o7 bool old_value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o7 bool new_value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in + opt_map … newbit0 + (λnb0.opt_map … newbit1 + (λnb1.opt_map … newbit2 + (λnb2.opt_map … newbit3 + (λnb3.opt_map … newbit4 + (λnb4.opt_map … newbit5 + (λnb5.opt_map … newbit6 + (λnb6.opt_map … newbit7 + (λnb7.Some ? (mt_update (Array8T bool) mem addr (array_8T bool nb7 nb6 nb5 nb4 nb3 nb2 nb1 nb0)))))))))). + +(* leggi controllando il tipo di memoria *) +(* NB: devono esistere tutti i bit *) +ndefinition mb_mem_read ≝ +λmem:Array16T (Array16T (Array16T (Array16T (Array8T bool)))). +λchk:Array16T (Array16T (Array16T (Array16T (Array8T memory_type)))). +λaddr:word16. +let bit_types ≝ mt_visit (Array8T memory_type) chk addr in +let value ≝ mt_visit (Array8T bool) mem addr in +let newbit0 ≝ match getn_array8T o0 memory_type bit_types with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o0 bool value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o0 bool value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit1 ≝ match getn_array8T o1 memory_type bit_types with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o1 bool value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o1 bool value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit2 ≝ match getn_array8T o2 memory_type bit_types with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o2 bool value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o2 bool value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit3 ≝ match getn_array8T o3 memory_type bit_types with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o3 bool value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o3 bool value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit4 ≝ match getn_array8T o4 memory_type bit_types with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o4 bool value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o4 bool value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit5 ≝ match getn_array8T o5 memory_type bit_types with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o5 bool value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o5 bool value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit6 ≝ match getn_array8T o6 memory_type bit_types with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o6 bool value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o6 bool value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in +let newbit7 ≝ match getn_array8T o7 memory_type bit_types with + [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o7 bool value) + | MEM_READ_WRITE ⇒ Some bool (getn_array8T o7 bool value) + | MEM_OUT_OF_BOUND ⇒ None bool ] in + opt_map … newbit0 + (λnb0.opt_map … newbit1 + (λnb1.opt_map … newbit2 + (λnb2.opt_map … newbit3 + (λnb3.opt_map … newbit4 + (λnb4.opt_map … newbit5 + (λnb5.opt_map … newbit6 + (λnb6.opt_map … newbit7 + (λnb7.Some ? (byte8_of_bits (array_8T bool nb7 nb6 nb5 nb4 nb3 nb2 nb1 nb0)))))))))). + +(* ************************** *) +(* CARICAMENTO PROGRAMMA/DATI *) +(* ************************** *) + +(* carica a paratire da addr, scartando source (pescando da old_mem) se si supera 0xFFFF... *) +nlet rec mb_load_from_source_at (old_mem:Array16T (Array16T (Array16T (Array16T (Array8T bool))))) + (source:list byte8) (addr:word16) on source ≝ +match source with + (* fine di source: carica da old_mem *) + [ nil ⇒ old_mem + | cons hd tl ⇒ match lt_w16 addr 〈〈xF,xF〉:〈xF,xF〉〉 with + (* non supera 0xFFFF, ricorsione *) + [ true ⇒ mb_load_from_source_at (mt_update ? old_mem addr (bits_of_byte8 hd)) tl (plus_w16_d_d addr 〈〈x0,x0〉:〈x0,x1〉〉) + (* supera 0xFFFF, niente ricorsione *) + | false ⇒ mt_update ? old_mem addr (bits_of_byte8 hd) + ]]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/memory_func.ma b/helm/software/matita/contribs/ng_assembly/freescale/memory_func.ma new file mode 100755 index 000000000..0da0e6e41 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/memory_func.ma @@ -0,0 +1,91 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/memory_struct.ma". +include "num/word16.ma". +include "common/option.ma". +include "common/list.ma". + +(* ********************* *) +(* MEMORIA E DESCRITTORE *) +(* ********************* *) + +(* (mf_check_update_ranged chk inf sup mode) = setta tipo memoria *) +ndefinition mf_check_update_ranged ≝ +λf:word16 → memory_type.λi.λs.λv. + λx.match inrange_w16 x i s with + [ true ⇒ v + | false ⇒ f x ]. + +(* tutta la memoria non installata *) +ndefinition mf_out_of_bound_memory ≝ λ_:word16.MEM_OUT_OF_BOUND. + +ndefinition mf_chk_get ≝ +λc:word16 → memory_type.λa:word16. + match c a with + [ MEM_READ_ONLY ⇒ array_8T ? MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY + | MEM_READ_WRITE ⇒ array_8T ? MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE + | MEM_OUT_OF_BOUND ⇒ array_8T ? MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND + ]. + +(* (mf_mem_update mem checked addr val) = scrivi controllando il tipo di memoria *) +ndefinition mf_mem_update ≝ +λf:word16 → byte8.λc:Array8T memory_type.λa:word16.λv:byte8. + match getn_array8T o0 ? c with + (* ROM? ok, ma il valore viene perso *) + [ MEM_READ_ONLY ⇒ Some ? f + (* RAM? ok *) + | MEM_READ_WRITE ⇒ Some ? (λx.match eq_w16 x a with [ true ⇒ v | false ⇒ f x ]) + (* NON INSTALLATA? no *) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +(* tutta la memoria a 0 *) +ndefinition mf_zero_memory ≝ λ_:word16.〈x0,x0〉. + +(* (mf_mem_read mem check addr) = leggi controllando il tipo di memoria *) +ndefinition mf_mem_read ≝ +λf:word16 → byte8.λc:word16 → memory_type.λa. + match c a with + [ MEM_READ_ONLY ⇒ Some ? (f a) + | MEM_READ_WRITE ⇒ Some ? (f a) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +(* ************************** *) +(* CARICAMENTO PROGRAMMA/DATI *) +(* ************************** *) + +(* carica a paratire da addr, scartando source (pescando da old_mem) se si supera 0xFFFF... *) +nlet rec mf_load_from_source_at (old_mem:word16 → byte8) (source:list byte8) (addr:word16) on source ≝ +match source with + (* fine di source: carica da old_mem *) + [ nil ⇒ old_mem + | cons hd tl ⇒ λx:word16.match lt_w16 x addr with + (* e' prima di source: carica da old_mem *) + [ true ⇒ old_mem x + | false ⇒ match eq_w16 x addr with + (* la locazione corrisponde al punto corrente di source *) + [ true ⇒ hd + (* la locazione e' piu' avanti: ricorsione *) + | false ⇒ (mf_load_from_source_at old_mem tl (plus_w16_d_d addr 〈〈x0,x0〉:〈x0,x1〉〉)) x + ] + ] + ]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/memory_struct.ma b/helm/software/matita/contribs/ng_assembly/freescale/memory_struct.ma new file mode 100755 index 000000000..7ce6ae07f --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/memory_struct.ma @@ -0,0 +1,624 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "num/oct.ma". +include "num/byte8.ma". + +(* **************************** *) +(* TIPI PER I MODULI DI MEMORIA *) +(* **************************** *) + +(* tipi di memoria:RAM/ROM/non installata *) +ninductive memory_type : Type ≝ + MEM_READ_ONLY: memory_type +| MEM_READ_WRITE: memory_type +| MEM_OUT_OF_BOUND: memory_type. + +(* **************** *) +(* TIPO ARRAY DA 16 *) +(* **************** *) + +(* definizione di un array omogeneo di dimensione 16 *) +ninductive Array16T (T:Type) : Type ≝ +array_16T : T → T → T → T → T → T → T → T → + T → T → T → T → T → T → T → T → + Array16T T. + +(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) +(* posso definire un getter a matrice sull'array *) +ndefinition getn_array16T ≝ +λn:exadecim.λT:Type.λp:Array16T T. + match p with + [ array_16T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 ⇒ + match n with + [ x0 ⇒ e00 | x1 ⇒ e01 | x2 ⇒ e02 | x3 ⇒ e03 | x4 ⇒ e04 | x5 ⇒ e05 | x6 ⇒ e06 | x7 ⇒ e07 + | x8 ⇒ e08 | x9 ⇒ e09 | xA ⇒ e10 | xB ⇒ e11 | xC ⇒ e12 | xD ⇒ e13 | xE ⇒ e14 | xF ⇒ e15 + ]]. + +(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) +(* posso definire un setter a matrice sull'array *) +ndefinition setn_array16T ≝ +λn:exadecim.λT:Type.λp:Array16T T.λv:T. + match p with + [ array_16T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 ⇒ + match n with + [ x0 ⇒ array_16T T v e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x1 ⇒ array_16T T e00 v e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x2 ⇒ array_16T T e00 e01 v e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x3 ⇒ array_16T T e00 e01 e02 v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x4 ⇒ array_16T T e00 e01 e02 e03 v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x5 ⇒ array_16T T e00 e01 e02 e03 e04 v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x6 ⇒ array_16T T e00 e01 e02 e03 e04 e05 v e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x7 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 v + ]]. + +(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) +(* posso definire un setter multiplo [m,n] a matrice sull'array *) +ndefinition setmn_array16T ≝ +λm,n:exadecim.λT:Type.λp:Array16T T.λv:T. + match p with + [ array_16T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 ⇒ + match m with + [ x0 ⇒ match n with + [ x0 ⇒ array_16T T v e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x1 ⇒ array_16T T v v e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x2 ⇒ array_16T T v v v e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x3 ⇒ array_16T T v v v v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x4 ⇒ array_16T T v v v v v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x5 ⇒ array_16T T v v v v v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x6 ⇒ array_16T T v v v v v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x7 ⇒ array_16T T v v v v v v v v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T v v v v v v v v v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T v v v v v v v v v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T v v v v v v v v v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T v v v v v v v v v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T v v v v v v v v v v v v v e13 e14 e15 + | xD ⇒ array_16T T v v v v v v v v v v v v v v e14 e15 + | xE ⇒ array_16T T v v v v v v v v v v v v v v v e15 + | xF ⇒ array_16T T v v v v v v v v v v v v v v v v ] + | x1 ⇒ match n with + [ x0 ⇒ p + | x1 ⇒ array_16T T e00 v e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x2 ⇒ array_16T T e00 v v e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x3 ⇒ array_16T T e00 v v v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x4 ⇒ array_16T T e00 v v v v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x5 ⇒ array_16T T e00 v v v v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x6 ⇒ array_16T T e00 v v v v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x7 ⇒ array_16T T e00 v v v v v v v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T e00 v v v v v v v v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 v v v v v v v v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 v v v v v v v v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 v v v v v v v v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 v v v v v v v v v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 v v v v v v v v v v v v v e14 e15 + | xE ⇒ array_16T T e00 v v v v v v v v v v v v v v e15 + | xF ⇒ array_16T T e00 v v v v v v v v v v v v v v v ] + | x2 ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p + | x2 ⇒ array_16T T e00 e01 v e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x3 ⇒ array_16T T e00 e01 v v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x4 ⇒ array_16T T e00 e01 v v v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x5 ⇒ array_16T T e00 e01 v v v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x6 ⇒ array_16T T e00 e01 v v v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x7 ⇒ array_16T T e00 e01 v v v v v v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T e00 e01 v v v v v v v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 e01 v v v v v v v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 v v v v v v v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 v v v v v v v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 v v v v v v v v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 v v v v v v v v v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 v v v v v v v v v v v v v e15 + | xF ⇒ array_16T T e00 e01 v v v v v v v v v v v v v v ] + | x3 ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p + | x3 ⇒ array_16T T e00 e01 e02 v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x4 ⇒ array_16T T e00 e01 e02 v v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x5 ⇒ array_16T T e00 e01 e02 v v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x6 ⇒ array_16T T e00 e01 e02 v v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x7 ⇒ array_16T T e00 e01 e02 v v v v v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T e00 e01 e02 v v v v v v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 e01 e02 v v v v v v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 e02 v v v v v v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 v v v v v v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 v v v v v v v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 v v v v v v v v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 v v v v v v v v v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 v v v v v v v v v v v v v ] + | x4 ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p + | x4 ⇒ array_16T T e00 e01 e02 e03 v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x5 ⇒ array_16T T e00 e01 e02 e03 v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x6 ⇒ array_16T T e00 e01 e02 e03 v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x7 ⇒ array_16T T e00 e01 e02 e03 v v v v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T e00 e01 e02 e03 v v v v v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 e01 e02 e03 v v v v v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 e02 e03 v v v v v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 e03 v v v v v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 v v v v v v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 v v v v v v v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 v v v v v v v v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 v v v v v v v v v v v v ] + | x5 ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p + | x5 ⇒ array_16T T e00 e01 e02 e03 e04 v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x6 ⇒ array_16T T e00 e01 e02 e03 e04 v v e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x7 ⇒ array_16T T e00 e01 e02 e03 e04 v v v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T e00 e01 e02 e03 e04 v v v v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 e01 e02 e03 e04 v v v v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 e02 e03 e04 v v v v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 e03 e04 v v v v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 e04 v v v v v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 v v v v v v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 v v v v v v v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 v v v v v v v v v v v ] + | x6 ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p + | x6 ⇒ array_16T T e00 e01 e02 e03 e04 e05 v e07 e08 e09 e10 e11 e12 e13 e14 e15 + | x7 ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v v v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v v v v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v v v v v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 v v v v v v v v v v ] + | x7 ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p + | x7 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v e08 e09 e10 e11 e12 e13 e14 e15 + | x8 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v v v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v v v v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v v v v v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 v v v v v v v v v ] + | x8 ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p + | x8 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v e09 e10 e11 e12 e13 e14 e15 + | x9 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v v v v v ] + | x9 ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p + | x8 ⇒ p + | x9 ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v e10 e11 e12 e13 e14 e15 + | xA ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v v v v v ] + | xA ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p + | x8 ⇒ p | x9 ⇒ p + | xA ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v e11 e12 e13 e14 e15 + | xB ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v v v v v ] + | xB ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p + | x8 ⇒ p | x9 ⇒ p | xA ⇒ p + | xB ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v e12 e13 e14 e15 + | xC ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v v v v v ] + | xC ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p + | x8 ⇒ p | x9 ⇒ p | xA ⇒ p | xB ⇒ p + | xC ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v e13 e14 e15 + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v v v v ] + | xD ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p + | x8 ⇒ p | x9 ⇒ p | xA ⇒ p | xB ⇒ p | xC ⇒ p + | xD ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 v e14 e15 + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 v v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 v v v ] + | xE ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p + | x8 ⇒ p | x9 ⇒ p | xA ⇒ p | xB ⇒ p | xC ⇒ p | xD ⇒ p + | xE ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 v e15 + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 v v ] + | xF ⇒ match n with + [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p + | x8 ⇒ p | x9 ⇒ p | xA ⇒ p | xB ⇒ p | xC ⇒ p | xD ⇒ p | xE ⇒ p + | xF ⇒ array_16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 v ] + ]]. + +(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) +(* posso definire un setter composto [m+1,n-1] a matrice sull'array *) +(* NB: obbiettivo evitare l'overflow *) +ndefinition setmn_array16T_succ_pred ≝ +λm,n:exadecim.λT:Type.λp:Array16T T.λv:T. + match lt_ex m xF with + [ true ⇒ match gt_ex n x0 with + [ true ⇒ setmn_array16T (succ_ex m) (pred_ex n) T p v + | false ⇒ p + ] + | false ⇒ p + ]. + +(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) +(* posso definire un setter composto [m+1,F] a matrice sull'array *) +(* NB: obbiettivo evitare l'overflow *) +ndefinition setmn_array16T_succ ≝ +λm:exadecim.λT:Type.λp:Array16T T.λv:T. + match lt_ex m xF with + [ true ⇒ setmn_array16T (succ_ex m) xF T p v + | false ⇒ p + ]. + +(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) +(* posso definire un setter composto [0,n-1] a matrice sull'array *) +(* NB: obbiettivo evitare l'overflow *) +ndefinition setmn_array16T_pred ≝ +λn:exadecim.λT:Type.λp:Array16T T.λv:T. + match gt_ex n x0 with + [ true ⇒ setmn_array16T x0 (pred_ex n) T p v + | false ⇒ p + ]. + +(* ************************** *) +(* TIPO BYTE COME INSIEME BIT *) +(* ************************** *) + +(* definizione di un byte come 8 bit *) +ninductive Array8T (T:Type) : Type ≝ +array_8T : T → T → T → T → T → T → T → T → + Array8T T. + +(* abbiamo gia' gli ottali come tipo induttivo quindi: *) +(* posso definire un getter a matrice sull'array *) +ndefinition getn_array8T ≝ +λn:oct.λT:Type.λp:Array8T T. + match p with + [ array_8T e07 e06 e05 e04 e03 e02 e01 e00 ⇒ + match n with + [ o0 ⇒ e00 | o1 ⇒ e01 | o2 ⇒ e02 | o3 ⇒ e03 | o4 ⇒ e04 | o5 ⇒ e05 | o6 ⇒ e06 | o7 ⇒ e07 ]]. + +(* abbiamo gia' gli ottali come tipo induttivo quindi: *) +(* posso definire un setter a matrice sull'array *) +ndefinition setn_array8T ≝ +λn:oct.λT:Type.λp:Array8T T.λv:T. + match p with + [ array_8T e07 e06 e05 e04 e03 e02 e01 e00 ⇒ + match n with + [ o0 ⇒ array_8T T e07 e06 e05 e04 e03 e02 e01 v + | o1 ⇒ array_8T T e07 e06 e05 e04 e03 e02 v e00 + | o2 ⇒ array_8T T e07 e06 e05 e04 e03 v e01 e00 + | o3 ⇒ array_8T T e07 e06 e05 e04 v e02 e01 e00 + | o4 ⇒ array_8T T e07 e06 e05 v e03 e02 e01 e00 + | o5 ⇒ array_8T T e07 e06 v e04 e03 e02 e01 e00 + | o6 ⇒ array_8T T e07 v e05 e04 e03 e02 e01 e00 + | o7 ⇒ array_8T T v e06 e05 e04 e03 e02 e01 e00 + ]]. + +(* lettura byte *) +ndefinition byte8_of_bits ≝ +λp:Array8T bool. + match p with + [ array_8T e07 e06 e05 e04 e03 e02 e01 e00 ⇒ + mk_byte8 + (or_ex (match e07 with [ true ⇒ x8 | false ⇒ x0 ]) + (or_ex (match e06 with [ true ⇒ x4 | false ⇒ x0 ]) + (or_ex (match e05 with [ true ⇒ x2 | false ⇒ x0 ]) + (match e04 with [ true ⇒ x1 | false ⇒ x0 ])))) + (or_ex (match e03 with [ true ⇒ x8 | false ⇒ x0 ]) + (or_ex (match e02 with [ true ⇒ x4 | false ⇒ x0 ]) + (or_ex (match e01 with [ true ⇒ x2 | false ⇒ x0 ]) + (match e00 with [ true ⇒ x1 | false ⇒ x0 ])))) ]. + +(* scrittura byte *) +ndefinition bits_of_byte8 ≝ +λp:byte8. + match b8h p with + [ x0 ⇒ match b8l p with + [ x0 ⇒ array_8T bool false false false false false false false false + | x1 ⇒ array_8T bool false false false false false false false true + | x2 ⇒ array_8T bool false false false false false false true false + | x3 ⇒ array_8T bool false false false false false false true true + | x4 ⇒ array_8T bool false false false false false true false false + | x5 ⇒ array_8T bool false false false false false true false true + | x6 ⇒ array_8T bool false false false false false true true false + | x7 ⇒ array_8T bool false false false false false true true true + | x8 ⇒ array_8T bool false false false false true false false false + | x9 ⇒ array_8T bool false false false false true false false true + | xA ⇒ array_8T bool false false false false true false true false + | xB ⇒ array_8T bool false false false false true false true true + | xC ⇒ array_8T bool false false false false true true false false + | xD ⇒ array_8T bool false false false false true true false true + | xE ⇒ array_8T bool false false false false true true true false + | xF ⇒ array_8T bool false false false false true true true true ] + | x1 ⇒ match b8l p with + [ x0 ⇒ array_8T bool false false false true false false false false + | x1 ⇒ array_8T bool false false false true false false false true + | x2 ⇒ array_8T bool false false false true false false true false + | x3 ⇒ array_8T bool false false false true false false true true + | x4 ⇒ array_8T bool false false false true false true false false + | x5 ⇒ array_8T bool false false false true false true false true + | x6 ⇒ array_8T bool false false false true false true true false + | x7 ⇒ array_8T bool false false false true false true true true + | x8 ⇒ array_8T bool false false false true true false false false + | x9 ⇒ array_8T bool false false false true true false false true + | xA ⇒ array_8T bool false false false true true false true false + | xB ⇒ array_8T bool false false false true true false true true + | xC ⇒ array_8T bool false false false true true true false false + | xD ⇒ array_8T bool false false false true true true false true + | xE ⇒ array_8T bool false false false true true true true false + | xF ⇒ array_8T bool false false false true true true true true ] + | x2 ⇒ match b8l p with + [ x0 ⇒ array_8T bool false false true false false false false false + | x1 ⇒ array_8T bool false false true false false false false true + | x2 ⇒ array_8T bool false false true false false false true false + | x3 ⇒ array_8T bool false false true false false false true true + | x4 ⇒ array_8T bool false false true false false true false false + | x5 ⇒ array_8T bool false false true false false true false true + | x6 ⇒ array_8T bool false false true false false true true false + | x7 ⇒ array_8T bool false false true false false true true true + | x8 ⇒ array_8T bool false false true false true false false false + | x9 ⇒ array_8T bool false false true false true false false true + | xA ⇒ array_8T bool false false true false true false true false + | xB ⇒ array_8T bool false false true false true false true true + | xC ⇒ array_8T bool false false true false true true false false + | xD ⇒ array_8T bool false false true false true true false true + | xE ⇒ array_8T bool false false true false true true true false + | xF ⇒ array_8T bool false false true false true true true true ] + | x3 ⇒ match b8l p with + [ x0 ⇒ array_8T bool false false true true false false false false + | x1 ⇒ array_8T bool false false true true false false false true + | x2 ⇒ array_8T bool false false true true false false true false + | x3 ⇒ array_8T bool false false true true false false true true + | x4 ⇒ array_8T bool false false true true false true false false + | x5 ⇒ array_8T bool false false true true false true false true + | x6 ⇒ array_8T bool false false true true false true true false + | x7 ⇒ array_8T bool false false true true false true true true + | x8 ⇒ array_8T bool false false true true true false false false + | x9 ⇒ array_8T bool false false true true true false false true + | xA ⇒ array_8T bool false false true true true false true false + | xB ⇒ array_8T bool false false true true true false true true + | xC ⇒ array_8T bool false false true true true true false false + | xD ⇒ array_8T bool false false true true true true false true + | xE ⇒ array_8T bool false false true true true true true false + | xF ⇒ array_8T bool false false true true true true true true ] + | x4 ⇒ match b8l p with + [ x0 ⇒ array_8T bool false true false false false false false false + | x1 ⇒ array_8T bool false true false false false false false true + | x2 ⇒ array_8T bool false true false false false false true false + | x3 ⇒ array_8T bool false true false false false false true true + | x4 ⇒ array_8T bool false true false false false true false false + | x5 ⇒ array_8T bool false true false false false true false true + | x6 ⇒ array_8T bool false true false false false true true false + | x7 ⇒ array_8T bool false true false false false true true true + | x8 ⇒ array_8T bool false true false false true false false false + | x9 ⇒ array_8T bool false true false false true false false true + | xA ⇒ array_8T bool false true false false true false true false + | xB ⇒ array_8T bool false true false false true false true true + | xC ⇒ array_8T bool false true false false true true false false + | xD ⇒ array_8T bool false true false false true true false true + | xE ⇒ array_8T bool false true false false true true true false + | xF ⇒ array_8T bool false true false false true true true true ] + | x5 ⇒ match b8l p with + [ x0 ⇒ array_8T bool false true false true false false false false + | x1 ⇒ array_8T bool false true false true false false false true + | x2 ⇒ array_8T bool false true false true false false true false + | x3 ⇒ array_8T bool false true false true false false true true + | x4 ⇒ array_8T bool false true false true false true false false + | x5 ⇒ array_8T bool false true false true false true false true + | x6 ⇒ array_8T bool false true false true false true true false + | x7 ⇒ array_8T bool false true false true false true true true + | x8 ⇒ array_8T bool false true false true true false false false + | x9 ⇒ array_8T bool false true false true true false false true + | xA ⇒ array_8T bool false true false true true false true false + | xB ⇒ array_8T bool false true false true true false true true + | xC ⇒ array_8T bool false true false true true true false false + | xD ⇒ array_8T bool false true false true true true false true + | xE ⇒ array_8T bool false true false true true true true false + | xF ⇒ array_8T bool false true false true true true true true ] + | x6 ⇒ match b8l p with + [ x0 ⇒ array_8T bool false true true false false false false false + | x1 ⇒ array_8T bool false true true false false false false true + | x2 ⇒ array_8T bool false true true false false false true false + | x3 ⇒ array_8T bool false true true false false false true true + | x4 ⇒ array_8T bool false true true false false true false false + | x5 ⇒ array_8T bool false true true false false true false true + | x6 ⇒ array_8T bool false true true false false true true false + | x7 ⇒ array_8T bool false true true false false true true true + | x8 ⇒ array_8T bool false true true false true false false false + | x9 ⇒ array_8T bool false true true false true false false true + | xA ⇒ array_8T bool false true true false true false true false + | xB ⇒ array_8T bool false true true false true false true true + | xC ⇒ array_8T bool false true true false true true false false + | xD ⇒ array_8T bool false true true false true true false true + | xE ⇒ array_8T bool false true true false true true true false + | xF ⇒ array_8T bool false true true false true true true true ] + | x7 ⇒ match b8l p with + [ x0 ⇒ array_8T bool false true true true false false false false + | x1 ⇒ array_8T bool false true true true false false false true + | x2 ⇒ array_8T bool false true true true false false true false + | x3 ⇒ array_8T bool false true true true false false true true + | x4 ⇒ array_8T bool false true true true false true false false + | x5 ⇒ array_8T bool false true true true false true false true + | x6 ⇒ array_8T bool false true true true false true true false + | x7 ⇒ array_8T bool false true true true false true true true + | x8 ⇒ array_8T bool false true true true true false false false + | x9 ⇒ array_8T bool false true true true true false false true + | xA ⇒ array_8T bool false true true true true false true false + | xB ⇒ array_8T bool false true true true true false true true + | xC ⇒ array_8T bool false true true true true true false false + | xD ⇒ array_8T bool false true true true true true false true + | xE ⇒ array_8T bool false true true true true true true false + | xF ⇒ array_8T bool false true true true true true true true ] + | x8 ⇒ match b8l p with + [ x0 ⇒ array_8T bool true false false false false false false false + | x1 ⇒ array_8T bool true false false false false false false true + | x2 ⇒ array_8T bool true false false false false false true false + | x3 ⇒ array_8T bool true false false false false false true true + | x4 ⇒ array_8T bool true false false false false true false false + | x5 ⇒ array_8T bool true false false false false true false true + | x6 ⇒ array_8T bool true false false false false true true false + | x7 ⇒ array_8T bool true false false false false true true true + | x8 ⇒ array_8T bool true false false false true false false false + | x9 ⇒ array_8T bool true false false false true false false true + | xA ⇒ array_8T bool true false false false true false true false + | xB ⇒ array_8T bool true false false false true false true true + | xC ⇒ array_8T bool true false false false true true false false + | xD ⇒ array_8T bool true false false false true true false true + | xE ⇒ array_8T bool true false false false true true true false + | xF ⇒ array_8T bool true false false false true true true true ] + | x9 ⇒ match b8l p with + [ x0 ⇒ array_8T bool true false false true false false false false + | x1 ⇒ array_8T bool true false false true false false false true + | x2 ⇒ array_8T bool true false false true false false true false + | x3 ⇒ array_8T bool true false false true false false true true + | x4 ⇒ array_8T bool true false false true false true false false + | x5 ⇒ array_8T bool true false false true false true false true + | x6 ⇒ array_8T bool true false false true false true true false + | x7 ⇒ array_8T bool true false false true false true true true + | x8 ⇒ array_8T bool true false false true true false false false + | x9 ⇒ array_8T bool true false false true true false false true + | xA ⇒ array_8T bool true false false true true false true false + | xB ⇒ array_8T bool true false false true true false true true + | xC ⇒ array_8T bool true false false true true true false false + | xD ⇒ array_8T bool true false false true true true false true + | xE ⇒ array_8T bool true false false true true true true false + | xF ⇒ array_8T bool true false false true true true true true ] + | xA ⇒ match b8l p with + [ x0 ⇒ array_8T bool true false true false false false false false + | x1 ⇒ array_8T bool true false true false false false false true + | x2 ⇒ array_8T bool true false true false false false true false + | x3 ⇒ array_8T bool true false true false false false true true + | x4 ⇒ array_8T bool true false true false false true false false + | x5 ⇒ array_8T bool true false true false false true false true + | x6 ⇒ array_8T bool true false true false false true true false + | x7 ⇒ array_8T bool true false true false false true true true + | x8 ⇒ array_8T bool true false true false true false false false + | x9 ⇒ array_8T bool true false true false true false false true + | xA ⇒ array_8T bool true false true false true false true false + | xB ⇒ array_8T bool true false true false true false true true + | xC ⇒ array_8T bool true false true false true true false false + | xD ⇒ array_8T bool true false true false true true false true + | xE ⇒ array_8T bool true false true false true true true false + | xF ⇒ array_8T bool true false true false true true true true ] + | xB ⇒ match b8l p with + [ x0 ⇒ array_8T bool true false true true false false false false + | x1 ⇒ array_8T bool true false true true false false false true + | x2 ⇒ array_8T bool true false true true false false true false + | x3 ⇒ array_8T bool true false true true false false true true + | x4 ⇒ array_8T bool true false true true false true false false + | x5 ⇒ array_8T bool true false true true false true false true + | x6 ⇒ array_8T bool true false true true false true true false + | x7 ⇒ array_8T bool true false true true false true true true + | x8 ⇒ array_8T bool true false true true true false false false + | x9 ⇒ array_8T bool true false true true true false false true + | xA ⇒ array_8T bool true false true true true false true false + | xB ⇒ array_8T bool true false true true true false true true + | xC ⇒ array_8T bool true false true true true true false false + | xD ⇒ array_8T bool true false true true true true false true + | xE ⇒ array_8T bool true false true true true true true false + | xF ⇒ array_8T bool true false true true true true true true ] + | xC ⇒ match b8l p with + [ x0 ⇒ array_8T bool true true false false false false false false + | x1 ⇒ array_8T bool true true false false false false false true + | x2 ⇒ array_8T bool true true false false false false true false + | x3 ⇒ array_8T bool true true false false false false true true + | x4 ⇒ array_8T bool true true false false false true false false + | x5 ⇒ array_8T bool true true false false false true false true + | x6 ⇒ array_8T bool true true false false false true true false + | x7 ⇒ array_8T bool true true false false false true true true + | x8 ⇒ array_8T bool true true false false true false false false + | x9 ⇒ array_8T bool true true false false true false false true + | xA ⇒ array_8T bool true true false false true false true false + | xB ⇒ array_8T bool true true false false true false true true + | xC ⇒ array_8T bool true true false false true true false false + | xD ⇒ array_8T bool true true false false true true false true + | xE ⇒ array_8T bool true true false false true true true false + | xF ⇒ array_8T bool true true false false true true true true ] + | xD ⇒ match b8l p with + [ x0 ⇒ array_8T bool true true false true false false false false + | x1 ⇒ array_8T bool true true false true false false false true + | x2 ⇒ array_8T bool true true false true false false true false + | x3 ⇒ array_8T bool true true false true false false true true + | x4 ⇒ array_8T bool true true false true false true false false + | x5 ⇒ array_8T bool true true false true false true false true + | x6 ⇒ array_8T bool true true false true false true true false + | x7 ⇒ array_8T bool true true false true false true true true + | x8 ⇒ array_8T bool true true false true true false false false + | x9 ⇒ array_8T bool true true false true true false false true + | xA ⇒ array_8T bool true true false true true false true false + | xB ⇒ array_8T bool true true false true true false true true + | xC ⇒ array_8T bool true true false true true true false false + | xD ⇒ array_8T bool true true false true true true false true + | xE ⇒ array_8T bool true true false true true true true false + | xF ⇒ array_8T bool true true false true true true true true ] + | xE ⇒ match b8l p with + [ x0 ⇒ array_8T bool true true true false false false false false + | x1 ⇒ array_8T bool true true true false false false false true + | x2 ⇒ array_8T bool true true true false false false true false + | x3 ⇒ array_8T bool true true true false false false true true + | x4 ⇒ array_8T bool true true true false false true false false + | x5 ⇒ array_8T bool true true true false false true false true + | x6 ⇒ array_8T bool true true true false false true true false + | x7 ⇒ array_8T bool true true true false false true true true + | x8 ⇒ array_8T bool true true true false true false false false + | x9 ⇒ array_8T bool true true true false true false false true + | xA ⇒ array_8T bool true true true false true false true false + | xB ⇒ array_8T bool true true true false true false true true + | xC ⇒ array_8T bool true true true false true true false false + | xD ⇒ array_8T bool true true true false true true false true + | xE ⇒ array_8T bool true true true false true true true false + | xF ⇒ array_8T bool true true true false true true true true ] + | xF ⇒ match b8l p with + [ x0 ⇒ array_8T bool true true true true false false false false + | x1 ⇒ array_8T bool true true true true false false false true + | x2 ⇒ array_8T bool true true true true false false true false + | x3 ⇒ array_8T bool true true true true false false true true + | x4 ⇒ array_8T bool true true true true false true false false + | x5 ⇒ array_8T bool true true true true false true false true + | x6 ⇒ array_8T bool true true true true false true true false + | x7 ⇒ array_8T bool true true true true false true true true + | x8 ⇒ array_8T bool true true true true true false false false + | x9 ⇒ array_8T bool true true true true true false false true + | xA ⇒ array_8T bool true true true true true false true false + | xB ⇒ array_8T bool true true true true true false true true + | xC ⇒ array_8T bool true true true true true true false false + | xD ⇒ array_8T bool true true true true true true false true + | xE ⇒ array_8T bool true true true true true true true false + | xF ⇒ array_8T bool true true true true true true true true ] + ]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/memory_trees.ma b/helm/software/matita/contribs/ng_assembly/freescale/memory_trees.ma new file mode 100755 index 000000000..39a6468ae --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/memory_trees.ma @@ -0,0 +1,231 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/memory_struct.ma". +include "num/word16.ma". +include "common/option.ma". +include "common/list.ma". + +(* ********************* *) +(* MEMORIA E DESCRITTORE *) +(* ********************* *) + +(* tutta la memoria non installata *) +ndefinition mt_out_of_bound_memory ≝ +let lev4 ≝ array_16T ? + MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND + MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND + MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND + MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND + in +let lev3 ≝ array_16T ? + lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 + lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 + in +let lev2 ≝ array_16T ? + lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 + lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 + in +let lev1 ≝ array_16T ? + lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 + lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 + in +lev1. + +(* tutta la memoria a 0 *) +ndefinition mt_zero_memory ≝ +let lev4 ≝ array_16T ? + (mk_byte8 x0 x0) (mk_byte8 x0 x0) (mk_byte8 x0 x0) (mk_byte8 x0 x0) + (mk_byte8 x0 x0) (mk_byte8 x0 x0) (mk_byte8 x0 x0) (mk_byte8 x0 x0) + (mk_byte8 x0 x0) (mk_byte8 x0 x0) (mk_byte8 x0 x0) (mk_byte8 x0 x0) + (mk_byte8 x0 x0) (mk_byte8 x0 x0) (mk_byte8 x0 x0) (mk_byte8 x0 x0) + in +let lev3 ≝ array_16T ? + lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 + lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 + in +let lev2 ≝ array_16T ? + lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 + lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 + in +let lev1 ≝ array_16T ? + lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 + lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 + in +lev1. + +(* visita di un albero da 64KB di elementi: ln16(65536)=4 passaggi *) +ndefinition mt_visit ≝ +λT:Type.λdata:Array16T (Array16T (Array16T (Array16T T))).λaddr:word16. + match addr with + [ mk_word16 wh wl ⇒ + getn_array16T (b8l wl) ? + (getn_array16T (b8h wl) ? + (getn_array16T (b8l wh) ? + (getn_array16T (b8h wh) ? data))) ]. + +(* scrittura di un elemento in un albero da 64KB *) +ndefinition mt_update ≝ +λT:Type.λdata:Array16T (Array16T (Array16T (Array16T T))).λaddr:word16.λv:T. + match addr with + [ mk_word16 wh wl ⇒ + let lev2 ≝ getn_array16T (b8h wh) ? data in + let lev3 ≝ getn_array16T (b8l wh) ? lev2 in + let lev4 ≝ getn_array16T (b8h wl) ? lev3 in + setn_array16T (b8h wh) ? data + (setn_array16T (b8l wh) ? lev2 + (setn_array16T (b8h wl) ? lev3 + (setn_array16T (b8l wl) T lev4 v))) ]. + +(* scrittura di un range in un albero da 64KB *) +ndefinition mt_update_ranged ≝ +λT:Type.λdata:Array16T (Array16T (Array16T (Array16T T))).λi,s:word16.λv:T. + (* ok i≤s *) + match le_w16 i s with + [ true ⇒ + match i with + [ mk_word16 ih il ⇒ + match s with + [ mk_word16 sh sl ⇒ + let aux_4 ≝ Array16T T in + let aux_3 ≝ Array16T (Array16T T) in + let aux_2 ≝ Array16T (Array16T (Array16T T)) in + + let ilev2 ≝ getn_array16T (b8h ih) aux_2 data in + let ilev3 ≝ getn_array16T (b8l ih) aux_3 ilev2 in + let ilev4 ≝ getn_array16T (b8h il) aux_4 ilev3 in + + let slev2 ≝ getn_array16T (b8h sh) aux_2 data in + let slev3 ≝ getn_array16T (b8l sh) aux_3 slev2 in + let slev4 ≝ getn_array16T (b8h sl) aux_4 slev3 in + + let vlev4 ≝ array_16T T v v v v v v v v v v v v v v v v in + let vlev3 ≝ array_16T aux_4 vlev4 vlev4 vlev4 vlev4 vlev4 vlev4 vlev4 vlev4 + vlev4 vlev4 vlev4 vlev4 vlev4 vlev4 vlev4 vlev4 in + let vlev2 ≝ array_16T aux_3 vlev3 vlev3 vlev3 vlev3 vlev3 vlev3 vlev3 vlev3 + vlev3 vlev3 vlev3 vlev3 vlev3 vlev3 vlev3 vlev3 in + + match eq_ex (b8h ih) (b8h sh) with + [ true ⇒ match eq_ex (b8l ih) (b8l sh) with + [ true ⇒ match eq_ex (b8h il) (b8h sl) with + (* caso 0x...(X) a 0x...(Y) *) + [ true ⇒ setn_array16T (b8h ih) aux_2 data + (setn_array16T (b8l ih) aux_3 ilev2 + (setn_array16T (b8h il) aux_4 ilev3 + (* cambio a partire da livello 4 *) + (setmn_array16T (b8l il) (b8l sl) T ilev4 v))) (* ...X,...Y *) + (* caso 0x..(X1)(X2) a 0x..(Y1)(Y2) *) + | false ⇒ setn_array16T (b8h ih) aux_2 data + (setn_array16T (b8l ih) aux_3 ilev2 + (* cambio a partire da livello 3 *) + (setn_array16T (b8h sl) aux_4 (* ..(Y1)0,..(Y1)(Y2) *) + (setmn_array16T_succ_pred (b8h il) (b8h sl) aux_4 (* ..(X1+1).,..(Y1-1). *) + (setn_array16T (b8h il) aux_4 ilev3 + (setmn_array16T (b8l il) xF T ilev4 v)) (* ..(X1)(X2),..(X1)F *) + vlev4) + (setmn_array16T x0 (b8l sl) T slev4 v))) ] + (* caso 0x.(X1)(X2)(X3) a 0x..(Y1)(Y2)(Y3) *) + | false ⇒ setn_array16T (b8h ih) aux_2 data + (* cambio a partire da livello 2 *) + (setn_array16T (b8l sh) aux_3 + (setmn_array16T_succ_pred (b8l ih) (b8l sh) aux_3 (* .(X1+1)..,.(Y1-1).. *) + (setn_array16T (b8l ih) aux_3 ilev2 + (setmn_array16T_succ (b8h il) aux_4 (* .(X1)(X2+1).,.(X1)F. *) + (setn_array16T (b8h il) aux_4 ilev3 + (setmn_array16T (b8l il) xF T ilev4 v)) (* .(X1)(X2)(X3),.(X1)(X2)F *) + vlev4)) + vlev3) + (setmn_array16T_pred (b8h sl) aux_4 (* .(Y1)0.,.(Y1)(Y2-1). *) + (setn_array16T (b8h sl) aux_4 slev3 + (setmn_array16T x0 (b8l sl) T slev4 v)) (* .(Y1)(Y2)0,.(Y1)(Y2)(Y3) *) + vlev4)) + ] + (* caso 0x(X1)(X2)(X3)(X4) a 0x(Y1)(Y2)(Y3)(Y4) *) + | false ⇒ setn_array16T (b8h sh) aux_2 + (setmn_array16T_succ_pred (b8h ih) (b8h sh) aux_2 (* (X+1)...,(Y-1)... *) + (setn_array16T (b8h ih) aux_2 data + (setmn_array16T_succ (b8l ih) aux_3 (* (X1)(X2+1)..,(X1)F.. *) + (setn_array16T (b8l ih) aux_3 ilev2 + (setmn_array16T_succ (b8h il) aux_4 (* (X1)(X2)(X3+1).,(X1)(X2)F. *) + (setn_array16T (b8h il) aux_4 ilev3 + (setmn_array16T (b8l il) xF T ilev4 v)) (* (X1)(X2)(X3)(X4),(X1)(X2)(X3)F *) + vlev4)) + vlev3)) + vlev2) + (setmn_array16T_pred (b8l sh) aux_3 (* (Y1)0..,(Y1)(Y2-1).. *) + (setn_array16T (b8l sh) aux_3 slev2 + (setmn_array16T_pred (b8h sl) aux_4 (* (Y1)(Y2)0.,(Y1)(Y2)(Y3-1). *) + (setn_array16T (b8h sl) aux_4 slev3 + (setmn_array16T x0 (b8l sl) T slev4 v)) (* (Y1)(Y2)(Y3)0,(Y1)(Y2)(Y3)(Y4) *) + vlev4)) + vlev3) ]]] + (* no i>s *) + | false ⇒ data + ]. + +ndefinition mt_chk_get ≝ +λchk:Array16T (Array16T (Array16T (Array16T memory_type))).λaddr:word16. + match mt_visit ? chk addr with + [ MEM_READ_ONLY ⇒ array_8T ? MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY + | MEM_READ_WRITE ⇒ array_8T ? MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE + | MEM_OUT_OF_BOUND ⇒ array_8T ? MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND + ]. + +(* scrivi controllando il tipo di memoria *) +ndefinition mt_mem_update ≝ +λmem:Array16T (Array16T (Array16T (Array16T byte8))). +λchk:Array8T memory_type. +λaddr:word16.λv:byte8. + match getn_array8T o0 ? chk with + (* ROM? ok, ma il valore viene perso *) + [ MEM_READ_ONLY ⇒ Some ? mem + (* RAM? ok *) + | MEM_READ_WRITE ⇒ Some ? (mt_update ? mem addr v) + (* NON INSTALLATA? no *) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +(* leggi controllando il tipo di memoria *) +ndefinition mt_mem_read ≝ +λmem:Array16T (Array16T (Array16T (Array16T byte8))). +λchk:Array16T (Array16T (Array16T (Array16T memory_type))). +λaddr:word16. + match mt_visit ? chk addr with + [ MEM_READ_ONLY ⇒ Some ? (mt_visit ? mem addr) + | MEM_READ_WRITE ⇒ Some ? (mt_visit ? mem addr) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +(* ************************** *) +(* CARICAMENTO PROGRAMMA/DATI *) +(* ************************** *) + +(* carica a paratire da addr, scartando source (pescando da old_mem) se si supera 0xFFFF... *) +nlet rec mt_load_from_source_at (old_mem:Array16T (Array16T (Array16T (Array16T byte8)))) + (source:list byte8) (addr:word16) on source ≝ +match source with + (* fine di source: carica da old_mem *) + [ nil ⇒ old_mem + | cons hd tl ⇒ match lt_w16 addr 〈〈xF,xF〉:〈xF,xF〉〉 with + (* non supera 0xFFFF, ricorsione *) + [ true ⇒ mt_load_from_source_at (mt_update ? old_mem addr hd) tl (plus_w16_d_d addr 〈〈x0,x0〉:〈x0,x1〉〉) + (* supera 0xFFFF, niente ricorsione *) + | false ⇒ mt_update ? old_mem addr hd + ]]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/opcode.ma b/helm/software/matita/contribs/ng_assembly/freescale/opcode.ma new file mode 100755 index 000000000..bfaa0e101 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/opcode.ma @@ -0,0 +1,180 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/opcode_base.ma". +include "common/list.ma". + +(* ********************************************* *) +(* STRUMENTI PER LE DIMOSTRAZIONI DI CORRETTEZZA *) +(* ********************************************* *) + +(* su tutta la lista quante volte compare il byte *) +nlet rec get_byte_count (m:mcu_type) (b:byte8) (c:word16) + (l:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on l ≝ + match l with + [ nil ⇒ c + | cons hd tl ⇒ match thd4T … hd with + [ Byte b' ⇒ match eq_b8 b b' with + [ true ⇒ get_byte_count m b (succ_w16 c) tl + | false ⇒ get_byte_count m b c tl + ] + | Word _ ⇒ get_byte_count m b c tl + ] + ]. + +(* su tutta la lista quante volte compare la word (0x9E+byte) *) +nlet rec get_word_count (m:mcu_type) (b:byte8) (c:word16) + (l:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on l ≝ + match l with + [ nil ⇒ c + | cons hd tl ⇒ match thd4T … hd with + [ Byte _ ⇒ get_word_count m b c tl + | Word w ⇒ match eq_w16 〈〈x9,xE〉:b〉 w with + [ true ⇒ get_word_count m b (succ_w16 c) tl + | false ⇒ get_word_count m b c tl + ] + ] + ]. + +(* su tutta la lista quante volte compare lo pseudocodice *) +nlet rec get_pseudo_count (m:mcu_type) (o:opcode) (c:word16) + (l:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on l ≝ + match l with + [ nil ⇒ c + | cons hd tl ⇒ match fst4T … hd with + [ anyOP o' ⇒ match eq_op o o' with + [ true ⇒ get_pseudo_count m o (succ_w16 c) tl + | false ⇒ get_pseudo_count m o c tl + ] + ] + ]. + +(* su tutta la lista quante volte compare la modalita' *) +nlet rec get_mode_count (m:mcu_type) (i:instr_mode) (c:word16) + (l:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on l ≝ + match l with + [ nil ⇒ c + | cons hd tl ⇒ match eq_im (snd4T … hd) i with + [ true ⇒ get_mode_count m i (succ_w16 c) tl + | false ⇒ get_mode_count m i c tl + ] + ]. + +(* b e' non implementato? *) +nlet rec test_not_impl_byte (b:byte8) (l:list byte8) on l ≝ + match l with + [ nil ⇒ false + | cons hd tl ⇒ match eq_b8 b hd with + [ true ⇒ true + | false ⇒ test_not_impl_byte b tl + ] + ]. + +(* o e' non implementato? *) +nlet rec test_not_impl_pseudo (o:opcode) (l:list opcode) on l ≝ + match l with + [ nil ⇒ false + | cons hd tl ⇒ match eq_op o hd with + [ true ⇒ true + | false ⇒ test_not_impl_pseudo o tl + ] + ]. + +(* i e' non implementato? *) +nlet rec test_not_impl_mode (i:instr_mode) (l:list instr_mode) on l ≝ + match l with + [ nil ⇒ false + | cons hd tl ⇒ match eq_im i hd with + [ true ⇒ true + | false ⇒ test_not_impl_mode i tl + ] + ]. + +(* su tutta la lista quante volte compare la coppia opcode,instr_mode *) +nlet rec get_OpIm_count (m:mcu_type) (o:any_opcode m) (i:instr_mode) (c:word16) + (l:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on l ≝ + match l with + [ nil ⇒ c + | cons hd tl ⇒ + match (eq_anyop m o (fst4T … hd)) ⊗ + (eq_im i (snd4T … hd)) with + [ true ⇒ get_OpIm_count m o i (succ_w16 c) tl + | false ⇒ get_OpIm_count m o i c tl + ] + ]. + +(* iteratore sugli opcode *) +ndefinition forall_op ≝ λP. + P ADC ⊗ P ADD ⊗ P AIS ⊗ P AIX ⊗ P AND ⊗ P ASL ⊗ P ASR ⊗ P BCC ⊗ + P BCLRn ⊗ P BCS ⊗ P BEQ ⊗ P BGE ⊗ P BGND ⊗ P BGT ⊗ P BHCC ⊗ P BHCS ⊗ + P BHI ⊗ P BIH ⊗ P BIL ⊗ P BIT ⊗ P BLE ⊗ P BLS ⊗ P BLT ⊗ P BMC ⊗ + P BMI ⊗ P BMS ⊗ P BNE ⊗ P BPL ⊗ P BRA ⊗ P BRCLRn ⊗ P BRN ⊗ P BRSETn ⊗ + P BSETn ⊗ P BSR ⊗ P CBEQA ⊗ P CBEQX ⊗ P CLC ⊗ P CLI ⊗ P CLR ⊗ P CMP ⊗ + P COM ⊗ P CPHX ⊗ P CPX ⊗ P DAA ⊗ P DBNZ ⊗ P DEC ⊗ P DIV ⊗ P EOR ⊗ + P INC ⊗ P JMP ⊗ P JSR ⊗ P LDA ⊗ P LDHX ⊗ P LDX ⊗ P LSR ⊗ P MOV ⊗ + P MUL ⊗ P NEG ⊗ P NOP ⊗ P NSA ⊗ P ORA ⊗ P PSHA ⊗ P PSHH ⊗ P PSHX ⊗ + P PULA ⊗ P PULH ⊗ P PULX ⊗ P ROL ⊗ P ROR ⊗ P RSP ⊗ P RTI ⊗ P RTS ⊗ + P SBC ⊗ P SEC ⊗ P SEI ⊗ P SHA ⊗ P SLA ⊗ P STA ⊗ P STHX ⊗ P STOP ⊗ + P STX ⊗ P SUB ⊗ P SWI ⊗ P TAP ⊗ P TAX ⊗ P TPA ⊗ P TST ⊗ P TSX ⊗ + P TXA ⊗ P TXS ⊗ P WAIT. + +(* iteratore sulle modalita' *) +ndefinition forall_im ≝ λP. + P MODE_INH +⊗ P MODE_INHA +⊗ P MODE_INHX +⊗ P MODE_INHH + +⊗ P MODE_INHX0ADD +⊗ P MODE_INHX1ADD +⊗ P MODE_INHX2ADD + +⊗ P MODE_IMM1 +⊗ P MODE_IMM1EXT +⊗ P MODE_IMM2 +⊗ P MODE_DIR1 +⊗ P MODE_DIR2 +⊗ P MODE_IX0 +⊗ P MODE_IX1 +⊗ P MODE_IX2 +⊗ P MODE_SP1 +⊗ P MODE_SP2 + +⊗ P MODE_DIR1_to_DIR1 +⊗ P MODE_IMM1_to_DIR1 +⊗ P MODE_IX0p_to_DIR1 +⊗ P MODE_DIR1_to_IX0p + +⊗ P MODE_INHA_and_IMM1 +⊗ P MODE_INHX_and_IMM1 +⊗ P MODE_IMM1_and_IMM1 +⊗ P MODE_DIR1_and_IMM1 +⊗ P MODE_IX0_and_IMM1 +⊗ P MODE_IX0p_and_IMM1 +⊗ P MODE_IX1_and_IMM1 +⊗ P MODE_IX1p_and_IMM1 +⊗ P MODE_SP1_and_IMM1 + +⊗ forall_oct (λo. P (MODE_DIRn o)) +⊗ forall_oct (λo. P (MODE_DIRn_and_IMM1 o)) +⊗ forall_ex (λe. P (MODE_TNY e)) +⊗ forall_bit (λt. P (MODE_SRT t)). diff --git a/helm/software/matita/contribs/ng_assembly/freescale/opcode_base.ma b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base.ma new file mode 100755 index 000000000..20abd2f8c --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base.ma @@ -0,0 +1,330 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "num/word16.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. + +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 ] + ]. + +(* enumerazione delle modalita' di indirizzamento = caricamento degli operandi *) +ninductive instr_mode: Type ≝ + (* INHERENT = nessun operando *) + MODE_INH : instr_mode + (* INHERENT = nessun operando (A implicito) *) +| MODE_INHA : instr_mode + (* INHERENT = nessun operando (X implicito) *) +| MODE_INHX : instr_mode + (* INHERENT = nessun operando (H implicito) *) +| MODE_INHH : instr_mode + + (* INHERENT_ADDRESS = nessun operando (HX implicito) *) +| MODE_INHX0ADD : instr_mode + (* INHERENT_ADDRESS = nessun operando (HX implicito+0x00bb) *) +| MODE_INHX1ADD : instr_mode + (* INHERENT_ADDRESS = nessun operando (HX implicito+0xwwww) *) +| MODE_INHX2ADD : instr_mode + + (* IMMEDIATE = operando valore immediato byte = 0xbb *) +| MODE_IMM1 : instr_mode + (* IMMEDIATE_EXT = operando valore immediato byte = 0xbb -> esteso a word *) +| MODE_IMM1EXT : instr_mode + (* IMMEDIATE = operando valore immediato word = 0xwwww *) +| MODE_IMM2 : instr_mode + (* DIRECT = operando offset byte = [0x00bb] *) +| MODE_DIR1 : instr_mode + (* DIRECT = operando offset word = [0xwwww] *) +| MODE_DIR2 : instr_mode + (* INDEXED = nessun operando (implicito [X] *) +| MODE_IX0 : instr_mode + (* INDEXED = operando offset relativo byte = [X+0x00bb] *) +| MODE_IX1 : instr_mode + (* INDEXED = operando offset relativo word = [X+0xwwww] *) +| MODE_IX2 : instr_mode + (* INDEXED = operando offset relativo byte = [SP+0x00bb] *) +| MODE_SP1 : instr_mode + (* INDEXED = operando offset relativo word = [SP+0xwwww] *) +| MODE_SP2 : instr_mode + + (* DIRECT → DIRECT = carica da diretto/scrive su diretto *) +| MODE_DIR1_to_DIR1 : instr_mode + (* IMMEDIATE → DIRECT = carica da immediato/scrive su diretto *) +| MODE_IMM1_to_DIR1 : instr_mode + (* INDEXED++ → DIRECT = carica da [X]/scrive su diretto/H:X++ *) +| MODE_IX0p_to_DIR1 : instr_mode + (* DIRECT → INDEXED++ = carica da diretto/scrive su [X]/H:X++ *) +| MODE_DIR1_to_IX0p : instr_mode + + (* INHERENT(A) + IMMEDIATE *) +| MODE_INHA_and_IMM1 : instr_mode + (* INHERENT(X) + IMMEDIATE *) +| MODE_INHX_and_IMM1 : instr_mode + (* IMMEDIATE + IMMEDIATE *) +| MODE_IMM1_and_IMM1 : instr_mode + (* DIRECT + IMMEDIATE *) +| MODE_DIR1_and_IMM1 : instr_mode + (* INDEXED + IMMEDIATE *) +| MODE_IX0_and_IMM1 : instr_mode + (* INDEXED++ + IMMEDIATE *) +| MODE_IX0p_and_IMM1 : instr_mode + (* INDEXED + IMMEDIATE *) +| MODE_IX1_and_IMM1 : instr_mode + (* INDEXED++ + IMMEDIATE *) +| MODE_IX1p_and_IMM1 : instr_mode + (* INDEXED + IMMEDIATE *) +| MODE_SP1_and_IMM1 : instr_mode + + (* DIRECT(mTNY) = operando offset byte(maschera scrittura implicita 3 bit) *) + (* ex: DIR3 e' carica b, scrivi b con n-simo bit modificato *) +| MODE_DIRn : oct → instr_mode + (* DIRECT(mTNY) + IMMEDIATE = operando offset byte(maschera lettura implicita 3 bit) *) + (* + operando valore immediato byte *) + (* ex: DIR2_and_IMM1 e' carica b, carica imm, restituisci n-simo bit di b + imm *) +| MODE_DIRn_and_IMM1 : oct → instr_mode + (* TINY = nessun operando (diretto implicito 4bit = [0x00000000:0000iiii]) *) +| MODE_TNY : exadecim → instr_mode + (* SHORT = nessun operando (diretto implicito 5bit = [0x00000000:000iiiii]) *) +| MODE_SRT : bitrigesim → instr_mode +. + +ndefinition eq_im ≝ +λi1,i2:instr_mode. + match i1 with + [ MODE_INH ⇒ match i2 with [ MODE_INH ⇒ true | _ ⇒ false ] + | MODE_INHA ⇒ match i2 with [ MODE_INHA ⇒ true | _ ⇒ false ] + | MODE_INHX ⇒ match i2 with [ MODE_INHX ⇒ true | _ ⇒ false ] + | MODE_INHH ⇒ match i2 with [ MODE_INHH ⇒ true | _ ⇒ false ] + | MODE_INHX0ADD ⇒ match i2 with [ MODE_INHX0ADD ⇒ true | _ ⇒ false ] + | MODE_INHX1ADD ⇒ match i2 with [ MODE_INHX1ADD ⇒ true | _ ⇒ false ] + | MODE_INHX2ADD ⇒ match i2 with [ MODE_INHX2ADD ⇒ true | _ ⇒ false ] + | MODE_IMM1 ⇒ match i2 with [ MODE_IMM1 ⇒ true | _ ⇒ false ] + | MODE_IMM1EXT ⇒ match i2 with [ MODE_IMM1EXT ⇒ true | _ ⇒ false ] + | MODE_IMM2 ⇒ match i2 with [ MODE_IMM2 ⇒ true | _ ⇒ false ] + | MODE_DIR1 ⇒ match i2 with [ MODE_DIR1 ⇒ true | _ ⇒ false ] + | MODE_DIR2 ⇒ match i2 with [ MODE_DIR2 ⇒ true | _ ⇒ false ] + | MODE_IX0 ⇒ match i2 with [ MODE_IX0 ⇒ true | _ ⇒ false ] + | MODE_IX1 ⇒ match i2 with [ MODE_IX1 ⇒ true | _ ⇒ false ] + | MODE_IX2 ⇒ match i2 with [ MODE_IX2 ⇒ true | _ ⇒ false ] + | MODE_SP1 ⇒ match i2 with [ MODE_SP1 ⇒ true | _ ⇒ false ] + | MODE_SP2 ⇒ match i2 with [ MODE_SP2 ⇒ true | _ ⇒ false ] + | MODE_DIR1_to_DIR1 ⇒ match i2 with [ MODE_DIR1_to_DIR1 ⇒ true | _ ⇒ false ] + | MODE_IMM1_to_DIR1 ⇒ match i2 with [ MODE_IMM1_to_DIR1 ⇒ true | _ ⇒ false ] + | MODE_IX0p_to_DIR1 ⇒ match i2 with [ MODE_IX0p_to_DIR1 ⇒ true | _ ⇒ false ] + | MODE_DIR1_to_IX0p ⇒ match i2 with [ MODE_DIR1_to_IX0p ⇒ true | _ ⇒ false ] + | MODE_INHA_and_IMM1 ⇒ match i2 with [ MODE_INHA_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_INHX_and_IMM1 ⇒ match i2 with [ MODE_INHX_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_IMM1_and_IMM1 ⇒ match i2 with [ MODE_IMM1_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_DIR1_and_IMM1 ⇒ match i2 with [ MODE_DIR1_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_IX0_and_IMM1 ⇒ match i2 with [ MODE_IX0_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_IX0p_and_IMM1 ⇒ match i2 with [ MODE_IX0p_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_IX1_and_IMM1 ⇒ match i2 with [ MODE_IX1_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_IX1p_and_IMM1 ⇒ match i2 with [ MODE_IX1p_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_SP1_and_IMM1 ⇒ match i2 with [ MODE_SP1_and_IMM1 ⇒ true | _ ⇒ false ] + | MODE_DIRn n1 ⇒ match i2 with [ MODE_DIRn n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] + | MODE_DIRn_and_IMM1 n1 ⇒ match i2 with [ MODE_DIRn_and_IMM1 n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] + | MODE_TNY e1 ⇒ match i2 with [ MODE_TNY e2 ⇒ eq_ex e1 e2 | _ ⇒ false ] + | MODE_SRT t1 ⇒ match i2 with [ MODE_SRT t2 ⇒ eq_bit t1 t2 | _ ⇒ false ] + ]. + +(* enumerazione delle istruzioni di tutte le ALU *) +ninductive opcode: Type ≝ + ADC : opcode (* add with carry *) +| ADD : opcode (* add *) +| AIS : opcode (* add immediate to SP *) +| AIX : opcode (* add immediate to X *) +| AND : opcode (* and *) +| ASL : opcode (* aritmetic shift left *) +| ASR : opcode (* aritmetic shift right *) +| BCC : opcode (* branch if C=0 *) +| BCLRn : opcode (* clear bit n *) +| BCS : opcode (* branch if C=1 *) +| BEQ : opcode (* branch if Z=1 *) +| BGE : opcode (* branch if N⊙V=0 (great or equal) *) +| BGND : opcode (* !!background mode!! *) +| BGT : opcode (* branch if Z|N⊙V=0 clear (great) *) +| BHCC : opcode (* branch if H=0 *) +| BHCS : opcode (* branch if H=1 *) +| BHI : opcode (* branch if C|Z=0, (higher) *) +| BIH : opcode (* branch if nIRQ=1 *) +| BIL : opcode (* branch if nIRQ=0 *) +| BIT : opcode (* flag = and (bit test) *) +| BLE : opcode (* branch if Z|N⊙V=1 (less or equal) *) +| BLS : opcode (* branch if C|Z=1 (lower or same) *) +| BLT : opcode (* branch if N⊙1=1 (less) *) +| BMC : opcode (* branch if I=0 (interrupt mask clear) *) +| BMI : opcode (* branch if N=1 (minus) *) +| BMS : opcode (* branch if I=1 (interrupt mask set) *) +| BNE : opcode (* branch if Z=0 *) +| BPL : opcode (* branch if N=0 (plus) *) +| BRA : opcode (* branch always *) +| BRCLRn : opcode (* branch if bit n clear *) +| BRN : opcode (* branch never (nop) *) +| BRSETn : opcode (* branch if bit n set *) +| BSETn : opcode (* set bit n *) +| BSR : opcode (* branch to subroutine *) +| CBEQA : opcode (* compare (A) and BEQ *) +| CBEQX : opcode (* compare (X) and BEQ *) +| CLC : opcode (* C=0 *) +| CLI : opcode (* I=0 *) +| CLR : opcode (* operand=0 *) +| CMP : opcode (* flag = sub (compare A) *) +| COM : opcode (* not (1 complement) *) +| CPHX : opcode (* flag = sub (compare H:X) *) +| CPX : opcode (* flag = sub (compare X) *) +| DAA : opcode (* decimal adjust A *) +| DBNZ : opcode (* dec and BNE *) +| DEC : opcode (* operand=operand-1 (decrement) *) +| DIV : opcode (* div *) +| EOR : opcode (* xor *) +| INC : opcode (* operand=operand+1 (increment) *) +| JMP : opcode (* jmp word [operand] *) +| JSR : opcode (* jmp to subroutine *) +| LDA : opcode (* load in A *) +| LDHX : opcode (* load in H:X *) +| LDX : opcode (* load in X *) +| LSR : opcode (* logical shift right *) +| MOV : opcode (* move *) +| MUL : opcode (* mul *) +| NEG : opcode (* neg (2 complement) *) +| NOP : opcode (* nop *) +| NSA : opcode (* nibble swap A (al:ah <- ah:al) *) +| ORA : opcode (* or *) +| PSHA : opcode (* push A *) +| PSHH : opcode (* push H *) +| PSHX : opcode (* push X *) +| PULA : opcode (* pop A *) +| PULH : opcode (* pop H *) +| PULX : opcode (* pop X *) +| ROL : opcode (* rotate left *) +| ROR : opcode (* rotate right *) +| RSP : opcode (* reset SP (0x00FF) *) +| RTI : opcode (* return from interrupt *) +| RTS : opcode (* return from subroutine *) +| SBC : opcode (* sub with carry*) +| SEC : opcode (* C=1 *) +| SEI : opcode (* I=1 *) +| SHA : opcode (* swap spc_high,A *) +| SLA : opcode (* swap spc_low,A *) +| STA : opcode (* store from A *) +| STHX : opcode (* store from H:X *) +| STOP : opcode (* !!stop mode!! *) +| STX : opcode (* store from X *) +| SUB : opcode (* sub *) +| SWI : opcode (* software interrupt *) +| TAP : opcode (* flag=A (transfer A to process status byte *) +| TAX : opcode (* X=A (transfer A to X) *) +| TPA : opcode (* A=flag (transfer process status byte to A) *) +| TST : opcode (* flag = sub (test) *) +| TSX : opcode (* X:H=SP (transfer SP to H:X) *) +| TXA : opcode (* A=X (transfer X to A) *) +| TXS : opcode (* SP=X:H (transfer H:X to SP) *) +| WAIT : opcode (* !!wait mode!! *) +. + +ndefinition eq_op ≝ +λop1,op2:opcode. + match op1 with + [ ADC ⇒ match op2 with [ ADC ⇒ true | _ ⇒ false ] | ADD ⇒ match op2 with [ ADD ⇒ true | _ ⇒ false ] + | AIS ⇒ match op2 with [ AIS ⇒ true | _ ⇒ false ] | AIX ⇒ match op2 with [ AIX ⇒ true | _ ⇒ false ] + | AND ⇒ match op2 with [ AND ⇒ true | _ ⇒ false ] | ASL ⇒ match op2 with [ ASL ⇒ true | _ ⇒ false ] + | ASR ⇒ match op2 with [ ASR ⇒ true | _ ⇒ false ] | BCC ⇒ match op2 with [ BCC ⇒ true | _ ⇒ false ] + | BCLRn ⇒ match op2 with [ BCLRn ⇒ true | _ ⇒ false ] | BCS ⇒ match op2 with [ BCS ⇒ true | _ ⇒ false ] + | BEQ ⇒ match op2 with [ BEQ ⇒ true | _ ⇒ false ] | BGE ⇒ match op2 with [ BGE ⇒ true | _ ⇒ false ] + | BGND ⇒ match op2 with [ BGND ⇒ true | _ ⇒ false ] | BGT ⇒ match op2 with [ BGT ⇒ true | _ ⇒ false ] + | BHCC ⇒ match op2 with [ BHCC ⇒ true | _ ⇒ false ] | BHCS ⇒ match op2 with [ BHCS ⇒ true | _ ⇒ false ] + | BHI ⇒ match op2 with [ BHI ⇒ true | _ ⇒ false ] | BIH ⇒ match op2 with [ BIH ⇒ true | _ ⇒ false ] + | BIL ⇒ match op2 with [ BIL ⇒ true | _ ⇒ false ] | BIT ⇒ match op2 with [ BIT ⇒ true | _ ⇒ false ] + | BLE ⇒ match op2 with [ BLE ⇒ true | _ ⇒ false ] | BLS ⇒ match op2 with [ BLS ⇒ true | _ ⇒ false ] + | BLT ⇒ match op2 with [ BLT ⇒ true | _ ⇒ false ] | BMC ⇒ match op2 with [ BMC ⇒ true | _ ⇒ false ] + | BMI ⇒ match op2 with [ BMI ⇒ true | _ ⇒ false ] | BMS ⇒ match op2 with [ BMS ⇒ true | _ ⇒ false ] + | BNE ⇒ match op2 with [ BNE ⇒ true | _ ⇒ false ] | BPL ⇒ match op2 with [ BPL ⇒ true | _ ⇒ false ] + | BRA ⇒ match op2 with [ BRA ⇒ true | _ ⇒ false ] | BRCLRn ⇒ match op2 with [ BRCLRn ⇒ true | _ ⇒ false ] + | BRN ⇒ match op2 with [ BRN ⇒ true | _ ⇒ false ] | BRSETn ⇒ match op2 with [ BRSETn ⇒ true | _ ⇒ false ] + | BSETn ⇒ match op2 with [ BSETn ⇒ true | _ ⇒ false ] | BSR ⇒ match op2 with [ BSR ⇒ true | _ ⇒ false ] + | CBEQA ⇒ match op2 with [ CBEQA ⇒ true | _ ⇒ false ] | CBEQX ⇒ match op2 with [ CBEQX ⇒ true | _ ⇒ false ] + | CLC ⇒ match op2 with [ CLC ⇒ true | _ ⇒ false ] | CLI ⇒ match op2 with [ CLI ⇒ true | _ ⇒ false ] + | CLR ⇒ match op2 with [ CLR ⇒ true | _ ⇒ false ] | CMP ⇒ match op2 with [ CMP ⇒ true | _ ⇒ false ] + | COM ⇒ match op2 with [ COM ⇒ true | _ ⇒ false ] | CPHX ⇒ match op2 with [ CPHX ⇒ true | _ ⇒ false ] + | CPX ⇒ match op2 with [ CPX ⇒ true | _ ⇒ false ] | DAA ⇒ match op2 with [ DAA ⇒ true | _ ⇒ false ] + | DBNZ ⇒ match op2 with [ DBNZ ⇒ true | _ ⇒ false ] | DEC ⇒ match op2 with [ DEC ⇒ true | _ ⇒ false ] + | DIV ⇒ match op2 with [ DIV ⇒ true | _ ⇒ false ] | EOR ⇒ match op2 with [ EOR ⇒ true | _ ⇒ false ] + | INC ⇒ match op2 with [ INC ⇒ true | _ ⇒ false ] | JMP ⇒ match op2 with [ JMP ⇒ true | _ ⇒ false ] + | JSR ⇒ match op2 with [ JSR ⇒ true | _ ⇒ false ] | LDA ⇒ match op2 with [ LDA ⇒ true | _ ⇒ false ] + | LDHX ⇒ match op2 with [ LDHX ⇒ true | _ ⇒ false ] | LDX ⇒ match op2 with [ LDX ⇒ true | _ ⇒ false ] + | LSR ⇒ match op2 with [ LSR ⇒ true | _ ⇒ false ] | MOV ⇒ match op2 with [ MOV ⇒ true | _ ⇒ false ] + | MUL ⇒ match op2 with [ MUL ⇒ true | _ ⇒ false ] | NEG ⇒ match op2 with [ NEG ⇒ true | _ ⇒ false ] + | NOP ⇒ match op2 with [ NOP ⇒ true | _ ⇒ false ] | NSA ⇒ match op2 with [ NSA ⇒ true | _ ⇒ false ] + | ORA ⇒ match op2 with [ ORA ⇒ true | _ ⇒ false ] | PSHA ⇒ match op2 with [ PSHA ⇒ true | _ ⇒ false ] + | PSHH ⇒ match op2 with [ PSHH ⇒ true | _ ⇒ false ] | PSHX ⇒ match op2 with [ PSHX ⇒ true | _ ⇒ false ] + | PULA ⇒ match op2 with [ PULA ⇒ true | _ ⇒ false ] | PULH ⇒ match op2 with [ PULH ⇒ true | _ ⇒ false ] + | PULX ⇒ match op2 with [ PULX ⇒ true | _ ⇒ false ] | ROL ⇒ match op2 with [ ROL ⇒ true | _ ⇒ false ] + | ROR ⇒ match op2 with [ ROR ⇒ true | _ ⇒ false ] | RSP ⇒ match op2 with [ RSP ⇒ true | _ ⇒ false ] + | RTI ⇒ match op2 with [ RTI ⇒ true | _ ⇒ false ] | RTS ⇒ match op2 with [ RTS ⇒ true | _ ⇒ false ] + | SBC ⇒ match op2 with [ SBC ⇒ true | _ ⇒ false ] | SEC ⇒ match op2 with [ SEC ⇒ true | _ ⇒ false ] + | SEI ⇒ match op2 with [ SEI ⇒ true | _ ⇒ false ] | SHA ⇒ match op2 with [ SHA ⇒ true | _ ⇒ false ] + | SLA ⇒ match op2 with [ SLA ⇒ true | _ ⇒ false ] | STA ⇒ match op2 with [ STA ⇒ true | _ ⇒ false ] + | STHX ⇒ match op2 with [ STHX ⇒ true | _ ⇒ false ] | STOP ⇒ match op2 with [ STOP ⇒ true | _ ⇒ false ] + | STX ⇒ match op2 with [ STX ⇒ true | _ ⇒ false ] | SUB ⇒ match op2 with [ SUB ⇒ true | _ ⇒ false ] + | SWI ⇒ match op2 with [ SWI ⇒ true | _ ⇒ false ] | TAP ⇒ match op2 with [ TAP ⇒ true | _ ⇒ false ] + | TAX ⇒ match op2 with [ TAX ⇒ true | _ ⇒ false ] | TPA ⇒ match op2 with [ TPA ⇒ true | _ ⇒ false ] + | TST ⇒ match op2 with [ TST ⇒ true | _ ⇒ false ] | TSX ⇒ match op2 with [ TSX ⇒ true | _ ⇒ false ] + | TXA ⇒ match op2 with [ TXA ⇒ true | _ ⇒ false ] | TXS ⇒ match op2 with [ TXS ⇒ true | _ ⇒ false ] + | WAIT ⇒ match op2 with [ WAIT ⇒ true | _ ⇒ false ] + ]. + +(* introduzione di un tipo opcode dipendente dall'mcu_type (phantom type) *) +ninductive any_opcode (m:mcu_type) : Type ≝ + anyOP : opcode → any_opcode m. + +ndefinition eq_anyop ≝ +λm:mcu_type.λop1,op2:any_opcode m. + match op1 with [ anyOP op1' ⇒ + match op2 with [ anyOP op2' ⇒ + eq_op op1' op2' ]]. + +(* raggruppamento di byte e word in un tipo unico *) +ninductive byte8_or_word16 : Type ≝ + Byte: byte8 → byte8_or_word16 +| Word: word16 → byte8_or_word16. + +ndefinition eq_b8w16 ≝ +λbw1,bw2:byte8_or_word16. + match bw1 with + [ Byte b1 ⇒ match bw2 with [ Byte b2 ⇒ eq_b8 b1 b2 | Word _ ⇒ false ] + | Word w1 ⇒ match bw2 with [ Byte _ ⇒ false | Word w2 ⇒ eq_w16 w1 w2 ] + ]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas.ma b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas.ma new file mode 100755 index 000000000..1ffe02b4a --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas.ma @@ -0,0 +1,127 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "num/bool_lemmas.ma". +include "freescale/opcode_base.ma". + +(* ********************************************** *) +(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) +(* ********************************************** *) + +ndefinition mcu_type_destruct_aux ≝ +Πm1,m2:mcu_type.ΠP:Prop.m1 = m2 → + match m1 with + [ HC05 ⇒ match m2 with [ HC05 ⇒ P → P | _ ⇒ P ] + | HC08 ⇒ match m2 with [ HC08 ⇒ P → P | _ ⇒ P ] + | HCS08 ⇒ match m2 with [ HCS08 ⇒ P → P | _ ⇒ P ] + | RS08 ⇒ match m2 with [ RS08 ⇒ P → P | _ ⇒ P ] + ]. + +ndefinition mcu_type_destruct : mcu_type_destruct_aux. + #m1; #m2; #P; + nelim m1; + ##[ ##1: nelim m2; nnormalize; #H; + ##[ ##1: napply (λx:P.x) + ##| ##*: napply False_ind; + nchange with (match HC05 with [ HC05 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] + ##| ##2: nelim m2; nnormalize; #H; + ##[ ##2: napply (λx:P.x) + ##| ##*: napply False_ind; + nchange with (match HC08 with [ HC08 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] + ##| ##3: nelim m2; nnormalize; #H; + ##[ ##3: napply (λx:P.x) + ##| ##*: napply False_ind; + nchange with (match HCS08 with [ HCS08 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] + ##| ##4: nelim m2; nnormalize; #H; + ##[ ##4: napply (λx:P.x) + ##| ##*: napply False_ind; + nchange with (match RS08 with [ RS08 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] + ##] +nqed. + +nlemma symmetric_eqmcutype : symmetricT mcu_type bool eq_mcutype. + #m1; #m2; + nelim m1; + nelim m2; + nnormalize; + napply refl_eq. +nqed. + +nlemma eqmcutype_to_eq : ∀m1,m2:mcu_type.(eq_mcutype m1 m2 = true) → (m1 = m2). + #m1; #m2; + ncases m1; + ncases m2; + nnormalize; + ##[ ##1,6,11,16: #H; napply refl_eq + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eq_to_eqmcutype : ∀m1,m2.m1 = m2 → eq_mcutype m1 m2 = true. + #m1; #m2; + ncases m1; + ncases m2; + nnormalize; + ##[ ##1,6,11,16: #H; napply refl_eq + ##| ##*: #H; napply (mcu_type_destruct … H) + ##] +nqed. + +nlemma instr_mode_destruct_MODE_DIRn : ∀n1,n2.MODE_DIRn n1 = MODE_DIRn n2 → n1 = n2. + #n1; #n2; #H; + nchange with (match MODE_DIRn n2 with [ MODE_DIRn a ⇒ n1 = a | _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma instr_mode_destruct_MODE_DIRn_and_IMM1 : ∀n1,n2.MODE_DIRn_and_IMM1 n1 = MODE_DIRn_and_IMM1 n2 → n1 = n2. + #n1; #n2; #H; + nchange with (match MODE_DIRn_and_IMM1 n2 with [ MODE_DIRn_and_IMM1 a ⇒ n1 = a | _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma instr_mode_destruct_MODE_TNY : ∀e1,e2.MODE_TNY e1 = MODE_TNY e2 → e1 = e2. + #e1; #e2; #H; + nchange with (match MODE_TNY e2 with [ MODE_TNY a ⇒ e1 = a | _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma instr_mode_destruct_MODE_SRT : ∀t1,t2.MODE_SRT t1 = MODE_SRT t2 → t1 = t2. + #t1; #t2; #H; + nchange with (match MODE_SRT t2 with [ MODE_SRT a ⇒ t1 = a | _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas1.ma b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas1.ma new file mode 100755 index 000000000..ba63e6013 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas1.ma @@ -0,0 +1,126 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/opcode_base_lemmas_opcode2.ma". +include "freescale/opcode_base_lemmas_instrmode2.ma". +include "num/word16_lemmas.ma". + +(* ********************************************** *) +(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) +(* ********************************************** *) + +nlemma anyop_destruct : ∀m.∀x1,x2:opcode.anyOP m x1 = anyOP m x2 → x1 = x2. + #m; #x1; #x2; #H; + nchange with (match anyOP m x2 with [ anyOP a ⇒ x1 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma symmetric_eqanyop : ∀m.∀op1,op2:any_opcode m.eq_anyop m op1 op2 = eq_anyop m op2 op1. + #m; + ncases m; + #op1; #op2; + ncases op1; + #x1; + ncases op2; + #x2; + nchange with (eq_op x1 x2 = eq_op x2 x1); + nrewrite > (symmetric_eqop x1 x2); + napply refl_eq. +nqed. + +nlemma eqanyop_to_eq : ∀m.∀op1,op2:any_opcode m.eq_anyop m op1 op2 = true → op1 = op2. + #m; + ncases m; + #op1; #op2; + ncases op1; + #x1; + ncases op2; + #x2; + nchange with ((eq_op x1 x2 = true) → ?); + #H; + nrewrite > (eqop_to_eq … H); + napply refl_eq. +nqed. + +nlemma eq_to_eqanyop : ∀m.∀op1,op2:any_opcode m.op1 = op2 → eq_anyop m op1 op2 = true. + #m; + ncases m; + #op1; #op2; + ncases op1; + #p1; + ncases op2; + #p2; #H; + nrewrite > (anyop_destruct … H); + nchange with (eq_op p2 p2 = true); + nrewrite > (eq_to_eqop p2 p2 (refl_eq opcode p2)); + napply refl_eq. +nqed. + +nlemma b8w16_destruct_b8_b8 : ∀x1,x2.Byte x1 = Byte x2 → x1 = x2. + #x1; #x2; #H; + nchange with (match Byte x2 with [ Byte a ⇒ x1 = a | Word _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma b8w16_destruct_w16_w16 : ∀x1,x2.Word x1 = Word x2 → x1 = x2. + #x1; #x2; #H; + nchange with (match Word x2 with [ Word a ⇒ x1 = a | Byte _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma b8w16_destruct_b8_w16 : ∀x1,x2.Byte x1 = Word x2 → False. + #x1; #x2; #H; + nchange with (match Byte x1 with [ Word _ ⇒ True | Byte a ⇒ False ]); + nrewrite > H; + nnormalize; + napply I. +nqed. + +nlemma b8w16_destruct_w16_b8 : ∀x1,x2.Word x1 = Byte x2 → False. + #x1; #x2; #H; + nchange with (match Word x1 with [ Word a ⇒ False | Byte _ ⇒ True ]); + nrewrite > H; + nnormalize; + napply I. +nqed. + +nlemma symmetric_eqb8w16 : ∀bw1,bw2.eq_b8w16 bw1 bw2 = eq_b8w16 bw2 bw1. + #bw1; #bw2; + ncases bw1; + #x1; + ncases bw2; + #x2; + ##[ ##1: nchange with (eq_b8 x1 x2 = eq_b8 x2 x1); + nrewrite > (symmetric_eqb8 x1 x2); + napply refl_eq + ##| ##2,3: nnormalize; napply refl_eq + ##| ##4: nchange with (eq_w16 x1 x2 = eq_w16 x2 x1); + nrewrite > (symmetric_eqw16 x1 x2); + napply refl_eq + ##] +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_instrmode1.ma b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_instrmode1.ma new file mode 100755 index 000000000..8dedbf873 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_instrmode1.ma @@ -0,0 +1,930 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "num/oct_lemmas.ma". +include "num/bitrigesim_lemmas.ma". +include "num/exadecim_lemmas.ma". +include "freescale/opcode_base.ma". + +(* ********************************************** *) +(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) +(* ********************************************** *) + +ndefinition instr_mode_destruct1 : + Πi2.ΠP:Prop.MODE_INH = i2 → match i2 with [ MODE_INH ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##1: #H; napply (λx:P.x) + ##| ##2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INH with [ MODE_INH ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INH with [ MODE_INH ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct2 : + Πi2.ΠP:Prop.MODE_INHA = i2 → match i2 with [ MODE_INHA ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##2: #H; napply (λx:P.x) + ##| ##1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INHA with [ MODE_INHA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INHA with [ MODE_INHA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct3 : + Πi2.ΠP:Prop.MODE_INHX = i2 → match i2 with [ MODE_INHX ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##3: #H; napply (λx:P.x) + ##| ##1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INHX with [ MODE_INHX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INHX with [ MODE_INHX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct4 : + Πi2.ΠP:Prop.MODE_INHH = i2 → match i2 with [ MODE_INHH ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##4: #H; napply (λx:P.x) + ##| ##1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INHH with [ MODE_INHH ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INHH with [ MODE_INHH ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct5 : + Πi2.ΠP:Prop.MODE_INHX0ADD = i2 → match i2 with [ MODE_INHX0ADD ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##5: #H; napply (λx:P.x) + ##| ##1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INHX0ADD with [ MODE_INHX0ADD ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INHX0ADD with [ MODE_INHX0ADD ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct6 : + Πi2.ΠP:Prop.MODE_INHX1ADD = i2 → match i2 with [ MODE_INHX1ADD ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##6: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INHX1ADD with [ MODE_INHX1ADD ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INHX1ADD with [ MODE_INHX1ADD ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct7 : + Πi2.ΠP:Prop.MODE_INHX2ADD = i2 → match i2 with [ MODE_INHX2ADD ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##7: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INHX2ADD with [ MODE_INHX2ADD ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INHX2ADD with [ MODE_INHX2ADD ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct8 : + Πi2.ΠP:Prop.MODE_IMM1 = i2 → match i2 with [ MODE_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##8: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IMM1 with [ MODE_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IMM1 with [ MODE_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct9 : + Πi2.ΠP:Prop.MODE_IMM1EXT = i2 → match i2 with [ MODE_IMM1EXT ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##9: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IMM1EXT with [ MODE_IMM1EXT ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IMM1EXT with [ MODE_IMM1EXT ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct10 : + Πi2.ΠP:Prop.MODE_IMM2 = i2 → match i2 with [ MODE_IMM2 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##10: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IMM2 with [ MODE_IMM2 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IMM2 with [ MODE_IMM2 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct11 : + Πi2.ΠP:Prop.MODE_DIR1 = i2 → match i2 with [ MODE_DIR1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##11: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_DIR1 with [ MODE_DIR1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_DIR1 with [ MODE_DIR1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct12 : + Πi2.ΠP:Prop.MODE_DIR2 = i2 → match i2 with [ MODE_DIR2 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##12: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_DIR2 with [ MODE_DIR2 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_DIR2 with [ MODE_DIR2 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct13 : + Πi2.ΠP:Prop.MODE_IX0 = i2 → match i2 with [ MODE_IX0 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##13: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IX0 with [ MODE_IX0 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IX0 with [ MODE_IX0 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct14 : + Πi2.ΠP:Prop.MODE_IX1 = i2 → match i2 with [ MODE_IX1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##14: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IX1 with [ MODE_IX1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IX1 with [ MODE_IX1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct15 : + Πi2.ΠP:Prop.MODE_IX2 = i2 → match i2 with [ MODE_IX2 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##15: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IX2 with [ MODE_IX2 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IX2 with [ MODE_IX2 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct16 : + Πi2.ΠP:Prop.MODE_SP1 = i2 → match i2 with [ MODE_SP1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##16: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_SP1 with [ MODE_SP1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_SP1 with [ MODE_SP1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct17 : + Πi2.ΠP:Prop.MODE_SP2 = i2 → match i2 with [ MODE_SP2 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##17: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_SP2 with [ MODE_SP2 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_SP2 with [ MODE_SP2 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct18 : + Πi2.ΠP:Prop.MODE_DIR1_to_DIR1 = i2 → match i2 with [ MODE_DIR1_to_DIR1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##18: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_DIR1_to_DIR1 with [ MODE_DIR1_to_DIR1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_DIR1_to_DIR1 with [ MODE_DIR1_to_DIR1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct19 : + Πi2.ΠP:Prop.MODE_IMM1_to_DIR1 = i2 → match i2 with [ MODE_IMM1_to_DIR1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##19: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IMM1_to_DIR1 with [ MODE_IMM1_to_DIR1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IMM1_to_DIR1 with [ MODE_IMM1_to_DIR1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct20 : + Πi2.ΠP:Prop.MODE_IX0p_to_DIR1 = i2 → match i2 with [ MODE_IX0p_to_DIR1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##20: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IX0p_to_DIR1 with [ MODE_IX0p_to_DIR1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IX0p_to_DIR1 with [ MODE_IX0p_to_DIR1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct21 : + Πi2.ΠP:Prop.MODE_DIR1_to_IX0p = i2 → match i2 with [ MODE_DIR1_to_IX0p ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##21: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_DIR1_to_IX0p with [ MODE_DIR1_to_IX0p ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_DIR1_to_IX0p with [ MODE_DIR1_to_IX0p ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct22 : + Πi2.ΠP:Prop.MODE_INHA_and_IMM1 = i2 → match i2 with [ MODE_INHA_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##22: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INHA_and_IMM1 with [ MODE_INHA_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INHA_and_IMM1 with [ MODE_INHA_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct23 : + Πi2.ΠP:Prop.MODE_INHX_and_IMM1 = i2 → match i2 with [ MODE_INHX_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##23: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_INHX_and_IMM1 with [ MODE_INHX_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_INHX_and_IMM1 with [ MODE_INHX_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct24 : + Πi2.ΠP:Prop.MODE_IMM1_and_IMM1 = i2 → match i2 with [ MODE_IMM1_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##24: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IMM1_and_IMM1 with [ MODE_IMM1_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IMM1_and_IMM1 with [ MODE_IMM1_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct25 : + Πi2.ΠP:Prop.MODE_DIR1_and_IMM1 = i2 → match i2 with [ MODE_DIR1_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##25: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_DIR1_and_IMM1 with [ MODE_DIR1_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_DIR1_and_IMM1 with [ MODE_DIR1_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct26 : + Πi2.ΠP:Prop.MODE_IX0_and_IMM1 = i2 → match i2 with [ MODE_IX0_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##26: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IX0_and_IMM1 with [ MODE_IX0_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IX0_and_IMM1 with [ MODE_IX0_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct27 : + Πi2.ΠP:Prop.MODE_IX0p_and_IMM1 = i2 → match i2 with [ MODE_IX0p_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##27: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30: #H; + napply False_ind; + nchange with (match MODE_IX0p_and_IMM1 with [ MODE_IX0p_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IX0p_and_IMM1 with [ MODE_IX0p_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct28 : + Πi2.ΠP:Prop.MODE_IX1_and_IMM1 = i2 → match i2 with [ MODE_IX1_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##28: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,29,30: #H; + napply False_ind; + nchange with (match MODE_IX1_and_IMM1 with [ MODE_IX1_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IX1_and_IMM1 with [ MODE_IX1_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct29 : + Πi2.ΠP:Prop.MODE_IX1p_and_IMM1 = i2 → match i2 with [ MODE_IX1p_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##29: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30: #H; + napply False_ind; + nchange with (match MODE_IX1p_and_IMM1 with [ MODE_IX1p_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_IX1p_and_IMM1 with [ MODE_IX1p_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition instr_mode_destruct30 : + Πi2.ΠP:Prop.MODE_SP1_and_IMM1 = i2 → match i2 with [ MODE_SP1_and_IMM1 ⇒ P → P | _ ⇒ P ]. + #i2; #P; + ncases i2; + nnormalize; + ##[ ##30: #H; napply (λx:P.x) + ##| ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29: #H; + napply False_ind; + nchange with (match MODE_SP1_and_IMM1 with [ MODE_SP1_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_SP1_and_IMM1 with [ MODE_SP1_and_IMM1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +nlemma instr_mode_destruct_MODE_DIRn : ∀n1,n2.MODE_DIRn n1 = MODE_DIRn n2 → n1 = n2. + #n1; #n2; #H; + nchange with (match MODE_DIRn n2 with [ MODE_DIRn a ⇒ n1 = a | _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +ndefinition instr_mode_destruct31 : + Πn1,i2.ΠP:Prop.MODE_DIRn n1 = i2 → + match i2 with + [ MODE_DIRn n2 ⇒ match n1 with + [ o0 ⇒ match n2 with [ o0 ⇒ P → P | _ ⇒ P ] | o1 ⇒ match n2 with [ o1 ⇒ P → P | _ ⇒ P ] + | o2 ⇒ match n2 with [ o2 ⇒ P → P | _ ⇒ P ] | o3 ⇒ match n2 with [ o3 ⇒ P → P | _ ⇒ P ] + | o4 ⇒ match n2 with [ o4 ⇒ P → P | _ ⇒ P ] | o5 ⇒ match n2 with [ o5 ⇒ P → P | _ ⇒ P ] + | o6 ⇒ match n2 with [ o6 ⇒ P → P | _ ⇒ P ] | o7 ⇒ match n2 with [ o7 ⇒ P → P | _ ⇒ P ]] + | _ ⇒ P ]. + #n1; #i2; #P; + ncases i2; + nnormalize; + ##[ ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_DIRn n1 with [ MODE_DIRn a ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##32,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_DIRn n1 with [ MODE_DIRn n1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31: #n2; + ncases n1; + ncases n2; + nnormalize; + ##[ ##1,10,19,28,37,46,55,64: #H; napply (λx:P.x) + ##| ##*: #H; napply (oct_destruct … (instr_mode_destruct_MODE_DIRn … H)) + ##] +nqed. + +nlemma instr_mode_destruct_MODE_DIRn_and_IMM1 : ∀n1,n2.MODE_DIRn_and_IMM1 n1 = MODE_DIRn_and_IMM1 n2 → n1 = n2. + #n1; #n2; #H; + nchange with (match MODE_DIRn_and_IMM1 n2 with [ MODE_DIRn_and_IMM1 a ⇒ n1 = a | _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +ndefinition instr_mode_destruct32 : + Πn1,i2.ΠP:Prop.MODE_DIRn_and_IMM1 n1 = i2 → + match i2 with + [ MODE_DIRn_and_IMM1 n2 ⇒ match n1 with + [ o0 ⇒ match n2 with [ o0 ⇒ P → P | _ ⇒ P ] | o1 ⇒ match n2 with [ o1 ⇒ P → P | _ ⇒ P ] + | o2 ⇒ match n2 with [ o2 ⇒ P → P | _ ⇒ P ] | o3 ⇒ match n2 with [ o3 ⇒ P → P | _ ⇒ P ] + | o4 ⇒ match n2 with [ o4 ⇒ P → P | _ ⇒ P ] | o5 ⇒ match n2 with [ o5 ⇒ P → P | _ ⇒ P ] + | o6 ⇒ match n2 with [ o6 ⇒ P → P | _ ⇒ P ] | o7 ⇒ match n2 with [ o7 ⇒ P → P | _ ⇒ P ]] + | _ ⇒ P ]. + #n1; #i2; #P; + ncases i2; + nnormalize; + ##[ ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_DIRn_and_IMM1 n1 with [ MODE_DIRn_and_IMM1 a ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,33,34: #n; #H; + napply False_ind; + nchange with (match MODE_DIRn_and_IMM1 n1 with [ MODE_DIRn_and_IMM1 n1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##32: #n2; + ncases n1; + ncases n2; + nnormalize; + ##[ ##1,10,19,28,37,46,55,64: #H; napply (λx:P.x) + ##| ##*: #H; napply (oct_destruct … (instr_mode_destruct_MODE_DIRn_and_IMM1 … H)) + ##] +nqed. + +nlemma instr_mode_destruct_MODE_TNY : ∀n1,n2.MODE_TNY n1 = MODE_TNY n2 → n1 = n2. + #n1; #n2; #H; + nchange with (match MODE_TNY n2 with [ MODE_TNY a ⇒ n1 = a | _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +ndefinition instr_mode_destruct33 : + Πn1,i2.ΠP:Prop.MODE_TNY n1 = i2 → + match i2 with + [ MODE_TNY n2 ⇒ match n1 with + [ x0 ⇒ match n2 with [ x0 ⇒ P → P | _ ⇒ P ] | x1 ⇒ match n2 with [ x1 ⇒ P → P | _ ⇒ P ] + | x2 ⇒ match n2 with [ x2 ⇒ P → P | _ ⇒ P ] | x3 ⇒ match n2 with [ x3 ⇒ P → P | _ ⇒ P ] + | x4 ⇒ match n2 with [ x4 ⇒ P → P | _ ⇒ P ] | x5 ⇒ match n2 with [ x5 ⇒ P → P | _ ⇒ P ] + | x6 ⇒ match n2 with [ x6 ⇒ P → P | _ ⇒ P ] | x7 ⇒ match n2 with [ x7 ⇒ P → P | _ ⇒ P ] + | x8 ⇒ match n2 with [ x8 ⇒ P → P | _ ⇒ P ] | x9 ⇒ match n2 with [ x9 ⇒ P → P | _ ⇒ P ] + | xA ⇒ match n2 with [ xA ⇒ P → P | _ ⇒ P ] | xB ⇒ match n2 with [ xB ⇒ P → P | _ ⇒ P ] + | xC ⇒ match n2 with [ xC ⇒ P → P | _ ⇒ P ] | xD ⇒ match n2 with [ xD ⇒ P → P | _ ⇒ P ] + | xE ⇒ match n2 with [ xE ⇒ P → P | _ ⇒ P ] | xF ⇒ match n2 with [ xF ⇒ P → P | _ ⇒ P ]] + | _ ⇒ P ]. + #n1; #i2; #P; + ncases i2; + nnormalize; + ##[ ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_TNY n1 with [ MODE_TNY a ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,34: #n; #H; + napply False_ind; + nchange with (match MODE_TNY n1 with [ MODE_TNY n1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##33: #n2; + ncases n1; + ncases n2; + nnormalize; + ##[ ##1,18,35,52,69,86,103,120,137,154,171,188,205,222,239,256: #H; napply (λx:P.x) + ##| ##*: #H; napply (exadecim_destruct … (instr_mode_destruct_MODE_TNY … H)) + ##] +nqed. + +nlemma instr_mode_destruct_MODE_SRT : ∀n1,n2.MODE_SRT n1 = MODE_SRT n2 → n1 = n2. + #n1; #n2; #H; + nchange with (match MODE_SRT n2 with [ MODE_SRT a ⇒ n1 = a | _ ⇒ False ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +ndefinition instr_mode_destruct34 : + Πn1,i2.ΠP:Prop.MODE_SRT n1 = i2 → + match i2 with + [ MODE_SRT n2 ⇒ match n1 with + [ t00 ⇒ match n2 with [ t00 ⇒ P → P | _ ⇒ P ] | t01 ⇒ match n2 with [ t01 ⇒ P → P | _ ⇒ P ] + | t02 ⇒ match n2 with [ t02 ⇒ P → P | _ ⇒ P ] | t03 ⇒ match n2 with [ t03 ⇒ P → P | _ ⇒ P ] + | t04 ⇒ match n2 with [ t04 ⇒ P → P | _ ⇒ P ] | t05 ⇒ match n2 with [ t05 ⇒ P → P | _ ⇒ P ] + | t06 ⇒ match n2 with [ t06 ⇒ P → P | _ ⇒ P ] | t07 ⇒ match n2 with [ t07 ⇒ P → P | _ ⇒ P ] + | t08 ⇒ match n2 with [ t08 ⇒ P → P | _ ⇒ P ] | t09 ⇒ match n2 with [ t09 ⇒ P → P | _ ⇒ P ] + | t0A ⇒ match n2 with [ t0A ⇒ P → P | _ ⇒ P ] | t0B ⇒ match n2 with [ t0B ⇒ P → P | _ ⇒ P ] + | t0C ⇒ match n2 with [ t0C ⇒ P → P | _ ⇒ P ] | t0D ⇒ match n2 with [ t0D ⇒ P → P | _ ⇒ P ] + | t0E ⇒ match n2 with [ t0E ⇒ P → P | _ ⇒ P ] | t0F ⇒ match n2 with [ t0F ⇒ P → P | _ ⇒ P ] + | t10 ⇒ match n2 with [ t10 ⇒ P → P | _ ⇒ P ] | t11 ⇒ match n2 with [ t11 ⇒ P → P | _ ⇒ P ] + | t12 ⇒ match n2 with [ t12 ⇒ P → P | _ ⇒ P ] | t13 ⇒ match n2 with [ t13 ⇒ P → P | _ ⇒ P ] + | t14 ⇒ match n2 with [ t14 ⇒ P → P | _ ⇒ P ] | t15 ⇒ match n2 with [ t15 ⇒ P → P | _ ⇒ P ] + | t16 ⇒ match n2 with [ t16 ⇒ P → P | _ ⇒ P ] | t17 ⇒ match n2 with [ t17 ⇒ P → P | _ ⇒ P ] + | t18 ⇒ match n2 with [ t18 ⇒ P → P | _ ⇒ P ] | t19 ⇒ match n2 with [ t19 ⇒ P → P | _ ⇒ P ] + | t1A ⇒ match n2 with [ t1A ⇒ P → P | _ ⇒ P ] | t1B ⇒ match n2 with [ t1B ⇒ P → P | _ ⇒ P ] + | t1C ⇒ match n2 with [ t1C ⇒ P → P | _ ⇒ P ] | t1D ⇒ match n2 with [ t1D ⇒ P → P | _ ⇒ P ] + | t1E ⇒ match n2 with [ t1E ⇒ P → P | _ ⇒ P ] | t1F ⇒ match n2 with [ t1F ⇒ P → P | _ ⇒ P ]] + | _ ⇒ P ]. + #n1; #i2; #P; + ncases i2; + nnormalize; + ##[ ##1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30: #H; + napply False_ind; + nchange with (match MODE_SRT n1 with [ MODE_SRT a ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##31,32,33: #n; #H; + napply False_ind; + nchange with (match MODE_SRT n1 with [ MODE_SRT n1 ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##| ##34: #n2; + ncases n1; + ##[ ##1: ncases n2; nnormalize; + ##[ ##1: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##2: ncases n2; nnormalize; + ##[ ##2: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##3: ncases n2; nnormalize; + ##[ ##3: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##4: ncases n2; nnormalize; + ##[ ##4: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##5: ncases n2; nnormalize; + ##[ ##5: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##6: ncases n2; nnormalize; + ##[ ##6: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##7: ncases n2; nnormalize; + ##[ ##7: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##8: ncases n2; nnormalize; + ##[ ##8: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##9: ncases n2; nnormalize; + ##[ ##9: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##10: ncases n2; nnormalize; + ##[ ##10: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##11: ncases n2; nnormalize; + ##[ ##11: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##12: ncases n2; nnormalize; + ##[ ##12: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##13: ncases n2; nnormalize; + ##[ ##13: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##14: ncases n2; nnormalize; + ##[ ##14: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##15: ncases n2; nnormalize; + ##[ ##15: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##16: ncases n2; nnormalize; + ##[ ##16: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##17: ncases n2; nnormalize; + ##[ ##17: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##18: ncases n2; nnormalize; + ##[ ##18: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##19: ncases n2; nnormalize; + ##[ ##19: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##20: ncases n2; nnormalize; + ##[ ##20: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##21: ncases n2; nnormalize; + ##[ ##21: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##22: ncases n2; nnormalize; + ##[ ##22: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##23: ncases n2; nnormalize; + ##[ ##23: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##24: ncases n2; nnormalize; + ##[ ##24: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##25: ncases n2; nnormalize; + ##[ ##25: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##26: ncases n2; nnormalize; + ##[ ##26: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##27: ncases n2; nnormalize; + ##[ ##27: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##28: ncases n2; nnormalize; + ##[ ##28: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##29: ncases n2; nnormalize; + ##[ ##29: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##30: ncases n2; nnormalize; + ##[ ##30: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##31: ncases n2; nnormalize; + ##[ ##31: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##| ##32: ncases n2; nnormalize; + ##[ ##32: #H; napply (λx:P.x) + ##| ##*: #H; napply (bitrigesim_destruct … (instr_mode_destruct_MODE_SRT … H)) + ##] + ##] + ##] +nqed. + +ndefinition instr_mode_destruct_aux ≝ +Πi1,i2.ΠP:Prop.i1 = i2 → + match i1 with + [ MODE_INH ⇒ match i2 with [ MODE_INH ⇒ P → P | _ ⇒ P ] + | MODE_INHA ⇒ match i2 with [ MODE_INHA ⇒ P → P | _ ⇒ P ] + | MODE_INHX ⇒ match i2 with [ MODE_INHX ⇒ P → P | _ ⇒ P ] + | MODE_INHH ⇒ match i2 with [ MODE_INHH ⇒ P → P | _ ⇒ P ] + | MODE_INHX0ADD ⇒ match i2 with [ MODE_INHX0ADD ⇒ P → P | _ ⇒ P ] + | MODE_INHX1ADD ⇒ match i2 with [ MODE_INHX1ADD ⇒ P → P | _ ⇒ P ] + | MODE_INHX2ADD ⇒ match i2 with [ MODE_INHX2ADD ⇒ P → P | _ ⇒ P ] + | MODE_IMM1 ⇒ match i2 with [ MODE_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_IMM1EXT ⇒ match i2 with [ MODE_IMM1EXT ⇒ P → P | _ ⇒ P ] + | MODE_IMM2 ⇒ match i2 with [ MODE_IMM2 ⇒ P → P | _ ⇒ P ] + | MODE_DIR1 ⇒ match i2 with [ MODE_DIR1 ⇒ P → P | _ ⇒ P ] + | MODE_DIR2 ⇒ match i2 with [ MODE_DIR2 ⇒ P → P | _ ⇒ P ] + | MODE_IX0 ⇒ match i2 with [ MODE_IX0 ⇒ P → P | _ ⇒ P ] + | MODE_IX1 ⇒ match i2 with [ MODE_IX1 ⇒ P → P | _ ⇒ P ] + | MODE_IX2 ⇒ match i2 with [ MODE_IX2 ⇒ P → P | _ ⇒ P ] + | MODE_SP1 ⇒ match i2 with [ MODE_SP1 ⇒ P → P | _ ⇒ P ] + | MODE_SP2 ⇒ match i2 with [ MODE_SP2 ⇒ P → P | _ ⇒ P ] + | MODE_DIR1_to_DIR1 ⇒ match i2 with [ MODE_DIR1_to_DIR1 ⇒ P → P | _ ⇒ P ] + | MODE_IMM1_to_DIR1 ⇒ match i2 with [ MODE_IMM1_to_DIR1 ⇒ P → P | _ ⇒ P ] + | MODE_IX0p_to_DIR1 ⇒ match i2 with [ MODE_IX0p_to_DIR1 ⇒ P → P | _ ⇒ P ] + | MODE_DIR1_to_IX0p ⇒ match i2 with [ MODE_DIR1_to_IX0p ⇒ P → P | _ ⇒ P ] + | MODE_INHA_and_IMM1 ⇒ match i2 with [ MODE_INHA_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_INHX_and_IMM1 ⇒ match i2 with [ MODE_INHX_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_IMM1_and_IMM1 ⇒ match i2 with [ MODE_IMM1_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_DIR1_and_IMM1 ⇒ match i2 with [ MODE_DIR1_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_IX0_and_IMM1 ⇒ match i2 with [ MODE_IX0_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_IX0p_and_IMM1 ⇒ match i2 with [ MODE_IX0p_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_IX1_and_IMM1 ⇒ match i2 with [ MODE_IX1_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_IX1p_and_IMM1 ⇒ match i2 with [ MODE_IX1p_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_SP1_and_IMM1 ⇒ match i2 with [ MODE_SP1_and_IMM1 ⇒ P → P | _ ⇒ P ] + | MODE_DIRn n1 ⇒ match i2 with + [ MODE_DIRn n2 ⇒ match n1 with + [ o0 ⇒ match n2 with [ o0 ⇒ P → P | _ ⇒ P ] | o1 ⇒ match n2 with [ o1 ⇒ P → P | _ ⇒ P ] + | o2 ⇒ match n2 with [ o2 ⇒ P → P | _ ⇒ P ] | o3 ⇒ match n2 with [ o3 ⇒ P → P | _ ⇒ P ] + | o4 ⇒ match n2 with [ o4 ⇒ P → P | _ ⇒ P ] | o5 ⇒ match n2 with [ o5 ⇒ P → P | _ ⇒ P ] + | o6 ⇒ match n2 with [ o6 ⇒ P → P | _ ⇒ P ] | o7 ⇒ match n2 with [ o7 ⇒ P → P | _ ⇒ P ]] + | _ ⇒ P ] + | MODE_DIRn_and_IMM1 n1 ⇒ match i2 with + [ MODE_DIRn_and_IMM1 n2 ⇒ match n1 with + [ o0 ⇒ match n2 with [ o0 ⇒ P → P | _ ⇒ P ] | o1 ⇒ match n2 with [ o1 ⇒ P → P | _ ⇒ P ] + | o2 ⇒ match n2 with [ o2 ⇒ P → P | _ ⇒ P ] | o3 ⇒ match n2 with [ o3 ⇒ P → P | _ ⇒ P ] + | o4 ⇒ match n2 with [ o4 ⇒ P → P | _ ⇒ P ] | o5 ⇒ match n2 with [ o5 ⇒ P → P | _ ⇒ P ] + | o6 ⇒ match n2 with [ o6 ⇒ P → P | _ ⇒ P ] | o7 ⇒ match n2 with [ o7 ⇒ P → P | _ ⇒ P ]] + | _ ⇒ P ] + | MODE_TNY e1 ⇒ match i2 with + [ MODE_TNY e2 ⇒ match e1 with + [ x0 ⇒ match e2 with [ x0 ⇒ P → P | _ ⇒ P ] | x1 ⇒ match e2 with [ x1 ⇒ P → P | _ ⇒ P ] + | x2 ⇒ match e2 with [ x2 ⇒ P → P | _ ⇒ P ] | x3 ⇒ match e2 with [ x3 ⇒ P → P | _ ⇒ P ] + | x4 ⇒ match e2 with [ x4 ⇒ P → P | _ ⇒ P ] | x5 ⇒ match e2 with [ x5 ⇒ P → P | _ ⇒ P ] + | x6 ⇒ match e2 with [ x6 ⇒ P → P | _ ⇒ P ] | x7 ⇒ match e2 with [ x7 ⇒ P → P | _ ⇒ P ] + | x8 ⇒ match e2 with [ x8 ⇒ P → P | _ ⇒ P ] | x9 ⇒ match e2 with [ x9 ⇒ P → P | _ ⇒ P ] + | xA ⇒ match e2 with [ xA ⇒ P → P | _ ⇒ P ] | xB ⇒ match e2 with [ xB ⇒ P → P | _ ⇒ P ] + | xC ⇒ match e2 with [ xC ⇒ P → P | _ ⇒ P ] | xD ⇒ match e2 with [ xD ⇒ P → P | _ ⇒ P ] + | xE ⇒ match e2 with [ xE ⇒ P → P | _ ⇒ P ] | xF ⇒ match e2 with [ xF ⇒ P → P | _ ⇒ P ]] + | _ ⇒ P ] + | MODE_SRT t1 ⇒ match i2 with + [ MODE_SRT t2 ⇒ match t1 with + [ t00 ⇒ match t2 with [ t00 ⇒ P → P | _ ⇒ P ] | t01 ⇒ match t2 with [ t01 ⇒ P → P | _ ⇒ P ] + | t02 ⇒ match t2 with [ t02 ⇒ P → P | _ ⇒ P ] | t03 ⇒ match t2 with [ t03 ⇒ P → P | _ ⇒ P ] + | t04 ⇒ match t2 with [ t04 ⇒ P → P | _ ⇒ P ] | t05 ⇒ match t2 with [ t05 ⇒ P → P | _ ⇒ P ] + | t06 ⇒ match t2 with [ t06 ⇒ P → P | _ ⇒ P ] | t07 ⇒ match t2 with [ t07 ⇒ P → P | _ ⇒ P ] + | t08 ⇒ match t2 with [ t08 ⇒ P → P | _ ⇒ P ] | t09 ⇒ match t2 with [ t09 ⇒ P → P | _ ⇒ P ] + | t0A ⇒ match t2 with [ t0A ⇒ P → P | _ ⇒ P ] | t0B ⇒ match t2 with [ t0B ⇒ P → P | _ ⇒ P ] + | t0C ⇒ match t2 with [ t0C ⇒ P → P | _ ⇒ P ] | t0D ⇒ match t2 with [ t0D ⇒ P → P | _ ⇒ P ] + | t0E ⇒ match t2 with [ t0E ⇒ P → P | _ ⇒ P ] | t0F ⇒ match t2 with [ t0F ⇒ P → P | _ ⇒ P ] + | t10 ⇒ match t2 with [ t10 ⇒ P → P | _ ⇒ P ] | t11 ⇒ match t2 with [ t11 ⇒ P → P | _ ⇒ P ] + | t12 ⇒ match t2 with [ t12 ⇒ P → P | _ ⇒ P ] | t13 ⇒ match t2 with [ t13 ⇒ P → P | _ ⇒ P ] + | t14 ⇒ match t2 with [ t14 ⇒ P → P | _ ⇒ P ] | t15 ⇒ match t2 with [ t15 ⇒ P → P | _ ⇒ P ] + | t16 ⇒ match t2 with [ t16 ⇒ P → P | _ ⇒ P ] | t17 ⇒ match t2 with [ t17 ⇒ P → P | _ ⇒ P ] + | t18 ⇒ match t2 with [ t18 ⇒ P → P | _ ⇒ P ] | t19 ⇒ match t2 with [ t19 ⇒ P → P | _ ⇒ P ] + | t1A ⇒ match t2 with [ t1A ⇒ P → P | _ ⇒ P ] | t1B ⇒ match t2 with [ t1B ⇒ P → P | _ ⇒ P ] + | t1C ⇒ match t2 with [ t1C ⇒ P → P | _ ⇒ P ] | t1D ⇒ match t2 with [ t1D ⇒ P → P | _ ⇒ P ] + | t1E ⇒ match t2 with [ t1E ⇒ P → P | _ ⇒ P ] | t1F ⇒ match t2 with [ t1F ⇒ P → P | _ ⇒ P ]] + | _ ⇒ P ] + ]. + +ndefinition instr_mode_destruct : instr_mode_destruct_aux. + #t1; ncases t1; + ##[ ##1: napply instr_mode_destruct1 ##| ##2: napply instr_mode_destruct2 + ##| ##3: napply instr_mode_destruct3 ##| ##4: napply instr_mode_destruct4 + ##| ##5: napply instr_mode_destruct5 ##| ##6: napply instr_mode_destruct6 + ##| ##7: napply instr_mode_destruct7 ##| ##8: napply instr_mode_destruct8 + ##| ##9: napply instr_mode_destruct9 ##| ##10: napply instr_mode_destruct10 + ##| ##11: napply instr_mode_destruct11 ##| ##12: napply instr_mode_destruct12 + ##| ##13: napply instr_mode_destruct13 ##| ##14: napply instr_mode_destruct14 + ##| ##15: napply instr_mode_destruct15 ##| ##16: napply instr_mode_destruct16 + ##| ##17: napply instr_mode_destruct17 ##| ##18: napply instr_mode_destruct18 + ##| ##19: napply instr_mode_destruct19 ##| ##20: napply instr_mode_destruct20 + ##| ##21: napply instr_mode_destruct21 ##| ##22: napply instr_mode_destruct22 + ##| ##23: napply instr_mode_destruct23 ##| ##24: napply instr_mode_destruct24 + ##| ##25: napply instr_mode_destruct25 ##| ##26: napply instr_mode_destruct26 + ##| ##27: napply instr_mode_destruct27 ##| ##28: napply instr_mode_destruct28 + ##| ##29: napply instr_mode_destruct29 ##| ##30: napply instr_mode_destruct30 + ##| ##31: napply instr_mode_destruct31 ##| ##32: napply instr_mode_destruct32 + ##| ##33: napply instr_mode_destruct33 ##| ##34: napply instr_mode_destruct34 + ##] +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_instrmode2.ma b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_instrmode2.ma new file mode 100755 index 000000000..a80e96d21 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_instrmode2.ma @@ -0,0 +1,707 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/opcode_base_lemmas_instrmode1.ma". + +(* ********************************************** *) +(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) +(* ********************************************** *) + +nlemma symmetric_eqim : symmetricT instr_mode bool eq_im. + #i1; #i2; + ncases i1; + ##[ ##1: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##2: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##3: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##4: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##5: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##6: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##7: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##8: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##9: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##10: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##11: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##12: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##13: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##14: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##15: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##16: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##17: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##18: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##19: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##20: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##21: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##22: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##23: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##24: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##25: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##26: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##27: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##28: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##29: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##30: ncases i2; nnormalize; ##[ ##31,32,33,34: #n ##] napply refl_eq + ##| ##31: ncases i2; #n1; + ##[ ##31: #n2; + nchange with (eq_oct n2 n1 = eq_oct n1 n2); + nrewrite > (symmetric_eqoct n1 n2); + ##| ##32,33,34: #n2; nnormalize + ##] + nnormalize; napply refl_eq + ##| ##32: ncases i2; #n1; + ##[ ##32: #n2; + nchange with (eq_oct n2 n1 = eq_oct n1 n2); + nrewrite > (symmetric_eqoct n1 n2); + ##| ##31,33,34: #n2; nnormalize + ##] + nnormalize; napply refl_eq + ##| ##33: ncases i2; #n1; + ##[ ##33: #n2; + nchange with (eq_ex n2 n1 = eq_ex n1 n2); + nrewrite > (symmetric_eqex n1 n2); + ##| ##31,32,34: #n2; nnormalize + ##] + nnormalize; napply refl_eq + ##| ##34: ncases i2; #n1; + ##[ ##34: #n2; + nchange with (eq_bit n2 n1 = eq_bit n1 n2); + nrewrite > (symmetric_eqbit n1 n2); + ##| ##31,32,33: #n2; nnormalize + ##] + nnormalize; napply refl_eq + ##] +nqed. + +nlemma eqim_to_eq1 : ∀i2.eq_im MODE_INH i2 = true → MODE_INH = i2. + #i2; ncases i2; nnormalize; + ##[ ##1: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq2 : ∀i2.eq_im MODE_INHA i2 = true → MODE_INHA = i2. + #i2; ncases i2; nnormalize; + ##[ ##2: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq3 : ∀i2.eq_im MODE_INHX i2 = true → MODE_INHX = i2. + #i2; ncases i2; nnormalize; + ##[ ##3: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq4 : ∀i2.eq_im MODE_INHH i2 = true → MODE_INHH = i2. + #i2; ncases i2; nnormalize; + ##[ ##4: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq5 : ∀i2.eq_im MODE_INHX0ADD i2 = true → MODE_INHX0ADD = i2. + #i2; ncases i2; nnormalize; + ##[ ##5: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq6 : ∀i2.eq_im MODE_INHX1ADD i2 = true → MODE_INHX1ADD = i2. + #i2; ncases i2; nnormalize; + ##[ ##6: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq7 : ∀i2.eq_im MODE_INHX2ADD i2 = true → MODE_INHX2ADD = i2. + #i2; ncases i2; nnormalize; + ##[ ##7: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq8 : ∀i2.eq_im MODE_IMM1 i2 = true → MODE_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##8: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq9 : ∀i2.eq_im MODE_IMM1EXT i2 = true → MODE_IMM1EXT = i2. + #i2; ncases i2; nnormalize; + ##[ ##9: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq10 : ∀i2.eq_im MODE_IMM2 i2 = true → MODE_IMM2 = i2. + #i2; ncases i2; nnormalize; + ##[ ##10: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq11 : ∀i2.eq_im MODE_DIR1 i2 = true → MODE_DIR1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##11: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq12 : ∀i2.eq_im MODE_DIR2 i2 = true → MODE_DIR2 = i2. + #i2; ncases i2; nnormalize; + ##[ ##12: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq13 : ∀i2.eq_im MODE_IX0 i2 = true → MODE_IX0 = i2. + #i2; ncases i2; nnormalize; + ##[ ##13: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq14 : ∀i2.eq_im MODE_IX1 i2 = true → MODE_IX1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##14: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq15 : ∀i2.eq_im MODE_IX2 i2 = true → MODE_IX2 = i2. + #i2; ncases i2; nnormalize; + ##[ ##15: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq16 : ∀i2.eq_im MODE_SP1 i2 = true → MODE_SP1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##16: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq17 : ∀i2.eq_im MODE_SP2 i2 = true → MODE_SP2 = i2. + #i2; ncases i2; nnormalize; + ##[ ##17: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq18 : ∀i2.eq_im MODE_DIR1_to_DIR1 i2 = true → MODE_DIR1_to_DIR1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##18: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq19 : ∀i2.eq_im MODE_IMM1_to_DIR1 i2 = true → MODE_IMM1_to_DIR1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##19: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq20 : ∀i2.eq_im MODE_IX0p_to_DIR1 i2 = true → MODE_IX0p_to_DIR1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##20: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq21 : ∀i2.eq_im MODE_DIR1_to_IX0p i2 = true → MODE_DIR1_to_IX0p = i2. + #i2; ncases i2; nnormalize; + ##[ ##21: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq22 : ∀i2.eq_im MODE_INHA_and_IMM1 i2 = true → MODE_INHA_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##22: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq23 : ∀i2.eq_im MODE_INHX_and_IMM1 i2 = true → MODE_INHX_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##23: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq24 : ∀i2.eq_im MODE_IMM1_and_IMM1 i2 = true → MODE_IMM1_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##24: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq25 : ∀i2.eq_im MODE_DIR1_and_IMM1 i2 = true → MODE_DIR1_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##25: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq26 : ∀i2.eq_im MODE_IX0_and_IMM1 i2 = true → MODE_IX0_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##26: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq27 : ∀i2.eq_im MODE_IX0p_and_IMM1 i2 = true → MODE_IX0p_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##27: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq28 : ∀i2.eq_im MODE_IX1_and_IMM1 i2 = true → MODE_IX1_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##28: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq29 : ∀i2.eq_im MODE_IX1p_and_IMM1 i2 = true → MODE_IX1p_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##29: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq30 : ∀i2.eq_im MODE_SP1_and_IMM1 i2 = true → MODE_SP1_and_IMM1 = i2. + #i2; ncases i2; nnormalize; + ##[ ##30: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (bool_destruct … H) + ##| ##*: #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq31 : ∀n1,i2.eq_im (MODE_DIRn n1) i2 = true → MODE_DIRn n1 = i2. + #n1; #i2; ncases i2; + ##[ ##31: #n2; #H; + nchange in H:(%) with (eq_oct n1 n2 = true); + nrewrite > (eqoct_to_eq … H); + napply refl_eq + ##| ##32,33,34: nnormalize; #n2; #H; napply (bool_destruct … H) + ##| ##*: nnormalize; #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq32 : ∀n1,i2.eq_im (MODE_DIRn_and_IMM1 n1) i2 = true → MODE_DIRn_and_IMM1 n1 = i2. + #n1; #i2; ncases i2; + ##[ ##32: #n2; #H; + nchange in H:(%) with (eq_oct n1 n2 = true); + nrewrite > (eqoct_to_eq … H); + napply refl_eq + ##| ##31,33,34: nnormalize; #n2; #H; napply (bool_destruct … H) + ##| ##*: nnormalize; #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq33 : ∀n1,i2.eq_im (MODE_TNY n1) i2 = true → MODE_TNY n1 = i2. + #n1; #i2; ncases i2; + ##[ ##33: #n2; #H; + nchange in H:(%) with (eq_ex n1 n2 = true); + nrewrite > (eqex_to_eq … H); + napply refl_eq + ##| ##31,32,34: nnormalize; #n2; #H; napply (bool_destruct … H) + ##| ##*: nnormalize; #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq34 : ∀n1,i2.eq_im (MODE_SRT n1) i2 = true → MODE_SRT n1 = i2. + #n1; #i2; ncases i2; + ##[ ##34: #n2; #H; + nchange in H:(%) with (eq_bit n1 n2 = true); + nrewrite > (eqbit_to_eq … H); + napply refl_eq + ##| ##31,32,33: nnormalize; #n2; #H; napply (bool_destruct … H) + ##| ##*: nnormalize; #H; napply (bool_destruct … H) + ##] +nqed. + +nlemma eqim_to_eq : ∀i1,i2.eq_im i1 i2 = true → i1 = i2. + #i1; ncases i1; + ##[ ##1: napply eqim_to_eq1 ##| ##2: napply eqim_to_eq2 + ##| ##3: napply eqim_to_eq3 ##| ##4: napply eqim_to_eq4 + ##| ##5: napply eqim_to_eq5 ##| ##6: napply eqim_to_eq6 + ##| ##7: napply eqim_to_eq7 ##| ##8: napply eqim_to_eq8 + ##| ##9: napply eqim_to_eq9 ##| ##10: napply eqim_to_eq10 + ##| ##11: napply eqim_to_eq11 ##| ##12: napply eqim_to_eq12 + ##| ##13: napply eqim_to_eq13 ##| ##14: napply eqim_to_eq14 + ##| ##15: napply eqim_to_eq15 ##| ##16: napply eqim_to_eq16 + ##| ##17: napply eqim_to_eq17 ##| ##18: napply eqim_to_eq18 + ##| ##19: napply eqim_to_eq19 ##| ##20: napply eqim_to_eq20 + ##| ##21: napply eqim_to_eq21 ##| ##22: napply eqim_to_eq22 + ##| ##23: napply eqim_to_eq23 ##| ##24: napply eqim_to_eq24 + ##| ##25: napply eqim_to_eq25 ##| ##26: napply eqim_to_eq26 + ##| ##27: napply eqim_to_eq27 ##| ##28: napply eqim_to_eq28 + ##| ##29: napply eqim_to_eq29 ##| ##30: napply eqim_to_eq30 + ##| ##31: napply eqim_to_eq31 ##| ##32: napply eqim_to_eq32 + ##| ##33: napply eqim_to_eq33 ##| ##34: napply eqim_to_eq34 + ##] +nqed. + +nlemma eq_to_eqim1 : ∀i2.MODE_INH = i2 → eq_im MODE_INH i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##1: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim2 : ∀i2.MODE_INHA = i2 → eq_im MODE_INHA i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##2: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim3 : ∀i2.MODE_INHX = i2 → eq_im MODE_INHX i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##3: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim4 : ∀i2.MODE_INHH = i2 → eq_im MODE_INHH i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##4: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim5 : ∀i2.MODE_INHX0ADD = i2 → eq_im MODE_INHX0ADD i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##5: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim6 : ∀i2.MODE_INHX1ADD = i2 → eq_im MODE_INHX1ADD i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##6: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim7 : ∀i2.MODE_INHX2ADD = i2 → eq_im MODE_INHX2ADD i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##7: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim8 : ∀i2.MODE_IMM1 = i2 → eq_im MODE_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##8: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim9 : ∀i2.MODE_IMM1EXT = i2 → eq_im MODE_IMM1EXT i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##9: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim10 : ∀i2.MODE_IMM2 = i2 → eq_im MODE_IMM2 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##10: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim11 : ∀i2.MODE_DIR1 = i2 → eq_im MODE_DIR1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##11: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim12 : ∀i2.MODE_DIR2 = i2 → eq_im MODE_DIR2 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##12: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim13 : ∀i2.MODE_IX0 = i2 → eq_im MODE_IX0 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##13: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim14 : ∀i2.MODE_IX1 = i2 → eq_im MODE_IX1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##14: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim15 : ∀i2.MODE_IX2 = i2 → eq_im MODE_IX2 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##15: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim16 : ∀i2.MODE_SP1 = i2 → eq_im MODE_SP1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##16: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim17 : ∀i2.MODE_SP2 = i2 → eq_im MODE_SP2 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##17: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim18 : ∀i2.MODE_DIR1_to_DIR1 = i2 → eq_im MODE_DIR1_to_DIR1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##18: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim19 : ∀i2.MODE_IMM1_to_DIR1 = i2 → eq_im MODE_IMM1_to_DIR1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##19: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim20 : ∀i2.MODE_IX0p_to_DIR1 = i2 → eq_im MODE_IX0p_to_DIR1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##20: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim21 : ∀i2.MODE_DIR1_to_IX0p = i2 → eq_im MODE_DIR1_to_IX0p i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##21: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim22 : ∀i2.MODE_INHA_and_IMM1 = i2 → eq_im MODE_INHA_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##22: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim23 : ∀i2.MODE_INHX_and_IMM1 = i2 → eq_im MODE_INHX_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##23: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim24 : ∀i2.MODE_IMM1_and_IMM1 = i2 → eq_im MODE_IMM1_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##24: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim25 : ∀i2.MODE_DIR1_and_IMM1 = i2 → eq_im MODE_DIR1_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##25: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim26 : ∀i2.MODE_IX0_and_IMM1 = i2 → eq_im MODE_IX0_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##26: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim27 : ∀i2.MODE_IX0p_and_IMM1 = i2 → eq_im MODE_IX0p_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##27: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim28 : ∀i2.MODE_IX1_and_IMM1 = i2 → eq_im MODE_IX1_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##28: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim29 : ∀i2.MODE_IX1p_and_IMM1 = i2 → eq_im MODE_IX1p_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##29: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim30 : ∀i2.MODE_SP1_and_IMM1 = i2 → eq_im MODE_SP1_and_IMM1 i2 = true. + #t2; ncases t2; nnormalize; + ##[ ##30: #H; napply refl_eq + ##| ##31,32,33,34: #n; #H; napply (instr_mode_destruct … H) + ##| ##*: #H; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim31 : ∀n1,i2.MODE_DIRn n1 = i2 → eq_im (MODE_DIRn n1) i2 = true. + #n1; #t2; ncases t2; + ##[ ##31: #n2; #H; + nchange with (eq_oct n1 n2 = true); + nrewrite > (instr_mode_destruct_MODE_DIRn … H); + nrewrite > (eq_to_eqoct n2 n2 (refl_eq …)); + napply refl_eq + ##| ##32,33,34: #n; #H; nnormalize; napply (instr_mode_destruct … H) + ##| ##*: #H; nnormalize; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim32 : ∀n1,i2.MODE_DIRn_and_IMM1 n1 = i2 → eq_im (MODE_DIRn_and_IMM1 n1) i2 = true. + #n1; #t2; ncases t2; + ##[ ##32: #n2; #H; + nchange with (eq_oct n1 n2 = true); + nrewrite > (instr_mode_destruct_MODE_DIRn_and_IMM1 … H); + nrewrite > (eq_to_eqoct n2 n2 (refl_eq …)); + napply refl_eq + ##| ##31,33,34: #n; #H; nnormalize; napply (instr_mode_destruct … H) + ##| ##*: #H; nnormalize; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim33 : ∀n1,i2.MODE_TNY n1 = i2 → eq_im (MODE_TNY n1) i2 = true. + #n1; #t2; ncases t2; + ##[ ##33: #n2; #H; + nchange with (eq_ex n1 n2 = true); + nrewrite > (instr_mode_destruct_MODE_TNY … H); + nrewrite > (eq_to_eqex n2 n2 (refl_eq …)); + napply refl_eq + ##| ##31,32,34: #n; #H; nnormalize; napply (instr_mode_destruct … H) + ##| ##*: #H; nnormalize; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim34 : ∀n1,i2.MODE_SRT n1 = i2 → eq_im (MODE_SRT n1) i2 = true. + #n1; #t2; ncases t2; + ##[ ##34: #n2; #H; + nchange with (eq_bit n1 n2 = true); + nrewrite > (instr_mode_destruct_MODE_SRT … H); + nrewrite > (eq_to_eqbit n2 n2 (refl_eq …)); + napply refl_eq + ##| ##31,32,33: #n; #H; nnormalize; napply (instr_mode_destruct … H) + ##| ##*: #H; nnormalize; napply (instr_mode_destruct … H) + ##] +nqed. + +nlemma eq_to_eqim : ∀i1,i2.i1 = i2 → eq_im i1 i2 = true. + #i1; ncases i1; + ##[ ##1: napply eq_to_eqim1 ##| ##2: napply eq_to_eqim2 + ##| ##3: napply eq_to_eqim3 ##| ##4: napply eq_to_eqim4 + ##| ##5: napply eq_to_eqim5 ##| ##6: napply eq_to_eqim6 + ##| ##7: napply eq_to_eqim7 ##| ##8: napply eq_to_eqim8 + ##| ##9: napply eq_to_eqim9 ##| ##10: napply eq_to_eqim10 + ##| ##11: napply eq_to_eqim11 ##| ##12: napply eq_to_eqim12 + ##| ##13: napply eq_to_eqim13 ##| ##14: napply eq_to_eqim14 + ##| ##15: napply eq_to_eqim15 ##| ##16: napply eq_to_eqim16 + ##| ##17: napply eq_to_eqim17 ##| ##18: napply eq_to_eqim18 + ##| ##19: napply eq_to_eqim19 ##| ##20: napply eq_to_eqim20 + ##| ##21: napply eq_to_eqim21 ##| ##22: napply eq_to_eqim22 + ##| ##23: napply eq_to_eqim23 ##| ##24: napply eq_to_eqim24 + ##| ##25: napply eq_to_eqim25 ##| ##26: napply eq_to_eqim26 + ##| ##27: napply eq_to_eqim27 ##| ##28: napply eq_to_eqim28 + ##| ##29: napply eq_to_eqim29 ##| ##30: napply eq_to_eqim30 + ##| ##31: napply eq_to_eqim31 ##| ##32: napply eq_to_eqim32 + ##| ##33: napply eq_to_eqim33 ##| ##34: napply eq_to_eqim34 + ##] +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_opcode1.ma b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_opcode1.ma new file mode 100755 index 000000000..db2a96d46 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_opcode1.ma @@ -0,0 +1,970 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "num/bool_lemmas.ma". +include "freescale/opcode_base.ma". + +(* ********************************************** *) +(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) +(* ********************************************** *) + +ndefinition opcode_destruct1 : Πop2.ΠP:Prop.ADC = op2 → match op2 with [ ADC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##1: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match ADC with [ ADC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct2 : Πop2.ΠP:Prop.ADD = op2 → match op2 with [ ADD ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##2: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match ADD with [ ADD ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct3 : Πop2.ΠP:Prop.AIS = op2 → match op2 with [ AIS ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##3: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match AIS with [ AIS ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct4 : Πop2.ΠP:Prop.AIX = op2 → match op2 with [ AIX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##4: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match AIX with [ AIX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct5 : Πop2.ΠP:Prop.AND = op2 → match op2 with [ AND ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##5: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match AND with [ AND ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct6 : Πop2.ΠP:Prop.ASL = op2 → match op2 with [ ASL ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##6: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match ASL with [ ASL ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct7 : Πop2.ΠP:Prop.ASR = op2 → match op2 with [ ASR ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##7: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match ASR with [ ASR ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct8 : Πop2.ΠP:Prop.BCC = op2 → match op2 with [ BCC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##8: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BCC with [ BCC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct9 : Πop2.ΠP:Prop.BCLRn = op2 → match op2 with [ BCLRn ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##9: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BCLRn with [ BCLRn ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct10 : Πop2.ΠP:Prop.BCS = op2 → match op2 with [ BCS ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##10: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BCS with [ BCS ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct11 : Πop2.ΠP:Prop.BEQ = op2 → match op2 with [ BEQ ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##11: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BEQ with [ BEQ ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct12 : Πop2.ΠP:Prop.BGE = op2 → match op2 with [ BGE ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##12: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BGE with [ BGE ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct13 : Πop2.ΠP:Prop.BGND = op2 → match op2 with [ BGND ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##13: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BGND with [ BGND ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct14 : Πop2.ΠP:Prop.BGT = op2 → match op2 with [ BGT ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##14: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BGT with [ BGT ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct15 : Πop2.ΠP:Prop.BHCC = op2 → match op2 with [ BHCC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##15: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BHCC with [ BHCC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct16 : Πop2.ΠP:Prop.BHCS = op2 → match op2 with [ BHCS ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##16: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BHCS with [ BHCS ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct17 : Πop2.ΠP:Prop.BHI = op2 → match op2 with [ BHI ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##17: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BHI with [ BHI ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct18 : Πop2.ΠP:Prop.BIH = op2 → match op2 with [ BIH ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##18: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BIH with [ BIH ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct19 : Πop2.ΠP:Prop.BIL = op2 → match op2 with [ BIL ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##19: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BIL with [ BIL ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct20 : Πop2.ΠP:Prop.BIT = op2 → match op2 with [ BIT ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##20: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BIT with [ BIT ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct21 : Πop2.ΠP:Prop.BLE = op2 → match op2 with [ BLE ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##21: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BLE with [ BLE ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct22 : Πop2.ΠP:Prop.BLS = op2 → match op2 with [ BLS ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##22: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BLS with [ BLS ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct23 : Πop2.ΠP:Prop.BLT = op2 → match op2 with [ BLT ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##23: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BLT with [ BLT ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct24 : Πop2.ΠP:Prop.BMC = op2 → match op2 with [ BMC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##24: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BMC with [ BMC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct25 : Πop2.ΠP:Prop.BMI = op2 → match op2 with [ BMI ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##25: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BMI with [ BMI ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct26 : Πop2.ΠP:Prop.BMS = op2 → match op2 with [ BMS ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##26: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BMS with [ BMS ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct27 : Πop2.ΠP:Prop.BNE = op2 → match op2 with [ BNE ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##27: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BNE with [ BNE ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct28 : Πop2.ΠP:Prop.BPL = op2 → match op2 with [ BPL ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##28: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BPL with [ BPL ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct29 : Πop2.ΠP:Prop.BRA = op2 → match op2 with [ BRA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##29: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BRA with [ BRA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct30 : Πop2.ΠP:Prop.BRCLRn = op2 → match op2 with [ BRCLRn ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##30: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BRCLRn with [ BRCLRn ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct31 : Πop2.ΠP:Prop.BRN = op2 → match op2 with [ BRN ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##31: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BRN with [ BRN ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct32 : Πop2.ΠP:Prop.BRSETn = op2 → match op2 with [ BRSETn ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##32: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BRSETn with [ BRSETn ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct33 : Πop2.ΠP:Prop.BSETn = op2 → match op2 with [ BSETn ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##33: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BSETn with [ BSETn ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct34 : Πop2.ΠP:Prop.BSR = op2 → match op2 with [ BSR ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##34: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match BSR with [ BSR ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct35 : Πop2.ΠP:Prop.CBEQA = op2 → match op2 with [ CBEQA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##35: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match CBEQA with [ CBEQA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct36 : Πop2.ΠP:Prop.CBEQX = op2 → match op2 with [ CBEQX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##36: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match CBEQX with [ CBEQX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct37 : Πop2.ΠP:Prop.CLC = op2 → match op2 with [ CLC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##37: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match CLC with [ CLC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct38 : Πop2.ΠP:Prop.CLI = op2 → match op2 with [ CLI ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##38: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match CLI with [ CLI ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct39 : Πop2.ΠP:Prop.CLR = op2 → match op2 with [ CLR ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##39: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match CLR with [ CLR ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct40 : Πop2.ΠP:Prop.CMP = op2 → match op2 with [ CMP ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##40: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match CMP with [ CMP ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct41 : Πop2.ΠP:Prop.COM = op2 → match op2 with [ COM ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##41: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match COM with [ COM ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct42 : Πop2.ΠP:Prop.CPHX = op2 → match op2 with [ CPHX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##42: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match CPHX with [ CPHX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct43 : Πop2.ΠP:Prop.CPX = op2 → match op2 with [ CPX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##43: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match CPX with [ CPX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct44 : Πop2.ΠP:Prop.DAA = op2 → match op2 with [ DAA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##44: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match DAA with [ DAA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct45 : Πop2.ΠP:Prop.DBNZ = op2 → match op2 with [ DBNZ ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##45: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match DBNZ with [ DBNZ ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct46 : Πop2.ΠP:Prop.DEC = op2 → match op2 with [ DEC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##46: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match DEC with [ DEC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct47 : Πop2.ΠP:Prop.DIV = op2 → match op2 with [ DIV ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##47: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match DIV with [ DIV ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct48 : Πop2.ΠP:Prop.EOR = op2 → match op2 with [ EOR ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##48: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match EOR with [ EOR ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct49 : Πop2.ΠP:Prop.INC = op2 → match op2 with [ INC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##49: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match INC with [ INC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct50 : Πop2.ΠP:Prop.JMP = op2 → match op2 with [ JMP ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##50: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match JMP with [ JMP ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct51 : Πop2.ΠP:Prop.JSR = op2 → match op2 with [ JSR ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##51: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match JSR with [ JSR ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct52 : Πop2.ΠP:Prop.LDA = op2 → match op2 with [ LDA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##52: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match LDA with [ LDA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct53 : Πop2.ΠP:Prop.LDHX = op2 → match op2 with [ LDHX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##53: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match LDHX with [ LDHX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct54 : Πop2.ΠP:Prop.LDX = op2 → match op2 with [ LDX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##54: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match LDX with [ LDX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct55 : Πop2.ΠP:Prop.LSR = op2 → match op2 with [ LSR ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##55: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match LSR with [ LSR ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct56 : Πop2.ΠP:Prop.MOV = op2 → match op2 with [ MOV ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##56: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match MOV with [ MOV ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct57 : Πop2.ΠP:Prop.MUL = op2 → match op2 with [ MUL ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##57: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match MUL with [ MUL ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct58 : Πop2.ΠP:Prop.NEG = op2 → match op2 with [ NEG ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##58: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match NEG with [ NEG ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct59 : Πop2.ΠP:Prop.NOP = op2 → match op2 with [ NOP ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##59: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match NOP with [ NOP ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct60 : Πop2.ΠP:Prop.NSA = op2 → match op2 with [ NSA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##60: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match NSA with [ NSA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct61 : Πop2.ΠP:Prop.ORA = op2 → match op2 with [ ORA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##61: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match ORA with [ ORA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct62 : Πop2.ΠP:Prop.PSHA = op2 → match op2 with [ PSHA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##62: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match PSHA with [ PSHA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct63 : Πop2.ΠP:Prop.PSHH = op2 → match op2 with [ PSHH ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##63: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match PSHH with [ PSHH ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct64 : Πop2.ΠP:Prop.PSHX = op2 → match op2 with [ PSHX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##64: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match PSHX with [ PSHX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct65 : Πop2.ΠP:Prop.PULA = op2 → match op2 with [ PULA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##65: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match PULA with [ PULA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct66 : Πop2.ΠP:Prop.PULH = op2 → match op2 with [ PULH ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##66: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match PULH with [ PULH ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct67 : Πop2.ΠP:Prop.PULX = op2 → match op2 with [ PULX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##67: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match PULX with [ PULX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct68 : Πop2.ΠP:Prop.ROL = op2 → match op2 with [ ROL ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##68: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match ROL with [ ROL ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct69 : Πop2.ΠP:Prop.ROR = op2 → match op2 with [ ROR ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##69: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match ROR with [ ROR ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct70 : Πop2.ΠP:Prop.RSP = op2 → match op2 with [ RSP ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##70: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match RSP with [ RSP ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct71 : Πop2.ΠP:Prop.RTI = op2 → match op2 with [ RTI ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##71: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match RTI with [ RTI ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct72 : Πop2.ΠP:Prop.RTS = op2 → match op2 with [ RTS ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##72: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match RTS with [ RTS ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct73 : Πop2.ΠP:Prop.SBC = op2 → match op2 with [ SBC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##73: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match SBC with [ SBC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct74 : Πop2.ΠP:Prop.SEC = op2 → match op2 with [ SEC ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##74: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match SEC with [ SEC ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct75 : Πop2.ΠP:Prop.SEI = op2 → match op2 with [ SEI ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##75: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match SEI with [ SEI ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct76 : Πop2.ΠP:Prop.SHA = op2 → match op2 with [ SHA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##76: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match SHA with [ SHA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct77 : Πop2.ΠP:Prop.SLA = op2 → match op2 with [ SLA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##77: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match SLA with [ SLA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct78 : Πop2.ΠP:Prop.STA = op2 → match op2 with [ STA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##78: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match STA with [ STA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct79 : Πop2.ΠP:Prop.STHX = op2 → match op2 with [ STHX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##79: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match STHX with [ STHX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct80 : Πop2.ΠP:Prop.STOP = op2 → match op2 with [ STOP ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##80: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match STOP with [ STOP ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct81 : Πop2.ΠP:Prop.STX = op2 → match op2 with [ STX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##81: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match STX with [ STX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct82 : Πop2.ΠP:Prop.SUB = op2 → match op2 with [ SUB ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##82: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match SUB with [ SUB ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct83 : Πop2.ΠP:Prop.SWI = op2 → match op2 with [ SWI ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##83: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match SWI with [ SWI ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct84 : Πop2.ΠP:Prop.TAP = op2 → match op2 with [ TAP ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##84: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match TAP with [ TAP ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct85 : Πop2.ΠP:Prop.TAX = op2 → match op2 with [ TAX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##85: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match TAX with [ TAX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct86 : Πop2.ΠP:Prop.TPA = op2 → match op2 with [ TPA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##86: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match TPA with [ TPA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct87 : Πop2.ΠP:Prop.TST = op2 → match op2 with [ TST ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##87: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match TST with [ TST ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct88 : Πop2.ΠP:Prop.TSX = op2 → match op2 with [ TSX ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##88: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match TSX with [ TSX ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct89 : Πop2.ΠP:Prop.TXA = op2 → match op2 with [ TXA ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##89: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match TXA with [ TXA ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct90 : Πop2.ΠP:Prop.TXS = op2 → match op2 with [ TXS ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##90: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match TXS with [ TXS ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct91 : Πop2.ΠP:Prop.WAIT = op2 → match op2 with [ WAIT ⇒ P → P | _ ⇒ P ]. + #op2; #P; ncases op2; nnormalize; + ##[ ##91: #H; napply (λx:P.x) + ##| ##*: #H; napply False_ind; + nchange with (match WAIT with [ WAIT ⇒ False | _ ⇒ True ]); + nrewrite > H; nnormalize; napply I + ##] +nqed. + +ndefinition opcode_destruct_aux ≝ +Πop1,op2.ΠP:Prop.op1 = op2 → + match op1 with + [ ADC ⇒ match op2 with [ ADC ⇒ P → P | _ ⇒ P ] + | ADD ⇒ match op2 with [ ADD ⇒ P → P | _ ⇒ P ] + | AIS ⇒ match op2 with [ AIS ⇒ P → P | _ ⇒ P ] + | AIX ⇒ match op2 with [ AIX ⇒ P → P | _ ⇒ P ] + | AND ⇒ match op2 with [ AND ⇒ P → P | _ ⇒ P ] + | ASL ⇒ match op2 with [ ASL ⇒ P → P | _ ⇒ P ] + | ASR ⇒ match op2 with [ ASR ⇒ P → P | _ ⇒ P ] + | BCC ⇒ match op2 with [ BCC ⇒ P → P | _ ⇒ P ] + | BCLRn ⇒ match op2 with [ BCLRn ⇒ P → P | _ ⇒ P ] + | BCS ⇒ match op2 with [ BCS ⇒ P → P | _ ⇒ P ] + | BEQ ⇒ match op2 with [ BEQ ⇒ P → P | _ ⇒ P ] + | BGE ⇒ match op2 with [ BGE ⇒ P → P | _ ⇒ P ] + | BGND ⇒ match op2 with [ BGND ⇒ P → P | _ ⇒ P ] + | BGT ⇒ match op2 with [ BGT ⇒ P → P | _ ⇒ P ] + | BHCC ⇒ match op2 with [ BHCC ⇒ P → P | _ ⇒ P ] + | BHCS ⇒ match op2 with [ BHCS ⇒ P → P | _ ⇒ P ] + | BHI ⇒ match op2 with [ BHI ⇒ P → P | _ ⇒ P ] + | BIH ⇒ match op2 with [ BIH ⇒ P → P | _ ⇒ P ] + | BIL ⇒ match op2 with [ BIL ⇒ P → P | _ ⇒ P ] + | BIT ⇒ match op2 with [ BIT ⇒ P → P | _ ⇒ P ] + | BLE ⇒ match op2 with [ BLE ⇒ P → P | _ ⇒ P ] + | BLS ⇒ match op2 with [ BLS ⇒ P → P | _ ⇒ P ] + | BLT ⇒ match op2 with [ BLT ⇒ P → P | _ ⇒ P ] + | BMC ⇒ match op2 with [ BMC ⇒ P → P | _ ⇒ P ] + | BMI ⇒ match op2 with [ BMI ⇒ P → P | _ ⇒ P ] + | BMS ⇒ match op2 with [ BMS ⇒ P → P | _ ⇒ P ] + | BNE ⇒ match op2 with [ BNE ⇒ P → P | _ ⇒ P ] + | BPL ⇒ match op2 with [ BPL ⇒ P → P | _ ⇒ P ] + | BRA ⇒ match op2 with [ BRA ⇒ P → P | _ ⇒ P ] + | BRCLRn ⇒ match op2 with [ BRCLRn ⇒ P → P | _ ⇒ P ] + | BRN ⇒ match op2 with [ BRN ⇒ P → P | _ ⇒ P ] + | BRSETn ⇒ match op2 with [ BRSETn ⇒ P → P | _ ⇒ P ] + | BSETn ⇒ match op2 with [ BSETn ⇒ P → P | _ ⇒ P ] + | BSR ⇒ match op2 with [ BSR ⇒ P → P | _ ⇒ P ] + | CBEQA ⇒ match op2 with [ CBEQA ⇒ P → P | _ ⇒ P ] + | CBEQX ⇒ match op2 with [ CBEQX ⇒ P → P | _ ⇒ P ] + | CLC ⇒ match op2 with [ CLC ⇒ P → P | _ ⇒ P ] + | CLI ⇒ match op2 with [ CLI ⇒ P → P | _ ⇒ P ] + | CLR ⇒ match op2 with [ CLR ⇒ P → P | _ ⇒ P ] + | CMP ⇒ match op2 with [ CMP ⇒ P → P | _ ⇒ P ] + | COM ⇒ match op2 with [ COM ⇒ P → P | _ ⇒ P ] + | CPHX ⇒ match op2 with [ CPHX ⇒ P → P | _ ⇒ P ] + | CPX ⇒ match op2 with [ CPX ⇒ P → P | _ ⇒ P ] + | DAA ⇒ match op2 with [ DAA ⇒ P → P | _ ⇒ P ] + | DBNZ ⇒ match op2 with [ DBNZ ⇒ P → P | _ ⇒ P ] + | DEC ⇒ match op2 with [ DEC ⇒ P → P | _ ⇒ P ] + | DIV ⇒ match op2 with [ DIV ⇒ P → P | _ ⇒ P ] + | EOR ⇒ match op2 with [ EOR ⇒ P → P | _ ⇒ P ] + | INC ⇒ match op2 with [ INC ⇒ P → P | _ ⇒ P ] + | JMP ⇒ match op2 with [ JMP ⇒ P → P | _ ⇒ P ] + | JSR ⇒ match op2 with [ JSR ⇒ P → P | _ ⇒ P ] + | LDA ⇒ match op2 with [ LDA ⇒ P → P | _ ⇒ P ] + | LDHX ⇒ match op2 with [ LDHX ⇒ P → P | _ ⇒ P ] + | LDX ⇒ match op2 with [ LDX ⇒ P → P | _ ⇒ P ] + | LSR ⇒ match op2 with [ LSR ⇒ P → P | _ ⇒ P ] + | MOV ⇒ match op2 with [ MOV ⇒ P → P | _ ⇒ P ] + | MUL ⇒ match op2 with [ MUL ⇒ P → P | _ ⇒ P ] + | NEG ⇒ match op2 with [ NEG ⇒ P → P | _ ⇒ P ] + | NOP ⇒ match op2 with [ NOP ⇒ P → P | _ ⇒ P ] + | NSA ⇒ match op2 with [ NSA ⇒ P → P | _ ⇒ P ] + | ORA ⇒ match op2 with [ ORA ⇒ P → P | _ ⇒ P ] + | PSHA ⇒ match op2 with [ PSHA ⇒ P → P | _ ⇒ P ] + | PSHH ⇒ match op2 with [ PSHH ⇒ P → P | _ ⇒ P ] + | PSHX ⇒ match op2 with [ PSHX ⇒ P → P | _ ⇒ P ] + | PULA ⇒ match op2 with [ PULA ⇒ P → P | _ ⇒ P ] + | PULH ⇒ match op2 with [ PULH ⇒ P → P | _ ⇒ P ] + | PULX ⇒ match op2 with [ PULX ⇒ P → P | _ ⇒ P ] + | ROL ⇒ match op2 with [ ROL ⇒ P → P | _ ⇒ P ] + | ROR ⇒ match op2 with [ ROR ⇒ P → P | _ ⇒ P ] + | RSP ⇒ match op2 with [ RSP ⇒ P → P | _ ⇒ P ] + | RTI ⇒ match op2 with [ RTI ⇒ P → P | _ ⇒ P ] + | RTS ⇒ match op2 with [ RTS ⇒ P → P | _ ⇒ P ] + | SBC ⇒ match op2 with [ SBC ⇒ P → P | _ ⇒ P ] + | SEC ⇒ match op2 with [ SEC ⇒ P → P | _ ⇒ P ] + | SEI ⇒ match op2 with [ SEI ⇒ P → P | _ ⇒ P ] + | SHA ⇒ match op2 with [ SHA ⇒ P → P | _ ⇒ P ] + | SLA ⇒ match op2 with [ SLA ⇒ P → P | _ ⇒ P ] + | STA ⇒ match op2 with [ STA ⇒ P → P | _ ⇒ P ] + | STHX ⇒ match op2 with [ STHX ⇒ P → P | _ ⇒ P ] + | STOP ⇒ match op2 with [ STOP ⇒ P → P | _ ⇒ P ] + | STX ⇒ match op2 with [ STX ⇒ P → P | _ ⇒ P ] + | SUB ⇒ match op2 with [ SUB ⇒ P → P | _ ⇒ P ] + | SWI ⇒ match op2 with [ SWI ⇒ P → P | _ ⇒ P ] + | TAP ⇒ match op2 with [ TAP ⇒ P → P | _ ⇒ P ] + | TAX ⇒ match op2 with [ TAX ⇒ P → P | _ ⇒ P ] + | TPA ⇒ match op2 with [ TPA ⇒ P → P | _ ⇒ P ] + | TST ⇒ match op2 with [ TST ⇒ P → P | _ ⇒ P ] + | TSX ⇒ match op2 with [ TSX ⇒ P → P | _ ⇒ P ] + | TXA ⇒ match op2 with [ TXA ⇒ P → P | _ ⇒ P ] + | TXS ⇒ match op2 with [ TXS ⇒ P → P | _ ⇒ P ] + | WAIT ⇒ match op2 with [ WAIT ⇒ P → P | _ ⇒ P ] + ]. + +ndefinition opcode_destruct : opcode_destruct_aux. + #op1; ncases op1; + ##[ ##1: napply opcode_destruct1 ##| ##2: napply opcode_destruct2 ##| ##3: napply opcode_destruct3 ##| ##4: napply opcode_destruct4 + ##| ##5: napply opcode_destruct5 ##| ##6: napply opcode_destruct6 ##| ##7: napply opcode_destruct7 ##| ##8: napply opcode_destruct8 + ##| ##9: napply opcode_destruct9 ##| ##10: napply opcode_destruct10 ##| ##11: napply opcode_destruct11 ##| ##12: napply opcode_destruct12 + ##| ##13: napply opcode_destruct13 ##| ##14: napply opcode_destruct14 ##| ##15: napply opcode_destruct15 ##| ##16: napply opcode_destruct16 + ##| ##17: napply opcode_destruct17 ##| ##18: napply opcode_destruct18 ##| ##19: napply opcode_destruct19 ##| ##20: napply opcode_destruct20 + ##| ##21: napply opcode_destruct21 ##| ##22: napply opcode_destruct22 ##| ##23: napply opcode_destruct23 ##| ##24: napply opcode_destruct24 + ##| ##25: napply opcode_destruct25 ##| ##26: napply opcode_destruct26 ##| ##27: napply opcode_destruct27 ##| ##28: napply opcode_destruct28 + ##| ##29: napply opcode_destruct29 ##| ##30: napply opcode_destruct30 ##| ##31: napply opcode_destruct31 ##| ##32: napply opcode_destruct32 + ##| ##33: napply opcode_destruct33 ##| ##34: napply opcode_destruct34 ##| ##35: napply opcode_destruct35 ##| ##36: napply opcode_destruct36 + ##| ##37: napply opcode_destruct37 ##| ##38: napply opcode_destruct38 ##| ##39: napply opcode_destruct39 ##| ##40: napply opcode_destruct40 + ##| ##41: napply opcode_destruct41 ##| ##42: napply opcode_destruct42 ##| ##43: napply opcode_destruct43 ##| ##44: napply opcode_destruct44 + ##| ##45: napply opcode_destruct45 ##| ##46: napply opcode_destruct46 ##| ##47: napply opcode_destruct47 ##| ##48: napply opcode_destruct48 + ##| ##49: napply opcode_destruct49 ##| ##50: napply opcode_destruct50 ##| ##51: napply opcode_destruct51 ##| ##52: napply opcode_destruct52 + ##| ##53: napply opcode_destruct53 ##| ##54: napply opcode_destruct54 ##| ##55: napply opcode_destruct55 ##| ##56: napply opcode_destruct56 + ##| ##57: napply opcode_destruct57 ##| ##58: napply opcode_destruct58 ##| ##59: napply opcode_destruct59 ##| ##60: napply opcode_destruct60 + ##| ##61: napply opcode_destruct61 ##| ##62: napply opcode_destruct62 ##| ##63: napply opcode_destruct63 ##| ##64: napply opcode_destruct64 + ##| ##65: napply opcode_destruct65 ##| ##66: napply opcode_destruct66 ##| ##67: napply opcode_destruct67 ##| ##68: napply opcode_destruct68 + ##| ##69: napply opcode_destruct69 ##| ##70: napply opcode_destruct70 ##| ##71: napply opcode_destruct71 ##| ##72: napply opcode_destruct72 + ##| ##73: napply opcode_destruct73 ##| ##74: napply opcode_destruct74 ##| ##75: napply opcode_destruct75 ##| ##76: napply opcode_destruct76 + ##| ##77: napply opcode_destruct77 ##| ##78: napply opcode_destruct78 ##| ##79: napply opcode_destruct79 ##| ##80: napply opcode_destruct80 + ##| ##81: napply opcode_destruct81 ##| ##82: napply opcode_destruct82 ##| ##83: napply opcode_destruct83 ##| ##84: napply opcode_destruct84 + ##| ##85: napply opcode_destruct85 ##| ##86: napply opcode_destruct86 ##| ##87: napply opcode_destruct87 ##| ##88: napply opcode_destruct88 + ##| ##89: napply opcode_destruct89 ##| ##90: napply opcode_destruct90 ##| ##91: napply opcode_destruct91 ##] +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_opcode2.ma b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_opcode2.ma new file mode 100755 index 000000000..5e727309d --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/opcode_base_lemmas_opcode2.ma @@ -0,0 +1,384 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/opcode_base_lemmas_opcode1.ma". + +(* ********************************************** *) +(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) +(* ********************************************** *) + +nlemma symmetric_eqop1 : ∀op2.eq_op ADC op2 = eq_op op2 ADC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop2 : ∀op2.eq_op ADD op2 = eq_op op2 ADD. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop3 : ∀op2.eq_op AIS op2 = eq_op op2 AIS. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop4 : ∀op2.eq_op AIX op2 = eq_op op2 AIX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop5 : ∀op2.eq_op AND op2 = eq_op op2 AND. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop6 : ∀op2.eq_op ASL op2 = eq_op op2 ASL. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop7 : ∀op2.eq_op ASR op2 = eq_op op2 ASR. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop8 : ∀op2.eq_op BCC op2 = eq_op op2 BCC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop9 : ∀op2.eq_op BCLRn op2 = eq_op op2 BCLRn. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop10 : ∀op2.eq_op BCS op2 = eq_op op2 BCS. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop11 : ∀op2.eq_op BEQ op2 = eq_op op2 BEQ. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop12 : ∀op2.eq_op BGE op2 = eq_op op2 BGE. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop13 : ∀op2.eq_op BGND op2 = eq_op op2 BGND. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop14 : ∀op2.eq_op BGT op2 = eq_op op2 BGT. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop15 : ∀op2.eq_op BHCC op2 = eq_op op2 BHCC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop16 : ∀op2.eq_op BHCS op2 = eq_op op2 BHCS. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop17 : ∀op2.eq_op BHI op2 = eq_op op2 BHI. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop18 : ∀op2.eq_op BIH op2 = eq_op op2 BIH. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop19 : ∀op2.eq_op BIL op2 = eq_op op2 BIL. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop20 : ∀op2.eq_op BIT op2 = eq_op op2 BIT. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop21 : ∀op2.eq_op BLE op2 = eq_op op2 BLE. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop22 : ∀op2.eq_op BLS op2 = eq_op op2 BLS. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop23 : ∀op2.eq_op BLT op2 = eq_op op2 BLT. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop24 : ∀op2.eq_op BMC op2 = eq_op op2 BMC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop25 : ∀op2.eq_op BMI op2 = eq_op op2 BMI. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop26 : ∀op2.eq_op BMS op2 = eq_op op2 BMS. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop27 : ∀op2.eq_op BNE op2 = eq_op op2 BNE. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop28 : ∀op2.eq_op BPL op2 = eq_op op2 BPL. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop29 : ∀op2.eq_op BRA op2 = eq_op op2 BRA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop30 : ∀op2.eq_op BRCLRn op2 = eq_op op2 BRCLRn. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop31 : ∀op2.eq_op BRN op2 = eq_op op2 BRN. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop32 : ∀op2.eq_op BRSETn op2 = eq_op op2 BRSETn. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop33 : ∀op2.eq_op BSETn op2 = eq_op op2 BSETn. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop34 : ∀op2.eq_op BSR op2 = eq_op op2 BSR. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop35 : ∀op2.eq_op CBEQA op2 = eq_op op2 CBEQA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop36 : ∀op2.eq_op CBEQX op2 = eq_op op2 CBEQX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop37 : ∀op2.eq_op CLC op2 = eq_op op2 CLC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop38 : ∀op2.eq_op CLI op2 = eq_op op2 CLI. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop39 : ∀op2.eq_op CLR op2 = eq_op op2 CLR. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop40 : ∀op2.eq_op CMP op2 = eq_op op2 CMP. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop41 : ∀op2.eq_op COM op2 = eq_op op2 COM. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop42 : ∀op2.eq_op CPHX op2 = eq_op op2 CPHX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop43 : ∀op2.eq_op CPX op2 = eq_op op2 CPX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop44 : ∀op2.eq_op DAA op2 = eq_op op2 DAA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop45 : ∀op2.eq_op DBNZ op2 = eq_op op2 DBNZ. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop46 : ∀op2.eq_op DEC op2 = eq_op op2 DEC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop47 : ∀op2.eq_op DIV op2 = eq_op op2 DIV. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop48 : ∀op2.eq_op EOR op2 = eq_op op2 EOR. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop49 : ∀op2.eq_op INC op2 = eq_op op2 INC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop50 : ∀op2.eq_op JMP op2 = eq_op op2 JMP. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop51 : ∀op2.eq_op JSR op2 = eq_op op2 JSR. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop52 : ∀op2.eq_op LDA op2 = eq_op op2 LDA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop53 : ∀op2.eq_op LDHX op2 = eq_op op2 LDHX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop54 : ∀op2.eq_op LDX op2 = eq_op op2 LDX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop55 : ∀op2.eq_op LSR op2 = eq_op op2 LSR. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop56 : ∀op2.eq_op MOV op2 = eq_op op2 MOV. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop57 : ∀op2.eq_op MUL op2 = eq_op op2 MUL. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop58 : ∀op2.eq_op NEG op2 = eq_op op2 NEG. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop59 : ∀op2.eq_op NOP op2 = eq_op op2 NOP. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop60 : ∀op2.eq_op NSA op2 = eq_op op2 NSA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop61 : ∀op2.eq_op ORA op2 = eq_op op2 ORA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop62 : ∀op2.eq_op PSHA op2 = eq_op op2 PSHA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop63 : ∀op2.eq_op PSHH op2 = eq_op op2 PSHH. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop64 : ∀op2.eq_op PSHX op2 = eq_op op2 PSHX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop65 : ∀op2.eq_op PULA op2 = eq_op op2 PULA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop66 : ∀op2.eq_op PULH op2 = eq_op op2 PULH. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop67 : ∀op2.eq_op PULX op2 = eq_op op2 PULX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop68 : ∀op2.eq_op ROL op2 = eq_op op2 ROL. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop69 : ∀op2.eq_op ROR op2 = eq_op op2 ROR. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop70 : ∀op2.eq_op RSP op2 = eq_op op2 RSP. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop71 : ∀op2.eq_op RTI op2 = eq_op op2 RTI. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop72 : ∀op2.eq_op RTS op2 = eq_op op2 RTS. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop73 : ∀op2.eq_op SBC op2 = eq_op op2 SBC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop74 : ∀op2.eq_op SEC op2 = eq_op op2 SEC. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop75 : ∀op2.eq_op SEI op2 = eq_op op2 SEI. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop76 : ∀op2.eq_op SHA op2 = eq_op op2 SHA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop77 : ∀op2.eq_op SLA op2 = eq_op op2 SLA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop78 : ∀op2.eq_op STA op2 = eq_op op2 STA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop79 : ∀op2.eq_op STHX op2 = eq_op op2 STHX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop80 : ∀op2.eq_op STOP op2 = eq_op op2 STOP. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop81 : ∀op2.eq_op STX op2 = eq_op op2 STX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop82 : ∀op2.eq_op SUB op2 = eq_op op2 SUB. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop83 : ∀op2.eq_op SWI op2 = eq_op op2 SWI. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop84 : ∀op2.eq_op TAP op2 = eq_op op2 TAP. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop85 : ∀op2.eq_op TAX op2 = eq_op op2 TAX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop86 : ∀op2.eq_op TPA op2 = eq_op op2 TPA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop87 : ∀op2.eq_op TST op2 = eq_op op2 TST. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop88 : ∀op2.eq_op TSX op2 = eq_op op2 TSX. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop89 : ∀op2.eq_op TXA op2 = eq_op op2 TXA. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop90 : ∀op2.eq_op TXS op2 = eq_op op2 TXS. #op2; nnormalize; napply refl_eq.nqed. +nlemma symmetric_eqop91 : ∀op2.eq_op WAIT op2 = eq_op op2 WAIT. #op2; nnormalize; napply refl_eq.nqed. + +nlemma symmetric_eqop : symmetricT opcode bool eq_op. + #op1; ncases op1; + ##[ ##1: napply symmetric_eqop1 ##| ##2: napply symmetric_eqop2 ##| ##3: napply symmetric_eqop3 ##| ##4: napply symmetric_eqop4 + ##| ##5: napply symmetric_eqop5 ##| ##6: napply symmetric_eqop6 ##| ##7: napply symmetric_eqop7 ##| ##8: napply symmetric_eqop8 + ##| ##9: napply symmetric_eqop9 ##| ##10: napply symmetric_eqop10 ##| ##11: napply symmetric_eqop11 ##| ##12: napply symmetric_eqop12 + ##| ##13: napply symmetric_eqop13 ##| ##14: napply symmetric_eqop14 ##| ##15: napply symmetric_eqop15 ##| ##16: napply symmetric_eqop16 + ##| ##17: napply symmetric_eqop17 ##| ##18: napply symmetric_eqop18 ##| ##19: napply symmetric_eqop19 ##| ##20: napply symmetric_eqop20 + ##| ##21: napply symmetric_eqop21 ##| ##22: napply symmetric_eqop22 ##| ##23: napply symmetric_eqop23 ##| ##24: napply symmetric_eqop24 + ##| ##25: napply symmetric_eqop25 ##| ##26: napply symmetric_eqop26 ##| ##27: napply symmetric_eqop27 ##| ##28: napply symmetric_eqop28 + ##| ##29: napply symmetric_eqop29 ##| ##30: napply symmetric_eqop30 ##| ##31: napply symmetric_eqop31 ##| ##32: napply symmetric_eqop32 + ##| ##33: napply symmetric_eqop33 ##| ##34: napply symmetric_eqop34 ##| ##35: napply symmetric_eqop35 ##| ##36: napply symmetric_eqop36 + ##| ##37: napply symmetric_eqop37 ##| ##38: napply symmetric_eqop38 ##| ##39: napply symmetric_eqop39 ##| ##40: napply symmetric_eqop40 + ##| ##41: napply symmetric_eqop41 ##| ##42: napply symmetric_eqop42 ##| ##43: napply symmetric_eqop43 ##| ##44: napply symmetric_eqop44 + ##| ##45: napply symmetric_eqop45 ##| ##46: napply symmetric_eqop46 ##| ##47: napply symmetric_eqop47 ##| ##48: napply symmetric_eqop48 + ##| ##49: napply symmetric_eqop49 ##| ##50: napply symmetric_eqop50 ##| ##51: napply symmetric_eqop51 ##| ##52: napply symmetric_eqop52 + ##| ##53: napply symmetric_eqop53 ##| ##54: napply symmetric_eqop54 ##| ##55: napply symmetric_eqop55 ##| ##56: napply symmetric_eqop56 + ##| ##57: napply symmetric_eqop57 ##| ##58: napply symmetric_eqop58 ##| ##59: napply symmetric_eqop59 ##| ##60: napply symmetric_eqop60 + ##| ##61: napply symmetric_eqop61 ##| ##62: napply symmetric_eqop62 ##| ##63: napply symmetric_eqop63 ##| ##64: napply symmetric_eqop64 + ##| ##65: napply symmetric_eqop65 ##| ##66: napply symmetric_eqop66 ##| ##67: napply symmetric_eqop67 ##| ##68: napply symmetric_eqop68 + ##| ##69: napply symmetric_eqop69 ##| ##70: napply symmetric_eqop70 ##| ##71: napply symmetric_eqop71 ##| ##72: napply symmetric_eqop72 + ##| ##73: napply symmetric_eqop73 ##| ##74: napply symmetric_eqop74 ##| ##75: napply symmetric_eqop75 ##| ##76: napply symmetric_eqop76 + ##| ##77: napply symmetric_eqop77 ##| ##78: napply symmetric_eqop78 ##| ##79: napply symmetric_eqop79 ##| ##80: napply symmetric_eqop80 + ##| ##81: napply symmetric_eqop81 ##| ##82: napply symmetric_eqop82 ##| ##83: napply symmetric_eqop83 ##| ##84: napply symmetric_eqop84 + ##| ##85: napply symmetric_eqop85 ##| ##86: napply symmetric_eqop86 ##| ##87: napply symmetric_eqop87 ##| ##88: napply symmetric_eqop88 + ##| ##89: napply symmetric_eqop89 ##| ##90: napply symmetric_eqop90 ##| ##91: napply symmetric_eqop91 ##] +nqed. + +nlemma eqop_to_eq1 : ∀op2.eq_op ADC op2 = true → ADC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##1: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq2 : ∀op2.eq_op ADD op2 = true → ADD = op2. #op2; ncases op2; nnormalize; #H; ##[ ##2: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq3 : ∀op2.eq_op AIS op2 = true → AIS = op2. #op2; ncases op2; nnormalize; #H; ##[ ##3: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq4 : ∀op2.eq_op AIX op2 = true → AIX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##4: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq5 : ∀op2.eq_op AND op2 = true → AND = op2. #op2; ncases op2; nnormalize; #H; ##[ ##5: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq6 : ∀op2.eq_op ASL op2 = true → ASL = op2. #op2; ncases op2; nnormalize; #H; ##[ ##6: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq7 : ∀op2.eq_op ASR op2 = true → ASR = op2. #op2; ncases op2; nnormalize; #H; ##[ ##7: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq8 : ∀op2.eq_op BCC op2 = true → BCC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##8: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq9 : ∀op2.eq_op BCLRn op2 = true → BCLRn = op2. #op2; ncases op2; nnormalize; #H; ##[ ##9: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq10 : ∀op2.eq_op BCS op2 = true → BCS = op2. #op2; ncases op2; nnormalize; #H; ##[ ##10: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq11 : ∀op2.eq_op BEQ op2 = true → BEQ = op2. #op2; ncases op2; nnormalize; #H; ##[ ##11: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq12 : ∀op2.eq_op BGE op2 = true → BGE = op2. #op2; ncases op2; nnormalize; #H; ##[ ##12: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq13 : ∀op2.eq_op BGND op2 = true → BGND = op2. #op2; ncases op2; nnormalize; #H; ##[ ##13: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq14 : ∀op2.eq_op BGT op2 = true → BGT = op2. #op2; ncases op2; nnormalize; #H; ##[ ##14: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq15 : ∀op2.eq_op BHCC op2 = true → BHCC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##15: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq16 : ∀op2.eq_op BHCS op2 = true → BHCS = op2. #op2; ncases op2; nnormalize; #H; ##[ ##16: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq17 : ∀op2.eq_op BHI op2 = true → BHI = op2. #op2; ncases op2; nnormalize; #H; ##[ ##17: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq18 : ∀op2.eq_op BIH op2 = true → BIH = op2. #op2; ncases op2; nnormalize; #H; ##[ ##18: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq19 : ∀op2.eq_op BIL op2 = true → BIL = op2. #op2; ncases op2; nnormalize; #H; ##[ ##19: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq20 : ∀op2.eq_op BIT op2 = true → BIT = op2. #op2; ncases op2; nnormalize; #H; ##[ ##20: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq21 : ∀op2.eq_op BLE op2 = true → BLE = op2. #op2; ncases op2; nnormalize; #H; ##[ ##21: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq22 : ∀op2.eq_op BLS op2 = true → BLS = op2. #op2; ncases op2; nnormalize; #H; ##[ ##22: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq23 : ∀op2.eq_op BLT op2 = true → BLT = op2. #op2; ncases op2; nnormalize; #H; ##[ ##23: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq24 : ∀op2.eq_op BMC op2 = true → BMC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##24: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq25 : ∀op2.eq_op BMI op2 = true → BMI = op2. #op2; ncases op2; nnormalize; #H; ##[ ##25: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq26 : ∀op2.eq_op BMS op2 = true → BMS = op2. #op2; ncases op2; nnormalize; #H; ##[ ##26: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq27 : ∀op2.eq_op BNE op2 = true → BNE = op2. #op2; ncases op2; nnormalize; #H; ##[ ##27: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq28 : ∀op2.eq_op BPL op2 = true → BPL = op2. #op2; ncases op2; nnormalize; #H; ##[ ##28: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq29 : ∀op2.eq_op BRA op2 = true → BRA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##29: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq30 : ∀op2.eq_op BRCLRn op2 = true → BRCLRn = op2. #op2; ncases op2; nnormalize; #H; ##[ ##30: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq31 : ∀op2.eq_op BRN op2 = true → BRN = op2. #op2; ncases op2; nnormalize; #H; ##[ ##31: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq32 : ∀op2.eq_op BRSETn op2 = true → BRSETn = op2. #op2; ncases op2; nnormalize; #H; ##[ ##32: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq33 : ∀op2.eq_op BSETn op2 = true → BSETn = op2. #op2; ncases op2; nnormalize; #H; ##[ ##33: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq34 : ∀op2.eq_op BSR op2 = true → BSR = op2. #op2; ncases op2; nnormalize; #H; ##[ ##34: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq35 : ∀op2.eq_op CBEQA op2 = true → CBEQA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##35: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq36 : ∀op2.eq_op CBEQX op2 = true → CBEQX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##36: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq37 : ∀op2.eq_op CLC op2 = true → CLC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##37: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq38 : ∀op2.eq_op CLI op2 = true → CLI = op2. #op2; ncases op2; nnormalize; #H; ##[ ##38: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq39 : ∀op2.eq_op CLR op2 = true → CLR = op2. #op2; ncases op2; nnormalize; #H; ##[ ##39: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq40 : ∀op2.eq_op CMP op2 = true → CMP = op2. #op2; ncases op2; nnormalize; #H; ##[ ##40: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq41 : ∀op2.eq_op COM op2 = true → COM = op2. #op2; ncases op2; nnormalize; #H; ##[ ##41: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq42 : ∀op2.eq_op CPHX op2 = true → CPHX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##42: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq43 : ∀op2.eq_op CPX op2 = true → CPX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##43: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq44 : ∀op2.eq_op DAA op2 = true → DAA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##44: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq45 : ∀op2.eq_op DBNZ op2 = true → DBNZ = op2. #op2; ncases op2; nnormalize; #H; ##[ ##45: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq46 : ∀op2.eq_op DEC op2 = true → DEC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##46: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq47 : ∀op2.eq_op DIV op2 = true → DIV = op2. #op2; ncases op2; nnormalize; #H; ##[ ##47: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq48 : ∀op2.eq_op EOR op2 = true → EOR = op2. #op2; ncases op2; nnormalize; #H; ##[ ##48: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq49 : ∀op2.eq_op INC op2 = true → INC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##49: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq50 : ∀op2.eq_op JMP op2 = true → JMP = op2. #op2; ncases op2; nnormalize; #H; ##[ ##50: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq51 : ∀op2.eq_op JSR op2 = true → JSR = op2. #op2; ncases op2; nnormalize; #H; ##[ ##51: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq52 : ∀op2.eq_op LDA op2 = true → LDA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##52: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq53 : ∀op2.eq_op LDHX op2 = true → LDHX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##53: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq54 : ∀op2.eq_op LDX op2 = true → LDX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##54: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq55 : ∀op2.eq_op LSR op2 = true → LSR = op2. #op2; ncases op2; nnormalize; #H; ##[ ##55: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq56 : ∀op2.eq_op MOV op2 = true → MOV = op2. #op2; ncases op2; nnormalize; #H; ##[ ##56: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq57 : ∀op2.eq_op MUL op2 = true → MUL = op2. #op2; ncases op2; nnormalize; #H; ##[ ##57: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq58 : ∀op2.eq_op NEG op2 = true → NEG = op2. #op2; ncases op2; nnormalize; #H; ##[ ##58: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq59 : ∀op2.eq_op NOP op2 = true → NOP = op2. #op2; ncases op2; nnormalize; #H; ##[ ##59: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq60 : ∀op2.eq_op NSA op2 = true → NSA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##60: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq61 : ∀op2.eq_op ORA op2 = true → ORA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##61: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq62 : ∀op2.eq_op PSHA op2 = true → PSHA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##62: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq63 : ∀op2.eq_op PSHH op2 = true → PSHH = op2. #op2; ncases op2; nnormalize; #H; ##[ ##63: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq64 : ∀op2.eq_op PSHX op2 = true → PSHX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##64: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq65 : ∀op2.eq_op PULA op2 = true → PULA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##65: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq66 : ∀op2.eq_op PULH op2 = true → PULH = op2. #op2; ncases op2; nnormalize; #H; ##[ ##66: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq67 : ∀op2.eq_op PULX op2 = true → PULX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##67: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq68 : ∀op2.eq_op ROL op2 = true → ROL = op2. #op2; ncases op2; nnormalize; #H; ##[ ##68: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq69 : ∀op2.eq_op ROR op2 = true → ROR = op2. #op2; ncases op2; nnormalize; #H; ##[ ##69: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq70 : ∀op2.eq_op RSP op2 = true → RSP = op2. #op2; ncases op2; nnormalize; #H; ##[ ##70: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq71 : ∀op2.eq_op RTI op2 = true → RTI = op2. #op2; ncases op2; nnormalize; #H; ##[ ##71: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq72 : ∀op2.eq_op RTS op2 = true → RTS = op2. #op2; ncases op2; nnormalize; #H; ##[ ##72: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq73 : ∀op2.eq_op SBC op2 = true → SBC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##73: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq74 : ∀op2.eq_op SEC op2 = true → SEC = op2. #op2; ncases op2; nnormalize; #H; ##[ ##74: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq75 : ∀op2.eq_op SEI op2 = true → SEI = op2. #op2; ncases op2; nnormalize; #H; ##[ ##75: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq76 : ∀op2.eq_op SHA op2 = true → SHA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##76: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq77 : ∀op2.eq_op SLA op2 = true → SLA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##77: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq78 : ∀op2.eq_op STA op2 = true → STA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##78: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq79 : ∀op2.eq_op STHX op2 = true → STHX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##79: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq80 : ∀op2.eq_op STOP op2 = true → STOP = op2. #op2; ncases op2; nnormalize; #H; ##[ ##80: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq81 : ∀op2.eq_op STX op2 = true → STX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##81: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq82 : ∀op2.eq_op SUB op2 = true → SUB = op2. #op2; ncases op2; nnormalize; #H; ##[ ##82: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq83 : ∀op2.eq_op SWI op2 = true → SWI = op2. #op2; ncases op2; nnormalize; #H; ##[ ##83: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq84 : ∀op2.eq_op TAP op2 = true → TAP = op2. #op2; ncases op2; nnormalize; #H; ##[ ##84: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq85 : ∀op2.eq_op TAX op2 = true → TAX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##85: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq86 : ∀op2.eq_op TPA op2 = true → TPA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##86: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq87 : ∀op2.eq_op TST op2 = true → TST = op2. #op2; ncases op2; nnormalize; #H; ##[ ##87: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq88 : ∀op2.eq_op TSX op2 = true → TSX = op2. #op2; ncases op2; nnormalize; #H; ##[ ##88: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq89 : ∀op2.eq_op TXA op2 = true → TXA = op2. #op2; ncases op2; nnormalize; #H; ##[ ##89: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq90 : ∀op2.eq_op TXS op2 = true → TXS = op2. #op2; ncases op2; nnormalize; #H; ##[ ##90: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. +nlemma eqop_to_eq91 : ∀op2.eq_op WAIT op2 = true → WAIT = op2. #op2; ncases op2; nnormalize; #H; ##[ ##91: napply refl_eq ##| ##*: napply (bool_destruct … H) ##]nqed. + +nlemma eqop_to_eq : ∀op1,op2.eq_op op1 op2 = true → op1 = op2. + #op1; ncases op1; + ##[ ##1: napply eqop_to_eq1 ##| ##2: napply eqop_to_eq2 ##| ##3: napply eqop_to_eq3 ##| ##4: napply eqop_to_eq4 + ##| ##5: napply eqop_to_eq5 ##| ##6: napply eqop_to_eq6 ##| ##7: napply eqop_to_eq7 ##| ##8: napply eqop_to_eq8 + ##| ##9: napply eqop_to_eq9 ##| ##10: napply eqop_to_eq10 ##| ##11: napply eqop_to_eq11 ##| ##12: napply eqop_to_eq12 + ##| ##13: napply eqop_to_eq13 ##| ##14: napply eqop_to_eq14 ##| ##15: napply eqop_to_eq15 ##| ##16: napply eqop_to_eq16 + ##| ##17: napply eqop_to_eq17 ##| ##18: napply eqop_to_eq18 ##| ##19: napply eqop_to_eq19 ##| ##20: napply eqop_to_eq20 + ##| ##21: napply eqop_to_eq21 ##| ##22: napply eqop_to_eq22 ##| ##23: napply eqop_to_eq23 ##| ##24: napply eqop_to_eq24 + ##| ##25: napply eqop_to_eq25 ##| ##26: napply eqop_to_eq26 ##| ##27: napply eqop_to_eq27 ##| ##28: napply eqop_to_eq28 + ##| ##29: napply eqop_to_eq29 ##| ##30: napply eqop_to_eq30 ##| ##31: napply eqop_to_eq31 ##| ##32: napply eqop_to_eq32 + ##| ##33: napply eqop_to_eq33 ##| ##34: napply eqop_to_eq34 ##| ##35: napply eqop_to_eq35 ##| ##36: napply eqop_to_eq36 + ##| ##37: napply eqop_to_eq37 ##| ##38: napply eqop_to_eq38 ##| ##39: napply eqop_to_eq39 ##| ##40: napply eqop_to_eq40 + ##| ##41: napply eqop_to_eq41 ##| ##42: napply eqop_to_eq42 ##| ##43: napply eqop_to_eq43 ##| ##44: napply eqop_to_eq44 + ##| ##45: napply eqop_to_eq45 ##| ##46: napply eqop_to_eq46 ##| ##47: napply eqop_to_eq47 ##| ##48: napply eqop_to_eq48 + ##| ##49: napply eqop_to_eq49 ##| ##50: napply eqop_to_eq50 ##| ##51: napply eqop_to_eq51 ##| ##52: napply eqop_to_eq52 + ##| ##53: napply eqop_to_eq53 ##| ##54: napply eqop_to_eq54 ##| ##55: napply eqop_to_eq55 ##| ##56: napply eqop_to_eq56 + ##| ##57: napply eqop_to_eq57 ##| ##58: napply eqop_to_eq58 ##| ##59: napply eqop_to_eq59 ##| ##60: napply eqop_to_eq60 + ##| ##61: napply eqop_to_eq61 ##| ##62: napply eqop_to_eq62 ##| ##63: napply eqop_to_eq63 ##| ##64: napply eqop_to_eq64 + ##| ##65: napply eqop_to_eq65 ##| ##66: napply eqop_to_eq66 ##| ##67: napply eqop_to_eq67 ##| ##68: napply eqop_to_eq68 + ##| ##69: napply eqop_to_eq69 ##| ##70: napply eqop_to_eq70 ##| ##71: napply eqop_to_eq71 ##| ##72: napply eqop_to_eq72 + ##| ##73: napply eqop_to_eq73 ##| ##74: napply eqop_to_eq74 ##| ##75: napply eqop_to_eq75 ##| ##76: napply eqop_to_eq76 + ##| ##77: napply eqop_to_eq77 ##| ##78: napply eqop_to_eq78 ##| ##79: napply eqop_to_eq79 ##| ##80: napply eqop_to_eq80 + ##| ##81: napply eqop_to_eq81 ##| ##82: napply eqop_to_eq82 ##| ##83: napply eqop_to_eq83 ##| ##84: napply eqop_to_eq84 + ##| ##85: napply eqop_to_eq85 ##| ##86: napply eqop_to_eq86 ##| ##87: napply eqop_to_eq87 ##| ##88: napply eqop_to_eq88 + ##| ##89: napply eqop_to_eq89 ##| ##90: napply eqop_to_eq90 ##| ##91: napply eqop_to_eq91 ##] +nqed. + +nlemma eq_to_eqop1 : ∀op2.ADC = op2 → eq_op ADC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##1: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop2 : ∀op2.ADD = op2 → eq_op ADD op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##2: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop3 : ∀op2.AIS = op2 → eq_op AIS op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##3: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop4 : ∀op2.AIX = op2 → eq_op AIX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##4: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop5 : ∀op2.AND = op2 → eq_op AND op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##5: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop6 : ∀op2.ASL = op2 → eq_op ASL op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##6: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop7 : ∀op2.ASR = op2 → eq_op ASR op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##7: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop8 : ∀op2.BCC = op2 → eq_op BCC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##8: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop9 : ∀op2.BCLRn = op2 → eq_op BCLRn op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##9: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop10 : ∀op2.BCS = op2 → eq_op BCS op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##10: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop11 : ∀op2.BEQ = op2 → eq_op BEQ op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##11: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop12 : ∀op2.BGE = op2 → eq_op BGE op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##12: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop13 : ∀op2.BGND = op2 → eq_op BGND op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##13: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop14 : ∀op2.BGT = op2 → eq_op BGT op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##14: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop15 : ∀op2.BHCC = op2 → eq_op BHCC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##15: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop16 : ∀op2.BHCS = op2 → eq_op BHCS op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##16: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop17 : ∀op2.BHI = op2 → eq_op BHI op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##17: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop18 : ∀op2.BIH = op2 → eq_op BIH op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##18: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop19 : ∀op2.BIL = op2 → eq_op BIL op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##19: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop20 : ∀op2.BIT = op2 → eq_op BIT op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##20: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop21 : ∀op2.BLE = op2 → eq_op BLE op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##21: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop22 : ∀op2.BLS = op2 → eq_op BLS op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##22: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop23 : ∀op2.BLT = op2 → eq_op BLT op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##23: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop24 : ∀op2.BMC = op2 → eq_op BMC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##24: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop25 : ∀op2.BMI = op2 → eq_op BMI op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##25: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop26 : ∀op2.BMS = op2 → eq_op BMS op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##26: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop27 : ∀op2.BNE = op2 → eq_op BNE op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##27: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop28 : ∀op2.BPL = op2 → eq_op BPL op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##28: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop29 : ∀op2.BRA = op2 → eq_op BRA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##29: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop30 : ∀op2.BRCLRn = op2 → eq_op BRCLRn op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##30: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop31 : ∀op2.BRN = op2 → eq_op BRN op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##31: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop32 : ∀op2.BRSETn = op2 → eq_op BRSETn op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##32: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop33 : ∀op2.BSETn = op2 → eq_op BSETn op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##33: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop34 : ∀op2.BSR = op2 → eq_op BSR op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##34: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop35 : ∀op2.CBEQA = op2 → eq_op CBEQA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##35: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop36 : ∀op2.CBEQX = op2 → eq_op CBEQX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##36: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop37 : ∀op2.CLC = op2 → eq_op CLC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##37: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop38 : ∀op2.CLI = op2 → eq_op CLI op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##38: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop39 : ∀op2.CLR = op2 → eq_op CLR op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##39: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop40 : ∀op2.CMP = op2 → eq_op CMP op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##40: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop41 : ∀op2.COM = op2 → eq_op COM op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##41: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop42 : ∀op2.CPHX = op2 → eq_op CPHX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##42: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop43 : ∀op2.CPX = op2 → eq_op CPX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##43: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop44 : ∀op2.DAA = op2 → eq_op DAA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##44: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop45 : ∀op2.DBNZ = op2 → eq_op DBNZ op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##45: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop46 : ∀op2.DEC = op2 → eq_op DEC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##46: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop47 : ∀op2.DIV = op2 → eq_op DIV op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##47: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop48 : ∀op2.EOR = op2 → eq_op EOR op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##48: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop49 : ∀op2.INC = op2 → eq_op INC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##49: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop50 : ∀op2.JMP = op2 → eq_op JMP op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##50: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop51 : ∀op2.JSR = op2 → eq_op JSR op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##51: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop52 : ∀op2.LDA = op2 → eq_op LDA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##52: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop53 : ∀op2.LDHX = op2 → eq_op LDHX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##53: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop54 : ∀op2.LDX = op2 → eq_op LDX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##54: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop55 : ∀op2.LSR = op2 → eq_op LSR op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##55: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop56 : ∀op2.MOV = op2 → eq_op MOV op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##56: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop57 : ∀op2.MUL = op2 → eq_op MUL op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##57: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop58 : ∀op2.NEG = op2 → eq_op NEG op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##58: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop59 : ∀op2.NOP = op2 → eq_op NOP op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##59: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop60 : ∀op2.NSA = op2 → eq_op NSA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##60: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop61 : ∀op2.ORA = op2 → eq_op ORA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##61: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop62 : ∀op2.PSHA = op2 → eq_op PSHA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##62: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop63 : ∀op2.PSHH = op2 → eq_op PSHH op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##63: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop64 : ∀op2.PSHX = op2 → eq_op PSHX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##64: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop65 : ∀op2.PULA = op2 → eq_op PULA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##65: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop66 : ∀op2.PULH = op2 → eq_op PULH op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##66: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop67 : ∀op2.PULX = op2 → eq_op PULX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##67: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop68 : ∀op2.ROL = op2 → eq_op ROL op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##68: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop69 : ∀op2.ROR = op2 → eq_op ROR op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##69: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop70 : ∀op2.RSP = op2 → eq_op RSP op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##70: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop71 : ∀op2.RTI = op2 → eq_op RTI op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##71: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop72 : ∀op2.RTS = op2 → eq_op RTS op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##72: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop73 : ∀op2.SBC = op2 → eq_op SBC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##73: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop74 : ∀op2.SEC = op2 → eq_op SEC op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##74: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop75 : ∀op2.SEI = op2 → eq_op SEI op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##75: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop76 : ∀op2.SHA = op2 → eq_op SHA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##76: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop77 : ∀op2.SLA = op2 → eq_op SLA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##77: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop78 : ∀op2.STA = op2 → eq_op STA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##78: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop79 : ∀op2.STHX = op2 → eq_op STHX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##79: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop80 : ∀op2.STOP = op2 → eq_op STOP op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##80: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop81 : ∀op2.STX = op2 → eq_op STX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##81: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop82 : ∀op2.SUB = op2 → eq_op SUB op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##82: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop83 : ∀op2.SWI = op2 → eq_op SWI op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##83: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop84 : ∀op2.TAP = op2 → eq_op TAP op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##84: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop85 : ∀op2.TAX = op2 → eq_op TAX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##85: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop86 : ∀op2.TPA = op2 → eq_op TPA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##86: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop87 : ∀op2.TST = op2 → eq_op TST op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##87: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop88 : ∀op2.TSX = op2 → eq_op TSX op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##88: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop89 : ∀op2.TXA = op2 → eq_op TXA op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##89: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop90 : ∀op2.TXS = op2 → eq_op TXS op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##90: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. +nlemma eq_to_eqop91 : ∀op2.WAIT = op2 → eq_op WAIT op2 = true. #op2; ncases op2; nnormalize; #H; ##[ ##91: napply refl_eq ##| ##*: napply (opcode_destruct … (false = true) H) ##]nqed. + +nlemma eq_to_eqop : ∀op1,op2.op1 = op2 → eq_op op1 op2 = true. + #op1; ncases op1; + ##[ ##1: napply eq_to_eqop1 ##| ##2: napply eq_to_eqop2 ##| ##3: napply eq_to_eqop3 ##| ##4: napply eq_to_eqop4 + ##| ##5: napply eq_to_eqop5 ##| ##6: napply eq_to_eqop6 ##| ##7: napply eq_to_eqop7 ##| ##8: napply eq_to_eqop8 + ##| ##9: napply eq_to_eqop9 ##| ##10: napply eq_to_eqop10 ##| ##11: napply eq_to_eqop11 ##| ##12: napply eq_to_eqop12 + ##| ##13: napply eq_to_eqop13 ##| ##14: napply eq_to_eqop14 ##| ##15: napply eq_to_eqop15 ##| ##16: napply eq_to_eqop16 + ##| ##17: napply eq_to_eqop17 ##| ##18: napply eq_to_eqop18 ##| ##19: napply eq_to_eqop19 ##| ##20: napply eq_to_eqop20 + ##| ##21: napply eq_to_eqop21 ##| ##22: napply eq_to_eqop22 ##| ##23: napply eq_to_eqop23 ##| ##24: napply eq_to_eqop24 + ##| ##25: napply eq_to_eqop25 ##| ##26: napply eq_to_eqop26 ##| ##27: napply eq_to_eqop27 ##| ##28: napply eq_to_eqop28 + ##| ##29: napply eq_to_eqop29 ##| ##30: napply eq_to_eqop30 ##| ##31: napply eq_to_eqop31 ##| ##32: napply eq_to_eqop32 + ##| ##33: napply eq_to_eqop33 ##| ##34: napply eq_to_eqop34 ##| ##35: napply eq_to_eqop35 ##| ##36: napply eq_to_eqop36 + ##| ##37: napply eq_to_eqop37 ##| ##38: napply eq_to_eqop38 ##| ##39: napply eq_to_eqop39 ##| ##40: napply eq_to_eqop40 + ##| ##41: napply eq_to_eqop41 ##| ##42: napply eq_to_eqop42 ##| ##43: napply eq_to_eqop43 ##| ##44: napply eq_to_eqop44 + ##| ##45: napply eq_to_eqop45 ##| ##46: napply eq_to_eqop46 ##| ##47: napply eq_to_eqop47 ##| ##48: napply eq_to_eqop48 + ##| ##49: napply eq_to_eqop49 ##| ##50: napply eq_to_eqop50 ##| ##51: napply eq_to_eqop51 ##| ##52: napply eq_to_eqop52 + ##| ##53: napply eq_to_eqop53 ##| ##54: napply eq_to_eqop54 ##| ##55: napply eq_to_eqop55 ##| ##56: napply eq_to_eqop56 + ##| ##57: napply eq_to_eqop57 ##| ##58: napply eq_to_eqop58 ##| ##59: napply eq_to_eqop59 ##| ##60: napply eq_to_eqop60 + ##| ##61: napply eq_to_eqop61 ##| ##62: napply eq_to_eqop62 ##| ##63: napply eq_to_eqop63 ##| ##64: napply eq_to_eqop64 + ##| ##65: napply eq_to_eqop65 ##| ##66: napply eq_to_eqop66 ##| ##67: napply eq_to_eqop67 ##| ##68: napply eq_to_eqop68 + ##| ##69: napply eq_to_eqop69 ##| ##70: napply eq_to_eqop70 ##| ##71: napply eq_to_eqop71 ##| ##72: napply eq_to_eqop72 + ##| ##73: napply eq_to_eqop73 ##| ##74: napply eq_to_eqop74 ##| ##75: napply eq_to_eqop75 ##| ##76: napply eq_to_eqop76 + ##| ##77: napply eq_to_eqop77 ##| ##78: napply eq_to_eqop78 ##| ##79: napply eq_to_eqop79 ##| ##80: napply eq_to_eqop80 + ##| ##81: napply eq_to_eqop81 ##| ##82: napply eq_to_eqop82 ##| ##83: napply eq_to_eqop83 ##| ##84: napply eq_to_eqop84 + ##| ##85: napply eq_to_eqop85 ##| ##86: napply eq_to_eqop86 ##| ##87: napply eq_to_eqop87 ##| ##88: napply eq_to_eqop88 + ##| ##89: napply eq_to_eqop89 ##| ##90: napply eq_to_eqop90 ##| ##91: napply eq_to_eqop91 ##] +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/status.ma b/helm/software/matita/contribs/ng_assembly/freescale/status.ma new file mode 100755 index 000000000..7f56fe8a9 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/status.ma @@ -0,0 +1,1275 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/memory_abs.ma". +include "freescale/opcode_base.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). + +(* ALU dell'HC08/HCS08 *) +nrecord alu_HC08: Type ≝ + { + (* A: registo accumulatore *) + acc_low_reg_HC08 : byte8; + (* X: registro indice parte bassa *) + indX_low_reg_HC08 : byte8; + (* H: registro indice parte alta *) + indX_high_reg_HC08 : byte8; + (* SP: registo stack pointer *) + sp_reg_HC08 : word16; + (* PC: registro program counter *) + pc_reg_HC08 : word16; + + (* V: flag overflow *) + v_flag_HC08 : bool; + (* H: flag semi-carry (somma nibble basso) *) + h_flag_HC08 : bool; + (* I: flag mascheramento degli interrupt mascherabili: 1=mascherati *) + i_flag_HC08 : bool; + (* N: flag segno/negativita' *) + n_flag_HC08 : bool; + (* Z: flag zero *) + z_flag_HC08 : bool; + (* C: flag carry *) + c_flag_HC08 : bool; + + (* IRQ: flag che simula il pin esterno IRQ *) + irq_flag_HC08 : bool + }. + +notation "{hvbox('A_Reg' ≝ acclow ; break 'X_Reg' ≝ indxlow ; break 'H_Reg' ≝ indxhigh ; break 'Sp_Reg' ≝ sp ; break 'Pc_Reg' ≝ pc ; break 'V_Flag' ≝ vfl ; 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_HC08 $acclow $indxlow $indxhigh $sp $pc $vfl $hfl $ifl $nfl $zfl $cfl $irqfl }. +interpretation "mk_alu_HC08" 'mk_alu_HC08 acclow indxlow indxhigh sp pc vfl hfl ifl nfl zfl cfl irqfl = + (mk_alu_HC08 acclow indxlow indxhigh sp pc vfl hfl ifl nfl zfl cfl irqfl). + +(* ALU dell'RS08 *) +nrecord alu_RS08: Type ≝ + { + (* A: registo accumulatore *) + acc_low_reg_RS08 : byte8; + (* PC: registro program counter *) + pc_reg_RS08 : 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_RS08 : word16; + (* SPC: registro shadow program counter *) + (* NB: il suo modificatore e' lo stesso di PC *) + spc_reg_RS08 : word16; + + (* X: registro indice parte bassa *) + (* NB: in realta' e' mappato in memoria e non risiede nella ALU *) + (* la lettura/scrittura avviene tramite la locazione [0x000F] *) + (* la funzione memory_filter_read/write si occupera' di intercettare *) + (* e deviare sul registro le letture/scritture (modulo load_write) *) + x_map_RS08 : byte8; + (* PS: registro selezione di pagina *) + (* serve a indirizzare la finestra RAM di 64b [0x00C0-0x00FF] *) + (* su tutta la memoria installata [0x0000-0x3FFF]: [00pp pppp ppxx xxxx] *) + (* NB: in realta' e' mappato in memoria e non risiede nella ALU *) + (* la lettura/scrittura avviene tramite la locazione [0x001F] *) + (* la funzione memory_filter_read/write si occupera' di intercettare *) + (* e deviare sul registro le letture/scritture (modulo load_write) *) + ps_map_RS08 : byte8; + + (* Z: flag zero *) + z_flag_RS08 : bool; + (* C: flag carry *) + c_flag_RS08 : bool + }. + +notation "{hvbox('A_Reg' ≝ acclow ; break 'Pc_Reg' ≝ pc ; break 'Pc_Mask' ≝ pcm ; break 'Spc_Reg' ≝ spc ; break 'X_Map' ≝ xm ; break 'Ps_Map' ≝ psm ; break 'Z_Flag' ≝ zfl ; break 'C_Flag' ≝ cfl)}" + non associative with precedence 80 for + @{ 'mk_alu_RS08 $acclow $pc $pcm $spc $xm $psm $zfl $cfl }. +interpretation "mk_alu_RS08" 'mk_alu_RS08 acclow pc pcm spc xm psm zfl cfl = + (mk_alu_RS08 acclow pc pcm spc xm psm zfl cfl). + +(* tipo processore dipendente dalla mcu, varia solo la ALU *) +nrecord any_status (mcu:mcu_type) (t:memory_impl): Type ≝ + { + alu : match mcu with + [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ]; + + (* descritore della memoria *) + mem_desc : aux_mem_type t; + (* descrittore del tipo di memoria installata *) + chk_desc : aux_chk_type t; + (* descrittore del click = stato di avanzamento dell'esecuzione+cur_pc conseguente a fetch *) + (* 1) None = istruzione eseguita, attesa del fetch *) + (* 2) Some cur_clk,pseudo,mode,clks,cur_pc = fetch eseguito, countup a esecuzione *) + clk_desc : option (Prod5T byte8 (any_opcode mcu) (instr_mode) byte8 word16) + }. + +(* evitare di mostrare la memoria/descrittore che impalla il visualizzatore *) +notation > "{hvbox('Alu' ≝ alu ; break 'Clk' ≝ clk)}" non associative with precedence 80 + for @{ 'mk_any_status $alu $mem $chk $clk }. +interpretation "mk_any_status" 'mk_any_status alu mem chk clk = + (mk_any_status alu mem chk clk). + +(* **************** *) +(* GETTER SPECIFICI *) +(* **************** *) + +(* funzione ausiliaria per il tipaggio dei getter *) +ndefinition aux_get_typing ≝ λx:Type.λm:mcu_type.match m with + [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] → x. + +(* REGISTRI *) + +(* getter di A, esiste sempre *) +ndefinition get_acc_8_low_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing byte8 with + [ HC05 ⇒ acc_low_reg_HC05 + | HC08 ⇒ acc_low_reg_HC08 + | HCS08 ⇒ acc_low_reg_HC08 + | RS08 ⇒ acc_low_reg_RS08 ] + (alu m t s). + +(* getter di X, non esiste sempre *) +ndefinition get_indX_8_low_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option byte8) with + [ HC05 ⇒ λalu.Some ? (indX_low_reg_HC05 alu) + | HC08 ⇒ λalu.Some ? (indX_low_reg_HC08 alu) + | HCS08 ⇒ λalu.Some ? (indX_low_reg_HC08 alu) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* getter di H, non esiste sempre *) +ndefinition get_indX_8_high_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option byte8) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.Some ? (indX_high_reg_HC08 alu) + | HCS08 ⇒ λalu.Some ? (indX_high_reg_HC08 alu) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* getter di H:X, non esiste sempre *) +ndefinition get_indX_16_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option word16) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.Some ? (mk_word16 (indX_high_reg_HC08 alu) (indX_low_reg_HC08 alu)) + | HCS08 ⇒ λalu.Some ? (mk_word16 (indX_high_reg_HC08 alu) (indX_low_reg_HC08 alu)) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* getter di SP, non esiste sempre *) +ndefinition get_sp_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option word16) with + [ HC05 ⇒ λalu.Some ? (sp_reg_HC05 alu) + | HC08 ⇒ λalu.Some ? (sp_reg_HC08 alu) + | HCS08 ⇒ λalu.Some ? (sp_reg_HC08 alu) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* getter di PC, esiste sempre *) +ndefinition get_pc_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing word16 with + [ HC05 ⇒ pc_reg_HC05 + | HC08 ⇒ pc_reg_HC08 + | HCS08 ⇒ pc_reg_HC08 + | RS08 ⇒ pc_reg_RS08 ] + (alu m t s). + +(* getter di SPC, non esiste sempre *) +ndefinition get_spc_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option word16) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.Some ? (spc_reg_RS08 alu) ] + (alu m t s). + +(* REGISTRI MEMORY MAPPED *) + +(* getter di memory mapped X, non esiste sempre *) +ndefinition get_x_map ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option byte8) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.Some ? (x_map_RS08 alu) ] + (alu m t s). + +(* getter di memory mapped PS, non esiste sempre *) +ndefinition get_ps_map ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option byte8) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.Some ? (ps_map_RS08 alu) ] + (alu m t s). + +(* FLAG *) + +(* getter di V, non esiste sempre *) +ndefinition get_v_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option bool) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.Some ? (v_flag_HC08 alu) + | HCS08 ⇒ λalu.Some ? (v_flag_HC08 alu) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* getter di H, non esiste sempre *) +ndefinition get_h_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option bool) with + [ HC05 ⇒ λalu.Some ? (h_flag_HC05 alu) + | HC08 ⇒ λalu.Some ? (h_flag_HC08 alu) + | HCS08 ⇒ λalu.Some ? (h_flag_HC08 alu) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* getter di I, non esiste sempre *) +ndefinition get_i_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option bool) with + [ HC05 ⇒ λalu.Some ? (i_flag_HC05 alu) + | HC08 ⇒ λalu.Some ? (i_flag_HC08 alu) + | HCS08 ⇒ λalu.Some ? (i_flag_HC08 alu) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* getter di N, non esiste sempre *) +ndefinition get_n_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option bool) with + [ HC05 ⇒ λalu.Some ? (n_flag_HC05 alu) + | HC08 ⇒ λalu.Some ? (n_flag_HC08 alu) + | HCS08 ⇒ λalu.Some ? (n_flag_HC08 alu) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* getter di Z, esiste sempre *) +ndefinition get_z_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing bool with + [ HC05 ⇒ z_flag_HC05 + | HC08 ⇒ z_flag_HC08 + | HCS08 ⇒ z_flag_HC08 + | RS08 ⇒ z_flag_RS08 ] + (alu m t s). + +(* getter di C, esiste sempre *) +ndefinition get_c_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing bool with + [ HC05 ⇒ c_flag_HC05 + | HC08 ⇒ c_flag_HC08 + | HCS08 ⇒ c_flag_HC08 + | RS08 ⇒ c_flag_RS08 ] + (alu m t s). + +(* getter di IRQ, non esiste sempre *) +ndefinition get_irq_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_typing (option bool) with + [ HC05 ⇒ λalu.Some ? (irq_flag_HC05 alu) + | HC08 ⇒ λalu.Some ? (irq_flag_HC08 alu) + | HCS08 ⇒ λalu.Some ? (irq_flag_HC08 alu) + | RS08 ⇒ λalu.None ? ] + (alu m t s). + +(* ***************************** *) +(* SETTER SPECIFICI FORTI/DEBOLI *) +(* ***************************** *) + +(* funzione ausiliaria per il tipaggio dei setter forti *) +ndefinition aux_set_typing ≝ λx:Type.λm:mcu_type. + match m with [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] + → x → + match m with [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ]. + +(* funzione ausiliaria per il tipaggio dei setter deboli *) +ndefinition aux_set_typing_opt ≝ λx:Type.λm:mcu_type.option + (match m with [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] + → x → + match m with [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ]). + +(* DESCRITTORI ESTERNI ALLA ALU *) + +(* setter forte della ALU *) +ndefinition set_alu ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λalu'. + mk_any_status m t alu' (mem_desc m t s) (chk_desc m t s) (clk_desc m t s). + +(* setter forte della memoria *) +ndefinition set_mem_desc ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λmem':aux_mem_type t. + mk_any_status m t (alu m t s) mem' (chk_desc m t s) (clk_desc m t s). + +(* setter forte del descrittore *) +ndefinition set_chk_desc ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λchk':aux_chk_type t. + mk_any_status m t (alu m t s) (mem_desc m t s) chk' (clk_desc m t s). + +(* setter forte del clik *) +ndefinition set_clk_desc ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. +λclk':option (Prod5T byte8 (any_opcode m) (instr_mode) byte8 word16). + mk_any_status m t (alu m t s) (mem_desc m t s) (chk_desc m t s) clk'. + +(* REGISTRO A *) + +(* setter specifico HC05 di A *) +ndefinition set_acc_8_low_reg_HC05 ≝ +λalu.λacclow':byte8. + mk_alu_HC05 + acclow' + (indX_low_reg_HC05 alu) + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + (i_flag_HC05 alu) + (n_flag_HC05 alu) + (z_flag_HC05 alu) + (c_flag_HC05 alu) + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di A *) +ndefinition set_acc_8_low_reg_HC08 ≝ +λalu.λacclow':byte8. + mk_alu_HC08 + acclow' + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter specifico RS08 di A *) +ndefinition set_acc_8_low_reg_RS08 ≝ +λalu.λacclow':byte8. + mk_alu_RS08 + acclow' + (pc_reg_RS08 alu) + (pc_mask_RS08 alu) + (spc_reg_RS08 alu) + (x_map_RS08 alu) + (ps_map_RS08 alu) + (z_flag_RS08 alu) + (c_flag_RS08 alu). + +(* setter forte di A *) +ndefinition set_acc_8_low_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λacclow':byte8. + set_alu m t s + (match m return aux_set_typing byte8 with + [ HC05 ⇒ set_acc_8_low_reg_HC05 + | HC08 ⇒ set_acc_8_low_reg_HC08 + | HCS08 ⇒ set_acc_8_low_reg_HC08 + | RS08 ⇒ set_acc_8_low_reg_RS08 + ] (alu m t s) acclow'). + +(* REGISTRO X *) + +(* setter specifico HC05 di X *) +ndefinition set_indX_8_low_reg_HC05 ≝ +λalu.λindxlow':byte8. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + indxlow' + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + (i_flag_HC05 alu) + (n_flag_HC05 alu) + (z_flag_HC05 alu) + (c_flag_HC05 alu) + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di X *) +ndefinition set_indX_8_low_reg_HC08 ≝ +λalu.λindxlow':byte8. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + indxlow' + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter forte di X *) +ndefinition set_indX_8_low_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λindxlow':byte8. + opt_map … (match m return aux_set_typing_opt byte8 with + [ HC05 ⇒ Some ? set_indX_8_low_reg_HC05 + | HC08 ⇒ Some ? set_indX_8_low_reg_HC08 + | HCS08 ⇒ Some ? set_indX_8_low_reg_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) indxlow'))). + +(* setter debole di X *) +ndefinition setweak_indX_8_low_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λindxlow':byte8. + match set_indX_8_low_reg m t s indxlow' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO H *) + +(* setter specifico HC08/HCS08 di H *) +ndefinition set_indX_8_high_reg_HC08 ≝ +λalu.λindxhigh':byte8. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + indxhigh' + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter forte di H *) +ndefinition set_indX_8_high_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λindxhigh':byte8. + opt_map … (match m return aux_set_typing_opt byte8 with + [ HC05 ⇒ None ? + | HC08 ⇒ Some ? set_indX_8_high_reg_HC08 + | HCS08 ⇒ Some ? set_indX_8_high_reg_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) indxhigh'))). + +(* setter debole di H *) +ndefinition setweak_indX_8_high_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λindxhigh':byte8. + match set_indX_8_high_reg m t s indxhigh' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO H:X *) + +(* setter specifico HC08/HCS08 di H:X *) +ndefinition set_indX_16_reg_HC08 ≝ +λalu.λindx16:word16. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (w16l indx16) + (w16h indx16) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter forte di H:X *) +ndefinition set_indX_16_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λindx16:word16. + opt_map … (match m return aux_set_typing_opt word16 with + [ HC05 ⇒ None ? + | HC08 ⇒ Some ? set_indX_16_reg_HC08 + | HCS08 ⇒ Some ? set_indX_16_reg_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) indx16))). + +(* setter debole di H:X *) +ndefinition setweak_indX_16_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λindx16:word16. + match set_indX_16_reg m t s indx16 with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO SP *) + +(* setter specifico HC05 di SP, effettua (SP∧mask)∨fix *) +ndefinition set_sp_reg_HC05 ≝ +λalu.λsp':word16. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + (indX_low_reg_HC05 alu) + (or_w16 (and_w16 sp' (sp_mask_HC05 alu)) (sp_fix_HC05 alu)) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + (i_flag_HC05 alu) + (n_flag_HC05 alu) + (z_flag_HC05 alu) + (c_flag_HC05 alu) + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di SP *) +ndefinition set_sp_reg_HC08 ≝ +λalu.λsp':word16. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + sp' + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter forte di SP *) +ndefinition set_sp_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λsp':word16. + opt_map … (match m return aux_set_typing_opt word16 with + [ HC05 ⇒ Some ? set_sp_reg_HC05 + | HC08 ⇒ Some ? set_sp_reg_HC08 + | HCS08 ⇒ Some ? set_sp_reg_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) sp'))). + +(* setter debole di SP *) +ndefinition setweak_sp_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λsp':word16. + match set_sp_reg m t s sp' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO PC *) + +(* setter specifico HC05 di PC, effettua PC∧mask *) +ndefinition set_pc_reg_HC05 ≝ +λalu.λpc':word16. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + (indX_low_reg_HC05 alu) + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (and_w16 pc' (pc_mask_HC05 alu)) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + (i_flag_HC05 alu) + (n_flag_HC05 alu) + (z_flag_HC05 alu) + (c_flag_HC05 alu) + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di PC *) +ndefinition set_pc_reg_HC08 ≝ +λalu.λpc':word16. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + pc' + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter specifico RS08 di PC, effettua PC∧mask *) +ndefinition set_pc_reg_RS08 ≝ +λalu.λpc':word16. + mk_alu_RS08 + (acc_low_reg_RS08 alu) + (and_w16 pc' (pc_mask_RS08 alu)) + (pc_mask_RS08 alu) + (spc_reg_RS08 alu) + (x_map_RS08 alu) + (ps_map_RS08 alu) + (z_flag_RS08 alu) + (c_flag_RS08 alu). + +(* setter forte di PC *) +ndefinition set_pc_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λpc':word16. + set_alu m t s + (match m return aux_set_typing word16 with + [ HC05 ⇒ set_pc_reg_HC05 + | HC08 ⇒ set_pc_reg_HC08 + | HCS08 ⇒ set_pc_reg_HC08 + | RS08 ⇒ set_pc_reg_RS08 + ] (alu m t s) pc'). + +(* REGISTRO SPC *) + +(* setter specifico RS08 di SPC, effettua SPC∧mask *) +ndefinition set_spc_reg_RS08 ≝ +λalu.λspc':word16. + mk_alu_RS08 + (acc_low_reg_RS08 alu) + (pc_reg_RS08 alu) + (pc_mask_RS08 alu) + (and_w16 spc' (pc_mask_RS08 alu)) + (x_map_RS08 alu) + (ps_map_RS08 alu) + (z_flag_RS08 alu) + (c_flag_RS08 alu). + +(* setter forte di SPC *) +ndefinition set_spc_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λspc':word16. + opt_map … (match m return aux_set_typing_opt word16 with + [ HC05 ⇒ None ? + | HC08 ⇒ None ? + | HCS08 ⇒ None ? + | RS08 ⇒ Some ? set_spc_reg_RS08 ]) + (λf.Some ? (set_alu m t s (f (alu m t s) spc'))). + +(* setter debole di SPC *) +ndefinition setweak_spc_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λspc':word16. + match set_spc_reg m t s spc' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO MEMORY MAPPED X *) + +(* setter specifico RS08 di memory mapped X *) +ndefinition set_x_map_RS08 ≝ +λalu.λxm':byte8. + mk_alu_RS08 + (acc_low_reg_RS08 alu) + (pc_reg_RS08 alu) + (pc_mask_RS08 alu) + (spc_reg_RS08 alu) + xm' + (ps_map_RS08 alu) + (z_flag_RS08 alu) + (c_flag_RS08 alu). + +(* setter forte di memory mapped X *) +ndefinition set_x_map ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λxm':byte8. + opt_map … (match m return aux_set_typing_opt byte8 with + [ HC05 ⇒ None ? + | HC08 ⇒ None ? + | HCS08 ⇒ None ? + | RS08 ⇒ Some ? set_x_map_RS08 ]) + (λf.Some ? (set_alu m t s (f (alu m t s) xm'))). + +(* setter debole di memory mapped X *) +ndefinition setweak_x_map ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λxm':byte8. + match set_x_map m t s xm' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO MEMORY MAPPED PS *) + +(* setter specifico RS08 di memory mapped PS *) +ndefinition set_ps_map_RS08 ≝ +λalu.λpsm':byte8. + mk_alu_RS08 + (acc_low_reg_RS08 alu) + (pc_reg_RS08 alu) + (pc_mask_RS08 alu) + (spc_reg_RS08 alu) + (x_map_RS08 alu) + psm' + (z_flag_RS08 alu) + (c_flag_RS08 alu). + +(* setter forte di memory mapped PS *) +ndefinition set_ps_map ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λpsm':byte8. + opt_map … (match m return aux_set_typing_opt byte8 with + [ HC05 ⇒ None ? + | HC08 ⇒ None ? + | HCS08 ⇒ None ? + | RS08 ⇒ Some ? set_ps_map_RS08 ]) + (λf.Some ? (set_alu m t s (f (alu m t s) psm'))). + +(* setter debole di memory mapped PS *) +ndefinition setweak_ps_map ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λpsm':byte8. + match set_ps_map m t s psm' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG V *) + +(* setter specifico HC08/HCS08 di V *) +ndefinition set_v_flag_HC08 ≝ +λalu.λvfl':bool. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + vfl' + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter forte di V *) +ndefinition set_v_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λvfl':bool. + opt_map … (match m return aux_set_typing_opt bool with + [ HC05 ⇒ None ? + | HC08 ⇒ Some ? set_v_flag_HC08 + | HCS08 ⇒ Some ? set_v_flag_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) vfl'))). + +(* setter debole di V *) +ndefinition setweak_v_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λvfl':bool. + match set_v_flag m t s vfl' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG H *) + +(* setter specifico HC05 di H *) +ndefinition set_h_flag_HC05 ≝ +λalu.λhfl':bool. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + (indX_low_reg_HC05 alu) + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + hfl' + (i_flag_HC05 alu) + (n_flag_HC05 alu) + (z_flag_HC05 alu) + (c_flag_HC05 alu) + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di H *) +ndefinition set_h_flag_HC08 ≝ +λalu.λhfl':bool. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + hfl' + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter forte di H *) +ndefinition set_h_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λhfl':bool. + opt_map … (match m return aux_set_typing_opt bool with + [ HC05 ⇒ Some ? set_h_flag_HC05 + | HC08 ⇒ Some ? set_h_flag_HC08 + | HCS08 ⇒ Some ? set_h_flag_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) hfl'))). + +(* setter debole di H *) +ndefinition setweak_h_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λhfl':bool. + match set_h_flag m t s hfl' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG I *) + +(* setter specifico HC05 di I *) +ndefinition set_i_flag_HC05 ≝ +λalu.λifl':bool. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + (indX_low_reg_HC05 alu) + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + ifl' + (n_flag_HC05 alu) + (z_flag_HC05 alu) + (c_flag_HC05 alu) + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di I *) +ndefinition set_i_flag_HC08 ≝ +λalu.λifl':bool. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + ifl' + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter forte di I *) +ndefinition set_i_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λifl':bool. + opt_map … (match m return aux_set_typing_opt bool with + [ HC05 ⇒ Some ? set_i_flag_HC05 + | HC08 ⇒ Some ? set_i_flag_HC08 + | HCS08 ⇒ Some ? set_i_flag_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) ifl'))). + +(* setter debole di I *) +ndefinition setweak_i_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λifl':bool. + match set_i_flag m t s ifl' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG N *) + +(* setter specifico HC05 di N *) +ndefinition set_n_flag_HC05 ≝ +λalu.λnfl':bool. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + (indX_low_reg_HC05 alu) + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + (i_flag_HC05 alu) + nfl' + (z_flag_HC05 alu) + (c_flag_HC05 alu) + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di N *) +ndefinition set_n_flag_HC08 ≝ +λalu.λnfl':bool. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + nfl' + (z_flag_HC08 alu) + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter forte di N *) +ndefinition set_n_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λnfl':bool. + opt_map … (match m return aux_set_typing_opt bool with + [ HC05 ⇒ Some ? set_n_flag_HC05 + | HC08 ⇒ Some ? set_n_flag_HC08 + | HCS08 ⇒ Some ? set_n_flag_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) nfl'))). + +(* setter debole di N *) +ndefinition setweak_n_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λnfl':bool. + match set_n_flag m t s nfl' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG Z *) + +(* setter specifico HC05 di Z *) +ndefinition set_z_flag_HC05 ≝ +λalu.λzfl':bool. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + (indX_low_reg_HC05 alu) + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + (i_flag_HC05 alu) + (n_flag_HC05 alu) + zfl' + (c_flag_HC05 alu) + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di Z *) +ndefinition set_z_flag_HC08 ≝ +λalu.λzfl':bool. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + zfl' + (c_flag_HC08 alu) + (irq_flag_HC08 alu). + +(* setter sprcifico RS08 di Z *) +ndefinition set_z_flag_RS08 ≝ +λalu.λzfl':bool. + mk_alu_RS08 + (acc_low_reg_RS08 alu) + (pc_reg_RS08 alu) + (pc_mask_RS08 alu) + (spc_reg_RS08 alu) + (x_map_RS08 alu) + (ps_map_RS08 alu) + zfl' + (c_flag_RS08 alu). + +(* setter forte di Z *) +ndefinition set_z_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λzfl':bool. + set_alu m t s + (match m return aux_set_typing bool with + [ HC05 ⇒ set_z_flag_HC05 + | HC08 ⇒ set_z_flag_HC08 + | HCS08 ⇒ set_z_flag_HC08 + | RS08 ⇒ set_z_flag_RS08 + ] (alu m t s) zfl'). + +(* FLAG C *) + +(* setter specifico HC05 di C *) +ndefinition set_c_flag_HC05 ≝ +λalu.λcfl':bool. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + (indX_low_reg_HC05 alu) + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + (i_flag_HC05 alu) + (n_flag_HC05 alu) + (z_flag_HC05 alu) + cfl' + (irq_flag_HC05 alu). + +(* setter specifico HC08/HCS08 di C *) +ndefinition set_c_flag_HC08 ≝ +λalu.λcfl':bool. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + cfl' + (irq_flag_HC08 alu). + +(* setter specifico RS08 di C *) +ndefinition set_c_flag_RS08 ≝ +λalu.λcfl':bool. + mk_alu_RS08 + (acc_low_reg_RS08 alu) + (pc_reg_RS08 alu) + (pc_mask_RS08 alu) + (spc_reg_RS08 alu) + (x_map_RS08 alu) + (ps_map_RS08 alu) + (z_flag_RS08 alu) + cfl'. + +(* setter forte di C *) +ndefinition set_c_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcfl':bool. + set_alu m t s + (match m return aux_set_typing bool with + [ HC05 ⇒ set_c_flag_HC05 + | HC08 ⇒ set_c_flag_HC08 + | HCS08 ⇒ set_c_flag_HC08 + | RS08 ⇒ set_c_flag_RS08 + ] (alu m t s) cfl'). + +(* FLAG IRQ *) + +(* setter specifico HC05 di IRQ *) +ndefinition set_irq_flag_HC05 ≝ +λalu.λirqfl':bool. + mk_alu_HC05 + (acc_low_reg_HC05 alu) + (indX_low_reg_HC05 alu) + (sp_reg_HC05 alu) + (sp_mask_HC05 alu) + (sp_fix_HC05 alu) + (pc_reg_HC05 alu) + (pc_mask_HC05 alu) + (h_flag_HC05 alu) + (i_flag_HC05 alu) + (n_flag_HC05 alu) + (z_flag_HC05 alu) + (c_flag_HC05 alu) + irqfl'. + +(* setter specifico HC08/HCS08 di IRQ *) +ndefinition set_irq_flag_HC08 ≝ +λalu.λirqfl':bool. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (indX_low_reg_HC08 alu) + (indX_high_reg_HC08 alu) + (sp_reg_HC08 alu) + (pc_reg_HC08 alu) + (v_flag_HC08 alu) + (h_flag_HC08 alu) + (i_flag_HC08 alu) + (n_flag_HC08 alu) + (z_flag_HC08 alu) + (c_flag_HC08 alu) + irqfl'. + +(* setter forte di IRQ *) +ndefinition set_irq_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λirqfl':bool. + opt_map … (match m return aux_set_typing_opt bool with + [ HC05 ⇒ Some ? set_irq_flag_HC05 + | HC08 ⇒ Some ? set_irq_flag_HC08 + | HCS08 ⇒ Some ? set_irq_flag_HC08 + | RS08 ⇒ None ? ]) + (λf.Some ? (set_alu m t s (f (alu m t s) irqfl'))). + +(* setter debole di IRQ *) +ndefinition setweak_irq_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λirqfl':bool. + match set_irq_flag m t s irqfl' with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* ***************** *) +(* CONFRONTO FRA ALU *) +(* ***************** *) + +(* confronto registro per registro dell'HC05 *) +ndefinition eq_alu_HC05 ≝ +λalu1,alu2:alu_HC05. + match alu1 with + [ mk_alu_HC05 acclow1 indxlow1 sp1 spm1 spf1 pc1 pcm1 hfl1 ifl1 nfl1 zfl1 cfl1 irqfl1 ⇒ + match alu2 with + [ mk_alu_HC05 acclow2 indxlow2 sp2 spm2 spf2 pc2 pcm2 hfl2 ifl2 nfl2 zfl2 cfl2 irqfl2 ⇒ + (eq_b8 acclow1 acclow2) ⊗ + (eq_b8 indxlow1 indxlow2) ⊗ + (eq_w16 sp1 sp2) ⊗ + (eq_w16 spm1 spm2) ⊗ + (eq_w16 spf1 spf2) ⊗ + (eq_w16 pc1 pc2) ⊗ + (eq_w16 pcm1 pcm2) ⊗ + (eq_bool hfl1 hfl2) ⊗ + (eq_bool ifl1 ifl2) ⊗ + (eq_bool nfl1 nfl2) ⊗ + (eq_bool zfl1 zfl2) ⊗ + (eq_bool cfl1 cfl2) ⊗ + (eq_bool irqfl1 irqfl2) ]]. + +(* confronto registro per registro dell'HC08 *) +ndefinition eq_alu_HC08 ≝ +λalu1,alu2:alu_HC08. + match alu1 with + [ mk_alu_HC08 acclow1 indxlow1 indxhigh1 sp1 pc1 vfl1 hfl1 ifl1 nfl1 zfl1 cfl1 irqfl1 ⇒ + match alu2 with + [ mk_alu_HC08 acclow2 indxlow2 indxhigh2 sp2 pc2 vfl2 hfl2 ifl2 nfl2 zfl2 cfl2 irqfl2 ⇒ + (eq_b8 acclow1 acclow2) ⊗ + (eq_b8 indxlow1 indxlow2) ⊗ + (eq_b8 indxhigh1 indxhigh2) ⊗ + (eq_w16 sp1 sp2) ⊗ + (eq_w16 pc1 pc2) ⊗ + (eq_bool vfl1 vfl2) ⊗ + (eq_bool hfl1 hfl2) ⊗ + (eq_bool ifl1 ifl2) ⊗ + (eq_bool nfl1 nfl2) ⊗ + (eq_bool zfl1 zfl2) ⊗ + (eq_bool cfl1 cfl2) ⊗ + (eq_bool irqfl1 irqfl2) ]]. + +(* confronto registro per registro dell'RS08 *) +ndefinition eq_alu_RS08 ≝ +λalu1,alu2:alu_RS08. + match alu1 with + [ mk_alu_RS08 acclow1 pc1 pcm1 spc1 xm1 psm1 zfl1 cfl1 ⇒ + match alu2 with + [ mk_alu_RS08 acclow2 pc2 pcm2 spc2 xm2 psm2 zfl2 cfl2 ⇒ + (eq_b8 acclow1 acclow2) ⊗ + (eq_w16 pc1 pc2) ⊗ + (eq_w16 pcm1 pcm2) ⊗ + (eq_w16 spc1 spc2) ⊗ + (eq_b8 xm1 xm2) ⊗ + (eq_b8 psm1 psm2) ⊗ + (eq_bool zfl1 zfl2) ⊗ + (eq_bool cfl1 cfl2) ]]. + +(* ******************** *) +(* CONFRONTO FRA STATUS *) +(* ******************** *) + +(* confronto di una regione di memoria [addr1 ; ... ; addrn] *) +nlet rec forall_memory_ranged + (t:memory_impl) + (chk1:aux_chk_type t) (chk2:aux_chk_type t) + (mem1:aux_mem_type t) (mem2:aux_mem_type t) + (addrl:list word16) on addrl ≝ + match addrl return λ_.bool with + [ nil ⇒ true + | cons hd tl ⇒ (eq_option byte8 (mem_read t mem1 chk1 hd) + (mem_read t mem2 chk2 hd) eq_b8) ⊗ + (forall_memory_ranged t chk1 chk2 mem1 mem2 tl) + ]. + +(* il clk e' option (Prod5T byte8 (any_opcode m) (instr_mode) byte8 word16) *) +ndefinition eq_clk ≝ +λm:mcu_type.λc1,c2:option (Prod5T byte8 (any_opcode m) (instr_mode) byte8 word16). + match c1 with + [ None ⇒ match c2 with + [ None ⇒ true | Some _ ⇒ false ] + | Some c1' ⇒ match c2 with + [ None ⇒ false | Some c2' ⇒ (eq_b8 (fst5T … c1') (fst5T … c2')) ⊗ + (eq_anyop m (snd5T … c1') (snd5T … c2')) ⊗ + (eq_im (thd5T … c1') (thd5T … c2')) ⊗ + (eq_b8 (frth5T … c1') (frth5T … c2')) ⊗ + (eq_w16 (ffth5T … c1') (ffth5T … c2')) ] + ]. + +(* generalizzazione del confronto fra stati *) +ndefinition eq_status ≝ +λm:mcu_type.λt:memory_impl.λs1,s2:any_status m t.λaddrl:list word16. + match s1 with [ mk_any_status alu1 mem1 chk1 clk1 ⇒ + match s2 with [ mk_any_status alu2 mem2 chk2 clk2 ⇒ + + (* 1) confronto della ALU *) + (match m return λm:mcu_type. + match m with + [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] → + match m with + [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] → + bool with + [ HC05 ⇒ eq_alu_HC05 | HC08 ⇒ eq_alu_HC08 | HCS08 ⇒ eq_alu_HC08 | RS08 ⇒ eq_alu_RS08 ] + alu1 alu2) ⊗ + + (* 2) confronto della memoria in [inf,inf+n] *) + (forall_memory_ranged t chk1 chk2 mem1 mem2 addrl) ⊗ + + (* 3) confronto del clik *) + (eq_clk m clk1 clk2) + ]]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/table_HC05.ma b/helm/software/matita/contribs/ng_assembly/freescale/table_HC05.ma new file mode 100755 index 000000000..cc26940a9 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/table_HC05.ma @@ -0,0 +1,377 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/opcode_base.ma". +include "common/list.ma". + +(* ***************** *) +(* TABELLA DELL'HC05 *) +(* ***************** *) + +(* definizione come concatenazione finale di liste per velocizzare il parsing *) +(* ogni riga e' (any_opcode m) (instr_mode) (opcode esadecimale) (#cicli esecuzione) *) +(* NB: l'uso di any_opcode m + concatenazione finale tutte liste + impedisce di introdurre opcode disomogenei (per mcu) *) + +ndefinition opcode_table_HC05_1 ≝ +[ + quadruple … (anyOP HC05 ADC) MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 ADC) MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ADC) MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 ADC) MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 ADC) MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 ADC) MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC05_2 ≝ +[ + quadruple … (anyOP HC05 ADD) MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 ADD) MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ADD) MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 ADD) MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 ADD) MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 ADD) MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_3 ≝ +[ + quadruple … (anyOP HC05 AND) MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 AND) MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 AND) MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 AND) MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 AND) MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 AND) MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_4 ≝ +[ + quadruple … (anyOP HC05 ASL) MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 ASL) MODE_INHA (Byte 〈x4,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ASL) MODE_INHX (Byte 〈x5,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ASL) MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 ASL) MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_5 ≝ +[ + quadruple … (anyOP HC05 ASR) MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 ASR) MODE_INHA (Byte 〈x4,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ASR) MODE_INHX (Byte 〈x5,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ASR) MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 ASR) MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_6 ≝ +[ + quadruple … (anyOP HC05 BRA ) MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BRN ) MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BHI ) MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BLS ) MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BCC ) MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BCS ) MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BNE ) MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BEQ ) MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BHCC) MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BHCS) MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BPL ) MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BMI ) MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BMC ) MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BMS ) MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BIL ) MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BIH ) MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_7 ≝ +[ + quadruple … (anyOP HC05 BSETn) (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BCLRn) (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BSETn) (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BCLRn) (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BSETn) (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BCLRn) (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BSETn) (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BCLRn) (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BSETn) (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BCLRn) (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BSETn) (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BCLRn) (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BSETn) (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BCLRn) (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BSETn) (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BCLRn) (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_8 ≝ +[ + quadruple … (anyOP HC05 BRSETn) (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRCLRn) (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRSETn) (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRCLRn) (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRSETn) (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRCLRn) (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRSETn) (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRCLRn) (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRSETn) (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRCLRn) (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRSETn) (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRCLRn) (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRSETn) (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRCLRn) (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRSETn) (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BRCLRn) (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_9 ≝ +[ + quadruple … (anyOP HC05 BIT) MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 BIT) MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 BIT) MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 BIT) MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 BIT) MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 BIT) MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_10 ≝ +[ + quadruple … (anyOP HC05 MUL ) MODE_INH (Byte 〈x4,x2〉) 〈x0,xB〉 +; quadruple … (anyOP HC05 RTI ) MODE_INH (Byte 〈x8,x0〉) 〈x0,x9〉 +; quadruple … (anyOP HC05 RTS ) MODE_INH (Byte 〈x8,x1〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 SWI ) MODE_INH (Byte 〈x8,x3〉) 〈x0,xA〉 +; quadruple … (anyOP HC05 STOP) MODE_INH (Byte 〈x8,xE〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 WAIT) MODE_INH (Byte 〈x8,xF〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 TAX ) MODE_INH (Byte 〈x9,x7〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 CLC ) MODE_INH (Byte 〈x9,x8〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 SEC ) MODE_INH (Byte 〈x9,x9〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 CLI ) MODE_INH (Byte 〈x9,xA〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 SEI ) MODE_INH (Byte 〈x9,xB〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 RSP ) MODE_INH (Byte 〈x9,xC〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 NOP ) MODE_INH (Byte 〈x9,xD〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 TXA ) MODE_INH (Byte 〈x9,xF〉) 〈x0,x2〉 +]. + +ndefinition opcode_table_HC05_11 ≝ +[ + quadruple … (anyOP HC05 CLR) MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 CLR) MODE_INHA (Byte 〈x4,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 CLR) MODE_INHX (Byte 〈x5,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 CLR) MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 CLR) MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_12 ≝ +[ + quadruple … (anyOP HC05 CMP) MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 CMP) MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 CMP) MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 CMP) MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 CMP) MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 CMP) MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_13 ≝ +[ + quadruple … (anyOP HC05 COM) MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 COM) MODE_INHA (Byte 〈x4,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 COM) MODE_INHX (Byte 〈x5,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 COM) MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 COM) MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_14 ≝ +[ + quadruple … (anyOP HC05 CPX) MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 CPX) MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 CPX) MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 CPX) MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 CPX) MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 CPX) MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_15 ≝ +[ + quadruple … (anyOP HC05 DEC) MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 DEC) MODE_INHA (Byte 〈x4,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 DEC) MODE_INHX (Byte 〈x5,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 DEC) MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 DEC) MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_16 ≝ +[ + quadruple … (anyOP HC05 EOR) MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 EOR) MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 EOR) MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 EOR) MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 EOR) MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 EOR) MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_17 ≝ +[ + quadruple … (anyOP HC05 INC) MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 INC) MODE_INHA (Byte 〈x4,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 INC) MODE_INHX (Byte 〈x5,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 INC) MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 INC) MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_18 ≝ +[ + quadruple … (anyOP HC05 JMP) MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 JMP) MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 JMP) MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 JMP) MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 JMP) MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x2〉 +]. + +ndefinition opcode_table_HC05_19 ≝ +[ + quadruple … (anyOP HC05 BSR) MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 JSR) MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 JSR) MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 JSR) MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x7〉 +; quadruple … (anyOP HC05 JSR) MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 JSR) MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_20 ≝ +[ + quadruple … (anyOP HC05 LDA) MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 LDA) MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 LDA) MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 LDA) MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 LDA) MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 LDA) MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_21 ≝ +[ + quadruple … (anyOP HC05 LDX) MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 LDX) MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 LDX) MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 LDX) MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 LDX) MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 LDX) MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_22 ≝ +[ + quadruple … (anyOP HC05 LSR) MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 LSR) MODE_INHA (Byte 〈x4,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 LSR) MODE_INHX (Byte 〈x5,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 LSR) MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 LSR) MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_23 ≝ +[ + quadruple … (anyOP HC05 NEG) MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 NEG) MODE_INHA (Byte 〈x4,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 NEG) MODE_INHX (Byte 〈x5,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 NEG) MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 NEG) MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_24 ≝ +[ + quadruple … (anyOP HC05 ORA) MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 ORA) MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ORA) MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 ORA) MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 ORA) MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 ORA) MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_25 ≝ +[ + quadruple … (anyOP HC05 ROL) MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 ROL) MODE_INHA (Byte 〈x4,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ROL) MODE_INHX (Byte 〈x5,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ROL) MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 ROL) MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_26 ≝ +[ + quadruple … (anyOP HC05 ROR) MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 ROR) MODE_INHA (Byte 〈x4,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ROR) MODE_INHX (Byte 〈x5,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 ROR) MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 ROR) MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC05_27 ≝ +[ + quadruple … (anyOP HC05 SBC) MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 SBC) MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 SBC) MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 SBC) MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 SBC) MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 SBC) MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_28 ≝ +[ + quadruple … (anyOP HC05 STA) MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 STA) MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 STA) MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 STA) MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 STA) MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC05_29 ≝ +[ + quadruple … (anyOP HC05 STX) MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 STX) MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 STX) MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x6〉 +; quadruple … (anyOP HC05 STX) MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 STX) MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC05_30 ≝ +[ + quadruple … (anyOP HC05 SUB) MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 +; quadruple … (anyOP HC05 SUB) MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 SUB) MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 SUB) MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 SUB) MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 SUB) MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC05_31 ≝ +[ + quadruple … (anyOP HC05 TST) MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x4〉 +; quadruple … (anyOP HC05 TST) MODE_INHA (Byte 〈x4,xD〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 TST) MODE_INHX (Byte 〈x5,xD〉) 〈x0,x3〉 +; quadruple … (anyOP HC05 TST) MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HC05 TST) MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC05 ≝ + opcode_table_HC05_1 @ opcode_table_HC05_2 @ opcode_table_HC05_3 @ opcode_table_HC05_4 @ + opcode_table_HC05_5 @ opcode_table_HC05_6 @ opcode_table_HC05_7 @ opcode_table_HC05_8 @ + opcode_table_HC05_9 @ opcode_table_HC05_10 @ opcode_table_HC05_11 @ opcode_table_HC05_12 @ + opcode_table_HC05_13 @ opcode_table_HC05_14 @ opcode_table_HC05_15 @ opcode_table_HC05_16 @ + opcode_table_HC05_17 @ opcode_table_HC05_18 @ opcode_table_HC05_19 @ opcode_table_HC05_20 @ + opcode_table_HC05_21 @ opcode_table_HC05_22 @ opcode_table_HC05_23 @ opcode_table_HC05_24 @ + opcode_table_HC05_25 @ opcode_table_HC05_26 @ opcode_table_HC05_27 @ opcode_table_HC05_28 @ + opcode_table_HC05_29 @ opcode_table_HC05_30 @ opcode_table_HC05_31. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/table_HC05_tests.ma b/helm/software/matita/contribs/ng_assembly/freescale/table_HC05_tests.ma new file mode 100755 index 000000000..67d148dee --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/table_HC05_tests.ma @@ -0,0 +1,94 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/table_HC05.ma". +include "freescale/opcode.ma". + +(* ***************** *) +(* TABELLA DELL'HC05 *) +(* ***************** *) + +(* HC05: opcode non implementati come da manuale *) +ndefinition HC05_not_impl_byte ≝ + [〈x3,x1〉;〈x3,x2〉;〈x3,x5〉;〈x3,xB〉;〈x3,xE〉 + ;〈x4,x1〉;〈x4,x5〉;〈x4,xB〉;〈x4,xE〉 + ;〈x5,x1〉;〈x5,x2〉;〈x5,x5〉;〈x5,xB〉;〈x5,xE〉 + ;〈x6,x1〉;〈x6,x2〉;〈x6,x5〉;〈x6,xB〉;〈x6,xE〉 + ;〈x7,x1〉;〈x7,x2〉;〈x7,x5〉;〈x7,xB〉;〈x7,xE〉 + ;〈x8,x2〉;〈x8,x4〉;〈x8,x5〉;〈x8,x6〉;〈x8,x7〉;〈x8,x8〉;〈x8,x9〉;〈x8,xA〉;〈x8,xB〉;〈x8,xC〉;〈x8,xD〉 + ;〈x9,x0〉;〈x9,x1〉;〈x9,x2〉;〈x9,x3〉;〈x9,x4〉;〈x9,x5〉;〈x9,x6〉;〈x9,xE〉 + ;〈xA,x7〉;〈xA,xC〉;〈xA,xF〉 + ]. + +nlemma ok_byte_table_HC05 : forall_b8 (λb. + (test_not_impl_byte b HC05_not_impl_byte ⊙ eq_w16 (get_byte_count HC05 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b HC05_not_impl_byte) ⊙ eq_w16 (get_byte_count HC05 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC05: pseudocodici non implementati come da manuale *) +ndefinition HC05_not_impl_pseudo ≝ + [ AIS ; AIX ; BGE ; BGND ; BGT ; BLE ; BLT ; CBEQA ; CBEQX ; CPHX ; DAA + ; DBNZ ; DIV ; LDHX ; MOV ; NSA ; PSHA ; PSHH ; PSHX ; PULA ; PULH ; PULX + ; SHA ; SLA ; STHX ; TAP ; TPA ; TSX ; TXS ]. + +nlemma ok_pseudo_table_HC05 : forall_op (λo. + (test_not_impl_pseudo o HC05_not_impl_pseudo ⊙ le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HC05 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05)) ⊗ + (⊖ (test_not_impl_pseudo o HC05_not_impl_pseudo) ⊙ eq_w16 (get_pseudo_count HC05 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC05: modalita' non implementate come da manuale *) +ndefinition HC05_not_impl_mode ≝ + [ MODE_INHH ; MODE_SP1 ; MODE_SP2 ; MODE_DIR1_to_DIR1 + ; MODE_IMM1_to_DIR1 ; MODE_IX0p_to_DIR1 ; MODE_DIR1_to_IX0p + ; MODE_INHA_and_IMM1 ; MODE_INHX_and_IMM1 ; MODE_IMM1_and_IMM1 + ; MODE_DIR1_and_IMM1 ; MODE_IX0_and_IMM1 ; MODE_IX0p_and_IMM1 + ; MODE_IX1_and_IMM1 ; MODE_IX1p_and_IMM1 ; MODE_SP1_and_IMM1 + ; MODE_TNY x0 ; MODE_TNY x1 ; MODE_TNY x2 ; MODE_TNY x3 + ; MODE_TNY x4 ; MODE_TNY x5 ; MODE_TNY x6 ; MODE_TNY x7 + ; MODE_TNY x8 ; MODE_TNY x9 ; MODE_TNY xA ; MODE_TNY xB + ; MODE_TNY xC ; MODE_TNY xD ; MODE_TNY xE ; MODE_TNY xF + ; MODE_SRT t00 ; MODE_SRT t01 ; MODE_SRT t02 ; MODE_SRT t03 + ; MODE_SRT t04 ; MODE_SRT t05 ; MODE_SRT t06 ; MODE_SRT t07 + ; MODE_SRT t08 ; MODE_SRT t09 ; MODE_SRT t0A ; MODE_SRT t0B + ; MODE_SRT t0C ; MODE_SRT t0D ; MODE_SRT t0E ; MODE_SRT t0F + ; MODE_SRT t10 ; MODE_SRT t11 ; MODE_SRT t12 ; MODE_SRT t13 + ; MODE_SRT t14 ; MODE_SRT t15 ; MODE_SRT t16 ; MODE_SRT t17 + ; MODE_SRT t18 ; MODE_SRT t19 ; MODE_SRT t1A ; MODE_SRT t1B + ; MODE_SRT t1C ; MODE_SRT t1D ; MODE_SRT t1E ; MODE_SRT t1F ]. + +nlemma ok_mode_table_HC05 : forall_im (λi. + (test_not_impl_mode i HC05_not_impl_mode ⊙ le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HC05 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05)) ⊗ + (⊖ (test_not_impl_mode i HC05_not_impl_mode) ⊙ eq_w16 (get_mode_count HC05 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +nlemma ok_OpIm_table_HC05 : + forall_im (λi:instr_mode. + forall_op (λop:opcode. + le_w16 (get_OpIm_count HC05 (anyOP HC05 op) i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. + napply refl_eq. +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/table_HC08.ma b/helm/software/matita/contribs/ng_assembly/freescale/table_HC08.ma new file mode 100755 index 000000000..578712267 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/table_HC08.ma @@ -0,0 +1,474 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/opcode_base.ma". +include "common/list.ma". + +(* ***************** *) +(* TABELLA DELL'HC08 *) +(* ***************** *) + +(* definizione come concatenazione finale di liste per velocizzare il parsing *) +(* ogni riga e' (any_opcode m) (instr_mode) (opcode esadecimale) (#cicli esecuzione) *) +(* NB: l'uso di any_opcode m + concatenazione finale tutte liste + impedisce di introdurre opcode disomogenei (per mcu) *) + +ndefinition opcode_table_HC08_1 ≝ +[ + quadruple … (anyOP HC08 ADC) MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 ADC) MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ADC) MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ADC) MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ADC) MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ADC) MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 ADC) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x9〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 ADC) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x9〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_2 ≝ +[ + quadruple … (anyOP HC08 ADD) MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 ADD) MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ADD) MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ADD) MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ADD) MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ADD) MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 ADD) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xB〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 ADD) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xB〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_3 ≝ +[ + quadruple … (anyOP HC08 AND) MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 AND) MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 AND) MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 AND) MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 AND) MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 AND) MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 AND) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x4〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 AND) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x4〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_4 ≝ +[ + quadruple … (anyOP HC08 ASL) MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ASL) MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 ASL) MODE_INHX (Byte 〈x5,x8〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 ASL) MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ASL) MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ASL) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x8〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_5 ≝ +[ + quadruple … (anyOP HC08 ASR) MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ASR) MODE_INHA (Byte 〈x4,x7〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 ASR) MODE_INHX (Byte 〈x5,x7〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 ASR) MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ASR) MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ASR) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x7〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_6 ≝ +[ + quadruple … (anyOP HC08 BRA ) MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BRN ) MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BHI ) MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BLS ) MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BCC ) MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BCS ) MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BNE ) MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BEQ ) MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BHCC) MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BHCS) MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BPL ) MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BMI ) MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BMC ) MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BMS ) MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BIL ) MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BIH ) MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BGE ) MODE_IMM1 (Byte 〈x9,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BLT ) MODE_IMM1 (Byte 〈x9,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BGT ) MODE_IMM1 (Byte 〈x9,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BLE ) MODE_IMM1 (Byte 〈x9,x3〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC08_7 ≝ +[ + quadruple … (anyOP HC08 BSETn) (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BCLRn) (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BSETn) (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BCLRn) (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BSETn) (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BCLRn) (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BSETn) (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BCLRn) (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BSETn) (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BCLRn) (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BSETn) (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BCLRn) (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BSETn) (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BCLRn) (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BSETn) (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BCLRn) (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_8 ≝ +[ + quadruple … (anyOP HC08 BRSETn) (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRCLRn) (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRSETn) (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRCLRn) (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRSETn) (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRCLRn) (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRSETn) (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRCLRn) (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRSETn) (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRCLRn) (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRSETn) (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRCLRn) (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRSETn) (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRCLRn) (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRSETn) (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BRCLRn) (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_9 ≝ +[ + quadruple … (anyOP HC08 BIT) MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 BIT) MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BIT) MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BIT) MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 BIT) MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 BIT) MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 BIT) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x5〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 BIT) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x5〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_10 ≝ +[ + quadruple … (anyOP HC08 MUL ) MODE_INH (Byte 〈x4,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 DIV ) MODE_INH (Byte 〈x5,x2〉) 〈x0,x7〉 +; quadruple … (anyOP HC08 NSA ) MODE_INH (Byte 〈x6,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 DAA ) MODE_INH (Byte 〈x7,x2〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 RTI ) MODE_INH (Byte 〈x8,x0〉) 〈x0,x7〉 +; quadruple … (anyOP HC08 RTS ) MODE_INH (Byte 〈x8,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 SWI ) MODE_INH (Byte 〈x8,x3〉) 〈x0,x9〉 +; quadruple … (anyOP HC08 TAP ) MODE_INH (Byte 〈x8,x4〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 TPA ) MODE_INH (Byte 〈x8,x5〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 PULA) MODE_INH (Byte 〈x8,x6〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 PSHA) MODE_INH (Byte 〈x8,x7〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 PULX) MODE_INH (Byte 〈x8,x8〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 PSHX) MODE_INH (Byte 〈x8,x9〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 PULH) MODE_INH (Byte 〈x8,xA〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 PSHH) MODE_INH (Byte 〈x8,xB〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 STOP) MODE_INH (Byte 〈x8,xE〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 WAIT) MODE_INH (Byte 〈x8,xF〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 TXS ) MODE_INH (Byte 〈x9,x4〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 TSX ) MODE_INH (Byte 〈x9,x5〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 TAX ) MODE_INH (Byte 〈x9,x7〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 CLC ) MODE_INH (Byte 〈x9,x8〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 SEC ) MODE_INH (Byte 〈x9,x9〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 CLI ) MODE_INH (Byte 〈x9,xA〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 SEI ) MODE_INH (Byte 〈x9,xB〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 RSP ) MODE_INH (Byte 〈x9,xC〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 NOP ) MODE_INH (Byte 〈x9,xD〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 TXA ) MODE_INH (Byte 〈x9,xF〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 AIS ) MODE_IMM1 (Byte 〈xA,x7〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 AIX ) MODE_IMM1 (Byte 〈xA,xF〉) 〈x0,x2〉 +]. + +ndefinition opcode_table_HC08_11 ≝ +[ + quadruple … (anyOP HC08 CBEQA) MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 CBEQA) MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 CBEQX) MODE_IMM1_and_IMM1 (Byte 〈x5,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 CBEQA) MODE_IX1p_and_IMM1 (Byte 〈x6,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 CBEQA) MODE_IX0p_and_IMM1 (Byte 〈x7,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 CBEQA) MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,x1〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HC08_12 ≝ +[ + quadruple … (anyOP HC08 CLR) MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 CLR) MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 CLR) MODE_INHX (Byte 〈x5,xF〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 CLR) MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 CLR) MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 CLR) MODE_INHH (Byte 〈x8,xC〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 CLR) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xF〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_13 ≝ +[ + quadruple … (anyOP HC08 CMP) MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 CMP) MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 CMP) MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 CMP) MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 CMP) MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 CMP) MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 CMP) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x1〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 CMP) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x1〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_14 ≝ +[ + quadruple … (anyOP HC08 COM) MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 COM) MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 COM) MODE_INHX (Byte 〈x5,x3〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 COM) MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 COM) MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 COM) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x3〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_15 ≝ +[ + quadruple … (anyOP HC08 STHX) MODE_DIR1 (Byte 〈x3,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 LDHX) MODE_IMM2 (Byte 〈x4,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 LDHX) MODE_DIR1 (Byte 〈x5,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 CPHX) MODE_IMM2 (Byte 〈x6,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 CPHX) MODE_DIR1 (Byte 〈x7,x5〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_16 ≝ +[ + quadruple … (anyOP HC08 CPX) MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 CPX) MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 CPX) MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 CPX) MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 CPX) MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 CPX) MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 CPX) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x3〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 CPX) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x3〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_17 ≝ +[ + quadruple … (anyOP HC08 DBNZ) MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 DBNZ) MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 DBNZ) MODE_INHX_and_IMM1 (Byte 〈x5,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 DBNZ) MODE_IX1_and_IMM1 (Byte 〈x6,xB〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 DBNZ) MODE_IX0_and_IMM1 (Byte 〈x7,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 DBNZ) MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,xB〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HC08_18 ≝ +[ + quadruple … (anyOP HC08 DEC) MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 DEC) MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 DEC) MODE_INHX (Byte 〈x5,xA〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 DEC) MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 DEC) MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 DEC) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xA〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_19 ≝ +[ + quadruple … (anyOP HC08 EOR) MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 EOR) MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 EOR) MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 EOR) MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 EOR) MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 EOR) MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 EOR) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x8〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 EOR) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x8〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_20 ≝ +[ + quadruple … (anyOP HC08 INC) MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 INC) MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 INC) MODE_INHX (Byte 〈x5,xC〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 INC) MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 INC) MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 INC) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xC〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_21 ≝ +[ + quadruple … (anyOP HC08 JMP) MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 JMP) MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 JMP) MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 JMP) MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 JMP) MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HC08_22 ≝ +[ + quadruple … (anyOP HC08 BSR) MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 JSR) MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 JSR) MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 JSR) MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x6〉 +; quadruple … (anyOP HC08 JSR) MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 JSR) MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_23 ≝ +[ + quadruple … (anyOP HC08 LDA) MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 LDA) MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 LDA) MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 LDA) MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 LDA) MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 LDA) MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 LDA) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x6〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 LDA) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x6〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_24 ≝ +[ + quadruple … (anyOP HC08 LDX) MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 LDX) MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 LDX) MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 LDX) MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 LDX) MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 LDX) MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 LDX) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xE〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 LDX) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xE〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_25 ≝ +[ + quadruple … (anyOP HC08 LSR) MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 LSR) MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 LSR) MODE_INHX (Byte 〈x5,x4〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 LSR) MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 LSR) MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 LSR) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x4〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_26 ≝ +[ + quadruple … (anyOP HC08 MOV) MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 MOV) MODE_DIR1_to_IX0p (Byte 〈x5,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 MOV) MODE_IMM1_to_DIR1 (Byte 〈x6,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 MOV) MODE_IX0p_to_DIR1 (Byte 〈x7,xE〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_27 ≝ +[ + quadruple … (anyOP HC08 NEG) MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 NEG) MODE_INHA (Byte 〈x4,x0〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 NEG) MODE_INHX (Byte 〈x5,x0〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 NEG) MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 NEG) MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 NEG) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x0〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_28 ≝ +[ + quadruple … (anyOP HC08 ORA) MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 ORA) MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ORA) MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ORA) MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ORA) MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ORA) MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 ORA) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xA〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 ORA) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xA〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_29 ≝ +[ + quadruple … (anyOP HC08 ROL) MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ROL) MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 ROL) MODE_INHX (Byte 〈x5,x9〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 ROL) MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ROL) MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ROL) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x9〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_30 ≝ +[ + quadruple … (anyOP HC08 ROR) MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ROR) MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 ROR) MODE_INHX (Byte 〈x5,x6〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 ROR) MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 ROR) MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 ROR) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x6〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HC08_31 ≝ +[ + quadruple … (anyOP HC08 SBC) MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 SBC) MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 SBC) MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 SBC) MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 SBC) MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 SBC) MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 SBC) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x2〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 SBC) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x2〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_32 ≝ +[ + quadruple … (anyOP HC08 STA) MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 STA) MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 STA) MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 STA) MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 STA) MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 STA) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x7〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 STA) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x7〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_33 ≝ +[ + quadruple … (anyOP HC08 STX) MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 STX) MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 STX) MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 STX) MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 STX) MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 STX) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xF〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 STX) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xF〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_34 ≝ +[ + quadruple … (anyOP HC08 SUB) MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 SUB) MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 SUB) MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 SUB) MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HC08 SUB) MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 SUB) MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 SUB) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x0〉〉) 〈x0,x5〉 +; quadruple … (anyOP HC08 SUB) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x0〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08_35 ≝ +[ + quadruple … (anyOP HC08 TST) MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 TST) MODE_INHA (Byte 〈x4,xD〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 TST) MODE_INHX (Byte 〈x5,xD〉) 〈x0,x1〉 +; quadruple … (anyOP HC08 TST) MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x3〉 +; quadruple … (anyOP HC08 TST) MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x2〉 +; quadruple … (anyOP HC08 TST) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xD〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HC08 ≝ +opcode_table_HC08_1 @ opcode_table_HC08_2 @ opcode_table_HC08_3 @ opcode_table_HC08_4 @ +opcode_table_HC08_5 @ opcode_table_HC08_6 @ opcode_table_HC08_7 @ opcode_table_HC08_8 @ +opcode_table_HC08_9 @ opcode_table_HC08_10 @ opcode_table_HC08_11 @ opcode_table_HC08_12 @ +opcode_table_HC08_13 @ opcode_table_HC08_14 @ opcode_table_HC08_15 @ opcode_table_HC08_16 @ +opcode_table_HC08_17 @ opcode_table_HC08_18 @ opcode_table_HC08_19 @ opcode_table_HC08_20 @ +opcode_table_HC08_21 @ opcode_table_HC08_22 @ opcode_table_HC08_23 @ opcode_table_HC08_24 @ +opcode_table_HC08_25 @ opcode_table_HC08_26 @ opcode_table_HC08_27 @ opcode_table_HC08_28 @ +opcode_table_HC08_29 @ opcode_table_HC08_30 @ opcode_table_HC08_31 @ opcode_table_HC08_32 @ +opcode_table_HC08_33 @ opcode_table_HC08_34 @ opcode_table_HC08_35. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/table_HC08_tests.ma b/helm/software/matita/contribs/ng_assembly/freescale/table_HC08_tests.ma new file mode 100755 index 000000000..6ec7ad82e --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/table_HC08_tests.ma @@ -0,0 +1,123 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/table_HC08.ma". +include "freescale/opcode.ma". + +(* ***************** *) +(* TABELLA DELL'HC08 *) +(* ***************** *) + +(* HC08: opcode non implementati come da manuale (byte) *) +ndefinition HC08_not_impl_byte ≝ + [〈x3,x2〉;〈x3,xE〉 + ;〈x8,x2〉;〈x8,xD〉 + ;〈x9,x6〉;〈x9,xE〉 + ;〈xA,xC〉 + ]. + +nlemma ok_byte_table_HC08 : forall_b8 (λb. + (test_not_impl_byte b HC08_not_impl_byte ⊙ eq_w16 (get_byte_count HC08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b HC08_not_impl_byte) ⊙ eq_w16 (get_byte_count HC08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC08: opcode non implementati come da manuale (0x9E+byte) *) +ndefinition HC08_not_impl_word ≝ + [〈x0,x0〉;〈x0,x1〉;〈x0,x2〉;〈x0,x3〉;〈x0,x4〉;〈x0,x5〉;〈x0,x6〉;〈x0,x7〉 + ;〈x0,x8〉;〈x0,x9〉;〈x0,xA〉;〈x0,xB〉;〈x0,xC〉;〈x0,xD〉;〈x0,xE〉;〈x0,xF〉 + ;〈x1,x0〉;〈x1,x1〉;〈x1,x2〉;〈x1,x3〉;〈x1,x4〉;〈x1,x5〉;〈x1,x6〉;〈x1,x7〉 + ;〈x1,x8〉;〈x1,x9〉;〈x1,xA〉;〈x1,xB〉;〈x1,xC〉;〈x1,xD〉;〈x1,xE〉;〈x1,xF〉 + ;〈x2,x0〉;〈x2,x1〉;〈x2,x2〉;〈x2,x3〉;〈x2,x4〉;〈x2,x5〉;〈x2,x6〉;〈x2,x7〉 + ;〈x2,x8〉;〈x2,x9〉;〈x2,xA〉;〈x2,xB〉;〈x2,xC〉;〈x2,xD〉;〈x2,xE〉;〈x2,xF〉 + ;〈x3,x0〉;〈x3,x1〉;〈x3,x2〉;〈x3,x3〉;〈x3,x4〉;〈x3,x5〉;〈x3,x6〉;〈x3,x7〉 + ;〈x3,x8〉;〈x3,x9〉;〈x3,xA〉;〈x3,xB〉;〈x3,xC〉;〈x3,xD〉;〈x3,xE〉;〈x3,xF〉 + ;〈x4,x0〉;〈x4,x1〉;〈x4,x2〉;〈x4,x3〉;〈x4,x4〉;〈x4,x5〉;〈x4,x6〉;〈x4,x7〉 + ;〈x4,x8〉;〈x4,x9〉;〈x4,xA〉;〈x4,xB〉;〈x4,xC〉;〈x4,xD〉;〈x4,xE〉;〈x4,xF〉 + ;〈x5,x0〉;〈x5,x1〉;〈x5,x2〉;〈x5,x3〉;〈x5,x4〉;〈x5,x5〉;〈x5,x6〉;〈x5,x7〉 + ;〈x5,x8〉;〈x5,x9〉;〈x5,xA〉;〈x5,xB〉;〈x5,xC〉;〈x5,xD〉;〈x5,xE〉;〈x5,xF〉 + ;〈x6,x2〉;〈x6,x5〉;〈x6,xE〉 + ;〈x7,x0〉;〈x7,x1〉;〈x7,x2〉;〈x7,x3〉;〈x7,x4〉;〈x7,x5〉;〈x7,x6〉;〈x7,x7〉 + ;〈x7,x8〉;〈x7,x9〉;〈x7,xA〉;〈x7,xB〉;〈x7,xC〉;〈x7,xD〉;〈x7,xE〉;〈x7,xF〉 + ;〈x8,x0〉;〈x8,x1〉;〈x8,x2〉;〈x8,x3〉;〈x8,x4〉;〈x8,x5〉;〈x8,x6〉;〈x8,x7〉 + ;〈x8,x8〉;〈x8,x9〉;〈x8,xA〉;〈x8,xB〉;〈x8,xC〉;〈x8,xD〉;〈x8,xE〉;〈x8,xF〉 + ;〈x9,x0〉;〈x9,x1〉;〈x9,x2〉;〈x9,x3〉;〈x9,x4〉;〈x9,x5〉;〈x9,x6〉;〈x9,x7〉 + ;〈x9,x8〉;〈x9,x9〉;〈x9,xA〉;〈x9,xB〉;〈x9,xC〉;〈x9,xD〉;〈x9,xE〉;〈x9,xF〉 + ;〈xA,x0〉;〈xA,x1〉;〈xA,x2〉;〈xA,x3〉;〈xA,x4〉;〈xA,x5〉;〈xA,x6〉;〈xA,x7〉 + ;〈xA,x8〉;〈xA,x9〉;〈xA,xA〉;〈xA,xB〉;〈xA,xC〉;〈xA,xD〉;〈xA,xE〉;〈xA,xF〉 + ;〈xB,x0〉;〈xB,x1〉;〈xB,x2〉;〈xB,x3〉;〈xB,x4〉;〈xB,x5〉;〈xB,x6〉;〈xB,x7〉 + ;〈xB,x8〉;〈xB,x9〉;〈xB,xA〉;〈xB,xB〉;〈xB,xC〉;〈xB,xD〉;〈xB,xE〉;〈xB,xF〉 + ;〈xC,x0〉;〈xC,x1〉;〈xC,x2〉;〈xC,x3〉;〈xC,x4〉;〈xC,x5〉;〈xC,x6〉;〈xC,x7〉 + ;〈xC,x8〉;〈xC,x9〉;〈xC,xA〉;〈xC,xB〉;〈xC,xC〉;〈xC,xD〉;〈xC,xE〉;〈xC,xF〉 + ;〈xD,xC〉;〈xD,xD〉 + ;〈xE,xC〉;〈xE,xD〉 + ;〈xF,x0〉;〈xF,x1〉;〈xF,x2〉;〈xF,x3〉;〈xF,x4〉;〈xF,x5〉;〈xF,x6〉;〈xF,x7〉 + ;〈xF,x8〉;〈xF,x9〉;〈xF,xA〉;〈xF,xB〉;〈xF,xC〉;〈xF,xD〉;〈xF,xE〉;〈xF,xF〉 + ]. + +nlemma ok_word_table_HC08 : forall_b8 (λb. + (test_not_impl_byte b HC08_not_impl_word ⊙ eq_w16 (get_word_count HC08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b HC08_not_impl_word) ⊙ eq_w16 (get_word_count HC08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC08: pseudocodici non implementati come da manuale *) +ndefinition HC08_not_impl_pseudo ≝ + [ BGND ; SHA ; SLA ]. + +nlemma ok_pseudo_table_HC08 : forall_op (λo. + (test_not_impl_pseudo o HC08_not_impl_pseudo ⊙ le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HC08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08)) ⊗ + (⊖ (test_not_impl_pseudo o HC08_not_impl_pseudo) ⊙ eq_w16 (get_pseudo_count HC08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC08: modalita' non implementate come da manuale *) +ndefinition HC08_not_impl_mode ≝ + [ MODE_TNY x0 ; MODE_TNY x1 ; MODE_TNY x2 ; MODE_TNY x3 + ; MODE_TNY x4 ; MODE_TNY x5 ; MODE_TNY x6 ; MODE_TNY x7 + ; MODE_TNY x8 ; MODE_TNY x9 ; MODE_TNY xA ; MODE_TNY xB + ; MODE_TNY xC ; MODE_TNY xD ; MODE_TNY xE ; MODE_TNY xF + ; MODE_SRT t00 ; MODE_SRT t01 ; MODE_SRT t02 ; MODE_SRT t03 + ; MODE_SRT t04 ; MODE_SRT t05 ; MODE_SRT t06 ; MODE_SRT t07 + ; MODE_SRT t08 ; MODE_SRT t09 ; MODE_SRT t0A ; MODE_SRT t0B + ; MODE_SRT t0C ; MODE_SRT t0D ; MODE_SRT t0E ; MODE_SRT t0F + ; MODE_SRT t10 ; MODE_SRT t11 ; MODE_SRT t12 ; MODE_SRT t13 + ; MODE_SRT t14 ; MODE_SRT t15 ; MODE_SRT t16 ; MODE_SRT t17 + ; MODE_SRT t18 ; MODE_SRT t19 ; MODE_SRT t1A ; MODE_SRT t1B + ; MODE_SRT t1C ; MODE_SRT t1D ; MODE_SRT t1E ; MODE_SRT t1F ]. + +nlemma ok_mode_table_HC08 : forall_im (λi. + (test_not_impl_mode i HC08_not_impl_mode ⊙ le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HC08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08)) ⊗ + (⊖ (test_not_impl_mode i HC08_not_impl_mode) ⊙ eq_w16 (get_mode_count HC08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +nlemma ok_OpIm_table_HC08 : + forall_im (λi:instr_mode. + forall_op (λop:opcode. + le_w16 (get_OpIm_count HC08 (anyOP HC08 op) i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. + napply refl_eq. +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/table_HCS08.ma b/helm/software/matita/contribs/ng_assembly/freescale/table_HCS08.ma new file mode 100755 index 000000000..a3f3266cf --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/table_HCS08.ma @@ -0,0 +1,486 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/opcode_base.ma". +include "common/list.ma". + +(* ****************** *) +(* TABELLA DELL'HCS08 *) +(* ****************** *) + +(* definizione come concatenazione finale di liste per velocizzare il parsing *) +(* ogni riga e' (any_opcode m) (instr_mode) (opcode esadecimale) (#cicli esecuzione) *) +(* NB: l'uso di any_opcode m + concatenazione finale tutte liste + impedisce di introdurre opcode disomogenei (per mcu) *) + +ndefinition opcode_table_HCS08_1 ≝ +[ + quadruple … (anyOP HCS08 ADC) MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 ADC) MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ADC) MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ADC) MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ADC) MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ADC) MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ADC) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x9〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ADC) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x9〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_2 ≝ +[ + quadruple … (anyOP HCS08 ADD) MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 ADD) MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ADD) MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ADD) MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ADD) MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ADD) MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ADD) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xB〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ADD) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xB〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_3 ≝ +[ + quadruple … (anyOP HCS08 AND) MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 AND) MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 AND) MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 AND) MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 AND) MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 AND) MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 AND) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x4〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 AND) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x4〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_4 ≝ +[ + quadruple … (anyOP HCS08 ASL) MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ASL) MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 ASL) MODE_INHX (Byte 〈x5,x8〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 ASL) MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ASL) MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ASL) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x8〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_5 ≝ +[ + quadruple … (anyOP HCS08 ASR) MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ASR) MODE_INHA (Byte 〈x4,x7〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 ASR) MODE_INHX (Byte 〈x5,x7〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 ASR) MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ASR) MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ASR) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x7〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_6 ≝ +[ + quadruple … (anyOP HCS08 BRA ) MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BRN ) MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BHI ) MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BLS ) MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BCC ) MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BCS ) MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BNE ) MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BEQ ) MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BHCC) MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BHCS) MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BPL ) MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BMI ) MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BMC ) MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BMS ) MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BIL ) MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BIH ) MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BGE ) MODE_IMM1 (Byte 〈x9,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BLT ) MODE_IMM1 (Byte 〈x9,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BGT ) MODE_IMM1 (Byte 〈x9,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BLE ) MODE_IMM1 (Byte 〈x9,x3〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HCS08_7 ≝ +[ + quadruple … (anyOP HCS08 BSETn) (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BCLRn) (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BSETn) (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BCLRn) (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BSETn) (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BCLRn) (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BSETn) (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BCLRn) (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BSETn) (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BCLRn) (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BSETn) (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BCLRn) (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BSETn) (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BCLRn) (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BSETn) (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BCLRn) (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HCS08_8 ≝ +[ + quadruple … (anyOP HCS08 BRSETn) (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRCLRn) (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRSETn) (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRCLRn) (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRSETn) (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRCLRn) (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRSETn) (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRCLRn) (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRSETn) (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRCLRn) (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRSETn) (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRCLRn) (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRSETn) (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRCLRn) (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRSETn) (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BRCLRn) (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HCS08_9 ≝ +[ + quadruple … (anyOP HCS08 BIT) MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 BIT) MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BIT) MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 BIT) MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 BIT) MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BIT) MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 BIT) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x5〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 BIT) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x5〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_10 ≝ +[ + quadruple … (anyOP HCS08 MUL ) MODE_INH (Byte 〈x4,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 DIV ) MODE_INH (Byte 〈x5,x2〉) 〈x0,x6〉 +; quadruple … (anyOP HCS08 NSA ) MODE_INH (Byte 〈x6,x2〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 DAA ) MODE_INH (Byte 〈x7,x2〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 RTI ) MODE_INH (Byte 〈x8,x0〉) 〈x0,x9〉 +; quadruple … (anyOP HCS08 RTS ) MODE_INH (Byte 〈x8,x1〉) 〈x0,x6〉 +; quadruple … (anyOP HCS08 SWI ) MODE_INH (Byte 〈x8,x3〉) 〈x0,xB〉 +; quadruple … (anyOP HCS08 BGND) MODE_INH (Byte 〈x8,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 TAP ) MODE_INH (Byte 〈x8,x4〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 TPA ) MODE_INH (Byte 〈x8,x5〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 PULA) MODE_INH (Byte 〈x8,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 PSHA) MODE_INH (Byte 〈x8,x7〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 PULX) MODE_INH (Byte 〈x8,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 PSHX) MODE_INH (Byte 〈x8,x9〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 PULH) MODE_INH (Byte 〈x8,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 PSHH) MODE_INH (Byte 〈x8,xB〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 STOP) MODE_INH (Byte 〈x8,xE〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 WAIT) MODE_INH (Byte 〈x8,xF〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 TXS ) MODE_INH (Byte 〈x9,x4〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 TSX ) MODE_INH (Byte 〈x9,x5〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 TAX ) MODE_INH (Byte 〈x9,x7〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 CLC ) MODE_INH (Byte 〈x9,x8〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 SEC ) MODE_INH (Byte 〈x9,x9〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 CLI ) MODE_INH (Byte 〈x9,xA〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 SEI ) MODE_INH (Byte 〈x9,xB〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 RSP ) MODE_INH (Byte 〈x9,xC〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 NOP ) MODE_INH (Byte 〈x9,xD〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 TXA ) MODE_INH (Byte 〈x9,xF〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 AIS ) MODE_IMM1 (Byte 〈xA,x7〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 AIX ) MODE_IMM1 (Byte 〈xA,xF〉) 〈x0,x2〉 +]. + +ndefinition opcode_table_HCS08_11 ≝ +[ + quadruple … (anyOP HCS08 CBEQA) MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 CBEQA) MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 CBEQX) MODE_IMM1_and_IMM1 (Byte 〈x5,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 CBEQA) MODE_IX1p_and_IMM1 (Byte 〈x6,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 CBEQA) MODE_IX0p_and_IMM1 (Byte 〈x7,x1〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 CBEQA) MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,x1〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_12 ≝ +[ + quadruple … (anyOP HCS08 CLR) MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 CLR) MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 CLR) MODE_INHX (Byte 〈x5,xF〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 CLR) MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 CLR) MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 CLR) MODE_INHH (Byte 〈x8,xC〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 CLR) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xF〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_13 ≝ +[ + quadruple … (anyOP HCS08 CMP) MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 CMP) MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 CMP) MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 CMP) MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 CMP) MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 CMP) MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 CMP) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x1〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 CMP) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x1〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_14 ≝ +[ + quadruple … (anyOP HCS08 COM) MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 COM) MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 COM) MODE_INHX (Byte 〈x5,x3〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 COM) MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 COM) MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 COM) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x3〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_15 ≝ +[ + quadruple … (anyOP HCS08 CPHX) MODE_DIR2 (Byte 〈x3,xE〉) 〈x0,x6〉 +; quadruple … (anyOP HCS08 CPHX) MODE_IMM2 (Byte 〈x6,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 CPHX) MODE_DIR1 (Byte 〈x7,x5〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 CPHX) MODE_SP1 (Word 〈〈x9,xE〉:〈xF,x3〉〉) 〈x0,x6〉 + +; quadruple … (anyOP HCS08 LDHX) MODE_DIR2 (Byte 〈x3,x2〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 LDHX) MODE_IMM2 (Byte 〈x4,x5〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 LDHX) MODE_DIR1 (Byte 〈x5,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 LDHX) MODE_IX0 (Word 〈〈x9,xE〉:〈xA,xE〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 LDHX) MODE_IX2 (Word 〈〈x9,xE〉:〈xB,xE〉〉) 〈x0,x6〉 +; quadruple … (anyOP HCS08 LDHX) MODE_IX1 (Word 〈〈x9,xE〉:〈xC,xE〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 LDHX) MODE_SP1 (Word 〈〈x9,xE〉:〈xF,xE〉〉) 〈x0,x5〉 + +; quadruple … (anyOP HCS08 STHX) MODE_DIR1 (Byte 〈x3,x5〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 STHX) MODE_DIR2 (Byte 〈x9,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 STHX) MODE_SP1 (Word 〈〈x9,xE〉:〈xF,xF〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HCS08_16 ≝ +[ + quadruple … (anyOP HCS08 CPX) MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 CPX) MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 CPX) MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 CPX) MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 CPX) MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 CPX) MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 CPX) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x3〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 CPX) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x3〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_17 ≝ +[ + quadruple … (anyOP HCS08 DBNZ) MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x7〉 +; quadruple … (anyOP HCS08 DBNZ) MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 DBNZ) MODE_INHX_and_IMM1 (Byte 〈x5,xB〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 DBNZ) MODE_IX1_and_IMM1 (Byte 〈x6,xB〉) 〈x0,x7〉 +; quadruple … (anyOP HCS08 DBNZ) MODE_IX0_and_IMM1 (Byte 〈x7,xB〉) 〈x0,x6〉 +; quadruple … (anyOP HCS08 DBNZ) MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,xB〉〉) 〈x0,x8〉 +]. + +ndefinition opcode_table_HCS08_18 ≝ +[ + quadruple … (anyOP HCS08 DEC) MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 DEC) MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 DEC) MODE_INHX (Byte 〈x5,xA〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 DEC) MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 DEC) MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 DEC) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xA〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_19 ≝ +[ + quadruple … (anyOP HCS08 EOR) MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 EOR) MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 EOR) MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 EOR) MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 EOR) MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 EOR) MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 EOR) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x8〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 EOR) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x8〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_20 ≝ +[ + quadruple … (anyOP HCS08 INC) MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 INC) MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 INC) MODE_INHX (Byte 〈x5,xC〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 INC) MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 INC) MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 INC) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xC〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_21 ≝ +[ + quadruple … (anyOP HCS08 JMP) MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 JMP) MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 JMP) MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 JMP) MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 JMP) MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_HCS08_22 ≝ +[ + quadruple … (anyOP HCS08 BSR) MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 JSR) MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 JSR) MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x6〉 +; quadruple … (anyOP HCS08 JSR) MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x6〉 +; quadruple … (anyOP HCS08 JSR) MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 JSR) MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HCS08_23 ≝ +[ + quadruple … (anyOP HCS08 LDA) MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 LDA) MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 LDA) MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 LDA) MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 LDA) MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 LDA) MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 LDA) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x6〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 LDA) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x6〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_24 ≝ +[ + quadruple … (anyOP HCS08 LDX) MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 LDX) MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 LDX) MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 LDX) MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 LDX) MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 LDX) MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 LDX) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xE〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 LDX) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xE〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_25 ≝ +[ + quadruple … (anyOP HCS08 LSR) MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 LSR) MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 LSR) MODE_INHX (Byte 〈x5,x4〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 LSR) MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 LSR) MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 LSR) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x4〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_26 ≝ +[ + quadruple … (anyOP HCS08 MOV) MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 MOV) MODE_DIR1_to_IX0p (Byte 〈x5,xE〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 MOV) MODE_IMM1_to_DIR1 (Byte 〈x6,xE〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 MOV) MODE_IX0p_to_DIR1 (Byte 〈x7,xE〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HCS08_27 ≝ +[ + quadruple … (anyOP HCS08 NEG) MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 NEG) MODE_INHA (Byte 〈x4,x0〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 NEG) MODE_INHX (Byte 〈x5,x0〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 NEG) MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 NEG) MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 NEG) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x0〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_28 ≝ +[ + quadruple … (anyOP HCS08 ORA) MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 ORA) MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ORA) MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ORA) MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ORA) MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ORA) MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 ORA) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xA〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ORA) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xA〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_29 ≝ +[ + quadruple … (anyOP HCS08 ROL) MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ROL) MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 ROL) MODE_INHX (Byte 〈x5,x9〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 ROL) MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ROL) MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ROL) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x9〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_30 ≝ +[ + quadruple … (anyOP HCS08 ROR) MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ROR) MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 ROR) MODE_INHX (Byte 〈x5,x6〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 ROR) MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 ROR) MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 ROR) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x6〉〉) 〈x0,x6〉 +]. + +ndefinition opcode_table_HCS08_31 ≝ +[ + quadruple … (anyOP HCS08 SBC) MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 SBC) MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 SBC) MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 SBC) MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 SBC) MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 SBC) MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 SBC) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x2〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 SBC) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x2〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_32 ≝ +[ + quadruple … (anyOP HCS08 STA) MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 STA) MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 STA) MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 STA) MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 STA) MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 STA) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x7〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 STA) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x7〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_33 ≝ +[ + quadruple … (anyOP HCS08 STX) MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 STX) MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 STX) MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 STX) MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 STX) MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 STX) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xF〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 STX) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xF〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_34 ≝ +[ + quadruple … (anyOP HCS08 SUB) MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 +; quadruple … (anyOP HCS08 SUB) MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 SUB) MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 SUB) MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 SUB) MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 SUB) MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 SUB) MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x0〉〉) 〈x0,x5〉 +; quadruple … (anyOP HCS08 SUB) MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x0〉〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_HCS08_35 ≝ +[ + quadruple … (anyOP HCS08 TST) MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 TST) MODE_INHA (Byte 〈x4,xD〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 TST) MODE_INHX (Byte 〈x5,xD〉) 〈x0,x1〉 +; quadruple … (anyOP HCS08 TST) MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x4〉 +; quadruple … (anyOP HCS08 TST) MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x3〉 +; quadruple … (anyOP HCS08 TST) MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xD〉〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_HCS08 ≝ +opcode_table_HCS08_1 @ opcode_table_HCS08_2 @ opcode_table_HCS08_3 @ opcode_table_HCS08_4 @ +opcode_table_HCS08_5 @ opcode_table_HCS08_6 @ opcode_table_HCS08_7 @ opcode_table_HCS08_8 @ +opcode_table_HCS08_9 @ opcode_table_HCS08_10 @ opcode_table_HCS08_11 @ opcode_table_HCS08_12 @ +opcode_table_HCS08_13 @ opcode_table_HCS08_14 @ opcode_table_HCS08_15 @ opcode_table_HCS08_16 @ +opcode_table_HCS08_17 @ opcode_table_HCS08_18 @ opcode_table_HCS08_19 @ opcode_table_HCS08_20 @ +opcode_table_HCS08_21 @ opcode_table_HCS08_22 @ opcode_table_HCS08_23 @ opcode_table_HCS08_24 @ +opcode_table_HCS08_25 @ opcode_table_HCS08_26 @ opcode_table_HCS08_27 @ opcode_table_HCS08_28 @ +opcode_table_HCS08_29 @ opcode_table_HCS08_30 @ opcode_table_HCS08_31 @ opcode_table_HCS08_32 @ +opcode_table_HCS08_33 @ opcode_table_HCS08_34 @ opcode_table_HCS08_35. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/table_HCS08_tests.ma b/helm/software/matita/contribs/ng_assembly/freescale/table_HCS08_tests.ma new file mode 100755 index 000000000..6cc138d66 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/table_HCS08_tests.ma @@ -0,0 +1,118 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/table_HCS08.ma". +include "freescale/opcode.ma". + +(* ****************** *) +(* TABELLA DELL'HCS08 *) +(* ****************** *) + +(* HCS08: opcode non implementati come da manuale (byte) *) +ndefinition HCS08_not_impl_byte ≝ + [〈x8,xD〉 + ;〈x9,xE〉 + ;〈xA,xC〉 + ]. + +nlemma ok_byte_table_HCS08 : forall_b8 (λb. + (test_not_impl_byte b HCS08_not_impl_byte ⊙ eq_w16 (get_byte_count HCS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b HCS08_not_impl_byte) ⊙ eq_w16 (get_byte_count HCS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HCS08: opcode non implementati come da manuale (0x9E+byte) *) +ndefinition HCS08_not_impl_word ≝ + [〈x0,x0〉;〈x0,x1〉;〈x0,x2〉;〈x0,x3〉;〈x0,x4〉;〈x0,x5〉;〈x0,x6〉;〈x0,x7〉 + ;〈x0,x8〉;〈x0,x9〉;〈x0,xA〉;〈x0,xB〉;〈x0,xC〉;〈x0,xD〉;〈x0,xE〉;〈x0,xF〉 + ;〈x1,x0〉;〈x1,x1〉;〈x1,x2〉;〈x1,x3〉;〈x1,x4〉;〈x1,x5〉;〈x1,x6〉;〈x1,x7〉 + ;〈x1,x8〉;〈x1,x9〉;〈x1,xA〉;〈x1,xB〉;〈x1,xC〉;〈x1,xD〉;〈x1,xE〉;〈x1,xF〉 + ;〈x2,x0〉;〈x2,x1〉;〈x2,x2〉;〈x2,x3〉;〈x2,x4〉;〈x2,x5〉;〈x2,x6〉;〈x2,x7〉 + ;〈x2,x8〉;〈x2,x9〉;〈x2,xA〉;〈x2,xB〉;〈x2,xC〉;〈x2,xD〉;〈x2,xE〉;〈x2,xF〉 + ;〈x3,x0〉;〈x3,x1〉;〈x3,x2〉;〈x3,x3〉;〈x3,x4〉;〈x3,x5〉;〈x3,x6〉;〈x3,x7〉 + ;〈x3,x8〉;〈x3,x9〉;〈x3,xA〉;〈x3,xB〉;〈x3,xC〉;〈x3,xD〉;〈x3,xE〉;〈x3,xF〉 + ;〈x4,x0〉;〈x4,x1〉;〈x4,x2〉;〈x4,x3〉;〈x4,x4〉;〈x4,x5〉;〈x4,x6〉;〈x4,x7〉 + ;〈x4,x8〉;〈x4,x9〉;〈x4,xA〉;〈x4,xB〉;〈x4,xC〉;〈x4,xD〉;〈x4,xE〉;〈x4,xF〉 + ;〈x5,x0〉;〈x5,x1〉;〈x5,x2〉;〈x5,x3〉;〈x5,x4〉;〈x5,x5〉;〈x5,x6〉;〈x5,x7〉 + ;〈x5,x8〉;〈x5,x9〉;〈x5,xA〉;〈x5,xB〉;〈x5,xC〉;〈x5,xD〉;〈x5,xE〉;〈x5,xF〉 + ;〈x6,x2〉;〈x6,x5〉;〈x6,xE〉 + ;〈x7,x0〉;〈x7,x1〉;〈x7,x2〉;〈x7,x3〉;〈x7,x4〉;〈x7,x5〉;〈x7,x6〉;〈x7,x7〉 + ;〈x7,x8〉;〈x7,x9〉;〈x7,xA〉;〈x7,xB〉;〈x7,xC〉;〈x7,xD〉;〈x7,xE〉;〈x7,xF〉 + ;〈x8,x0〉;〈x8,x1〉;〈x8,x2〉;〈x8,x3〉;〈x8,x4〉;〈x8,x5〉;〈x8,x6〉;〈x8,x7〉 + ;〈x8,x8〉;〈x8,x9〉;〈x8,xA〉;〈x8,xB〉;〈x8,xC〉;〈x8,xD〉;〈x8,xE〉;〈x8,xF〉 + ;〈x9,x0〉;〈x9,x1〉;〈x9,x2〉;〈x9,x3〉;〈x9,x4〉;〈x9,x5〉;〈x9,x6〉;〈x9,x7〉 + ;〈x9,x8〉;〈x9,x9〉;〈x9,xA〉;〈x9,xB〉;〈x9,xC〉;〈x9,xD〉;〈x9,xE〉;〈x9,xF〉 + ;〈xA,x0〉;〈xA,x1〉;〈xA,x2〉;〈xA,x3〉;〈xA,x4〉;〈xA,x5〉;〈xA,x6〉;〈xA,x7〉;〈xA,x8〉;〈xA,x9〉;〈xA,xA〉;〈xA,xB〉;〈xA,xC〉;〈xA,xD〉;〈xA,xF〉 + ;〈xB,x0〉;〈xB,x1〉;〈xB,x2〉;〈xB,x3〉;〈xB,x4〉;〈xB,x5〉;〈xB,x6〉;〈xB,x7〉;〈xB,x8〉;〈xB,x9〉;〈xB,xA〉;〈xB,xB〉;〈xB,xC〉;〈xB,xD〉;〈xB,xF〉 + ;〈xC,x0〉;〈xC,x1〉;〈xC,x2〉;〈xC,x3〉;〈xC,x4〉;〈xC,x5〉;〈xC,x6〉;〈xC,x7〉;〈xC,x8〉;〈xC,x9〉;〈xC,xA〉;〈xC,xB〉;〈xC,xC〉;〈xC,xD〉;〈xC,xF〉 + ;〈xD,xC〉;〈xD,xD〉 + ;〈xE,xC〉;〈xE,xD〉 + ;〈xF,x0〉;〈xF,x1〉;〈xF,x2〉;〈xF,x4〉;〈xF,x5〉;〈xF,x6〉;〈xF,x7〉;〈xF,x8〉;〈xF,x9〉;〈xF,xA〉;〈xF,xB〉;〈xF,xC〉;〈xF,xD〉 + ]. + +nlemma ok_word_table_HCS08 : forall_b8 (λb. + (test_not_impl_byte b HCS08_not_impl_word ⊙ eq_w16 (get_word_count HCS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b HCS08_not_impl_word) ⊙ eq_w16 (get_word_count HCS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HCS08: pseudocodici non implementati come da manuale *) +ndefinition HCS08_not_impl_pseudo ≝ + [ SHA ; SLA ]. + +nlemma ok_pseudo_table_HCS08 : forall_op (λo. + (test_not_impl_pseudo o HCS08_not_impl_pseudo ⊙ le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HCS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08)) ⊗ + (⊖ (test_not_impl_pseudo o HCS08_not_impl_pseudo) ⊙ eq_w16 (get_pseudo_count HCS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HCS08: modalita' non implementate come da manuale *) +ndefinition HCS08_not_impl_mode ≝ + [ MODE_TNY x0 ; MODE_TNY x1 ; MODE_TNY x2 ; MODE_TNY x3 + ; MODE_TNY x4 ; MODE_TNY x5 ; MODE_TNY x6 ; MODE_TNY x7 + ; MODE_TNY x8 ; MODE_TNY x9 ; MODE_TNY xA ; MODE_TNY xB + ; MODE_TNY xC ; MODE_TNY xD ; MODE_TNY xE ; MODE_TNY xF + ; MODE_SRT t00 ; MODE_SRT t01 ; MODE_SRT t02 ; MODE_SRT t03 + ; MODE_SRT t04 ; MODE_SRT t05 ; MODE_SRT t06 ; MODE_SRT t07 + ; MODE_SRT t08 ; MODE_SRT t09 ; MODE_SRT t0A ; MODE_SRT t0B + ; MODE_SRT t0C ; MODE_SRT t0D ; MODE_SRT t0E ; MODE_SRT t0F + ; MODE_SRT t10 ; MODE_SRT t11 ; MODE_SRT t12 ; MODE_SRT t13 + ; MODE_SRT t14 ; MODE_SRT t15 ; MODE_SRT t16 ; MODE_SRT t17 + ; MODE_SRT t18 ; MODE_SRT t19 ; MODE_SRT t1A ; MODE_SRT t1B + ; MODE_SRT t1C ; MODE_SRT t1D ; MODE_SRT t1E ; MODE_SRT t1F ]. + +nlemma ok_mode_table_HCS08 : forall_im (λi. + (test_not_impl_mode i HCS08_not_impl_mode ⊙ le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HCS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08)) ⊗ + (⊖ (test_not_impl_mode i HCS08_not_impl_mode) ⊙ eq_w16 (get_mode_count HCS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +nlemma ok_OpIm_table_HCS08 : + forall_im (λi:instr_mode. + forall_op (λop:opcode. + le_w16 (get_OpIm_count HCS08 (anyOP HCS08 op) i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. + napply refl_eq. +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/table_RS08.ma b/helm/software/matita/contribs/ng_assembly/freescale/table_RS08.ma new file mode 100755 index 000000000..fc0ee75f9 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/table_RS08.ma @@ -0,0 +1,395 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/opcode_base.ma". +include "common/list.ma". + +(* ***************** *) +(* TABELLA DELL'RS08 *) +(* ***************** *) + +(* definizione come concatenazione finale di liste per velocizzare il parsing *) +(* ogni riga e' (any_opcode m) (instr_mode) (opcode esadecimale) (#cicli esecuzione) *) +(* NB: l'uso di any_opcode m + concatenazione finale tutte liste + impedisce di introdurre opcode disomogenei (per mcu) *) + +ndefinition opcode_table_RS08_1 ≝ +[ + quadruple … (anyOP RS08 ADC) MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 ADC) MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_2 ≝ +[ + quadruple … (anyOP RS08 ADD) MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 ADD) MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x0) (Byte 〈x6,x0〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x1) (Byte 〈x6,x1〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x2) (Byte 〈x6,x2〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x3) (Byte 〈x6,x3〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x4) (Byte 〈x6,x4〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x5) (Byte 〈x6,x5〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x6) (Byte 〈x6,x6〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x7) (Byte 〈x6,x7〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x8) (Byte 〈x6,x8〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY x9) (Byte 〈x6,x9〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY xA) (Byte 〈x6,xA〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY xB) (Byte 〈x6,xB〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY xC) (Byte 〈x6,xC〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY xD) (Byte 〈x6,xD〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY xE) (Byte 〈x6,xE〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 ADD) (MODE_TNY xF) (Byte 〈x6,xF〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_3 ≝ +[ + quadruple … (anyOP RS08 AND) MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 AND) MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_4 ≝ +[ + quadruple … (anyOP RS08 ASL) MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 +]. + +ndefinition opcode_table_RS08_5 ≝ +[ + quadruple … (anyOP RS08 BRA) MODE_IMM1 (Byte 〈x3,x0〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 BCC) MODE_IMM1 (Byte 〈x3,x4〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 BCS) MODE_IMM1 (Byte 〈x3,x5〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 BNE) MODE_IMM1 (Byte 〈x3,x6〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 BEQ) MODE_IMM1 (Byte 〈x3,x7〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_6 ≝ +[ + quadruple … (anyOP RS08 BSETn) (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BCLRn) (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BSETn) (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BCLRn) (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BSETn) (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BCLRn) (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BSETn) (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BCLRn) (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BSETn) (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BCLRn) (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BSETn) (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BCLRn) (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BSETn) (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BCLRn) (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BSETn) (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BCLRn) (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_RS08_7 ≝ +[ + quadruple … (anyOP RS08 BRSETn) (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRCLRn) (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRSETn) (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRCLRn) (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRSETn) (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRCLRn) (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRSETn) (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRCLRn) (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRSETn) (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRCLRn) (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRSETn) (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRCLRn) (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRSETn) (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRCLRn) (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRSETn) (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 BRCLRn) (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_RS08_8 ≝ +[ + quadruple … (anyOP RS08 CLC ) MODE_INH (Byte 〈x3,x8〉) 〈x0,x1〉 +; quadruple … (anyOP RS08 SEC ) MODE_INH (Byte 〈x3,x9〉) 〈x0,x1〉 +; quadruple … (anyOP RS08 SLA ) MODE_INH (Byte 〈x4,x2〉) 〈x0,x1〉 +; quadruple … (anyOP RS08 SHA ) MODE_INH (Byte 〈x4,x5〉) 〈x0,x1〉 +; quadruple … (anyOP RS08 NOP ) MODE_INH (Byte 〈xA,xC〉) 〈x0,x1〉 +; quadruple … (anyOP RS08 STOP) MODE_INH (Byte 〈xA,xE〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 WAIT) MODE_INH (Byte 〈xA,xF〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 RTS ) MODE_INH (Byte 〈xB,xE〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 BGND) MODE_INH (Byte 〈xB,xF〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_RS08_9 ≝ +[ + quadruple … (anyOP RS08 CBEQA) MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 CBEQA) MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_RS08_10 ≝ +[ + quadruple … (anyOP RS08 CLR) MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 CLR) MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t00) (Byte 〈x8,x0〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t01) (Byte 〈x8,x1〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t02) (Byte 〈x8,x2〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t03) (Byte 〈x8,x3〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t04) (Byte 〈x8,x4〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t05) (Byte 〈x8,x5〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t06) (Byte 〈x8,x6〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t07) (Byte 〈x8,x7〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t08) (Byte 〈x8,x8〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t09) (Byte 〈x8,x9〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t0A) (Byte 〈x8,xA〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t0B) (Byte 〈x8,xB〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t0C) (Byte 〈x8,xC〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t0D) (Byte 〈x8,xD〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t0E) (Byte 〈x8,xE〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t0F) (Byte 〈x8,xF〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t10) (Byte 〈x9,x0〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t11) (Byte 〈x9,x1〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t12) (Byte 〈x9,x2〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t13) (Byte 〈x9,x3〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t14) (Byte 〈x9,x4〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t15) (Byte 〈x9,x5〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t16) (Byte 〈x9,x6〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t17) (Byte 〈x9,x7〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t18) (Byte 〈x9,x8〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t19) (Byte 〈x9,x9〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t1A) (Byte 〈x9,xA〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t1B) (Byte 〈x9,xB〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t1C) (Byte 〈x9,xC〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t1D) (Byte 〈x9,xD〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t1E) (Byte 〈x9,xE〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CLR) (MODE_SRT t1F) (Byte 〈x9,xF〉) 〈x0,x2〉 +]. + +ndefinition opcode_table_RS08_11 ≝ +[ + quadruple … (anyOP RS08 CMP) MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 CMP) MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_12 ≝ +[ + quadruple … (anyOP RS08 COM) MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 +]. + +ndefinition opcode_table_RS08_13 ≝ +[ + quadruple … (anyOP RS08 DBNZ) MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x7〉 +; quadruple … (anyOP RS08 DBNZ) MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_RS08_14 ≝ +[ + quadruple … (anyOP RS08 DEC) MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 DEC) MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x0) (Byte 〈x5,x0〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x1) (Byte 〈x5,x1〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x2) (Byte 〈x5,x2〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x3) (Byte 〈x5,x3〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x4) (Byte 〈x5,x4〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x5) (Byte 〈x5,x5〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x6) (Byte 〈x5,x6〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x7) (Byte 〈x5,x7〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x8) (Byte 〈x5,x8〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY x9) (Byte 〈x5,x9〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY xA) (Byte 〈x5,xA〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY xB) (Byte 〈x5,xB〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY xC) (Byte 〈x5,xC〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY xD) (Byte 〈x5,xD〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY xE) (Byte 〈x5,xE〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 DEC) (MODE_TNY xF) (Byte 〈x5,xF〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_RS08_15 ≝ +[ + quadruple … (anyOP RS08 EOR) MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 EOR) MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_16 ≝ +[ + quadruple … (anyOP RS08 INC) MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 +; quadruple … (anyOP RS08 INC) MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x0) (Byte 〈x2,x0〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x1) (Byte 〈x2,x1〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x2) (Byte 〈x2,x2〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x3) (Byte 〈x2,x3〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x4) (Byte 〈x2,x4〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x5) (Byte 〈x2,x5〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x6) (Byte 〈x2,x6〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x7) (Byte 〈x2,x7〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x8) (Byte 〈x2,x8〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY x9) (Byte 〈x2,x9〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY xA) (Byte 〈x2,xA〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY xB) (Byte 〈x2,xB〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY xC) (Byte 〈x2,xC〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY xD) (Byte 〈x2,xD〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY xE) (Byte 〈x2,xE〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 INC) (MODE_TNY xF) (Byte 〈x2,xF〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_RS08_17 ≝ +[ + quadruple … (anyOP RS08 JMP) MODE_IMM2 (Byte 〈xB,xC〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_RS08_18 ≝ +[ + quadruple … (anyOP RS08 BSR) MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 JSR) MODE_IMM2 (Byte 〈xB,xD〉) 〈x0,x4〉 +]. + +ndefinition opcode_table_RS08_19 ≝ +[ + quadruple … (anyOP RS08 LDA) MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 LDA) MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t00) (Byte 〈xC,x0〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t01) (Byte 〈xC,x1〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t02) (Byte 〈xC,x2〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t03) (Byte 〈xC,x3〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t04) (Byte 〈xC,x4〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t05) (Byte 〈xC,x5〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t06) (Byte 〈xC,x6〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t07) (Byte 〈xC,x7〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t08) (Byte 〈xC,x8〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t09) (Byte 〈xC,x9〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t0A) (Byte 〈xC,xA〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t0B) (Byte 〈xC,xB〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t0C) (Byte 〈xC,xC〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t0D) (Byte 〈xC,xD〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t0E) (Byte 〈xC,xE〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t0F) (Byte 〈xC,xF〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t10) (Byte 〈xD,x0〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t11) (Byte 〈xD,x1〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t12) (Byte 〈xD,x2〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t13) (Byte 〈xD,x3〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t14) (Byte 〈xD,x4〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t15) (Byte 〈xD,x5〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t16) (Byte 〈xD,x6〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t17) (Byte 〈xD,x7〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t18) (Byte 〈xD,x8〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t19) (Byte 〈xD,x9〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t1A) (Byte 〈xD,xA〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t1B) (Byte 〈xD,xB〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t1C) (Byte 〈xD,xC〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t1D) (Byte 〈xD,xD〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t1E) (Byte 〈xD,xE〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 LDA) (MODE_SRT t1F) (Byte 〈xD,xF〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_20 ≝ +[ + quadruple … (anyOP RS08 LSR) MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 +]. + +ndefinition opcode_table_RS08_21 ≝ +[ + quadruple … (anyOP RS08 MOV) MODE_IMM1_to_DIR1 (Byte 〈x3,xE〉) 〈x0,x4〉 +; quadruple … (anyOP RS08 MOV) MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 +]. + +ndefinition opcode_table_RS08_22 ≝ +[ + quadruple … (anyOP RS08 ORA) MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 ORA) MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_23 ≝ +[ + quadruple … (anyOP RS08 ROL) MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 +]. + +ndefinition opcode_table_RS08_24 ≝ +[ + quadruple … (anyOP RS08 ROR) MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 +]. + +ndefinition opcode_table_RS08_25 ≝ +[ + quadruple … (anyOP RS08 SBC) MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 SBC) MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08_26 ≝ +[ + quadruple … (anyOP RS08 STA) MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t00) (Byte 〈xE,x0〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t01) (Byte 〈xE,x1〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t02) (Byte 〈xE,x2〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t03) (Byte 〈xE,x3〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t04) (Byte 〈xE,x4〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t05) (Byte 〈xE,x5〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t06) (Byte 〈xE,x6〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t07) (Byte 〈xE,x7〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t08) (Byte 〈xE,x8〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t09) (Byte 〈xE,x9〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t0A) (Byte 〈xE,xA〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t0B) (Byte 〈xE,xB〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t0C) (Byte 〈xE,xC〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t0D) (Byte 〈xE,xD〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t0E) (Byte 〈xE,xE〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t0F) (Byte 〈xE,xF〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t10) (Byte 〈xF,x0〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t11) (Byte 〈xF,x1〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t12) (Byte 〈xF,x2〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t13) (Byte 〈xF,x3〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t14) (Byte 〈xF,x4〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t15) (Byte 〈xF,x5〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t16) (Byte 〈xF,x6〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t17) (Byte 〈xF,x7〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t18) (Byte 〈xF,x8〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t19) (Byte 〈xF,x9〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t1A) (Byte 〈xF,xA〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t1B) (Byte 〈xF,xB〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t1C) (Byte 〈xF,xC〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t1D) (Byte 〈xF,xD〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t1E) (Byte 〈xF,xE〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 STA) (MODE_SRT t1F) (Byte 〈xF,xF〉) 〈x0,x2〉 +]. + +ndefinition opcode_table_RS08_27 ≝ +[ + quadruple … (anyOP RS08 SUB) MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 +; quadruple … (anyOP RS08 SUB) MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x0) (Byte 〈x7,x0〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x1) (Byte 〈x7,x1〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x2) (Byte 〈x7,x2〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x3) (Byte 〈x7,x3〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x4) (Byte 〈x7,x4〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x5) (Byte 〈x7,x5〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x6) (Byte 〈x7,x6〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x7) (Byte 〈x7,x7〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x8) (Byte 〈x7,x8〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY x9) (Byte 〈x7,x9〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY xA) (Byte 〈x7,xA〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY xB) (Byte 〈x7,xB〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY xC) (Byte 〈x7,xC〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY xD) (Byte 〈x7,xD〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY xE) (Byte 〈x7,xE〉) 〈x0,x3〉 +; quadruple … (anyOP RS08 SUB) (MODE_TNY xF) (Byte 〈x7,xF〉) 〈x0,x3〉 +]. + +ndefinition opcode_table_RS08 ≝ +opcode_table_RS08_1 @ opcode_table_RS08_2 @ opcode_table_RS08_3 @ opcode_table_RS08_4 @ +opcode_table_RS08_5 @ opcode_table_RS08_6 @ opcode_table_RS08_7 @ opcode_table_RS08_8 @ +opcode_table_RS08_9 @ opcode_table_RS08_10 @ opcode_table_RS08_11 @ opcode_table_RS08_12 @ +opcode_table_RS08_13 @ opcode_table_RS08_14 @ opcode_table_RS08_15 @ opcode_table_RS08_16 @ +opcode_table_RS08_17 @ opcode_table_RS08_18 @ opcode_table_RS08_19 @ opcode_table_RS08_20 @ +opcode_table_RS08_21 @ opcode_table_RS08_22 @ opcode_table_RS08_23 @ opcode_table_RS08_24 @ +opcode_table_RS08_25 @ opcode_table_RS08_26 @ opcode_table_RS08_27. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/table_RS08_tests.ma b/helm/software/matita/contribs/ng_assembly/freescale/table_RS08_tests.ma new file mode 100755 index 000000000..32727bcef --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/table_RS08_tests.ma @@ -0,0 +1,78 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/table_RS08.ma". +include "freescale/opcode.ma". + +(* ***************** *) +(* TABELLA DELL'RS08 *) +(* ***************** *) + +(* RS08: opcode non implementati come da manuale *) +ndefinition RS08_not_impl_byte ≝ + [〈x3,x2〉;〈x3,x3〉;〈x3,xD〉 + ;〈x4,x0〉;〈x4,x7〉;〈x4,xD〉 + ;〈xA,x3〉;〈xA,x5〉;〈xA,x7〉 + ;〈xB,x3〉;〈xB,x5〉 + ]. + +nlemma ok_byte_table_RS08 : forall_b8 (λb. + (test_not_impl_byte b RS08_not_impl_byte ⊙ eq_w16 (get_byte_count RS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b RS08_not_impl_byte) ⊙ eq_w16 (get_byte_count RS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* RS08: pseudocodici non implementati come da manuale *) +ndefinition RS08_not_impl_pseudo ≝ + [ AIS ; AIX ; ASR ; BGE ; BGT ; BHCC ; BHCS ; BHI ; BIH ; BIL ; BIT ; BLE ; BLS + ; BLT ; BMC ; BMI ; BMS ; BPL ; BRN ; CBEQX ; CLI ; CPHX ; CPX ; DAA ; DIV + ; LDHX ; LDX ; MUL ; NEG ; NSA ; PSHA ; PSHH ; PSHX ; PULA ; PULH ; PULX ; RSP + ; RTI ; SEI ; STHX ; STX ; SWI ; TAP ; TAX ; TPA ; TST ; TSX ; TXA ; TXS ]. + +nlemma ok_pseudo_table_RS08 : forall_op (λo. + (test_not_impl_pseudo o RS08_not_impl_pseudo ⊙ le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count RS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08)) ⊗ + (⊖ (test_not_impl_pseudo o RS08_not_impl_pseudo) ⊙ eq_w16 (get_pseudo_count RS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* RS08: modalita' non implementate come da manuale *) +ndefinition RS08_not_impl_mode ≝ + [ MODE_INHX ; MODE_INHH ; MODE_INHX0ADD ; MODE_INHX1ADD ; MODE_INHX2ADD ; MODE_IMM1EXT + ; MODE_DIR2 ; MODE_IX0 ; MODE_IX1 ; MODE_IX2 ; MODE_SP1 ; MODE_SP2 + ; MODE_IX0p_to_DIR1 ; MODE_DIR1_to_IX0p ; MODE_INHX_and_IMM1 ; MODE_IX0_and_IMM1 + ; MODE_IX0p_and_IMM1 ; MODE_IX1_and_IMM1 ; MODE_IX1p_and_IMM1 ; MODE_SP1_and_IMM1 ]. + +nlemma ok_mode_table_RS08 : forall_im (λi. + (test_not_impl_mode i RS08_not_impl_mode ⊙ le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count RS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08)) ⊗ + (⊖ (test_not_impl_mode i RS08_not_impl_mode) ⊙ eq_w16 (get_mode_count RS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +nlemma ok_OpIm_table_RS08 : + forall_im (λi:instr_mode. + forall_op (λop:opcode. + le_w16 (get_OpIm_count RS08 (anyOP RS08 op) i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. + napply refl_eq. +nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/translation.ma b/helm/software/matita/contribs/ng_assembly/freescale/translation.ma new file mode 100755 index 000000000..0474e6e9b --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly/freescale/translation.ma @@ -0,0 +1,249 @@ +(**************************************************************************) +(* ___ *) +(* ||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: Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Cosimo Oliboni, oliboni@cs.unibo.it *) +(* *) +(* ********************************************************************** *) + +include "freescale/table_HC05.ma". +include "freescale/table_HC08.ma". +include "freescale/table_HCS08.ma". +include "freescale/table_RS08.ma". +include "common/option.ma". + +(* ***************************** *) +(* TRADUZIONE ESADECIMALE → INFO *) +(* ***************************** *) + +(* accesso alla tabella della ALU prescelta *) +ndefinition opcode_table ≝ +λm:mcu_type. + match m + return λm:mcu_type.list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8) + with + [ HC05 ⇒ opcode_table_HC05 + | HC08 ⇒ opcode_table_HC08 + | HCS08 ⇒ opcode_table_HCS08 + | RS08 ⇒ opcode_table_RS08 + ]. + +(* traduzione mcu+esadecimale → info *) +(* NB: la ricerca per byte non matcha con una word con lo stesso byte superiore uguale *) +(* NB: per matchare una word (precode+code) bisogna passare una word *) +(* NB: il risultato e' sempre un'opzione, NON esiste un dummy opcode tipo UNKNOWN/ILLEGAL *) +nlet rec full_info_of_word16_aux (m:mcu_type) (borw:byte8_or_word16) + (param:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on param ≝ + match param with + [ nil ⇒ None ? + | cons hd tl ⇒ + match thd4T … hd with + [ Byte b ⇒ match borw with + [ Byte borw' ⇒ match eq_b8 borw' b with + [ true ⇒ Some ? hd + | false ⇒ full_info_of_word16_aux m borw tl ] + | Word _ ⇒ full_info_of_word16_aux m borw tl ] + | Word w ⇒ match borw with + [ Byte _ ⇒ full_info_of_word16_aux m borw tl + | Word borw' ⇒ match eq_w16 borw' w with + [ true ⇒ Some ? hd + | false ⇒ full_info_of_word16_aux m borw tl ] + ]]]. + +ndefinition full_info_of_word16 ≝ +λm:mcu_type.λborw:byte8_or_word16. +full_info_of_word16_aux m borw (opcode_table m). + +(* ******************************************************* *) +(* TRADUZIONE MCU+OPCODE+MODALITA'+ARGOMENTI → ESADECIMALE *) +(* ******************************************************* *) + +(* introduzione di un tipo byte8 dipendente dall'mcu_type (phantom type) *) +ninductive t_byte8 (m:mcu_type) : Type ≝ + TByte : byte8 → t_byte8 m. + +nlemma tbyte8_destruct : ∀m,b1,b2.TByte m b1 = TByte m b2 → b1 = b2. + #m; #b1; #b2; #H; + nchange with (match TByte m b2 with [ TByte a ⇒ b1 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +(* introduzione di un tipo dipendente (dalla modalita') per gli argomenti *) +ninductive MA_check : instr_mode → Type ≝ + maINH : MA_check MODE_INH +| maINHA : MA_check MODE_INHA +| maINHX : MA_check MODE_INHX +| maINHH : MA_check MODE_INHH +| maINHX0ADD : MA_check MODE_INHX0ADD +| maINHX1ADD : byte8 → MA_check MODE_INHX1ADD +| maINHX2ADD : word16 → MA_check MODE_INHX2ADD +| maIMM1 : byte8 → MA_check MODE_IMM1 +| maIMM1EXT : byte8 → MA_check MODE_IMM1EXT +| maIMM2 : word16 → MA_check MODE_IMM2 +| maDIR1 : byte8 → MA_check MODE_DIR1 +| maDIR2 : word16 → MA_check MODE_DIR2 +| maIX0 : MA_check MODE_IX0 +| maIX1 : byte8 → MA_check MODE_IX1 +| maIX2 : word16 → MA_check MODE_IX2 +| maSP1 : byte8 → MA_check MODE_SP1 +| maSP2 : word16 → MA_check MODE_SP2 +| maDIR1_to_DIR1 : byte8 → byte8 → MA_check MODE_DIR1_to_DIR1 +| maIMM1_to_DIR1 : byte8 → byte8 → MA_check MODE_IMM1_to_DIR1 +| maIX0p_to_DIR1 : byte8 → MA_check MODE_IX0p_to_DIR1 +| maDIR1_to_IX0p : byte8 → MA_check MODE_DIR1_to_IX0p +| maINHA_and_IMM1 : byte8 → MA_check MODE_INHA_and_IMM1 +| maINHX_and_IMM1 : byte8 → MA_check MODE_INHX_and_IMM1 +| maIMM1_and_IMM1 : byte8 → byte8 → MA_check MODE_IMM1_and_IMM1 +| maDIR1_and_IMM1 : byte8 → byte8 → MA_check MODE_DIR1_and_IMM1 +| maIX0_and_IMM1 : byte8 → MA_check MODE_IX0_and_IMM1 +| maIX0p_and_IMM1 : byte8 → MA_check MODE_IX0p_and_IMM1 +| maIX1_and_IMM1 : byte8 → byte8 → MA_check MODE_IX1_and_IMM1 +| maIX1p_and_IMM1 : byte8 → byte8 → MA_check MODE_IX1p_and_IMM1 +| maSP1_and_IMM1 : byte8 → byte8 → MA_check MODE_SP1_and_IMM1 +| maDIRn : ∀n.byte8 → MA_check (MODE_DIRn n) +| maDIRn_and_IMM1 : ∀n.byte8 → byte8 → MA_check (MODE_DIRn_and_IMM1 n) +| maTNY : ∀e.MA_check (MODE_TNY e) +| maSRT : ∀t.MA_check (MODE_SRT t) +. + +(* picker: trasforma l'argomento necessario in input a bytes_of_pseudo_instr_mode_param: + MA_check i → list (t_byte8 m) *) +ndefinition args_picker ≝ +λm:mcu_type.λi:instr_mode.λargs:MA_check i. + match args with + (* inherent: legale se nessun operando *) + [ maINH ⇒ nil ? + | maINHA ⇒ nil ? + | maINHX ⇒ nil ? + | maINHH ⇒ nil ? + (* inherent address: legale se nessun operando/1 byte/1 word *) + | maINHX0ADD ⇒ nil ? + | maINHX1ADD b ⇒ [ TByte m b ] + | maINHX2ADD w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] + (* _0/1/2: legale se nessun operando/1 byte/1 word *) + | maIMM1 b ⇒ [ TByte m b ] + | maIMM1EXT b ⇒ [ TByte m b ] + | maIMM2 w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] + | maDIR1 b ⇒ [ TByte m b ] + | maDIR2 w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] + | maIX0 ⇒ nil ? + | maIX1 b ⇒ [ TByte m b ] + | maIX2 w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] + | maSP1 b ⇒ [ TByte m b ] + | maSP2 w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] + (* movimento: legale se 2 operandi byte *) + | maDIR1_to_DIR1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] + | maIMM1_to_DIR1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] + | maIX0p_to_DIR1 b ⇒ [ TByte m b] + | maDIR1_to_IX0p b ⇒ [ TByte m b] + (* cbeq/dbnz: legale se 1/2 operandi byte *) + | maINHA_and_IMM1 b ⇒ [ TByte m b] + | maINHX_and_IMM1 b ⇒ [ TByte m b] + | maIMM1_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] + | maDIR1_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] + | maIX0_and_IMM1 b ⇒ [ TByte m b] + | maIX0p_and_IMM1 b ⇒ [ TByte m b] + | maIX1_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] + | maIX1p_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] + | maSP1_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] + (* DIRn: legale se 1 operando byte *) + | maDIRn _ b ⇒ [ TByte m b] + (* DIRn_and_IMM1: legale se 2 operandi byte *) + | maDIRn_and_IMM1 _ b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] + (* TNY: legale se nessun operando *) + | maTNY _ ⇒ nil ? + (* SRT: legale se nessun operando *) + | maSRT _ ⇒ nil ? + ]. + +(* trasformatore finale: mcu+opcode+instr_mode+args → list (t_byte8 m) *) +nlet rec bytes_of_pseudo_instr_mode_param_aux (m:mcu_type) (o:any_opcode m) (i:instr_mode) (p:MA_check i) + (param:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on param ≝ + match param with + [ nil ⇒ None ? | cons hd tl ⇒ + match (eq_anyop m o (fst4T … hd)) ⊗ (eq_im i (snd4T … hd)) with + [ true ⇒ match thd4T … hd with + [ Byte isab ⇒ + Some ? ([ (TByte m isab) ]@(args_picker m i p)) + | Word isaw ⇒ + Some ? ([ (TByte m (w16h isaw)) ; (TByte m (w16l isaw)) ]@(args_picker m i p)) + ] + | false ⇒ bytes_of_pseudo_instr_mode_param_aux m o i p tl ]]. + +ndefinition bytes_of_pseudo_instr_mode_param ≝ +λm:mcu_type.λo:any_opcode m.λi:instr_mode.λp:MA_check i. +bytes_of_pseudo_instr_mode_param_aux m o i p (opcode_table m). + +(* ****************************** *) +(* APPROCCIO COMPILAZIONE AL VOLO *) +(* ****************************** *) + +(* ausiliario di compile *) +ndefinition defined_option ≝ + λT:Type.λo:option T. + match o with + [ None ⇒ False + | Some _ ⇒ True + ]. + +(* compila solo se l'intera istruzione+modalita'+argomenti ha riscontro nelle tabelle *) +ndefinition compile ≝ +λmcu:mcu_type.λi:instr_mode.λop:opcode.λarg:MA_check i. + match bytes_of_pseudo_instr_mode_param mcu (anyOP mcu op) i arg + return λres:option ?.defined_option ? res → ? + with + [ None ⇒ λp:defined_option ? (None ?).False_rect_Type0 ? p + | Some x ⇒ λp:defined_option ? (Some ? x).x + ]. + +(* detipatore del compilato: (t_byte8 m) → byte8 *) +nlet rec source_to_byte8_HC05_aux (p1:list (t_byte8 HC05)) (p2:list byte8) ≝ + match p1 with + [ nil ⇒ p2 + | cons hd tl ⇒ match hd with [ TByte b ⇒ source_to_byte8_HC05_aux tl (p2@[b]) ] + ]. + +nlet rec source_to_byte8_HC08_aux (p1:list (t_byte8 HC08)) (p2:list byte8) ≝ + match p1 with + [ nil ⇒ p2 + | cons hd tl ⇒ match hd with [ TByte b ⇒ source_to_byte8_HC08_aux tl (p2@[b]) ] + ]. + +nlet rec source_to_byte8_HCS08_aux (p1:list (t_byte8 HCS08)) (p2:list byte8) ≝ + match p1 with + [ nil ⇒ p2 + | cons hd tl ⇒ match hd with [ TByte b ⇒ source_to_byte8_HCS08_aux tl (p2@[b]) ] + ]. + +nlet rec source_to_byte8_RS08_aux (p1:list (t_byte8 RS08)) (p2:list byte8) ≝ + match p1 with + [ nil ⇒ p2 + | cons hd tl ⇒ match hd with [ TByte b ⇒ source_to_byte8_RS08_aux tl (p2@[b]) ] + ]. + +ndefinition source_to_byte8 ≝ +λm:mcu_type. + match m + return λm:mcu_type.list (t_byte8 m) → list byte8 + with + [ HC05 ⇒ λl:list (t_byte8 HC05).source_to_byte8_HC05_aux l [] + | HC08 ⇒ λl:list (t_byte8 HC08).source_to_byte8_HC08_aux l [] + | HCS08 ⇒ λl:list (t_byte8 HCS08).source_to_byte8_HCS08_aux l [] + | RS08 ⇒ λl:list (t_byte8 RS08).source_to_byte8_RS08_aux l [] + ]. -- 2.39.2