From 67303bc29318bd94a31903a92a2127697c5de84e Mon Sep 17 00:00:00 2001 From: Cosimo Oliboni Date: Sat, 6 Feb 2010 10:30:51 +0000 Subject: [PATCH] freescale porting --- .../matita/contribs/ng_assembly2/depends | 35 +- .../ng_assembly2/emulator/model/HC05_model.ma | 104 ++ .../ng_assembly2/emulator/model/HC08_model.ma | 97 ++ .../emulator/model/HCS08_model.ma | 102 ++ .../emulator/model/IP2022_model.ma | 111 ++ .../ng_assembly2/emulator/model/RS08_model.ma | 92 ++ .../ng_assembly2/emulator/model/model.ma | 89 ++ .../emulator/multivm/Freescale_multivm.ma | 1235 +++++++++++++++++ .../emulator/multivm/IP2022_multivm.ma | 122 ++ .../ng_assembly2/emulator/multivm/multivm.ma | 216 +++ .../emulator/multivm/multivm_base.ma | 39 + .../emulator/opcodes/HC05_table.ma | 420 +++--- .../emulator/opcodes/HC08_table.ma | 580 ++++---- .../emulator/opcodes/HCS08_table.ma | 600 ++++---- .../emulator/opcodes/IP2022_table.ma | 528 +++---- .../emulator/opcodes/RS08_table.ma | 490 +++---- .../ng_assembly2/emulator/opcodes/pseudo.ma | 2 +- .../emulator/read_write/Freescale_fetch.ma | 47 + .../read_write/Freescale_load_write.ma | 589 ++++++++ .../emulator/read_write/IP2022_fetch.ma | 54 + .../emulator/read_write/IP2022_load_write.ma | 286 ++++ .../emulator/read_write/IP2022_read_write.ma | 287 ++++ .../emulator/read_write/RS08_read_write.ma | 138 ++ .../ng_assembly2/emulator/read_write/fetch.ma | 35 + .../emulator/read_write/fetch_base.ma | 49 + .../emulator/read_write/load_write.ma | 80 ++ .../emulator/read_write/load_write_base.ma | 113 ++ .../emulator/read_write/read_write.ma | 84 ++ .../emulator/read_write/read_write_base.ma | 31 + .../emulator/status/IP2022_status_base.ma | 8 +- .../emulator/status/status_base.ma | 22 +- .../emulator/status/status_getter.ma | 348 +++++ .../emulator/status/status_setter.ma | 768 ++++++++++ .../emulator/tests/micro_tests_tools.ma | 80 ++ .../contribs/ng_assembly2/num/word24.ma | 7 + 35 files changed, 6557 insertions(+), 1331 deletions(-) create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/model/HC05_model.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/model/HC08_model.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/model/HCS08_model.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/model/IP2022_model.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/model/RS08_model.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/model/model.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/multivm/Freescale_multivm.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/multivm/IP2022_multivm.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/multivm/multivm.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/multivm/multivm_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/Freescale_fetch.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/Freescale_load_write.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_fetch.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_load_write.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_read_write.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/RS08_read_write.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/fetch.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/fetch_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/load_write.ma create mode 100644 helm/software/matita/contribs/ng_assembly2/emulator/read_write/load_write_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/read_write.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/read_write/read_write_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/status_getter.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/status_setter.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/tests/micro_tests_tools.ma diff --git a/helm/software/matita/contribs/ng_assembly2/depends b/helm/software/matita/contribs/ng_assembly2/depends index 563104796..fc6f53f6b 100644 --- a/helm/software/matita/contribs/ng_assembly2/depends +++ b/helm/software/matita/contribs/ng_assembly2/depends @@ -1,4 +1,6 @@ +emulator/model/HCS08_model.ma emulator/status/status.ma emulator/status/status_base.ma emulator/memory/memory_abs.ma emulator/opcodes/pseudo.ma emulator/status/HC05_status.ma emulator/status/HC08_status.ma emulator/status/IP2022_status.ma emulator/status/RS08_status.ma +emulator/tests/micro_tests_tools.ma common/list.ma num/word16.ma common/nelist.ma common/list.ma emulator/opcodes/HC05_table_tests.ma emulator/opcodes/HC05_table.ma emulator/opcodes/pseudo.ma emulator/opcodes/IP2022_instr_mode_base.ma num/bitrigesim.ma num/oct.ma @@ -8,58 +10,80 @@ emulator/status/HC08_status.ma emulator/status/HC08_status_base.ma compiler/ast_base_type_base.ma num/bool.ma common/nat.ma common/comp.ma num/bool_lemmas.ma emulator/opcodes/IP2022_pseudo.ma common/comp.ma emulator/opcodes/IP2022_pseudo_base.ma num/bool_lemmas.ma +emulator/read_write/load_write.ma emulator/read_write/Freescale_load_write.ma emulator/read_write/IP2022_load_write.ma num/exadecim.ma num/bool_lemmas.ma num/comp_ext.ma num/oct.ma emulator/memory/memory_struct_base.ma num/byte8.ma emulator/status/status.ma emulator/status/status_base.ma num/byte8.ma num/bitrigesim.ma num/comp_num.ma num/exadecim.ma +emulator/model/model.ma emulator/model/HC05_model.ma emulator/model/HC08_model.ma emulator/model/HCS08_model.ma emulator/model/IP2022_model.ma emulator/model/RS08_model.ma emulator/opcodes/HC08_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma emulator/memory/memory_base.ma common/comp.ma num/bool_lemmas.ma +emulator/multivm/multivm.ma emulator/multivm/Freescale_multivm.ma emulator/multivm/IP2022_multivm.ma emulator/read_write/fetch.ma emulator/opcodes/HC05_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma emulator/status/HC08_status_base.ma num/word16.ma common/comp.ma common/hints_declaration.ma num/bool.ma +emulator/read_write/Freescale_fetch.ma emulator/read_write/fetch_base.ma emulator/status/status.ma emulator/memory/memory_trees.ma common/list.ma emulator/memory/memory_base.ma emulator/memory/memory_struct.ma num/word32.ma emulator/opcodes/Freescale_pseudo.ma common/comp.ma emulator/opcodes/Freescale_pseudo_base.ma num/bool_lemmas.ma -emulator/status/HC05_status_base.ma num/word16.ma common/pts.ma +emulator/status/HC05_status_base.ma num/word16.ma num/comp_ext.ma common/comp.ma common/prod.ma common/ascii_base.ma num/bool.ma +emulator/multivm/IP2022_multivm.ma emulator/multivm/multivm_base.ma emulator/read_write/load_write.ma +emulator/read_write/IP2022_fetch.ma emulator/read_write/fetch_base.ma emulator/status/status.ma emulator/opcodes/RS08_table_tests.ma emulator/opcodes/RS08_table.ma emulator/opcodes/pseudo.ma +emulator/multivm/multivm_base.ma emulator/status/status_setter.ma compiler/environment.ma common/string.ma compiler/ast_type.ma -emulator/translation/translation_base.ma common/option.ma emulator/opcodes/HC05_table.ma emulator/opcodes/HC08_table.ma emulator/opcodes/HCS08_table.ma emulator/opcodes/IP2022_table.ma emulator/opcodes/RS08_table.ma emulator/opcodes/pseudo.ma +emulator/read_write/IP2022_read_write.ma emulator/read_write/read_write_base.ma emulator/status/status_setter.ma +emulator/translation/translation_base.ma emulator/opcodes/HC05_table.ma emulator/opcodes/HC08_table.ma emulator/opcodes/HCS08_table.ma emulator/opcodes/IP2022_table.ma emulator/opcodes/RS08_table.ma emulator/opcodes/pseudo.ma compiler/ast_base_type.ma common/comp.ma compiler/ast_base_type_base.ma num/bool_lemmas.ma emulator/opcodes/IP2022_table.ma common/list.ma emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_pseudo.ma emulator/opcodes/byte_or_word.ma emulator/status/HC05_status.ma emulator/status/HC05_status_base.ma emulator/memory/memory_bits.ma emulator/memory/memory_trees.ma -common/string.ma common/ascii.ma common/list.ma common/theory.ma common/pts.ma +common/string.ma common/ascii.ma common/list.ma +emulator/read_write/RS08_read_write.ma emulator/status/status_setter.ma emulator/opcodes/byte_or_word.ma num/word16.ma compiler/ast_type.ma compiler/ast_type_base.ma num/word16.ma common/nat.ma num/byte8.ma -emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_instr_mode_base.ma common/prod.ma common/comp.ma common/prod_base.ma num/bool_lemmas.ma +emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_instr_mode_base.ma +emulator/status/status_getter.ma emulator/status/status_setter.ma num/word24.ma num/byte8.ma num/bool_lemmas.ma common/comp.ma num/bool.ma +emulator/model/HC08_model.ma emulator/status/status.ma emulator/memory/memory_abs.ma emulator/memory/memory_bits.ma emulator/memory/memory_func.ma emulator/memory/memory_trees.ma emulator/status/IP2022_status_base.ma emulator/memory/memory_struct.ma num/word16.ma num/word24.ma +emulator/read_write/Freescale_load_write.ma emulator/read_write/load_write_base.ma emulator/status/status_getter.ma emulator/memory/memory_struct.ma emulator/memory/memory_struct_base.ma +emulator/model/HC05_model.ma emulator/status/status.ma +emulator/status/status_setter.ma emulator/status/status.ma num/word32.ma num/word16.ma common/ascii.ma common/ascii_base.ma common/comp.ma num/bool_lemmas.ma +emulator/read_write/load_write_base.ma emulator/read_write/read_write.ma +emulator/model/IP2022_model.ma emulator/status/status.ma emulator/opcodes/HCS08_table_tests.ma emulator/opcodes/HCS08_table.ma emulator/opcodes/pseudo.ma emulator/opcodes/IP2022_table_tests.ma emulator/opcodes/IP2022_table.ma emulator/opcodes/pseudo.ma emulator/status/IP2022_status.ma emulator/status/IP2022_status_base.ma emulator/translation/Freescale_translation.ma emulator/translation/translation_base.ma +emulator/read_write/read_write.ma emulator/read_write/IP2022_read_write.ma emulator/read_write/RS08_read_write.ma emulator/memory/memory_func.ma common/list.ma emulator/memory/memory_base.ma num/word16.ma emulator/opcodes/Freescale_instr_mode.ma common/comp.ma emulator/opcodes/Freescale_instr_mode_base.ma num/bool_lemmas.ma emulator/status/RS08_status_base.ma num/word16.ma +emulator/read_write/read_write_base.ma common/theory.ma emulator/status/RS08_status.ma emulator/status/RS08_status_base.ma compiler/ast_type_base.ma common/nelist.ma compiler/ast_base_type.ma common/prod_base.ma num/bool.ma common/option_base.ma num/bool.ma common/option.ma common/comp.ma common/option_base.ma num/bool_lemmas.ma +emulator/multivm/Freescale_multivm.ma emulator/multivm/multivm_base.ma emulator/read_write/load_write.ma emulator/opcodes/RS08_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma +emulator/model/RS08_model.ma emulator/status/status.ma num/comp_num.ma num/bool_lemmas.ma num/comp_ext.ma +emulator/read_write/fetch_base.ma emulator/translation/translation.ma common/sigma.ma common/theory.ma emulator/opcodes/HCS08_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma +emulator/read_write/IP2022_load_write.ma emulator/read_write/IP2022_fetch.ma emulator/read_write/load_write_base.ma emulator/status/status_getter.ma emulator/translation/IP2022_translation.ma emulator/translation/translation_base.ma universe/universe.ma common/nelist.ma common/prod.ma num/bitrigesim.ma common/comp.ma num/bool_lemmas.ma @@ -67,8 +91,9 @@ common/hints_declaration.ma common/pts.ma emulator/opcodes/pseudo.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_pseudo.ma emulator/opcodes/byte_or_word.ma emulator/opcodes/Freescale_pseudo_base.ma num/bool.ma emulator/translation/translation.ma emulator/translation/Freescale_translation.ma emulator/translation/IP2022_translation.ma +emulator/read_write/fetch.ma emulator/read_write/Freescale_fetch.ma emulator/read_write/IP2022_fetch.ma emulator/status/status_getter.ma num/oct.ma common/comp.ma num/bool_lemmas.ma -emulator/opcodes/IP2022_pseudo_base.ma num/bool.ma common/list.ma common/comp.ma common/nat.ma common/option.ma +emulator/opcodes/IP2022_pseudo_base.ma num/bool.ma emulator/opcodes/Freescale_instr_mode_base.ma num/bitrigesim.ma num/exadecim.ma emulator/opcodes/HC08_table_tests.ma emulator/opcodes/HC08_table.ma emulator/opcodes/pseudo.ma diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/model/HC05_model.ma b/helm/software/matita/contribs/ng_assembly2/emulator/model/HC05_model.ma new file mode 100755 index 000000000..3ebb443ae --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/model/HC05_model.ma @@ -0,0 +1,104 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status.ma". + +(* *********************************** *) +(* IMPOSTAZIONI SPECIFICHE DEI MODELLI *) +(* *********************************** *) + +(* modelli di HC05 *) +ninductive HC05_model : Type ≝ + MC68HC05J5A: HC05_model + (*..*). + +(* memoria degli HC05 *) +ndefinition memory_type_of_FamilyHC05 ≝ +λm:HC05_model.match m with + [ MC68HC05J5A ⇒ + [ +(* tutto mappato nel segmento 0 *) +(* 0x0080-0x00FF *) quadruple … o0 〈〈x0,x0〉:〈x8,x0〉〉 〈〈x0,x0〉:〈x8,x0〉〉 MEM_READ_WRITE (* 128B RAM+STACK *) +(* 0x0300-0x0CFF *) ; quadruple … o0 〈〈x0,x3〉:〈x0,x0〉〉 〈〈x0,xA〉:〈x0,x0〉〉 MEM_READ_ONLY (* 2560B USER ROM *) +(* 0x0E00-0x0FFF *) ; quadruple … o0 〈〈x0,xE〉:〈x0,x0〉〉 〈〈x0,x2〉:〈x0,x0〉〉 MEM_READ_ONLY (* 512B INTERNAL ROM *) ] + (* etc.. *) + ]. + +(* parametrizzati i non deterministici rispetto a tutti i valori casuali + che verranno dati dall'esterno di tipo byte8 (ndby1-2) e bool (ndbo1-5). + l'ACCENSIONE e' totalmente equivalente ad un reset causato da calo di tensione + (reset V-low), la memoria ed il check possono essere passati *) +ndefinition start_of_model_HC05 ≝ +λmcu:HC05_model.λt:memory_impl. +λmem:aux_mem_type t.λchk:aux_chk_type t. +λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. + let build ≝ λspm,spf,pcm:word16. + mk_any_status HC05 t + (mk_alu_HC05 + (* acc_low: ? *) ndby1 + (* indx_low: ? *) ndby2 + (* sp: reset *) (orc ? (andc ? 〈〈x0,x0〉:〈xF,xF〉〉 spm) spf) + (* spm *) spm + (* spf *) spf + (* pc: reset+fetch *) (andc ? (mk_word16 (mem_read_abs t mem o0 (andc ? 〈〈xF,xF〉:〈xF,xE〉〉 pcm)) + (mem_read_abs t mem o0 (andc ? 〈〈xF,xF〉:〈xF,xF〉〉 pcm))) pcm) + (* pcm *) pcm + (* H: ? *) ndbo1 + (* I: reset *) true + (* N: ? *) ndbo2 + (* Z: ? *) ndbo3 + (* C: ? *) ndbo4 + (* IRQ: ? *) irqfl) + (* mem *) mem + (* chk *) chk + (* clk: reset *) (None ?) in + match mcu with + [ MC68HC05J5A ⇒ build 〈〈x0,x0〉:〈x3,xF〉〉 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,xF〉:〈xF,xF〉〉 + (*..*) + ]. + +(* cio' che non viene resettato mantiene il valore precedente: nella documentazione + viene riportato come "unaffected"/"indeterminate"/"unpredictable" + il soft RESET e' diverso da un calo di tensione e la ram non variera' *) +ndefinition reset_of_model_HC05 ≝ +λt:memory_impl.λs:any_status HC05 t. + (mk_any_status HC05 t + (mk_alu_HC05 + (* acc_low: inv. *) (acc_low_reg_HC05 (alu ? t s)) + (* indx_low: inv. *) (indX_low_reg_HC05 (alu ? t s)) + (* sp: reset *) (orc ? (andc ? 〈〈x0,x0〉:〈xF,xF〉〉 (sp_mask_HC05 (alu ? t s))) + (sp_fix_HC05 (alu ? t s))) + (* spm: inv. *) (sp_mask_HC05 (alu ? t s)) + (* spf: inv. *) (sp_fix_HC05 (alu ? t s)) + (* pc: reset+fetch *) (andc ? (mk_word16 (mem_read_abs t (mem_desc ? t s) o0 (andc ? 〈〈xF,xF〉:〈xF,xE〉〉 (pc_mask_HC05 (alu ? t s)))) + (mem_read_abs t (mem_desc ? t s) o0 (andc ? 〈〈xF,xF〉:〈xF,xF〉〉 (pc_mask_HC05 (alu ? t s))))) + (pc_mask_HC05 (alu ? t s))) + (* pcm: inv. *) (pc_mask_HC05 (alu ? t s)) + (* H: inv. *) (h_flag_HC05 (alu ? t s)) + (* I: reset *) true + (* N: inv. *) (n_flag_HC05 (alu ? t s)) + (* Z: inv. *) (z_flag_HC05 (alu ? t s)) + (* C: inv. *) (c_flag_HC05 (alu ? t s)) + (* IRQ: inv *) (irq_flag_HC05 (alu ? t s))) + (* mem: inv. *) (mem_desc ? t s) + (* chk: inv. *) (chk_desc ? t s) + (* clk: reset *) (None ?)). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/model/HC08_model.ma b/helm/software/matita/contribs/ng_assembly2/emulator/model/HC08_model.ma new file mode 100755 index 000000000..f9c26a4fb --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/model/HC08_model.ma @@ -0,0 +1,97 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status.ma". + +(* *********************************** *) +(* IMPOSTAZIONI SPECIFICHE DEI MODELLI *) +(* *********************************** *) + +(* modelli di HC08 *) +ninductive HC08_model : Type ≝ + MC68HC08AB16A: HC08_model + (*..*). + +(* memoria degli HC08 *) +ndefinition memory_type_of_FamilyHC08 ≝ +λm:HC08_model.match m with + [ MC68HC08AB16A ⇒ + [ +(* tutto mappato nel segmento 0 *) +(* 0x0050-0x024F *) quadruple … o0 〈〈x0,x0〉:〈x5,x0〉〉 〈〈x0,x2〉:〈x0,x0〉〉 MEM_READ_WRITE (* 512B RAM *) +(* 0x0800-0x09FF *) ; quadruple … o0 〈〈x0,x8〉:〈x0,x0〉〉 〈〈x0,x2〉:〈x0,x0〉〉 MEM_READ_ONLY (* 512B EEPROM *) +(* 0xBE00-0xFDFF *) ; quadruple … o0 〈〈xB,xE〉:〈x0,x0〉〉 〈〈x4,x0〉:〈x0,x0〉〉 MEM_READ_ONLY (* 16384B ROM *) +(* 0xFE20-0xFF52 *) ; quadruple … o0 〈〈xF,xE〉:〈x2,x0〉〉 〈〈x0,x1〉:〈x3,x3〉〉 MEM_READ_ONLY (* 307B ROM *) +(* 0xFFD0-0xFFFF *) ; quadruple … o0 〈〈xF,xF〉:〈xD,x0〉〉 〈〈x0,x0〉:〈x3,x0〉〉 MEM_READ_ONLY (* 48B ROM *) ] + (* etc... *) + ]. + +(* parametrizzati i non deterministici rispetto a tutti i valori casuali + che verranno dati dall'esterno di tipo byte8 (ndby1-2) e bool (ndbo1-5). + l'ACCENSIONE e' totalmente equivalente ad un reset causato da calo di tensione + (reset V-low), la memoria ed il check possono essere passati *) +ndefinition start_of_model_HC08 ≝ +λmcu:HC08_model.λt:memory_impl. +λmem:aux_mem_type t.λchk:aux_chk_type t. +λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. + mk_any_status HC08 t + (mk_alu_HC08 + (* acc_low: ? *) ndby1 + (* indw_low: ? *) ndby2 + (* indx_high: reset *) 〈x0,x0〉 + (* sp: reset *) 〈〈x0,x0〉:〈xF,xF〉〉 + (* pc: reset+fetch *) (mk_word16 (mem_read_abs t mem o0 〈〈xF,xF〉:〈xF,xE〉〉) + (mem_read_abs t mem o0 〈〈xF,xF〉:〈xF,xF〉〉)) + (* V: ? *) ndbo1 + (* H: ? *) ndbo2 + (* I: reset *) true + (* N: ? *) ndbo3 + (* Z: ? *) ndbo4 + (* C: ? *) ndbo5 + (* IRQ: ? *) irqfl) + (* mem *) mem + (* chk *) chk + (* clk: reset *) (None ?). + +(* cio' che non viene resettato mantiene il valore precedente: nella documentazione + viene riportato come "unaffected"/"indeterminate"/"unpredictable" + il soft RESET e' diverso da un calo di tensione e la ram non variera' *) +ndefinition reset_of_model_HC08 ≝ +λt:memory_impl.λs:any_status HC08 t. + (mk_any_status HC08 t + (mk_alu_HC08 + (* acc_low: inv. *) (acc_low_reg_HC08 (alu ? t s)) + (* indx_low: inv. *) (indX_low_reg_HC08 (alu ? t s)) + (* indx_high: reset *) 〈x0,x0〉 + (* sp: reset *) 〈〈x0,x0〉:〈xF,xF〉〉 + (* pc: reset+fetch *) (mk_word16 (mem_read_abs t (mem_desc ? t s) o0 〈〈xF,xF〉:〈xF,xE〉〉) + (mem_read_abs t (mem_desc ? t s) o0 〈〈xF,xF〉:〈xF,xE〉〉)) + (* V: inv. *) (v_flag_HC08 (alu ? t s)) + (* H: inv. *) (h_flag_HC08 (alu ? t s)) + (* I: reset *) true + (* N: inv. *) (n_flag_HC08 (alu ? t s)) + (* Z: inv. *) (z_flag_HC08 (alu ? t s)) + (* C: inv. *) (c_flag_HC08 (alu ? t s)) + (* IRQ: inv *) (irq_flag_HC08 (alu ? t s))) + (* mem: inv. *) (mem_desc ? t s) + (* chk: inv. *) (chk_desc ? t s) + (* clk: reset *) (None ?)). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/model/HCS08_model.ma b/helm/software/matita/contribs/ng_assembly2/emulator/model/HCS08_model.ma new file mode 100755 index 000000000..ec0dc938e --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/model/HCS08_model.ma @@ -0,0 +1,102 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status.ma". + +(* *********************************** *) +(* IMPOSTAZIONI SPECIFICHE DEI MODELLI *) +(* *********************************** *) + +(* modelli di HCS08 *) +ninductive HCS08_model : Type ≝ + MC9S08AW60 : HCS08_model +| MC9S08GB60 : HCS08_model + (*..*). + +(* memoria degli HCS08 *) +ndefinition memory_type_of_FamilyHCS08 ≝ +λm:HCS08_model.match m with + [ MC9S08AW60 ⇒ + [ +(* tutto mappato nel segmento 0 *) +(* 0x0070-0x086F *) quadruple … o0 〈〈x0,x0〉:〈x7,x0〉〉 〈〈x0,x8〉:〈x0,x0〉〉 MEM_READ_WRITE (* 2048B RAM *) +(* 0x0870-0x17FF *) ; quadruple … o0 〈〈x0,x8〉:〈x7,x0〉〉 〈〈x0,xF〉:〈x9,x0〉〉 MEM_READ_ONLY (* 3984B FLASH *) +(* 0x1860-0xFFFF *) ; quadruple … o0 〈〈x1,x8〉:〈x6,x0〉〉 〈〈xE,x7〉:〈xA,x0〉〉 MEM_READ_ONLY (* 59296B FLASH *) ] + | MC9S08GB60 ⇒ + [ +(* tutto mappato nel segmento 0 *) +(* 0x0080-0x107F *) quadruple … o0 〈〈x0,x0〉:〈x8,x0〉〉 〈〈x1,x0〉:〈x0,x0〉〉 MEM_READ_WRITE (* 4096B RAM *) +(* 0x1080-0x17FF *) ; quadruple … o0 〈〈x1,x0〉:〈x8,x0〉〉 〈〈x0,x7〉:〈x8,x0〉〉 MEM_READ_ONLY (* 1920B FLASH *) +(* 0x182C-0xFFFF *) ; quadruple … o0 〈〈x1,x8〉:〈x2,xC〉〉 〈〈xE,x7〉:〈xD,x4〉〉 MEM_READ_ONLY (* 59348B FLASH *) ] + (* etc... *) + ]. + +(* parametrizzati i non deterministici rispetto a tutti i valori casuali + che verranno dati dall'esterno di tipo byte8 (ndby1-2) e bool (ndbo1-5). + l'ACCENSIONE e' totalmente equivalente ad un reset causato da calo di tensione + (reset V-low), la memoria ed il check possono essere passati *) +ndefinition start_of_model_HCS08 ≝ +λmcu:HCS08_model.λt:memory_impl. +λmem:aux_mem_type t.λchk:aux_chk_type t. +λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. + mk_any_status HCS08 t + (mk_alu_HC08 + (* acc_low: ? *) ndby1 + (* indw_low: ? *) ndby2 + (* indx_high: reset *) 〈x0,x0〉 + (* sp: reset *) 〈〈x0,x0〉:〈xF,xF〉〉 + (* pc: reset+fetch *) (mk_word16 (mem_read_abs t mem o0 〈〈xF,xF〉:〈xF,xE〉〉) + (mem_read_abs t mem o0 〈〈xF,xF〉:〈xF,xF〉〉)) + (* V: ? *) ndbo1 + (* H: ? *) ndbo2 + (* I: reset *) true + (* N: ? *) ndbo3 + (* Z: ? *) ndbo4 + (* C: ? *) ndbo5 + (* IRQ: ? *) irqfl) + (* mem *) mem + (* chk *) chk + (* clk: reset *) (None ?). + +(* cio' che non viene resettato mantiene il valore precedente: nella documentazione + viene riportato come "unaffected"/"indeterminate"/"unpredictable" + il soft RESET e' diverso da un calo di tensione e la ram non variera' *) +ndefinition reset_of_model_HCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t. + (mk_any_status HCS08 t + (mk_alu_HC08 + (* acc_low: inv. *) (acc_low_reg_HC08 (alu ? t s)) + (* indx_low: inv. *) (indX_low_reg_HC08 (alu ? t s)) + (* indx_high: reset *) 〈x0,x0〉 + (* sp: reset *) 〈〈x0,x0〉:〈xF,xF〉〉 + (* pc: reset+fetch *) (mk_word16 (mem_read_abs t (mem_desc ? t s) o0 〈〈xF,xF〉:〈xF,xE〉〉) + (mem_read_abs t (mem_desc ? t s) o0 〈〈xF,xF〉:〈xF,xE〉〉)) + (* V: inv. *) (v_flag_HC08 (alu ? t s)) + (* H: inv. *) (h_flag_HC08 (alu ? t s)) + (* I: reset *) true + (* N: inv. *) (n_flag_HC08 (alu ? t s)) + (* Z: inv. *) (z_flag_HC08 (alu ? t s)) + (* C: inv. *) (c_flag_HC08 (alu ? t s)) + (* IRQ: inv *) (irq_flag_HC08 (alu ? t s))) + (* mem: inv. *) (mem_desc ? t s) + (* chk: inv. *) (chk_desc ? t s) + (* clk: reset *) (None ?)). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/model/IP2022_model.ma b/helm/software/matita/contribs/ng_assembly2/emulator/model/IP2022_model.ma new file mode 100755 index 000000000..f88130613 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/model/IP2022_model.ma @@ -0,0 +1,111 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status.ma". + +(* *********************************** *) +(* IMPOSTAZIONI SPECIFICHE DEI MODELLI *) +(* *********************************** *) + +(* modelli di IP2022 *) +ninductive IP2022_model : Type ≝ + IP2K: IP2022_model. + +(* memoria degli IP2022 *) +ndefinition memory_type_of_FamilyIP2022 ≝ +λm:IP2022_model.match m with + [ IP2K ⇒ + [ +(* mappato nel segmento 0 *) +(* 0x00000002-0x0000007F *) quadruple … o0 〈〈x0,x0〉:〈x0,x2〉〉 〈〈x0,x0〉:〈x7,xE〉〉 MEM_READ_ONLY (* 126B SystemMemoryReg *) +(* 0x00000080-0x00000FFF *) ; quadruple … o0 〈〈x0,x0〉:〈x8,x0〉〉 〈〈x0,xF〉:〈x8,x0〉〉 MEM_READ_WRITE (* 3968 UserMemoryReg+RAM+STACK *) +(* tutto mappato nel segmento 1 *) +(* 0x02000000-0x02003FFF *) ; quadruple … o1 〈〈x0,x0〉:〈x0,x0〉〉 〈〈x4,x0〉:〈x0,x0〉〉 MEM_READ_WRITE (* 16384B PROGRAM RAM *) +(* tutto mappato nel segmento 2 *) +(* 0x02010000-0x02013FFF *) ; quadruple … o2 〈〈x0,x0〉:〈x0,x0〉〉 〈〈x4,x0〉:〈x0,x0〉〉 MEM_READ_ONLY (* 16384B PROGRAM FLASH *) +(* 0x02014000-0x02017FFF *) ; quadruple … o2 〈〈x4,x0〉:〈x0,x0〉〉 〈〈x4,x0〉:〈x0,x0〉〉 MEM_READ_ONLY (* 16384B PROGRAM FLASH *) +(* 0x02018000-0x0201BFFF *) ; quadruple … o2 〈〈x8,x0〉:〈x0,x0〉〉 〈〈x4,x0〉:〈x0,x0〉〉 MEM_READ_ONLY (* 16384B PROGRAM FLASH *) +(* 0x0201C000-0x0201FFFF *) ; quadruple … o2 〈〈xC,x0〉:〈x0,x0〉〉 〈〈x4,x0〉:〈x0,x0〉〉 MEM_READ_ONLY (* 16384B PROGRAM FLASH *) ] + (*..*) + ]. + +(* punto di riferimento per accessi $FR, ($IP) ($DP) ($SP) *) +ndefinition IP2022_gpr_base ≝ 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x0,x0〉〉〉. +(* punto di riferimento per accessi ($PC) ($ADDR) *) +ndefinition IP2022_ram_base ≝ 〈〈〈x0,x2〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x0,x0〉〉〉. + +(* parametrizzati i non deterministici rispetto a tutti i valori casuali + che verranno dati dall'esterno di tipo byte8 (ndby1-2) e bool (ndbo1-5). + l'ACCENSIONE e' totalmente equivalente ad un reset causato da calo di tensione + (reset V-low), la memoria ed il check possono essere passati *) +ndefinition start_of_model_IP2022 ≝ +λmcu:IP2022_model.λt:memory_impl. +λmem:aux_mem_type t.λchk:aux_chk_type t. +λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. + (mk_any_status IP2022 t + (mk_alu_IP2022 + (* acc_low: reset *) 〈x0,x0〉 + (* mulh: reset *) 〈x0,x0〉 + (* addrsel: reset *) 〈x0,x0〉 + (* addr: reset *) new_addrarray + (* call: reset *) new_callstack + (* ip: reset *) 〈〈x0,x0〉:〈x0,x0〉〉 + (* dp: reset *) 〈〈x0,x0〉:〈x0,x0〉〉 + (* data: reset *) 〈〈x0,x0〉:〈x0,x0〉〉 + (* sp: reset *) 〈〈x0,x0〉:〈x0,x0〉〉 + (* pc: reset *) 〈〈xF,xF〉:〈xF,x0〉〉 + (* speed: reset *) x3 + (* page: reset *) o7 + (* H: reset *) false + (* Z: reset *) false + (* C: reset *) false + (* skip mode: reset *) false) + (* mem *) mem + (* chk *) chk + (* clk: reset *) (None ?)). + +(* cio' che non viene resettato mantiene il valore precedente: nella documentazione + viene riportato come "unaffected"/"indeterminate"/"unpredictable" + il soft RESET e' diverso da un calo di tensione e la ram non variera' *) +ndefinition reset_of_model_IP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t. + (mk_any_status IP2022 t + (mk_alu_IP2022 + (* acc_low: reset *) 〈x0,x0〉 + (* mulh: reset *) 〈x0,x0〉 + (* addrsel: reset *) 〈x0,x0〉 + (* addr: reset *) new_addrarray + (* call: reset *) new_callstack + (* ip: reset *) 〈〈x0,x0〉:〈x0,x0〉〉 + (* dp: reset *) 〈〈x0,x0〉:〈x0,x0〉〉 + (* data: reset *) 〈〈x0,x0〉:〈x0,x0〉〉 + (* sp: reset *) 〈〈x0,x0〉:〈x0,x0〉〉 + (* pc: reset *) 〈〈xF,xF〉:〈xF,x0〉〉 + (* speed: reset *) x3 + (* page: reset *) o7 + (* H: reset *) false + (* Z: reset *) false + (* C: reset *) false + (* skip mode: reset *) false) + (* mem: inv. *) (mem_desc ? t s) + (* chk: inv. *) (chk_desc ? t s) + (* clk: reset *) (None ?)). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/model/RS08_model.ma b/helm/software/matita/contribs/ng_assembly2/emulator/model/RS08_model.ma new file mode 100755 index 000000000..696b968e1 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/model/RS08_model.ma @@ -0,0 +1,92 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status.ma". + +(* *********************************** *) +(* IMPOSTAZIONI SPECIFICHE DEI MODELLI *) +(* *********************************** *) + +(* modelli di RS08 *) +ninductive RS08_model : Type ≝ + MC9RS08KA1 : RS08_model +| MC9RS08KA2 : RS08_model. + +(* memoria dei RS08 *) +ndefinition memory_type_of_FamilyRS08 ≝ +λm:RS08_model.match m with + [ MC9RS08KA1 ⇒ + [ +(* tutto mappato nel segmento 0 *) +(* 0x0020-0x004F *) quadruple … o0 〈〈x0,x0〉:〈x2,x0〉〉 〈〈x0,x0〉:〈x3,x0〉〉 MEM_READ_WRITE (* 48B RAM *) +(* 0x00C0-0x00FF *) ; quadruple … o0 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,x0〉:〈x4,x0〉〉 MEM_READ_WRITE (* 64B RAM PAGING *) +(* 0x0200-0x023F *) ; quadruple … o0 〈〈x0,x2〉:〈x0,x0〉〉 〈〈x0,x0〉:〈x4,x0〉〉 MEM_READ_WRITE (* 64B MEMORY MAPPED IO *) +(* 0x3C00-0x3FFF *) ; quadruple … o0 〈〈x3,xC〉:〈x0,x0〉〉 〈〈x0,x4〉:〈x0,x0〉〉 MEM_READ_ONLY (* 1024B FLASH *) ] + | MC9RS08KA2 ⇒ + [ +(* tutto mappato nel segmento 0 *) +(* 0x0020-0x004F *) quadruple … o0 〈〈x0,x0〉:〈x2,x0〉〉 〈〈x0,x0〉:〈x3,x0〉〉 MEM_READ_WRITE (* 48B RAM *) +(* 0x00C0-0x00FF *) ; quadruple … o0 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,x0〉:〈x4,x0〉〉 MEM_READ_WRITE (* 64B RAM PAGING *) +(* 0x0200-0x023F *) ; quadruple … o0 〈〈x0,x2〉:〈x0,x0〉〉 〈〈x0,x0〉:〈x4,x0〉〉 MEM_READ_WRITE (* 64B MEMORY MAPPED IO *) +(* 0x3800-0x3FFF *) ; quadruple … o0 〈〈x3,x8〉:〈x0,x0〉〉 〈〈x0,x8〉:〈x0,x0〉〉 MEM_READ_ONLY (* 2048B FLASH *) ] + ]. + +(* parametrizzati i non deterministici rispetto a tutti i valori casuali + che verranno dati dall'esterno di tipo byte8 (ndby1-2) e bool (ndbo1-5). + l'ACCENSIONE e' totalmente equivalente ad un reset causato da calo di tensione + (reset V-low), la memoria ed il check possono essere passati *) +ndefinition start_of_model_RS08 ≝ +λmcu:RS08_model.λt:memory_impl. +λmem:aux_mem_type t.λchk:aux_chk_type t. +λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. + (mk_any_status RS08 t + (mk_alu_RS08 + (* acc_low: reset *) 〈x0,x0〉 + (* pc: reset *) 〈〈x3,xF〉:〈xF,xD〉〉 + (* pcm *) 〈〈x3,xF〉:〈xF,xF〉〉 + (* spc: reset *) 〈〈x3,xF〉:〈xF,xD〉〉 + (* xm: reset *) 〈x0,x0〉 + (* psm: *) 〈x8,x0〉 + (* Z: reset *) false + (* C: reset *) false) + (* mem *) mem + (* chk *) chk + (* clk: reset *) (None ?)). + +(* cio' che non viene resettato mantiene il valore precedente: nella documentazione + viene riportato come "unaffected"/"indeterminate"/"unpredictable" + il soft RESET e' diverso da un calo di tensione e la ram non variera' *) +ndefinition reset_of_model_RS08 ≝ +λt:memory_impl.λs:any_status RS08 t. + (mk_any_status RS08 t + (mk_alu_RS08 + (* acc_low: reset *) 〈x0,x0〉 + (* pc: reset *) 〈〈x3,xF〉:〈xF,xD〉〉 + (* pcm *) (pc_mask_RS08 (alu ? t s)) + (* spc: reset *) 〈〈x3,xF〉:〈xF,xD〉〉 + (* xm: reset *) 〈x0,x0〉 + (* psm: reset *) 〈x8,x0〉 + (* Z: reset *) false + (* C: reset *) false) + (* mem: inv. *) (mem_desc ? t s) + (* chk: inv. *) (chk_desc ? t s) + (* clk: reset *) (None ?)). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/model/model.ma b/helm/software/matita/contribs/ng_assembly2/emulator/model/model.ma new file mode 100755 index 000000000..e730ced17 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/model/model.ma @@ -0,0 +1,89 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/model/HC05_model.ma". +include "emulator/model/HC08_model.ma". +include "emulator/model/HCS08_model.ma". +include "emulator/model/RS08_model.ma". +include "emulator/model/IP2022_model.ma". + +(* *********************************** *) +(* IMPOSTAZIONI SPECIFICHE DEI MODELLI *) +(* *********************************** *) + +(* raggruppamento dei modelli *) +ndefinition aux_model_type ≝ +λm:mcu_type.match m with + [ HC05 ⇒ HC05_model + | HC08 ⇒ HC08_model + | HCS08 ⇒ HCS08_model + | RS08 ⇒ RS08_model + | IP2022 ⇒ IP2022_model + ]. + +(* ∀modello.descrizione della memoria installata *) +ndefinition memory_type_of_model ≝ +λm:mcu_type. + match m + return λm.aux_model_type m → ? + with + [ HC05 ⇒ memory_type_of_FamilyHC05 + | HC08 ⇒ memory_type_of_FamilyHC08 + | HCS08 ⇒ memory_type_of_FamilyHCS08 + | RS08 ⇒ memory_type_of_FamilyRS08 + | IP2022 ⇒ memory_type_of_FamilyIP2022 + ]. + +(* dato un modello costruisce un descrittore a partire dalla lista precedente *) +nlet rec build_memory_type_of_model_aux t param (result:aux_chk_type t) on param ≝ + match param with + [ nil ⇒ result + | cons hd tl ⇒ + build_memory_type_of_model_aux t tl + (check_update_ranged t result (fst4T … hd) (snd4T … hd) + (thd4T … hd) (fth4T … hd)) ]. + +ndefinition build_memory_type_of_model ≝ +λm:mcu_type.λmcu:aux_model_type m.λt:memory_impl. + build_memory_type_of_model_aux t (memory_type_of_model m mcu) (out_of_bound_memory t). + +ndefinition start_of_model ≝ +λm:mcu_type. + match m + return λm.aux_model_type m → ? + with + [ HC05 ⇒ start_of_model_HC05 + | HC08 ⇒ start_of_model_HC08 + | HCS08 ⇒ start_of_model_HCS08 + | RS08 ⇒ start_of_model_RS08 + | IP2022 ⇒ start_of_model_IP2022 + ]. + +ndefinition reset_of_model ≝ +λm:mcu_type. + match m return λm.Πt.(any_status m t) → ? with + [ HC05 ⇒ reset_of_model_HC05 + | HC08 ⇒ reset_of_model_HC08 + | HCS08 ⇒ reset_of_model_HCS08 + | RS08 ⇒ reset_of_model_RS08 + | IP2022 ⇒ reset_of_model_IP2022 + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/multivm/Freescale_multivm.ma b/helm/software/matita/contribs/ng_assembly2/emulator/multivm/Freescale_multivm.ma new file mode 100755 index 000000000..9a7b36c8a --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/multivm/Freescale_multivm.ma @@ -0,0 +1,1235 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/multivm/multivm_base.ma". +include "emulator/read_write/load_write.ma". + +(* ************************************************ *) +(* LOGICHE AUSILIARE CHE ACCOMUNANO PIU' OPERAZIONI *) +(* ************************************************ *) + +(* A = [true] fAMC(A,M,C), [false] A *) +(* cioe' in caso di false l'operazione viene eseguita ma modifica solo i flag *) +(* fAMC e' la logica da applicare: somma con/senza carry *) +ndefinition execute_ADC_ADD_aux ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m.λsetflag:bool. +λfAMC:bool → byte8 → byte8 → ProdT bool byte8. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + let A_op ≝ get_acc_8_low_reg … s_tmp1 in + match fAMC (get_c_flag … s_tmp1) A_op M_op with + [ pair carry R_op ⇒ + let A7 ≝ getMSBc ? A_op in + let M7 ≝ getMSBc ? M_op in + let R7 ≝ getMSBc ? R_op in + let A3 ≝ getMSBc ? (cnL ? A_op) in + let M3 ≝ getMSBc ? (cnL ? M_op) in + let R3 ≝ getMSBc ? (cnL ? R_op) in + (* A = [true] fAMC(A,M,C), [false] A *) + let s_tmp2 ≝ match setflag with [ true ⇒ set_acc_8_low_reg … s_tmp1 R_op | false ⇒ s_tmp1 ] in + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp3 ≝ set_zflb … s_tmp2 R_op in + (* C = A7&M7 | M7&nR7 | nR7&A7 *) + let s_tmp4 ≝ set_c_flag … s_tmp3 ((A7⊗M7) ⊕ (M7⊗(⊖R7)) ⊕ ((⊖R7)⊗A7)) in + (* N = R7 *) + let s_tmp5 ≝ set_nflb … s_tmp4 R_op in + (* H = A3&M3 | M3&nR3 | nR3&A3 *) + let s_tmp6 ≝ setweak_h_flag … s_tmp5 ((A3⊗M3) ⊕ (M3⊗(⊖R3)) ⊕ ((⊖R3)⊗A3)) in + (* V = A7&M7&nR7 | nA7&nM7&R7 *) + let s_tmp7 ≝ setweak_v_flag … s_tmp6 ((A7⊗M7⊗(⊖R7)) ⊕ ((⊖A7)⊗(⊖M7)⊗R7)) in + (* newpc = nextpc *) + Some ? (pair … s_tmp7 new_pc) ]]). + +(* A = [true] fAM(A,M), [false] A *) +(* cioe' in caso di false l'operazione viene eseguita ma modifica solo i flag *) +(* fAM e' la logica da applicare: and/xor/or *) +ndefinition execute_AND_BIT_EOR_ORA_aux ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m.λsetflag:bool. +λfAM:byte8 → byte8 → byte8. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + let R_op ≝ fAM (get_acc_8_low_reg … s_tmp1) M_op in + (* A = [true] fAM(A,M), [false] A *) + let s_tmp2 ≝ match setflag with [ true ⇒ set_acc_8_low_reg … s_tmp1 R_op | false ⇒ s_tmp1 ] in + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp3 ≝ set_zflb … s_tmp2 R_op in + (* N = R7 *) + let s_tmp4 ≝ set_nflb … s_tmp3 R_op in + (* V = 0 *) + let s_tmp5 ≝ setweak_v_flag … s_tmp4 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp5 new_pc) ]). + +(* M = fMC(M,C) *) +(* fMC e' la logica da applicare: rc_/ro_/sh_ *) +ndefinition execute_ASL_ASR_LSR_ROL_ROR_aux ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. +λfMC:bool → byte8 → ProdT bool byte8. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op _ ⇒ + match fMC (get_c_flag … s_tmp1) M_op with [ pair carry R_op ⇒ + (* M = fMC(M,C) *) + opt_map … (multi_mode_writeb … s_tmp1 cur_pc auxMode_ok i R_op) + (λS_PC.match S_PC with + [ pair s_tmp2 new_pc ⇒ + (* C = carry *) + let s_tmp3 ≝ set_c_flag … s_tmp2 carry in + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp4 ≝ set_zflb … s_tmp3 R_op in + (* N = R7 *) + let s_tmp5 ≝ set_nflb … s_tmp4 R_op in + (* V = R7 ⊙ carry *) + let s_tmp6 ≝ setweak_v_flag … s_tmp5 ((getMSBc ? R_op) ⊙ carry) in + (* newpc = nextpc *) + Some ? (pair … s_tmp6 new_pc) ])]]). + +(* branch con byte+estensione segno *) +ndefinition branched_pc ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λb:byte8. + get_pc_reg … (set_pc_reg … s (plusc_d_d ? cur_pc (exts_w16 b))). + +(* if COND=1 branch *) +(* tutti i branch calcoleranno la condizione e la passeranno qui *) +ndefinition execute_any_BRANCH ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m.λfCOND:bool. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + (* if true, branch *) + match fCOND with + (* newpc = nextpc + rel *) + [ true ⇒ Some ? (pair … s_tmp1 (branched_pc … s_tmp1 new_pc M_op)) + (* newpc = nextpc *) + | false ⇒ Some ? (pair … s_tmp1 new_pc) ]]). + +(* Mn = filtered optval *) +(* il chiamante passa 0x00 per azzerare, 0xFF per impostare il bit di M *) +ndefinition execute_BCLRn_BSETn_aux ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m.λoptval:byte8. + (* Mn = filtered optval *) + opt_map … (multi_mode_writeb … s cur_pc auxMode_ok i optval) + (λS_PC.match S_PC with + (* newpc = nextpc *) + [ pair s_tmp1 new_pc ⇒ Some ? (pair … s_tmp1 new_pc) ]). + +(* if COND(Mn) branch *) +(* il chiamante passa la logica da testare (0x00,¬0x00) e poi si salta *) +ndefinition execute_BRCLRn_BRSETn_aux ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m.λfCOND:byte8 → bool. + opt_map … (multi_mode_loadw … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ match M_op with + [ mk_comp_num MH_op ML_op ⇒ + (* if COND(Mn) branch *) + match fCOND MH_op with + (* newpc = nextpc + rel *) + [ true ⇒ Some ? (pair … s_tmp1 (branched_pc … s_tmp1 new_pc ML_op)) + (* newpc = nextpc *) + | false ⇒ Some ? (pair … s_tmp1 new_pc) ]]]). + +(* A = [true] fAMC(A,M,C), [false] A *) +(* cioe' in caso di false l'operazione viene eseguita ma modifica solo i flag *) +(* fAMC e' la logica da applicare: sottrazione con/senza carry *) +ndefinition execute_CMP_SBC_SUB_aux ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m.λsetflag:bool. +λfAMC:bool → byte8 → byte8 → ProdT bool byte8. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + let A_op ≝ get_acc_8_low_reg … s_tmp1 in + match fAMC (get_c_flag … s_tmp1) A_op M_op with + [ pair carry R_op ⇒ + let A7 ≝ getMSBc ? A_op in + let M7 ≝ getMSBc ? M_op in + let R7 ≝ getMSBc ? R_op in + (* A = [true] fAMC(A,M,C), [false] A *) + let s_tmp2 ≝ match setflag with [ true ⇒ set_acc_8_low_reg … s_tmp1 R_op | false ⇒ s_tmp1 ] in + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp3 ≝ set_zflb … s_tmp2 R_op in + (* C = nA7&M7 | M7&R7 | R7&nA7 *) + let s_tmp4 ≝ set_c_flag … s_tmp3 (((⊖A7)⊗M7) ⊕ (M7⊗R7) ⊕ (R7⊗(⊖A7))) in + (* N = R7 *) + let s_tmp5 ≝ set_nflb … s_tmp4 R_op in + (* V = A7&nM7&nR7 | nA7&M7&R7 *) + let s_tmp6 ≝ setweak_v_flag … s_tmp5 ((A7⊗(⊖M7)⊗(⊖R7)) ⊕ ((⊖A7)⊗M7⊗R7)) in + (* newpc = nextpc *) + Some ? (pair … s_tmp6 new_pc) ]]). + +(* M = fM(M) *) +(* fM e' la logica da applicare: not/neg/++/-- *) +ndefinition execute_COM_DEC_INC_NEG_aux ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. +λfM:byte8 → byte8.λfV:bool → bool → bool.λfC:bool → byte8 → bool. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op _ ⇒ + let R_op ≝ fM M_op in + (* M = fM(M) *) + opt_map … (multi_mode_writeb … s_tmp1 cur_pc auxMode_ok i R_op) + (λS_PC.match S_PC with + [ pair s_tmp2 new_pc ⇒ + (* C = fCR (C,R) *) + let s_tmp3 ≝ set_c_flag … s_tmp2 (fC (get_c_flag … s_tmp2) R_op) in + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp4 ≝ set_zflb … s_tmp3 R_op in + (* N = R7 *) + let s_tmp5 ≝ set_nflb … s_tmp4 R_op in + (* V = fV (M7,R7) *) + let s_tmp6 ≝ setweak_v_flag … s_tmp5 (fV (getMSBc ? M_op) (getMSBc ? R_op)) in + (* newpc = nextpc *) + Some ? (pair … s_tmp6 new_pc) ])]). + +(* il classico push *) +ndefinition aux_push ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval:byte8. + opt_map … (get_sp_reg … s) + (* [SP] = val *) + (λSP_op.opt_map … (memory_filter_write … s SP_op auxMode_ok val) + (* SP -- *) + (λs_tmp1.opt_map … (set_sp_reg … s_tmp1 (predc ? SP_op)) + (λs_tmp2.Some ? s_tmp2))). + +(* il classico pop *) +(* NB: l'incremento di SP deve essere filtrato dalla ALU, quindi get(set(SP)) *) +ndefinition aux_pop ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + opt_map … (get_sp_reg … s) + (* SP ++ *) + (λSP_op.opt_map … (set_sp_reg … s (succc ? SP_op)) + (λs_tmp1.opt_map … (get_sp_reg … s_tmp1) + (* val = [SP] *) + (λSP_op'.opt_map … (memory_filter_read … s_tmp1 SP_op') + (λval.Some ? (pair … s_tmp1 val))))). + +(* CCR corrisponde a V11HINZC e cmq 1 se un flag non esiste *) +(* i flag mantengono posizione costante nelle varie ALU, e se non sono + implementati corrispondono a 1 *) +ndefinition aux_get_CCR_aux ≝ +λopt:option bool.match opt with [ None ⇒ true | Some b ⇒ b ]. + +ndefinition aux_get_CCR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + byte8_of_bits (mk_Array8T ? + (aux_get_CCR_aux (get_v_flag … s)) + true + true + (aux_get_CCR_aux (get_h_flag … s)) + (aux_get_CCR_aux (get_i_flag … s)) + (aux_get_CCR_aux (get_n_flag … s)) + (get_z_flag … s) + (get_c_flag … s)). + +(* CCR corrisponde a V11HINZC *) +(* i flag mantengono posizione costante nelle varie ALU, e se non sono + implementati si puo' usare tranquillamente setweak *) +ndefinition aux_set_CCR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λCCR:byte8. + match bits_of_byte8 CCR with + [ mk_Array8T vf _ _ hf if nf zf cf ⇒ + setweak_v_flag … + (setweak_h_flag … + (setweak_i_flag … + (setweak_n_flag … + (set_z_flag … + (set_c_flag … s cf) zf) nf) if) hf) vf ]. + +(* **************** *) +(* LOGICA DELLA ALU *) +(* **************** *) + +(* A = A + M + C *) +ndefinition execute_ADC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_ADC_ADD_aux … s cur_pc i true (λC_op.plusc_dc_dc ? C_op). + +(* A = A + M *) +ndefinition execute_ADD ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_ADC_ADD_aux … s cur_pc i true (λC_op.plusc_dc_dc ? false). + +(* SP += extended M *) +ndefinition execute_AIS ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + opt_map … (get_sp_reg … s_tmp1) + (* SP += extended M *) + (λSP_op.opt_map … (set_sp_reg … s_tmp1 (plusc_d_d ? SP_op (exts_w16 M_op))) + (λs_tmp2.Some ? (pair … s_tmp2 new_pc))) ]). + +(* H:X += extended M *) +ndefinition execute_AIX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + opt_map … (get_indX_16_reg … s_tmp1) + (* H:X += extended M *) + (λHX_op.opt_map … (set_indX_16_reg … s_tmp1 (plusc_d_d ? HX_op (exts_w16 M_op))) + (λs_tmp2.Some ? (pair … s_tmp2 new_pc))) ]). + +(* A = A & M *) +ndefinition execute_AND ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_AND_BIT_EOR_ORA_aux … s cur_pc i true (andc ?). + +(* M = C' <- rcl M <- 0 *) +ndefinition execute_ASL ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_ASL_ASR_LSR_ROL_ROR_aux … s cur_pc i (λC_op.rclc ? false). + +(* M = M7 -> rcr M -> C' *) +ndefinition execute_ASR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_ASL_ASR_LSR_ROL_ROR_aux … s cur_pc i (λC_op.λM_op.rcrc ? (getMSBc ? M_op) M_op). + +(* if C=0, branch *) +ndefinition execute_BCC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_any_BRANCH … s cur_pc i (⊖(get_c_flag … s)). + +(* Mn = 0 *) +ndefinition execute_BCLRn ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_BCLRn_BSETn_aux … s cur_pc i 〈x0,x0〉. + +(* if C=1, branch *) +ndefinition execute_BCS ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_any_BRANCH … s cur_pc i (get_c_flag … s). + +(* if Z=1, branch *) +ndefinition execute_BEQ ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_any_BRANCH … s cur_pc i (get_z_flag … s). + +(* if N⊙V=0, branch *) +ndefinition execute_BGE ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_n_flag … s) + (λN_op.opt_map … (get_v_flag … s) + (λV_op.execute_any_BRANCH … s cur_pc i (⊖(N_op ⊙ V_op)))). + +(* BGND mode *) +ndefinition execute_BGND ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + Some ? (pair … s cur_pc). + +(* if Z|N⊙V=0, branch *) +ndefinition execute_BGT ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_n_flag … s) + (λN_op.opt_map … (get_v_flag … s) + (λV_op.execute_any_BRANCH … s cur_pc i (⊖((get_z_flag … s) ⊕ (N_op ⊙ V_op))))). + +(* if H=0, branch *) +ndefinition execute_BHCC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_h_flag … s) + (λH_op.execute_any_BRANCH … s cur_pc i (⊖H_op)). + +(* if H=1, branch *) +ndefinition execute_BHCS ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_h_flag … s) + (λH_op.execute_any_BRANCH … s cur_pc i H_op). + +(* if C|Z=0, branch *) +ndefinition execute_BHI ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_any_BRANCH … s cur_pc i (⊖((get_c_flag … s) ⊕ (get_z_flag … s))). + +(* if nIRQ=1, branch NB: irqflag e' un negato del pin *) +ndefinition execute_BIH ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_irq_flag … s) + (λIRQ_op.execute_any_BRANCH … s cur_pc i (⊖IRQ_op)). + +(* if nIRQ=0, branch NB: irqflag e' un negato del pin *) +ndefinition execute_BIL ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_irq_flag … s) + (λIRQ_op.execute_any_BRANCH … s cur_pc i IRQ_op). + +(* flags = A & M *) +ndefinition execute_BIT ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_AND_BIT_EOR_ORA_aux … s cur_pc i false (andc ?). + +(* if Z|N⊙V=1, branch *) +ndefinition execute_BLE ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_n_flag … s) + (λN_op.opt_map … (get_v_flag … s) + (λV_op.execute_any_BRANCH … s cur_pc i ((get_z_flag … s) ⊕ (N_op ⊙ V_op)))). + +(* if C|Z=1, branch *) +ndefinition execute_BLS ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_any_BRANCH … s cur_pc i ((get_c_flag … s) ⊕ (get_z_flag … s)). + +(* if N⊙V=1, branch *) +ndefinition execute_BLT ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_n_flag … s) + (λN_op.opt_map … (get_v_flag … s) + (λV_op.execute_any_BRANCH … s cur_pc i (N_op ⊙ V_op))). + +(* if I=0, branch *) +ndefinition execute_BMC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_i_flag … s) + (λI_op.execute_any_BRANCH … s cur_pc i (⊖I_op)). + +(* if N=1, branch *) +ndefinition execute_BMI ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_n_flag … s) + (λN_op.execute_any_BRANCH … s cur_pc i N_op). + +(* if I=1, branch *) +ndefinition execute_BMS ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_i_flag … s) + (λI_op.execute_any_BRANCH … s cur_pc i I_op). + +(* if Z=0, branch *) +ndefinition execute_BNE ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_any_BRANCH … s cur_pc i (⊖(get_z_flag … s)). + +(* if N=0, branch *) +ndefinition execute_BPL ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_n_flag … s) + (λN_op.execute_any_BRANCH … s cur_pc i (⊖N_op)). + +(* branch always *) +ndefinition execute_BRA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_any_BRANCH … s cur_pc i true. + +(* if Mn=0 branch *) +ndefinition execute_BRCLRn ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_BRCLRn_BRSETn_aux … s cur_pc i + (λMn_op.eqc ? Mn_op (zeroc ?)). + +(* branch never... come se fosse un nop da 2 byte *) +ndefinition execute_BRN ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_any_BRANCH … s cur_pc i false. + +(* if Mn=1 branch *) +ndefinition execute_BRSETn ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_BRCLRn_BRSETn_aux … s cur_pc i + (λMn_op.⊖(eqc ? Mn_op (zeroc ?))). + +(* Mn = 1 *) +ndefinition execute_BSETn ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_BCLRn_BSETn_aux … s cur_pc i 〈xF,xF〉. + +(* branch to subroutine *) +(* HC05/HC08/HCS08 si appoggiano allo stack, RS08 a SPC *) +ndefinition execute_BSR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t .λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ let aux ≝ + (* push (new_pc low) *) + opt_map … (aux_push … s_tmp1 (cnL ? new_pc)) + (* push (new_pc high) *) + (λs_tmp2.opt_map … (aux_push … s_tmp2 (cnH ? new_pc)) + (* new_pc = new_pc + rel *) + (λs_tmp3.Some ? (pair … s_tmp3 (branched_pc … s_tmp3 new_pc M_op)))) + in match m with + [ HC05 ⇒ aux | HC08 ⇒ aux | HCS08 ⇒ aux + | RS08 ⇒ + (* SPC = new_pc *) + opt_map … (set_spc_reg … s_tmp1 new_pc) + (* new_pc = new_pc + rel *) + (λs_tmp2.Some ? (pair … s_tmp2 (branched_pc … s_tmp2 new_pc M_op))) + | _ ⇒ None ? + ]]). + +(* if A=M, branch *) +ndefinition execute_CBEQA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadw … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + match M_op with + [ mk_comp_num MH_op ML_op ⇒ + (* if A=M, branch *) + match eqc ? (get_acc_8_low_reg … s_tmp1) MH_op with + (* new_pc = new_pc + rel *) + [ true ⇒ Some ? (pair … s_tmp1 (branched_pc … s_tmp1 new_pc ML_op)) + (* new_pc = new_pc *) + | false ⇒ Some ? (pair … s_tmp1 new_pc) + ]]]). + +(* if X=M, branch *) +ndefinition execute_CBEQX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadw … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + match M_op with + [ mk_comp_num MH_op ML_op ⇒ + opt_map … (get_indX_8_low_reg … s_tmp1) + (* if X=M, branch *) + (λX_op.match eqc ? X_op MH_op with + (* new_pc = new_pc + rel *) + [ true ⇒ Some ? (pair … s_tmp1 (branched_pc … s_tmp1 new_pc ML_op)) + (* new_pc = new_pc *) + | false ⇒ Some ? (pair … s_tmp1 new_pc) + ])]]). + +(* C = 0 *) +ndefinition execute_CLC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + Some ? (pair … (set_c_flag … s false) cur_pc). + +(* I = 0 *) +ndefinition execute_CLI ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (set_i_flag … s false) + (λs_tmp.Some ? (pair … s_tmp cur_pc)). + +(* M = 0 *) +ndefinition execute_CLR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + (* M = 0 *) + opt_map … (multi_mode_writeb … s cur_pc auxMode_ok i 〈x0,x0〉) + (λS_PC.match S_PC with + [ pair s_tmp1 new_pc ⇒ + (* Z = 1 *) + let s_tmp2 ≝ set_z_flag … s_tmp1 true in + (* N = 0 *) + let s_tmp3 ≝ setweak_n_flag … s_tmp2 false in + (* V = 0 *) + let s_tmp4 ≝ setweak_v_flag … s_tmp3 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp4 new_pc) ]). + +(* flags = A - M *) +ndefinition execute_CMP ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_CMP_SBC_SUB_aux … s cur_pc i false (λC_op.λA_op.λM_op.plusc_dc_dc ? false A_op (complc ? M_op)). + +(* M = not M *) +ndefinition execute_COM ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_COM_DEC_INC_NEG_aux … s cur_pc i (notc ?) + (* fV = 0 *) + (λM7.λR7.false) + (* fC = 1 *) + (λC_op.λR_op.true). + +(* flags = H:X - M *) +ndefinition execute_CPHX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadw … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + opt_map … (get_indX_16_reg … s_tmp1) + (λX_op. + match plusc_dc_dc ? false X_op (complc ? M_op) with + [ pair carry R_op ⇒ + let X15 ≝ getMSBc ? X_op in + let M15 ≝ getMSBc ? M_op in + let R15 ≝ getMSBc ? R_op in + (* Z = nR15&nR14&nR13&nR12&nR11&nR10&nR9&nR8&nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp2 ≝ set_zflw … s_tmp1 R_op in + (* C = nX15&M15 | M15&R15 | R15&nX15 *) + let s_tmp3 ≝ set_c_flag … s_tmp2 (((⊖X15)⊗M15) ⊕ (M15⊗R15) ⊕ (R15⊗(⊖X15))) in + (* N = R15 *) + let s_tmp4 ≝ set_nflw … s_tmp3 R_op in + (* V = X15&nM15&nR15 | nX15&M15&R15 *) + let s_tmp5 ≝ setweak_v_flag … s_tmp4 ((X15⊗(⊖M15)⊗(⊖R15)) ⊕ ((⊖X15)⊗M15⊗R15)) in + (* newpc = nextpc *) + Some ? (pair … s_tmp5 new_pc) ] ) ]). + +(* flags = X - M *) +ndefinition execute_CPX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + opt_map … (get_indX_8_low_reg … s_tmp1) + (λX_op. + match plusc_dc_dc ? false X_op (complc ? M_op) with + [ pair carry R_op ⇒ + let X7 ≝ getMSBc ? X_op in + let M7 ≝ getMSBc ? M_op in + let R7 ≝ getMSBc ? R_op in + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp2 ≝ set_zflb … s_tmp1 R_op in + (* C = nX7&M7 | M7&R7 | R7&nX7 *) + let s_tmp3 ≝ set_c_flag … s_tmp2 (((⊖X7)⊗M7) ⊕ (M7⊗R7) ⊕ (R7⊗(⊖X7))) in + (* N = R7 *) + let s_tmp4 ≝ set_nflb … s_tmp3 R_op in + (* V = X7&nM7&nR7 | nX7&M7&R7 *) + let s_tmp5 ≝ setweak_v_flag … s_tmp4 ((X7⊗(⊖M7)⊗(⊖R7)) ⊕ ((⊖X7)⊗M7⊗R7)) in + (* newpc = nextpc *) + Some ? (pair … s_tmp5 new_pc) ] ) ]). + +(* decimal adjiust A *) +(* per i dettagli vedere daa_b8 (modulo byte8) *) +ndefinition execute_DAA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_h_flag … s) + (λH. + let M_op ≝ get_acc_8_low_reg … s in + match daa_b8 H (get_c_flag … s) M_op with + [ pair carry R_op ⇒ + (* A = R *) + let s_tmp1 ≝ set_acc_8_low_reg … s R_op in + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp2 ≝ set_zflb … s_tmp1 R_op in + (* C = carry *) + let s_tmp3 ≝ set_c_flag … s_tmp2 carry in + (* N = R7 *) + let s_tmp4 ≝ set_nflb … s_tmp3 R_op in + (* V = M7 ⊙ R7 *) + let s_tmp5 ≝ setweak_v_flag … s_tmp4 ((getMSBc ? M_op) ⊙ (getMSBc ? R_op)) in + (* newpc = curpc *) + Some ? (pair … s_tmp5 cur_pc) ]). + +(* if (--M)≠0, branch *) +ndefinition execute_DBNZ ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadw … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + match M_op with + [ mk_comp_num MH_op ML_op ⇒ + (* --M *) + let MH_op' ≝ predc ? MH_op in + opt_map … (multi_mode_writeb … s_tmp1 cur_pc auxMode_ok i MH_op') + (λS_PC.match S_PC with + [ pair s_tmp2 _ ⇒ + (* if (--M)≠0, branch *) + match eqc ? MH_op' (zeroc ?) with + (* new_pc = new_pc *) + [ true ⇒ Some ? (pair … s_tmp2 new_pc) + (* new_pc = new_pc + rel *) + | false ⇒ Some ? (pair … s_tmp2 (branched_pc … s_tmp2 new_pc ML_op)) ]])]]). + +(* M = M - 1 *) +ndefinition execute_DEC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_COM_DEC_INC_NEG_aux … s cur_pc i (predc ?) + (* fV = M7&nR7 *) + (λM7.λR7.M7⊗(⊖R7)) + (* fC = C *) + (λC_op.λR_op.C_op). + +(* A = H:A/X, H = H:AmodX se non c'e' overflow, altrimenti invariati *) +(* per i dettagli vedere div_b8 (modulo word16) *) +ndefinition execute_DIV ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_indX_8_high_reg … s) + (λH_op.opt_map … (get_indX_8_low_reg … s) + (λX_op.match div_b8 〈H_op:(get_acc_8_low_reg … s)〉 X_op with + [ triple quoz rest overflow ⇒ + (* C = overflow *) + let s_tmp1 ≝ set_c_flag … s overflow in + (* A = A o H:A/X *) + let s_tmp2 ≝ match overflow with + [ true ⇒ s_tmp1 + | false ⇒ set_acc_8_low_reg … s_tmp1 quoz ] in + (* Z = nA7&nA6&nA5&nA4&nA3&nA2&nA1&nA0 *) + (* NB: che A sia cambiato o no, lo testa *) + let s_tmp3 ≝ set_zflb … s_tmp2 (get_acc_8_low_reg … s_tmp2) in + (* H = H o H:AmodX *) + opt_map … (match overflow with + [ true ⇒ Some ? s_tmp3 + | false ⇒ set_indX_8_high_reg … s_tmp3 rest]) + (λs_tmp4.Some ? (pair … s_tmp4 cur_pc)) ])). + +(* A = A ⊙ M *) +ndefinition execute_EOR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_AND_BIT_EOR_ORA_aux … s cur_pc i true (xorc ?). + +(* M = M + 1 *) +ndefinition execute_INC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_COM_DEC_INC_NEG_aux … s cur_pc i (succc ?) + (* fV = nM7&R7 *) + (λM7.λR7.(⊖M7)⊗R7) + (* fC = C *) + (λC_op.λR_op.C_op). + +(* jmp, il nuovo indirizzo e' una WORD *) +ndefinition execute_JMP ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadw … s cur_pc i) + (λS_M_PC. + (* newpc = M_op *) + Some ? (pair … (fst3T … S_M_PC) (snd3T … S_M_PC))). + +(* jump to subroutine *) +(* HC05/HC08/HCS08 si appoggiano allo stack, RS08 a SPC *) +ndefinition execute_JSR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadw … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ let aux ≝ + (* push (new_pc low) *) + opt_map … (aux_push … s_tmp1 (cnL ? new_pc)) + (* push (new_pc high) *) + (λs_tmp2.opt_map … (aux_push … s_tmp2 (cnH ? new_pc)) + (* newpc = M_op *) + (λs_tmp3.Some ? (pair … s_tmp3 M_op))) + in match m with + [ HC05 ⇒ aux | HC08 ⇒ aux | HCS08 ⇒ aux + | RS08 ⇒ + (* SPC = new_pc *) + opt_map … (set_spc_reg … s_tmp1 new_pc) + (* newpc = M_op *) + (λs_tmp2.Some ? (pair … s_tmp2 M_op)) + | _ ⇒ None ? + ]]). + +(* A = M *) +ndefinition execute_LDA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + (* A = M *) + let s_tmp2 ≝ set_acc_8_low_reg … s_tmp1 M_op in + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp3 ≝ set_zflb … s_tmp2 M_op in + (* N = R7 *) + let s_tmp4 ≝ set_nflb … s_tmp3 M_op in + (* V = 0 *) + let s_tmp5 ≝ setweak_v_flag … s_tmp4 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp5 new_pc) ]). + +(* H:X = M *) +ndefinition execute_LDHX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadw … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + opt_map … (set_indX_16_reg … s_tmp1 M_op) + (λs_tmp2. + (* Z = nR15&nR14&nR13nR12&nR11&nR10&nR9&nR8nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp3 ≝ set_zflw … s_tmp2 M_op in + (* N = R15 *) + let s_tmp4 ≝ set_nflw … s_tmp3 M_op in + (* V = 0 *) + let s_tmp5 ≝ setweak_v_flag … s_tmp4 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp5 new_pc)) ]). + +(* X = M *) +ndefinition execute_LDX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + opt_map … (set_indX_8_low_reg … s_tmp1 M_op) + (λs_tmp2. + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp3 ≝ set_zflb … s_tmp2 M_op in + (* N = R7 *) + let s_tmp4 ≝ set_nflb … s_tmp3 M_op in + (* V = 0 *) + let s_tmp5 ≝ setweak_v_flag … s_tmp4 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp5 new_pc)) ]). + +(* M = 0 -> rcr M -> C' *) +ndefinition execute_LSR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_ASL_ASR_LSR_ROL_ROR_aux … s cur_pc i (λC_op.λM_op.rcrc ? false M_op). + +(* M2 = M1 *) +ndefinition execute_MOV ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + (* R_op = M1 *) + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_R_PC.match S_R_PC with + [ triple s_tmp1 R_op tmp_pc ⇒ + (* M2 = R_op *) + opt_map … (multi_mode_writeb … s_tmp1 tmp_pc auxMode_ok i R_op) + (λS_PC.match S_PC with + [ pair s_tmp2 new_pc ⇒ + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp3 ≝ set_zflb … s_tmp2 R_op in + (* N = R7 *) + let s_tmp4 ≝ set_nflb … s_tmp3 R_op in + (* V = 0 *) + let s_tmp5 ≝ setweak_v_flag … s_tmp4 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp5 new_pc)])]). + +(* X:A = X * A *) +ndefinition execute_MUL ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_indX_8_low_reg … s) + (λX_op.let R_op ≝ mulu_b8 X_op (get_acc_8_low_reg … s) in + opt_map … (set_indX_8_low_reg … s (cnH ? R_op)) + (λs_tmp.Some ? (pair … (set_acc_8_low_reg … s_tmp (cnL ? R_op)) cur_pc))). + +(* M = compl M *) +ndefinition execute_NEG ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_COM_DEC_INC_NEG_aux … s cur_pc i (complc ?) + (* fV = M7&R7 *) + (λM7.λR7.M7⊗R7) + (* fC = R7|R6|R5|R4|R3|R2|R1|R0 *) + (λC_op.λR_op.⊖(eqc ? R_op (zeroc ?))). + +(* nulla *) +ndefinition execute_NOP ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + Some ? (pair … s cur_pc). + +(* A = (mk_byte8 (b8l A) (b8h A)) *) +(* cioe' swap del nibble alto/nibble basso di A *) +ndefinition execute_NSA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + match get_acc_8_low_reg … s with [ mk_comp_num ah al ⇒ + (* A = (mk_byte8 (b8l A) (b8h A)) *) + Some ? (pair … (set_acc_8_low_reg … s 〈al,ah〉) cur_pc) ]. + +(* A = A | M *) +ndefinition execute_ORA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_AND_BIT_EOR_ORA_aux … s cur_pc i true (orc ?). + +(* push A *) +ndefinition execute_PSHA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (aux_push … s (get_acc_8_low_reg … s)) + (λs_tmp1.Some ? (pair … s_tmp1 cur_pc)). + +(* push H *) +ndefinition execute_PSHH ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_indX_8_high_reg … s) + (λH_op.opt_map … (aux_push … s H_op) + (λs_tmp1.Some ? (pair … s_tmp1 cur_pc))). + +(* push X *) +ndefinition execute_PSHX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_indX_8_low_reg … s) + (λH_op.opt_map … (aux_push … s H_op) + (λs_tmp1.Some ? (pair … s_tmp1 cur_pc))). + +(* pop A *) +ndefinition execute_PULA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (aux_pop … s) + (λS_and_A.match S_and_A with [ pair s_tmp1 A_op ⇒ + Some ? (pair … (set_acc_8_low_reg … s_tmp1 A_op) cur_pc) ]). + +(* pop H *) +ndefinition execute_PULH ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (aux_pop … s) + (λS_and_H.match S_and_H with [ pair s_tmp1 H_op ⇒ + opt_map … (set_indX_8_high_reg … s_tmp1 H_op) + (λs_tmp2.Some ? (pair … s_tmp2 cur_pc))]). + +(* pop X *) +ndefinition execute_PULX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (aux_pop … s) + (λS_and_X.match S_and_X with [ pair s_tmp1 X_op ⇒ + opt_map … (set_indX_8_low_reg … s_tmp1 X_op) + (λs_tmp2.Some ? (pair … s_tmp2 cur_pc))]). + +(* M = C' <- rcl M <- C *) +ndefinition execute_ROL ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_ASL_ASR_LSR_ROL_ROR_aux … s cur_pc i (rclc ?). + +(* M = C -> rcr M -> C' *) +ndefinition execute_ROR ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_ASL_ASR_LSR_ROL_ROR_aux … s cur_pc i (rcrc ?). + +(* SP = 0xuuFF *) +(* lascia inalterato il byte superiore di SP *) +ndefinition execute_RSP ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_sp_reg … s) + (λSP_op.match SP_op with [ mk_comp_num sph spl ⇒ + opt_map … (set_sp_reg … s 〈sph:〈xF,xF〉〉) + (λs_tmp.Some ? (pair … s_tmp cur_pc))]). + +(* return from interrupt *) +ndefinition execute_RTI ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + (* pop (CCR) *) + opt_map … (aux_pop … s) + (λS_and_CCR.match S_and_CCR with [ pair s_tmp1 CCR_op ⇒ + let s_tmp2 ≝ aux_set_CCR … s_tmp1 CCR_op in + (* pop (A) *) + opt_map … (aux_pop … s_tmp2) + (λS_and_A.match S_and_A with [ pair s_tmp3 A_op ⇒ + let s_tmp4 ≝ set_acc_8_low_reg … s_tmp3 A_op in + (* pop (X) *) + opt_map … (aux_pop … s_tmp4) + (λS_and_X.match S_and_X with [ pair s_tmp5 X_op ⇒ + opt_map … (set_indX_8_low_reg … s_tmp5 X_op) + (* pop (PC high) *) + (λs_tmp6.opt_map … (aux_pop … s_tmp6) + (λS_and_PCH.match S_and_PCH with [ pair s_tmp7 PCH_op ⇒ + (* pop (PC low) *) + opt_map … (aux_pop … s_tmp7) + (λS_and_PCL.match S_and_PCL with [ pair s_tmp8 PCL_op ⇒ + Some ? (pair … s_tmp8 〈PCH_op:PCL_op〉)])]))])])]). + +(* return from subroutine *) +(* HC05/HC08/HCS08 si appoggia allo stack, RS08 si appoggia a SPC *) +ndefinition execute_RTS ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + let aux ≝ + (* pop (PC high) *) + opt_map … (aux_pop … s) + (λS_and_PCH.match S_and_PCH with [ pair s_tmp1 PCH_op ⇒ + (* pop (PC low) *) + opt_map … (aux_pop … s_tmp1) + (λS_and_PCL.match S_and_PCL with [ pair s_tmp2 PCL_op ⇒ + Some ? (pair … s_tmp2 〈PCH_op:PCL_op〉)])]) + in match m with + [ HC05 ⇒ aux | HC08 ⇒ aux | HCS08 ⇒ aux + | RS08 ⇒ + (* new_pc = SPC *) + opt_map … (get_spc_reg … s) + (λSPC_op.Some ? (pair … s SPC_op)) + | _ ⇒ None ? + ]. + +(* A = A - M - C *) +ndefinition execute_SBC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_CMP_SBC_SUB_aux … s cur_pc i true + (λC_op.λA_op.λM_op.match plusc_dc_dc ? false A_op (complc ? M_op) with + [ pair resc resb ⇒ match C_op with + [ true ⇒ plusc_dc_dc ? false resb 〈xF,xF〉 + | false ⇒ pair … resc resb ]]). + +(* C = 1 *) +ndefinition execute_SEC ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + Some ? (pair … (set_c_flag … s true) cur_pc). + +(* I = 1 *) +ndefinition execute_SEI ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (set_i_flag … s true) + (λs_tmp.Some ? (pair … s_tmp cur_pc)). + +(* swap SPCh,A *) +(* senso: nell'RS08 SPC non e' accessibile direttamente e come si possono + fare subroutine annidate se RA (return address) e' salvato sempre in SPC? + occore accedere a SPC e salvarne il contenuto *) +ndefinition execute_SHA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_spc_reg … s) + (λSPC_op.opt_map … (set_spc_reg … s 〈(get_acc_8_low_reg … s):(cnL ? SPC_op)〉) + (λs_tmp1.Some ? (pair … (set_acc_8_low_reg … s_tmp1 (cnH ? SPC_op)) cur_pc))). + +(* swap SPCl,A *) +(* senso: nell'RS08 SPC non e' accessibile direttamente e come si possono + fare subroutine annidate se RA (return address) e' salvato sempre in SPC? + occore accedere a SPC e salvarne il contenuto *) +ndefinition execute_SLA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_spc_reg … s) + (λSPC_op.opt_map … (set_spc_reg … s 〈(cnH ? SPC_op):(get_acc_8_low_reg … s)〉) + (λs_tmp1.Some ? (pair … (set_acc_8_low_reg … s_tmp1 (cnL ? SPC_op)) cur_pc))). + +(* M = A *) +ndefinition execute_STA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + (* M = A *) + let A_op ≝ (get_acc_8_low_reg … s) in + opt_map … (multi_mode_writeb … s cur_pc auxMode_ok i A_op) + (λS_op_and_PC.match S_op_and_PC with + [ pair s_tmp1 new_pc ⇒ + (* Z = nA7&nA6&nA5&nA4&nA3&nA2&nA1&nA0 *) + let s_tmp2 ≝ set_zflb … s_tmp1 A_op in + (* N = A7 *) + let s_tmp3 ≝ set_nflb … s_tmp2 A_op in + (* V = 0 *) + let s_tmp4 ≝ setweak_v_flag … s_tmp3 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp4 new_pc) ]). + +(* M = H:X *) +ndefinition execute_STHX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + (* M = H:X *) + opt_map … (get_indX_16_reg … s) + (λX_op.opt_map … (multi_mode_writew … s cur_pc i X_op) + (λS_op_and_PC.match S_op_and_PC with + [ pair s_tmp1 new_pc ⇒ + (* Z = nR15&nR14&nR13nR12&nR11&nR10&nR9&nR8nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp2 ≝ set_zflw … s_tmp1 X_op in + (* N = R15 *) + let s_tmp3 ≝ set_nflw … s_tmp2 X_op in + (* V = 0 *) + let s_tmp4 ≝ setweak_v_flag … s_tmp3 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp4 new_pc) ])). + +(* I = 0 *) +ndefinition execute_STOP ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + Some ? (pair … (setweak_i_flag … s false) cur_pc). + +(* M = X *) +ndefinition execute_STX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + (* M = X *) + opt_map … (get_indX_8_low_reg … s) + (λX_op.opt_map … (multi_mode_writeb … s cur_pc auxMode_ok i X_op) + (λS_op_and_PC.match S_op_and_PC with + [ pair s_tmp1 new_pc ⇒ + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp2 ≝ set_zflb … s_tmp1 X_op in + (* N = R7 *) + let s_tmp3 ≝ set_nflb … s_tmp2 X_op in + (* V = 0 *) + let s_tmp4 ≝ setweak_v_flag … s_tmp3 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp4 new_pc) ])). + +(* A = A - M *) +ndefinition execute_SUB ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + execute_CMP_SBC_SUB_aux … s cur_pc i true (λC_op.λA_op.λM_op.plusc_dc_dc ? false A_op (complc ? M_op)). + +(* software interrupt *) +ndefinition execute_SWI ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + (* indirizzo da cui caricare il nuovo pc *) + let vector ≝ get_pc_reg … (set_pc_reg … s 〈〈xF,xF〉:〈xF,xC〉〉) in + (* push (cur_pc low) *) + opt_map … (aux_push … s (cnL ? cur_pc)) + (* push (cur_pc high *) + (λs_tmp1.opt_map … (aux_push … s_tmp1 (cnH ? cur_pc)) + (λs_tmp2.opt_map … (get_indX_8_low_reg … s_tmp2) + (* push (X) *) + (λX_op.opt_map … (aux_push … s_tmp2 X_op) + (* push (A) *) + (λs_tmp3.opt_map … (aux_push … s_tmp3 (get_acc_8_low_reg … s_tmp3)) + (* push (CCR) *) + (λs_tmp4.opt_map … (aux_push … s_tmp4 (aux_get_CCR … s_tmp4)) + (* I = 1 *) + (λs_tmp5.opt_map … (set_i_flag … s_tmp5 true) + (* load from vector high *) + (λs_tmp6.opt_map … (memory_filter_read … s_tmp6 vector) + (* load from vector low *) + (λaddrh.opt_map … (memory_filter_read … s_tmp6 (succc ? vector)) + (* newpc = [vector] *) + (λaddrl.Some ? (pair … s_tmp6 〈addrh:addrl〉)))))))))). + +(* flags = A *) +ndefinition execute_TAP ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + Some ? (pair … (aux_set_CCR … s (get_acc_8_low_reg … s)) cur_pc). + +(* X = A *) +ndefinition execute_TAX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (set_indX_8_low_reg … s (get_acc_8_low_reg … s)) + (λs_tmp.Some ? (pair … s_tmp cur_pc)). + +(* A = flags *) +ndefinition execute_TPA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + Some ? (pair … (set_acc_8_low_reg … s (aux_get_CCR … s)) cur_pc). + +(* flags = M - 0 *) +(* implementata senza richiamare la sottrazione, la modifica dei flag + e' immediata *) +ndefinition execute_TST ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (multi_mode_loadb … s cur_pc i) + (λS_M_PC.match S_M_PC with + [ triple s_tmp1 M_op new_pc ⇒ + (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) + let s_tmp2 ≝ set_zflb … s_tmp1 M_op in + (* N = R7 *) + let s_tmp3 ≝ set_nflb … s_tmp2 M_op in + (* V = 0 *) + let s_tmp4 ≝ setweak_v_flag … s_tmp3 false in + (* newpc = nextpc *) + Some ? (pair … s_tmp4 new_pc) ]). + +(* H:X = SP + 1 *) +ndefinition execute_TSX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_sp_reg … s ) + (λSP_op.opt_map … (set_indX_16_reg … s (succc ? SP_op)) + (* H:X = SP + 1 *) + (λs_tmp.Some ? (pair … s_tmp cur_pc))). + +(* A = X *) +ndefinition execute_TXA ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_indX_8_low_reg … s) + (λX_op.Some ? (pair … (set_acc_8_low_reg … s X_op) cur_pc)). + +(* SP = H:X - 1 *) +ndefinition execute_TXS ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + opt_map … (get_indX_16_reg … s ) + (λX_op.opt_map … (set_sp_reg … s (predc ? X_op)) + (* SP = H:X - 1 *) + (λs_tmp.Some ? (pair … s_tmp cur_pc))). + +(* I = 0 *) +ndefinition execute_WAIT ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + Some ? (pair … (setweak_i_flag … s false) cur_pc). + +(* raccordo *) +ndefinition Freescale_execute_any ≝ +λps:Freescale_pseudo.match ps with + [ ADC ⇒ execute_ADC (* add with carry *) + | ADD ⇒ execute_ADD (* add *) + | AIS ⇒ execute_AIS (* add immediate to SP *) + | AIX ⇒ execute_AIX (* add immediate to X *) + | AND ⇒ execute_AND (* and *) + | ASL ⇒ execute_ASL (* aritmetic shift left *) + | ASR ⇒ execute_ASR (* aritmetic shift right *) + | BCC ⇒ execute_BCC (* branch if C=0 *) + | BCLRn ⇒ execute_BCLRn (* clear bit n *) + | BCS ⇒ execute_BCS (* branch if C=1 *) + | BEQ ⇒ execute_BEQ (* branch if Z=1 *) + | BGE ⇒ execute_BGE (* branch if N⊙V=0 (great or equal) *) + | BGND ⇒ execute_BGND (* !!background mode!!*) + | BGT ⇒ execute_BGT (* branch if Z|N⊙V=0 clear (great) *) + | BHCC ⇒ execute_BHCC (* branch if H=0 *) + | BHCS ⇒ execute_BHCS (* branch if H=1 *) + | BHI ⇒ execute_BHI (* branch if C|Z=0, (higher) *) + | BIH ⇒ execute_BIH (* branch if nIRQ=1 *) + | BIL ⇒ execute_BIL (* branch if nIRQ=0 *) + | BIT ⇒ execute_BIT (* flag = and (bit test) *) + | BLE ⇒ execute_BLE (* branch if Z|N⊙V=1 (less or equal) *) + | BLS ⇒ execute_BLS (* branch if C|Z=1 (lower or same) *) + | BLT ⇒ execute_BLT (* branch if N⊙1=1 (less) *) + | BMC ⇒ execute_BMC (* branch if I=0 (interrupt mask clear) *) + | BMI ⇒ execute_BMI (* branch if N=1 (minus) *) + | BMS ⇒ execute_BMS (* branch if I=1 (interrupt mask set) *) + | BNE ⇒ execute_BNE (* branch if Z=0 *) + | BPL ⇒ execute_BPL (* branch if N=0 (plus) *) + | BRA ⇒ execute_BRA (* branch always *) + | BRCLRn ⇒ execute_BRCLRn (* branch if bit n clear *) + | BRN ⇒ execute_BRN (* branch never (nop) *) + | BRSETn ⇒ execute_BRSETn (* branch if bit n set *) + | BSETn ⇒ execute_BSETn (* set bit n *) + | BSR ⇒ execute_BSR (* branch to subroutine *) + | CBEQA ⇒ execute_CBEQA (* compare (A) and BEQ *) + | CBEQX ⇒ execute_CBEQX (* compare (X) and BEQ *) + | CLC ⇒ execute_CLC (* C=0 *) + | CLI ⇒ execute_CLI (* I=0 *) + | CLR ⇒ execute_CLR (* operand=0 *) + | CMP ⇒ execute_CMP (* flag = sub (compare A) *) + | COM ⇒ execute_COM (* not (1 complement) *) + | CPHX ⇒ execute_CPHX (* flag = sub (compare H:X) *) + | CPX ⇒ execute_CPX (* flag = sub (compare X) *) + | DAA ⇒ execute_DAA (* decimal adjust A *) + | DBNZ ⇒ execute_DBNZ (* dec and BNE *) + | DEC ⇒ execute_DEC (* operand=operand-1 (decrement) *) + | DIV ⇒ execute_DIV (* div *) + | EOR ⇒ execute_EOR (* xor *) + | INC ⇒ execute_INC (* operand=operand+1 (increment) *) + | JMP ⇒ execute_JMP (* jmp word [operand] *) + | JSR ⇒ execute_JSR (* jmp to subroutine *) + | LDA ⇒ execute_LDA (* load in A *) + | LDHX ⇒ execute_LDHX (* load in H:X *) + | LDX ⇒ execute_LDX (* load in X *) + | LSR ⇒ execute_LSR (* logical shift right *) + | MOV ⇒ execute_MOV (* move *) + | MUL ⇒ execute_MUL (* mul *) + | NEG ⇒ execute_NEG (* neg (2 complement) *) + | NOP ⇒ execute_NOP (* nop *) + | NSA ⇒ execute_NSA (* nibble swap A (al:ah <- ah:al) *) + | ORA ⇒ execute_ORA (* or *) + | PSHA ⇒ execute_PSHA (* push A *) + | PSHH ⇒ execute_PSHH (* push H *) + | PSHX ⇒ execute_PSHX (* push X *) + | PULA ⇒ execute_PULA (* pop A *) + | PULH ⇒ execute_PULH (* pop H *) + | PULX ⇒ execute_PULX (* pop X *) + | ROL ⇒ execute_ROL (* rotate left *) + | ROR ⇒ execute_ROR (* rotate right *) + | RSP ⇒ execute_RSP (* reset SP (0x00FF) *) + | RTI ⇒ execute_RTI (* return from interrupt *) + | RTS ⇒ execute_RTS (* return from subroutine *) + | SBC ⇒ execute_SBC (* sub with carry*) + | SEC ⇒ execute_SEC (* C=1 *) + | SEI ⇒ execute_SEI (* I=1 *) + | SHA ⇒ execute_SHA (* swap spc_high,A *) + | SLA ⇒ execute_SLA (* swap spc_low,A *) + | STA ⇒ execute_STA (* store from A *) + | STHX ⇒ execute_STHX (* store from H:X *) + | STOP ⇒ execute_STOP (* !!stop mode!! *) + | STX ⇒ execute_STX (* store from X *) + | SUB ⇒ execute_SUB (* sub *) + | SWI ⇒ execute_SWI (* software interrupt *) + | TAP ⇒ execute_TAP (* flag=A (transfer A to process status byte *) + | TAX ⇒ execute_TAX (* X=A (transfer A to X) *) + | TPA ⇒ execute_TPA (* A=flag (transfer process status byte to A) *) + | TST ⇒ execute_TST (* flag = sub (test) *) + | TSX ⇒ execute_TSX (* X:H=SP (transfer SP to H:X) *) + | TXA ⇒ execute_TXA (* A=X (transfer X to A) *) + | TXS ⇒ execute_TXS (* SP=X:H (transfer H:X to SP) *) + | WAIT ⇒ execute_WAIT (* !!wait mode!!*) + ]. + +(* stati speciali di esecuzione *) +ndefinition Freescale_check_susp ≝ +λps:Freescale_pseudo.match ps with + [ BGND ⇒ Some ? BGND_MODE + | STOP ⇒ Some ? STOP_MODE + | WAIT ⇒ Some ? WAIT_MODE + | _ ⇒ None ? + ]. + +(* istruzioni speciali per skip *) +ndefinition Freescale_check_skip ≝ +λps:Freescale_pseudo.false. + +(* motiplicatore del ciclo di durata *) +ndefinition Freescale_clk_mult ≝ +λm,t.λs:any_status m t.nat1. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/multivm/IP2022_multivm.ma b/helm/software/matita/contribs/ng_assembly2/emulator/multivm/IP2022_multivm.ma new file mode 100755 index 000000000..8d529365c --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/multivm/IP2022_multivm.ma @@ -0,0 +1,122 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/multivm/multivm_base.ma". +include "emulator/read_write/load_write.ma". + +(* ************************************************ *) +(* LOGICHE AUSILIARE CHE ACCOMUNANO PIU' OPERAZIONI *) +(* ************************************************ *) + +(* **************** *) +(* LOGICA DELLA ALU *) +(* **************** *) + +ndefinition execute_NO ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λi:aux_im_type m. + None (ProdT (any_status m t) word16). + +(* raccordo *) +ndefinition IP2022_execute_any ≝ +λps:IP2022_pseudo.match ps with + [ ADD ⇒ execute_NO (* add *) + | ADDC ⇒ execute_NO (* add with carry *) + | AND ⇒ execute_NO (* and *) + | BREAK ⇒ execute_NO (* enter break mode *) + | BREAKX ⇒ execute_NO (* enter break mode, after skip *) + | CALL ⇒ execute_NO (* subroutine call *) + | CLR ⇒ execute_NO (* clear *) + | CLRB ⇒ execute_NO (* clear bit *) + | CMP ⇒ execute_NO (* set flags according to sub *) + | CSE ⇒ execute_NO (* confront & skip if equal *) + | CSNE ⇒ execute_NO (* confront & skip if not equal *) + | CWDT ⇒ execute_NO (* clear watch dog -- not impl. ERR *) + | DEC ⇒ execute_NO (* decrement *) + | DECSNZ ⇒ execute_NO (* decrement & skip if not zero *) + | DECSZ ⇒ execute_NO (* decrement & skip if zero *) + | FERASE ⇒ execute_NO (* flash erase -- not impl. ERR *) + | FREAD ⇒ execute_NO (* flash read -- not impl. ERR *) + | FWRITE ⇒ execute_NO (* flash write -- not impl. ERR *) + | INC ⇒ execute_NO (* increment *) + | INCSNZ ⇒ execute_NO (* increment & skip if not zero *) + | INCSZ ⇒ execute_NO (* increment & skip if zero *) + | INT ⇒ execute_NO (* interrupt -- not impl. ERR *) + | IREAD ⇒ execute_NO (* memory read *) + | IWRITE ⇒ execute_NO (* memory write *) + | JMP ⇒ execute_NO (* jump *) + | LOADH ⇒ execute_NO (* load Data Pointer High *) + | LOADL ⇒ execute_NO (* load Data Pointer Low *) + | MOV ⇒ execute_NO (* move *) + | MULS ⇒ execute_NO (* signed mul *) + | MULU ⇒ execute_NO (* unsigned mul *) + | NOP ⇒ execute_NO (* nop *) + | NOT ⇒ execute_NO (* not *) + | OR ⇒ execute_NO (* or *) + | PAGE ⇒ execute_NO (* set Page Register *) + | POP ⇒ execute_NO (* pop *) + | PUSH ⇒ execute_NO (* push *) + | RET ⇒ execute_NO (* subroutine ret *) + | RETI ⇒ execute_NO (* interrupt ret -- not impl. ERR *) + | RETNP ⇒ execute_NO (* subroutine ret & don't restore Page Register *) + | RETW ⇒ execute_NO (* subroutine ret & load W Register *) + | RL ⇒ execute_NO (* rotate left *) + | RR ⇒ execute_NO (* rotate right *) + | SB ⇒ execute_NO (* skip if bit set *) + | SETB ⇒ execute_NO (* set bit *) + | SNB ⇒ execute_NO (* skip if bit not set *) + | SPEED ⇒ execute_NO (* set Speed Register *) + | SUB ⇒ execute_NO (* sub *) + | SUBC ⇒ execute_NO (* sub with carry *) + | SWAP ⇒ execute_NO (* swap xxxxyyyy → yyyyxxxx *) + | TEST ⇒ execute_NO (* set flags according to zero test *) + | XOR ⇒ execute_NO (* xor *) + ]. + +(* stati speciali di esecuzione *) +ndefinition IP2022_check_susp ≝ +λps:IP2022_pseudo.match ps with + [ BREAK ⇒ Some ? BGND_MODE + | BREAKX ⇒ Some ? BGND_MODE + | _ ⇒ None ? + ]. + +(* istruzioni speciali per skip *) +ndefinition IP2022_check_skip ≝ +λps:IP2022_pseudo.match ps with + [ LOADH ⇒ true + | LOADL ⇒ true + | PAGE ⇒ true + | _ ⇒ false + ]. + +(* motiplicatore del ciclo di durata *) +ndefinition IP2022_clk_mult ≝ +λt.λs:any_status IP2022 t. + (* divisore del clock, 0 = stop *) + match speed_reg_IP2022 … (alu … s) with + [ x0 ⇒ nat1 | x1 ⇒ nat2 | x2 ⇒ nat3 | x3 ⇒ nat4 + | x4 ⇒ nat5 | x5 ⇒ nat6 | x6 ⇒ nat8 | x7 ⇒ nat10 + | x8 ⇒ nat12 | x9 ⇒ nat16 | xA ⇒ nat24 | xB ⇒ nat32 + | xC ⇒ nat48 | xD ⇒ nat64 | xE ⇒ nat128 | xF ⇒ O ] * + (* FLASH clock 120MHz, RAM clock 40MHz *) + match IP2022_pc_flashtest (get_pc_reg … s) with + [ true ⇒ nat3 | false ⇒ nat1 ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/multivm/multivm.ma b/helm/software/matita/contribs/ng_assembly2/emulator/multivm/multivm.ma new file mode 100755 index 000000000..d68fe351b --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/multivm/multivm.ma @@ -0,0 +1,216 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/multivm/Freescale_multivm.ma". +include "emulator/multivm/IP2022_multivm.ma". +include "emulator/read_write/fetch.ma". + +(* raccordo *) +ndefinition execute_any ≝ +λm.match m + return λm.aux_pseudo_type m → Πt.any_status m t → word16 → + aux_im_type m → option (ProdT (any_status m t) word16) + with + [ HC05 ⇒ λps:aux_pseudo_type ?.Freescale_execute_any ps ? + | HC08 ⇒ λps:aux_pseudo_type ?.Freescale_execute_any ps ? + | HCS08 ⇒ λps:aux_pseudo_type ?.Freescale_execute_any ps ? + | RS08 ⇒ λps:aux_pseudo_type ?.Freescale_execute_any ps ? + | IP2022 ⇒ λps:aux_pseudo_type ?.IP2022_execute_any ps ? + ]. + +(* raccordo *) +ndefinition check_susp ≝ +λm.match m + return λm.aux_pseudo_type m → option susp_type + with + [ HC05 ⇒ Freescale_check_susp + | HC08 ⇒ Freescale_check_susp + | HCS08 ⇒ Freescale_check_susp + | RS08 ⇒ Freescale_check_susp + | IP2022 ⇒ IP2022_check_susp + ]. + +(* raccordo *) +ndefinition check_skip ≝ +λm.match m + return λm.aux_pseudo_type m → bool + with + [ HC05 ⇒ Freescale_check_skip + | HC08 ⇒ Freescale_check_skip + | HCS08 ⇒ Freescale_check_skip + | RS08 ⇒ Freescale_check_skip + | IP2022 ⇒ IP2022_check_skip + ]. + +(* motiplicatore del ciclo di durata *) +(* 0 = sospensione *) +ndefinition clk_mult ≝ +λm.match m + return λm.Πt.any_status m t → nat + with + [ HC05 ⇒ Freescale_clk_mult HC05 + | HC08 ⇒ Freescale_clk_mult HC08 + | HCS08 ⇒ Freescale_clk_mult HCS08 + | RS08 ⇒ Freescale_clk_mult RS08 + | IP2022 ⇒ IP2022_clk_mult + ]. + +(* **** *) +(* TICK *) +(* **** *) + +(* - errore: errore+stato (seguira' reset o …, cmq lo stato non va buttato) + - sospensione: sospensione+stato (seguira' resume o …) + - ok: stato *) +ninductive tick_result (A:Type) : Type ≝ + TickERR : A → error_type → tick_result A +| TickSUSP : A → susp_type → tick_result A +| TickOK : A → tick_result A. + +(* l'esecuzione e' considerata atomica quindi nel caso di un'instruzione + da 3 cicli la successione sara' + ([fetch/decode] s,clk:None) → + ( s,clk:Some 1,pseudo,mode,3,cur_pc) → + ( s,clk:Some 2,pseudo,mode,3,cur_pc) → + ([execute] s',clk:None) *) +ndefinition tick_execute ≝ +λm,t.λs:any_status m t. +λps:aux_pseudo_type m.λi:aux_im_type m. +λcur_pc:word16. + match execute_any m ps t s cur_pc i with + (* errore! fine esecuzione *) + [ None ⇒ TickERR ? (set_clk_desc … s (None ?)) ILL_FETCH_AD + (* ok, aggiornamento centralizzato *) + | Some S_newPC ⇒ match S_newPC with + [ pair s_tmp1 new_pc ⇒ + (* clk azzerato *) + let s_tmp2 ≝ set_clk_desc … s_tmp1 (None ?) in + (* aggiornamento pc *) + let s_tmp3 ≝ match eqc ? (get_pc_reg … s) (get_pc_reg … s_tmp1) with + (* ok, new_pc → pc *) + [ true ⇒ set_pc_reg … s_tmp2 new_pc + (* effetto collaterale modifica pc! scartare new_pc *) + | false ⇒ s_tmp2 ] in + match check_susp m ps with + (* esecuzione continua *) + [ None ⇒ TickOK ? s_tmp3 + (* esecuzione sospesa *) + | Some susp ⇒ TickSUSP ? s_tmp3 susp + ]]]. + +(* avanza fra fetch / countdown / execute *) +ndefinition tick_skip_aux ≝ +λm,t.λs:any_status m t. + match get_skip_mode … s with + [ None ⇒ false + | Some b ⇒ b ]. + +(* descrittore del fetch PSEUDO + INSTR_MODE + OPCODE + CICLI *) + +(* descrittore del click = stato di avanzamento dell'esecuzione *) +(* 1) None = istruzione eseguita, attesa del fetch *) +(* 2) Some cur_clk,clks,pseudo,mode,cur_pc = fetch eseguito *) +ndefinition tick ≝ +λm,t.λs:any_status m t. + match clk_desc … s with + (* e' il momento del fetch *) + [ None ⇒ match fetch … s with + (* errore nel fetch/decode? riportato in output, nessun avanzamento *) + [ FetchERR err ⇒ TickERR ? s err + (* nessun errore nel fetch *) + | FetchOK finfo cur_pc ⇒ match tick_skip_aux … s with + (* skip mode! *) + [ true ⇒ TickOK ? (set_clk_desc … + (set_pc_reg … + (match check_skip m (fst4T … finfo) with + [ true ⇒ s | false ⇒ setweak_skip_mode … s false ]) cur_pc) (None ?)) + (* ciclo normale: applicare divisore a numero reale di cicli *) + | false ⇒ + let real_clk ≝ (clk_mult … s)*(fth4T … finfo) in + match real_clk with + (* 0 = stop *) + [ O ⇒ TickSUSP ? s STOP_MODE + | S clk' ⇒ match clk' with + (* un solo clk, execute subito *) + [ O ⇒ tick_execute … s (fst4T … finfo) (snd4T … finfo) cur_pc + (* piu' clk, execute rimandata *) + | S clk'' ⇒ TickOK ? (set_clk_desc … s + (Some ? (quintuple … nat1 real_clk + (fst4T … finfo) (snd4T … finfo) cur_pc))) + ] + ] + ] + ] + (* fetch gia' eseguito, e' il turno di execute? *) + | Some sinfo ⇒ match eqc ? (S (fst5T … sinfo)) (snd5T … sinfo) with + (* si *) + [ true ⇒ tick_execute … s (thd5T … sinfo) (fth5T … sinfo) (fft5T … sinfo) + (* no, avanzamento cur_clk *) + | false ⇒ TickOK ? (set_clk_desc … s + (Some ? (quintuple … (S (fst5T … sinfo)) (snd5T … sinfo) + (thd5T … sinfo) (fth5T … sinfo) (fft5T … sinfo)))) + ] + ]. + +(* ********** *) +(* ESECUZIONE *) +(* ********** *) + +nlet rec execute (m:mcu_type) (t:memory_impl) (s:tick_result (any_status m t)) (n:nat) on n ≝ + match s with + [ TickERR s' error ⇒ TickERR ? s' error + | TickSUSP s' susp ⇒ TickSUSP ? s' susp + | TickOK s' ⇒ match n with [ O ⇒ TickOK ? s' | S n' ⇒ execute m t (tick m t s') n' ] + ]. + +nlemma breakpoint_err : ∀m,t,s,err,n.execute m t (TickERR ? s err) n = TickERR ? s err. + #m; #t; #s; #err; #n; + ncases n; + ##[ ##2: #n1; ##] + nnormalize; + napply refl_eq. +nqed. + +nlemma breakpoint_susp : ∀m,t,s,susp,n.execute m t (TickSUSP ? s susp) n = TickSUSP ? s susp. + #m; #t; #s; #susp; #n; + ncases n; + ##[ ##2: #n1; ##] + nnormalize; + napply refl_eq. +nqed. + +nlemma breakpoint : + ∀m,t,n1,n2,s. execute m t s (n1 + n2) = execute m t (execute m t s n1) n2. + #m; #t; #n1; + nelim n1; + ##[ ##1: nnormalize; #n2; #s; ncases s; nnormalize; ##[ ##1,2: #x ##] #y; napply refl_eq + ##| ##2: #n3; #H; #n2; #s; ncases s; + ##[ ##1: #x; #y; nnormalize; nrewrite > (breakpoint_err m t x y n2); napply refl_eq + ##| ##2: #x; #y; nnormalize; nrewrite > (breakpoint_susp m t x y n2); napply refl_eq + ##| ##3: #x; nrewrite > (Sn_p_n_to_S_npn n3 n2); + nchange with ((execute m t (tick m t x) (n3+n2)) = + (execute m t (execute m t (tick m t x) n3) n2)); + nrewrite > (H n2 (tick m t x)); + napply refl_eq + ##] + ##] +nqed. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/multivm/multivm_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/multivm/multivm_base.ma new file mode 100755 index 000000000..9479a3056 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/multivm/multivm_base.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status_setter.ma". + +ndefinition set_zflb ≝ +λm,t.λs:any_status m t.λb:byte8.set_z_flag … s (eqc ? b (zeroc ?)). +ndefinition set_zflw ≝ +λm,t.λs:any_status m t.λw:word16.set_z_flag … s (eqc ? w (zeroc ?)). + +ndefinition set_nflb ≝ +λm,t.λs:any_status m t.λb:byte8.setweak_n_flag … s (getMSBc ? b). +ndefinition set_nflw ≝ +λm,t.λs:any_status m t.λw:word16.setweak_n_flag … s (getMSBc ? w). + +(* enumerazione delle possibili modalita' di sospensione *) +ninductive susp_type : Type ≝ + BGND_MODE: susp_type +| STOP_MODE: susp_type +| WAIT_MODE: susp_type. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC05_table.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC05_table.ma index 20b16ec86..912c55328 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC05_table.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC05_table.ma @@ -34,336 +34,336 @@ include "common/list.ma". ndefinition opcode_table_HC05_1 ≝ [ - quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x5〉 -; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x4〉 + quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) nat2 +; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) nat3 +; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) nat4 +; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) nat5 +; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) nat4 +; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) nat4 ]. ndefinition opcode_table_HC05_2 ≝ [ - quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x5〉 -; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x3〉 + quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) nat2 +; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) nat3 +; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) nat4 +; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) nat5 +; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) nat4 +; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) nat3 ]. ndefinition opcode_table_HC05_3 ≝ [ - quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x5〉 -; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x3〉 + quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) nat2 +; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) nat3 +; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) nat4 +; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) nat5 +; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) nat4 +; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) nat3 ]. ndefinition opcode_table_HC05_4 ≝ [ - quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x5〉 -; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) 〈x0,x3〉 -; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) 〈x0,x3〉 -; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x6〉 -; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x5〉 + quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) nat5 +; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) nat3 +; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) nat3 +; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) nat6 +; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) nat5 ]. ndefinition opcode_table_HC05_5 ≝ [ - quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x5〉 -; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) 〈x0,x3〉 -; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) 〈x0,x3〉 -; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x6〉 -; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x5〉 + quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) nat5 +; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) nat3 +; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) nat3 +; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) nat6 +; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) nat5 ]. ndefinition opcode_table_HC05_6 ≝ [ - quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 -; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 -; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 -; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 -; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 -; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 -; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 -; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 -; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 -; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 -; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 -; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 -; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 -; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 -; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 -; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 + quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) nat3 +; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) nat3 +; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) nat3 +; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) nat3 +; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) nat3 +; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) nat3 +; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) nat3 +; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) nat3 +; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) nat3 +; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) nat3 +; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) nat3 +; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) nat3 +; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) nat3 +; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) nat3 +; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) nat3 +; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) nat3 ]. ndefinition opcode_table_HC05_7 ≝ [ - quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 + quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) nat5 +; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) nat5 +; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) nat5 +; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) nat5 +; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) nat5 +; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) nat5 +; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) nat5 +; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) nat5 +; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) nat5 +; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) nat5 +; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) nat5 +; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) nat5 +; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) nat5 +; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) nat5 +; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) nat5 +; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) nat5 ]. ndefinition opcode_table_HC05_8 ≝ [ - quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 + quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) nat5 ]. ndefinition opcode_table_HC05_9 ≝ [ - quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 -; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x5〉 -; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x3〉 + quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) nat2 +; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) nat3 +; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) nat4 +; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) nat5 +; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) nat4 +; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) nat3 ]. ndefinition opcode_table_HC05_10 ≝ [ - quadruple … MUL MODE_INH (Byte 〈x4,x2〉) 〈x0,xB〉 -; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) 〈x0,x9〉 -; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) 〈x0,x6〉 -; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) 〈x0,xA〉 -; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) 〈x0,x2〉 -; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) 〈x0,x2〉 -; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) 〈x0,x2〉 -; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) 〈x0,x2〉 -; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) 〈x0,x2〉 -; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) 〈x0,x2〉 -; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) 〈x0,x2〉 -; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) 〈x0,x2〉 -; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) 〈x0,x2〉 -; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) 〈x0,x2〉 + quadruple … MUL MODE_INH (Byte 〈x4,x2〉) nat11 +; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) nat9 +; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) nat6 +; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) nat10 +; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) nat2 +; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) nat2 +; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) nat2 +; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) nat2 +; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) nat2 +; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) nat2 +; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) nat2 +; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) nat2 +; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) nat2 +; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) nat2 ]. ndefinition opcode_table_HC05_11 ≝ [ - quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x5〉 -; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x6〉 -; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x5〉 + quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) nat5 +; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) nat3 +; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) nat3 +; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) nat6 +; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) nat5 ]. ndefinition opcode_table_HC05_12 ≝ [ - quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x5〉 -; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x3〉 + quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) nat2 +; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) nat3 +; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) nat4 +; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) nat5 +; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) nat4 +; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) nat3 ]. ndefinition opcode_table_HC05_13 ≝ [ - quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x5〉 -; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) 〈x0,x3〉 -; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) 〈x0,x3〉 -; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x6〉 -; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x5〉 + quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) nat5 +; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) nat3 +; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) nat3 +; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) nat6 +; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) nat5 ]. ndefinition opcode_table_HC05_14 ≝ [ - quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 -; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x5〉 -; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x3〉 + quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) nat2 +; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) nat3 +; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) nat4 +; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) nat5 +; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) nat4 +; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) nat3 ]. ndefinition opcode_table_HC05_15 ≝ [ - quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 -; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) 〈x0,x3〉 -; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) 〈x0,x3〉 -; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x6〉 -; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x5〉 + quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) nat5 +; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) nat3 +; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) nat3 +; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) nat6 +; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) nat5 ]. ndefinition opcode_table_HC05_16 ≝ [ - quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x5〉 -; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x3〉 + quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) nat2 +; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) nat3 +; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) nat4 +; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) nat5 +; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) nat4 +; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) nat3 ]. ndefinition opcode_table_HC05_17 ≝ [ - quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 -; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) 〈x0,x3〉 -; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) 〈x0,x3〉 -; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x6〉 -; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x5〉 + quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) nat5 +; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) nat3 +; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) nat3 +; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) nat6 +; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) nat5 ]. ndefinition opcode_table_HC05_18 ≝ [ - quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x2〉 -; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 -; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x2〉 + quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) nat2 +; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) nat3 +; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) nat4 +; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) nat3 +; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) nat2 ]. ndefinition opcode_table_HC05_19 ≝ [ - quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x7〉 -; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x5〉 + quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) nat6 +; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) nat5 +; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) nat6 +; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) nat7 +; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) nat6 +; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) nat5 ]. ndefinition opcode_table_HC05_20 ≝ [ - quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x5〉 -; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x3〉 + quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) nat2 +; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) nat3 +; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) nat4 +; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) nat5 +; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) nat4 +; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) nat3 ]. ndefinition opcode_table_HC05_21 ≝ [ - quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 -; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x5〉 -; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x3〉 + quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) nat2 +; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) nat3 +; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) nat4 +; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) nat5 +; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) nat4 +; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) nat3 ]. ndefinition opcode_table_HC05_22 ≝ [ - quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x5〉 -; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) 〈x0,x3〉 -; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) 〈x0,x3〉 -; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x6〉 -; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x5〉 + quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) nat5 +; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) nat3 +; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) nat3 +; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) nat6 +; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) nat5 ]. ndefinition opcode_table_HC05_23 ≝ [ - quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x5〉 -; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) 〈x0,x3〉 -; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) 〈x0,x3〉 -; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x6〉 -; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x5〉 + quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) nat5 +; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) nat3 +; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) nat3 +; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) nat6 +; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) nat5 ]. ndefinition opcode_table_HC05_24 ≝ [ - quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x5〉 -; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x3〉 + quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) nat2 +; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) nat3 +; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) nat4 +; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) nat5 +; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) nat4 +; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) nat3 ]. ndefinition opcode_table_HC05_25 ≝ [ - quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x5〉 -; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) 〈x0,x3〉 -; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) 〈x0,x3〉 -; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x6〉 -; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x5〉 + quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) nat5 +; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) nat3 +; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) nat3 +; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) nat6 +; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) nat5 ]. ndefinition opcode_table_HC05_26 ≝ [ - quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x5〉 -; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) 〈x0,x3〉 -; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) 〈x0,x3〉 -; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x6〉 -; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x5〉 + quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) nat5 +; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) nat3 +; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) nat3 +; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) nat6 +; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) nat5 ]. ndefinition opcode_table_HC05_27 ≝ [ - quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x5〉 -; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x3〉 + quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) nat2 +; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) nat3 +; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) nat4 +; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) nat5 +; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) nat4 +; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) nat3 ]. ndefinition opcode_table_HC05_28 ≝ [ - quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x5〉 -; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x6〉 -; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x5〉 -; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x4〉 + quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) nat4 +; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) nat5 +; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) nat6 +; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) nat5 +; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) nat4 ]. ndefinition opcode_table_HC05_29 ≝ [ - quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x5〉 -; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x6〉 -; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x5〉 -; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x4〉 + quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) nat4 +; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) nat5 +; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) nat6 +; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) nat5 +; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) nat4 ]. ndefinition opcode_table_HC05_30 ≝ [ - quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x5〉 -; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x3〉 + quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) nat2 +; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) nat3 +; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) nat4 +; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) nat5 +; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) nat4 +; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) nat3 ]. ndefinition opcode_table_HC05_31 ≝ [ - quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x4〉 -; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x5〉 -; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x4〉 + quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) nat4 +; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) nat3 +; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) nat3 +; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) nat5 +; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) nat4 ]. ndefinition opcode_table_HC05 ≝ diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC08_table.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC08_table.ma index a0a7300f5..04ca1a109 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC08_table.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC08_table.ma @@ -34,432 +34,432 @@ include "common/list.ma". ndefinition opcode_table_HC08_1 ≝ [ - quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x9〉〉) 〈x0,x5〉 -; quadruple … ADC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x9〉〉) 〈x0,x4〉 + quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) nat2 +; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) nat3 +; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) nat4 +; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) nat4 +; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) nat3 +; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) nat2 +; quadruple … ADC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x9〉〉) nat5 +; quadruple … ADC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x9〉〉) nat4 ]. ndefinition opcode_table_HC08_2 ≝ [ - quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xB〉〉) 〈x0,x5〉 -; quadruple … ADD MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xB〉〉) 〈x0,x4〉 + quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) nat2 +; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) nat3 +; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) nat4 +; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) nat4 +; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) nat3 +; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) nat2 +; quadruple … ADD MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xB〉〉) nat5 +; quadruple … ADD MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xB〉〉) nat4 ]. ndefinition opcode_table_HC08_3 ≝ [ - quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x4〉〉) 〈x0,x5〉 -; quadruple … AND MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x4〉〉) 〈x0,x4〉 + quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) nat2 +; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) nat3 +; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) nat4 +; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) nat4 +; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) nat3 +; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) nat2 +; quadruple … AND MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x4〉〉) nat5 +; quadruple … AND MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x4〉〉) nat4 ]. ndefinition opcode_table_HC08_4 ≝ [ - quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x4〉 -; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 -; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) 〈x0,x1〉 -; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x4〉 -; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x3〉 -; quadruple … ASL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x8〉〉) 〈x0,x5〉 + quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) nat4 +; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) nat1 +; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) nat1 +; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) nat4 +; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) nat3 +; quadruple … ASL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x8〉〉) nat5 ]. ndefinition opcode_table_HC08_5 ≝ [ - quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x4〉 -; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) 〈x0,x1〉 -; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) 〈x0,x1〉 -; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x4〉 -; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x3〉 -; quadruple … ASR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x7〉〉) 〈x0,x5〉 + quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) nat4 +; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) nat1 +; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) nat1 +; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) nat4 +; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) nat3 +; quadruple … ASR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x7〉〉) nat5 ]. ndefinition opcode_table_HC08_6 ≝ [ - quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 -; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 -; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 -; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 -; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 -; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 -; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 -; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 -; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 -; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 -; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 -; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 -; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 -; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 -; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 -; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 -; quadruple … BGE MODE_IMM1 (Byte 〈x9,x0〉) 〈x0,x3〉 -; quadruple … BLT MODE_IMM1 (Byte 〈x9,x1〉) 〈x0,x3〉 -; quadruple … BGT MODE_IMM1 (Byte 〈x9,x2〉) 〈x0,x3〉 -; quadruple … BLE MODE_IMM1 (Byte 〈x9,x3〉) 〈x0,x3〉 + quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) nat3 +; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) nat3 +; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) nat3 +; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) nat3 +; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) nat3 +; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) nat3 +; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) nat3 +; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) nat3 +; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) nat3 +; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) nat3 +; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) nat3 +; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) nat3 +; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) nat3 +; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) nat3 +; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) nat3 +; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) nat3 +; quadruple … BGE MODE_IMM1 (Byte 〈x9,x0〉) nat3 +; quadruple … BLT MODE_IMM1 (Byte 〈x9,x1〉) nat3 +; quadruple … BGT MODE_IMM1 (Byte 〈x9,x2〉) nat3 +; quadruple … BLE MODE_IMM1 (Byte 〈x9,x3〉) nat3 ]. ndefinition opcode_table_HC08_7 ≝ [ - quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x4〉 + quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) nat4 +; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) nat4 +; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) nat4 +; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) nat4 +; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) nat4 +; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) nat4 +; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) nat4 +; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) nat4 +; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) nat4 +; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) nat4 +; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) nat4 +; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) nat4 +; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) nat4 +; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) nat4 +; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) nat4 +; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) nat4 ]. ndefinition opcode_table_HC08_8 ≝ [ - quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 + quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) nat5 ]. ndefinition opcode_table_HC08_9 ≝ [ - quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 -; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x2〉 -; quadruple … BIT MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x5〉〉) 〈x0,x5〉 -; quadruple … BIT MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x5〉〉) 〈x0,x4〉 + quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) nat2 +; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) nat3 +; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) nat4 +; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) nat4 +; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) nat3 +; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) nat2 +; quadruple … BIT MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x5〉〉) nat5 +; quadruple … BIT MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x5〉〉) nat4 ]. ndefinition opcode_table_HC08_10 ≝ [ - quadruple … MUL MODE_INH (Byte 〈x4,x2〉) 〈x0,x5〉 -; quadruple … DIV MODE_INH (Byte 〈x5,x2〉) 〈x0,x7〉 -; quadruple … NSA MODE_INH (Byte 〈x6,x2〉) 〈x0,x3〉 -; quadruple … DAA MODE_INH (Byte 〈x7,x2〉) 〈x0,x2〉 -; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) 〈x0,x7〉 -; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) 〈x0,x4〉 -; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) 〈x0,x9〉 -; quadruple … TAP MODE_INH (Byte 〈x8,x4〉) 〈x0,x2〉 -; quadruple … TPA MODE_INH (Byte 〈x8,x5〉) 〈x0,x1〉 -; quadruple … PULA MODE_INH (Byte 〈x8,x6〉) 〈x0,x2〉 -; quadruple … PSHA MODE_INH (Byte 〈x8,x7〉) 〈x0,x2〉 -; quadruple … PULX MODE_INH (Byte 〈x8,x8〉) 〈x0,x2〉 -; quadruple … PSHX MODE_INH (Byte 〈x8,x9〉) 〈x0,x2〉 -; quadruple … PULH MODE_INH (Byte 〈x8,xA〉) 〈x0,x2〉 -; quadruple … PSHH MODE_INH (Byte 〈x8,xB〉) 〈x0,x2〉 -; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) 〈x0,x1〉 -; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) 〈x0,x1〉 -; quadruple … TXS MODE_INH (Byte 〈x9,x4〉) 〈x0,x2〉 -; quadruple … TSX MODE_INH (Byte 〈x9,x5〉) 〈x0,x2〉 -; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) 〈x0,x1〉 -; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) 〈x0,x1〉 -; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) 〈x0,x1〉 -; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) 〈x0,x2〉 -; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) 〈x0,x2〉 -; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) 〈x0,x1〉 -; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) 〈x0,x1〉 -; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) 〈x0,x1〉 -; quadruple … AIS MODE_IMM1 (Byte 〈xA,x7〉) 〈x0,x2〉 -; quadruple … AIX MODE_IMM1 (Byte 〈xA,xF〉) 〈x0,x2〉 + quadruple … MUL MODE_INH (Byte 〈x4,x2〉) nat5 +; quadruple … DIV MODE_INH (Byte 〈x5,x2〉) nat7 +; quadruple … NSA MODE_INH (Byte 〈x6,x2〉) nat3 +; quadruple … DAA MODE_INH (Byte 〈x7,x2〉) nat2 +; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) nat7 +; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) nat4 +; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) nat9 +; quadruple … TAP MODE_INH (Byte 〈x8,x4〉) nat2 +; quadruple … TPA MODE_INH (Byte 〈x8,x5〉) nat1 +; quadruple … PULA MODE_INH (Byte 〈x8,x6〉) nat2 +; quadruple … PSHA MODE_INH (Byte 〈x8,x7〉) nat2 +; quadruple … PULX MODE_INH (Byte 〈x8,x8〉) nat2 +; quadruple … PSHX MODE_INH (Byte 〈x8,x9〉) nat2 +; quadruple … PULH MODE_INH (Byte 〈x8,xA〉) nat2 +; quadruple … PSHH MODE_INH (Byte 〈x8,xB〉) nat2 +; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) nat1 +; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) nat1 +; quadruple … TXS MODE_INH (Byte 〈x9,x4〉) nat2 +; quadruple … TSX MODE_INH (Byte 〈x9,x5〉) nat2 +; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) nat1 +; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) nat1 +; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) nat1 +; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) nat2 +; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) nat2 +; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) nat1 +; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) nat1 +; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) nat1 +; quadruple … AIS MODE_IMM1 (Byte 〈xA,x7〉) nat2 +; quadruple … AIX MODE_IMM1 (Byte 〈xA,xF〉) nat2 ]. ndefinition opcode_table_HC08_11 ≝ [ - quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 -; quadruple … CBEQX MODE_IMM1_and_IMM1 (Byte 〈x5,x1〉) 〈x0,x4〉 -; quadruple … CBEQA MODE_IX1p_and_IMM1 (Byte 〈x6,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IX0p_and_IMM1 (Byte 〈x7,x1〉) 〈x0,x4〉 -; quadruple … CBEQA MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,x1〉〉) 〈x0,x6〉 + quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) nat5 +; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) nat4 +; quadruple … CBEQX MODE_IMM1_and_IMM1 (Byte 〈x5,x1〉) nat4 +; quadruple … CBEQA MODE_IX1p_and_IMM1 (Byte 〈x6,x1〉) nat5 +; quadruple … CBEQA MODE_IX0p_and_IMM1 (Byte 〈x7,x1〉) nat4 +; quadruple … CBEQA MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,x1〉〉) nat6 ]. ndefinition opcode_table_HC08_12 ≝ [ - quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 -; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) 〈x0,x1〉 -; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x2〉 -; quadruple … CLR MODE_INHH (Byte 〈x8,xC〉) 〈x0,x1〉 -; quadruple … CLR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xF〉〉) 〈x0,x4〉 + quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) nat3 +; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) nat1 +; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) nat1 +; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) nat3 +; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) nat2 +; quadruple … CLR MODE_INHH (Byte 〈x8,xC〉) nat1 +; quadruple … CLR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xF〉〉) nat4 ]. ndefinition opcode_table_HC08_13 ≝ [ - quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x1〉〉) 〈x0,x5〉 -; quadruple … CMP MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x1〉〉) 〈x0,x4〉 + quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) nat2 +; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) nat3 +; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) nat4 +; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) nat4 +; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) nat3 +; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) nat2 +; quadruple … CMP MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x1〉〉) nat5 +; quadruple … CMP MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x1〉〉) nat4 ]. ndefinition opcode_table_HC08_14 ≝ [ - quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x4〉 -; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 -; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) 〈x0,x1〉 -; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x4〉 -; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x3〉 -; quadruple … COM MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x3〉〉) 〈x0,x5〉 + quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) nat4 +; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) nat1 +; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) nat1 +; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) nat4 +; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) nat3 +; quadruple … COM MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x3〉〉) nat5 ]. ndefinition opcode_table_HC08_15 ≝ [ - quadruple … STHX MODE_DIR1 (Byte 〈x3,x5〉) 〈x0,x4〉 -; quadruple … LDHX MODE_IMM2 (Byte 〈x4,x5〉) 〈x0,x3〉 -; quadruple … LDHX MODE_DIR1 (Byte 〈x5,x5〉) 〈x0,x4〉 -; quadruple … CPHX MODE_IMM2 (Byte 〈x6,x5〉) 〈x0,x3〉 -; quadruple … CPHX MODE_DIR1 (Byte 〈x7,x5〉) 〈x0,x4〉 + quadruple … STHX MODE_DIR1 (Byte 〈x3,x5〉) nat4 +; quadruple … LDHX MODE_IMM2 (Byte 〈x4,x5〉) nat3 +; quadruple … LDHX MODE_DIR1 (Byte 〈x5,x5〉) nat4 +; quadruple … CPHX MODE_IMM2 (Byte 〈x6,x5〉) nat3 +; quadruple … CPHX MODE_DIR1 (Byte 〈x7,x5〉) nat4 ]. ndefinition opcode_table_HC08_16 ≝ [ - quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 -; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x2〉 -; quadruple … CPX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x3〉〉) 〈x0,x5〉 -; quadruple … CPX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x3〉〉) 〈x0,x4〉 + quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) nat2 +; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) nat3 +; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) nat4 +; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) nat4 +; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) nat3 +; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) nat2 +; quadruple … CPX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x3〉〉) nat5 +; quadruple … CPX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x3〉〉) nat4 ]. ndefinition opcode_table_HC08_17 ≝ [ - quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x5〉 -; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x3〉 -; quadruple … DBNZ MODE_INHX_and_IMM1 (Byte 〈x5,xB〉) 〈x0,x3〉 -; quadruple … DBNZ MODE_IX1_and_IMM1 (Byte 〈x6,xB〉) 〈x0,x5〉 -; quadruple … DBNZ MODE_IX0_and_IMM1 (Byte 〈x7,xB〉) 〈x0,x4〉 -; quadruple … DBNZ MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,xB〉〉) 〈x0,x6〉 + quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) nat5 +; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) nat3 +; quadruple … DBNZ MODE_INHX_and_IMM1 (Byte 〈x5,xB〉) nat3 +; quadruple … DBNZ MODE_IX1_and_IMM1 (Byte 〈x6,xB〉) nat5 +; quadruple … DBNZ MODE_IX0_and_IMM1 (Byte 〈x7,xB〉) nat4 +; quadruple … DBNZ MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,xB〉〉) nat6 ]. ndefinition opcode_table_HC08_18 ≝ [ - quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x4〉 -; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 -; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) 〈x0,x1〉 -; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x4〉 -; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x3〉 -; quadruple … DEC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xA〉〉) 〈x0,x5〉 + quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) nat4 +; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) nat1 +; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) nat1 +; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) nat4 +; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) nat3 +; quadruple … DEC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xA〉〉) nat5 ]. ndefinition opcode_table_HC08_19 ≝ [ - quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x8〉〉) 〈x0,x5〉 -; quadruple … EOR MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x8〉〉) 〈x0,x4〉 + quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) nat2 +; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) nat3 +; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) nat4 +; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) nat4 +; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) nat3 +; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) nat2 +; quadruple … EOR MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x8〉〉) nat5 +; quadruple … EOR MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x8〉〉) nat4 ]. ndefinition opcode_table_HC08_20 ≝ [ - quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x4〉 -; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 -; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) 〈x0,x1〉 -; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x4〉 -; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x3〉 -; quadruple … INC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xC〉〉) 〈x0,x5〉 + quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) nat4 +; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) nat1 +; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) nat1 +; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) nat4 +; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) nat3 +; quadruple … INC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xC〉〉) nat5 ]. ndefinition opcode_table_HC08_21 ≝ [ - quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x2〉 -; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 -; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x3〉 + quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) nat2 +; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) nat3 +; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) nat4 +; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) nat3 +; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) nat3 ]. ndefinition opcode_table_HC08_22 ≝ [ - quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x4〉 -; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x4〉 -; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x4〉 + quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) nat4 +; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) nat4 +; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) nat5 +; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) nat6 +; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) nat5 +; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) nat4 ]. ndefinition opcode_table_HC08_23 ≝ [ - quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x6〉〉) 〈x0,x5〉 -; quadruple … LDA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x6〉〉) 〈x0,x4〉 + quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) nat2 +; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) nat3 +; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) nat4 +; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) nat4 +; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) nat3 +; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) nat2 +; quadruple … LDA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x6〉〉) nat5 +; quadruple … LDA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x6〉〉) nat4 ]. ndefinition opcode_table_HC08_24 ≝ [ - quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 -; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x2〉 -; quadruple … LDX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xE〉〉) 〈x0,x5〉 -; quadruple … LDX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xE〉〉) 〈x0,x4〉 + quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) nat2 +; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) nat3 +; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) nat4 +; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) nat4 +; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) nat3 +; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) nat2 +; quadruple … LDX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xE〉〉) nat5 +; quadruple … LDX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xE〉〉) nat4 ]. ndefinition opcode_table_HC08_25 ≝ [ - quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x4〉 -; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 -; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) 〈x0,x1〉 -; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x4〉 -; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x3〉 -; quadruple … LSR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x4〉〉) 〈x0,x5〉 + quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) nat4 +; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) nat1 +; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) nat1 +; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) nat4 +; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) nat3 +; quadruple … LSR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x4〉〉) nat5 ]. ndefinition opcode_table_HC08_26 ≝ [ - quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 -; quadruple … MOV MODE_DIR1_to_IX0p (Byte 〈x5,xE〉) 〈x0,x4〉 -; quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x6,xE〉) 〈x0,x4〉 -; quadruple … MOV MODE_IX0p_to_DIR1 (Byte 〈x7,xE〉) 〈x0,x4〉 + quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) nat5 +; quadruple … MOV MODE_DIR1_to_IX0p (Byte 〈x5,xE〉) nat4 +; quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x6,xE〉) nat4 +; quadruple … MOV MODE_IX0p_to_DIR1 (Byte 〈x7,xE〉) nat4 ]. ndefinition opcode_table_HC08_27 ≝ [ - quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x4〉 -; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) 〈x0,x1〉 -; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) 〈x0,x1〉 -; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x4〉 -; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x3〉 -; quadruple … NEG MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x0〉〉) 〈x0,x5〉 + quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) nat4 +; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) nat1 +; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) nat1 +; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) nat4 +; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) nat3 +; quadruple … NEG MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x0〉〉) nat5 ]. ndefinition opcode_table_HC08_28 ≝ [ - quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xA〉〉) 〈x0,x5〉 -; quadruple … ORA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xA〉〉) 〈x0,x4〉 + quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) nat2 +; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) nat3 +; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) nat4 +; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) nat4 +; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) nat3 +; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) nat2 +; quadruple … ORA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xA〉〉) nat5 +; quadruple … ORA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xA〉〉) nat4 ]. ndefinition opcode_table_HC08_29 ≝ [ - quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x4〉 -; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 -; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) 〈x0,x1〉 -; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x4〉 -; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x3〉 -; quadruple … ROL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x9〉〉) 〈x0,x5〉 + quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) nat4 +; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) nat1 +; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) nat1 +; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) nat4 +; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) nat3 +; quadruple … ROL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x9〉〉) nat5 ]. ndefinition opcode_table_HC08_30 ≝ [ - quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x4〉 -; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 -; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) 〈x0,x1〉 -; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x4〉 -; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x3〉 -; quadruple … ROR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x6〉〉) 〈x0,x5〉 + quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) nat4 +; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) nat1 +; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) nat1 +; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) nat4 +; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) nat3 +; quadruple … ROR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x6〉〉) nat5 ]. ndefinition opcode_table_HC08_31 ≝ [ - quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x2〉〉) 〈x0,x5〉 -; quadruple … SBC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x2〉〉) 〈x0,x4〉 + quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) nat2 +; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) nat3 +; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) nat4 +; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) nat4 +; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) nat3 +; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) nat2 +; quadruple … SBC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x2〉〉) nat5 +; quadruple … SBC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x2〉〉) nat4 ]. ndefinition opcode_table_HC08_32 ≝ [ - quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 -; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x3〉 -; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x2〉 -; quadruple … STA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x7〉〉) 〈x0,x5〉 -; quadruple … STA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x7〉〉) 〈x0,x4〉 + quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) nat3 +; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) nat4 +; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) nat4 +; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) nat3 +; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) nat2 +; quadruple … STA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x7〉〉) nat5 +; quadruple … STA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x7〉〉) nat4 ]. ndefinition opcode_table_HC08_33 ≝ [ - quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x3〉 -; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x3〉 -; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x2〉 -; quadruple … STX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xF〉〉) 〈x0,x5〉 -; quadruple … STX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xF〉〉) 〈x0,x4〉 + quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) nat3 +; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) nat4 +; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) nat4 +; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) nat3 +; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) nat2 +; quadruple … STX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xF〉〉) nat5 +; quadruple … STX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xF〉〉) nat4 ]. ndefinition opcode_table_HC08_34 ≝ [ - quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x0〉〉) 〈x0,x5〉 -; quadruple … SUB MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x0〉〉) 〈x0,x4〉 + quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) nat2 +; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) nat3 +; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) nat4 +; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) nat4 +; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) nat3 +; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) nat2 +; quadruple … SUB MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x0〉〉) nat5 +; quadruple … SUB MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x0〉〉) nat4 ]. ndefinition opcode_table_HC08_35 ≝ [ - quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) 〈x0,x1〉 -; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) 〈x0,x1〉 -; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x2〉 -; quadruple … TST MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xD〉〉) 〈x0,x4〉 + quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) nat3 +; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) nat1 +; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) nat1 +; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) nat3 +; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) nat2 +; quadruple … TST MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xD〉〉) nat4 ]. ndefinition opcode_table_HC08 ≝ diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HCS08_table.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HCS08_table.ma index 04f3b0890..9e659c827 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HCS08_table.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HCS08_table.ma @@ -34,444 +34,444 @@ include "common/list.ma". ndefinition opcode_table_HCS08_1 ≝ [ - quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x9〉〉) 〈x0,x5〉 -; quadruple … ADC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x9〉〉) 〈x0,x4〉 + quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) nat2 +; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) nat3 +; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) nat4 +; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) nat4 +; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) nat3 +; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) nat3 +; quadruple … ADC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x9〉〉) nat5 +; quadruple … ADC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x9〉〉) nat4 ]. ndefinition opcode_table_HCS08_2 ≝ [ - quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xB〉〉) 〈x0,x5〉 -; quadruple … ADD MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xB〉〉) 〈x0,x4〉 + quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) nat2 +; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) nat3 +; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) nat4 +; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) nat4 +; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) nat3 +; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) nat3 +; quadruple … ADD MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xB〉〉) nat5 +; quadruple … ADD MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xB〉〉) nat4 ]. ndefinition opcode_table_HCS08_3 ≝ [ - quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x4〉〉) 〈x0,x5〉 -; quadruple … AND MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x4〉〉) 〈x0,x4〉 + quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) nat2 +; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) nat3 +; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) nat4 +; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) nat4 +; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) nat3 +; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) nat3 +; quadruple … AND MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x4〉〉) nat5 +; quadruple … AND MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x4〉〉) nat4 ]. ndefinition opcode_table_HCS08_4 ≝ [ - quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x5〉 -; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 -; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) 〈x0,x1〉 -; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x5〉 -; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x4〉 -; quadruple … ASL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x8〉〉) 〈x0,x6〉 + quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) nat5 +; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) nat1 +; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) nat1 +; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) nat5 +; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) nat4 +; quadruple … ASL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x8〉〉) nat6 ]. ndefinition opcode_table_HCS08_5 ≝ [ - quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x5〉 -; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) 〈x0,x1〉 -; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) 〈x0,x1〉 -; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x5〉 -; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x4〉 -; quadruple … ASR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x7〉〉) 〈x0,x6〉 + quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) nat5 +; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) nat1 +; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) nat1 +; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) nat5 +; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) nat4 +; quadruple … ASR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x7〉〉) nat6 ]. ndefinition opcode_table_HCS08_6 ≝ [ - quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 -; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 -; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 -; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 -; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 -; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 -; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 -; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 -; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 -; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 -; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 -; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 -; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 -; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 -; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 -; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 -; quadruple … BGE MODE_IMM1 (Byte 〈x9,x0〉) 〈x0,x3〉 -; quadruple … BLT MODE_IMM1 (Byte 〈x9,x1〉) 〈x0,x3〉 -; quadruple … BGT MODE_IMM1 (Byte 〈x9,x2〉) 〈x0,x3〉 -; quadruple … BLE MODE_IMM1 (Byte 〈x9,x3〉) 〈x0,x3〉 + quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) nat3 +; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) nat3 +; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) nat3 +; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) nat3 +; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) nat3 +; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) nat3 +; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) nat3 +; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) nat3 +; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) nat3 +; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) nat3 +; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) nat3 +; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) nat3 +; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) nat3 +; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) nat3 +; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) nat3 +; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) nat3 +; quadruple … BGE MODE_IMM1 (Byte 〈x9,x0〉) nat3 +; quadruple … BLT MODE_IMM1 (Byte 〈x9,x1〉) nat3 +; quadruple … BGT MODE_IMM1 (Byte 〈x9,x2〉) nat3 +; quadruple … BLE MODE_IMM1 (Byte 〈x9,x3〉) nat3 ]. ndefinition opcode_table_HCS08_7 ≝ [ - quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 + quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) nat5 +; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) nat5 +; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) nat5 +; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) nat5 +; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) nat5 +; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) nat5 +; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) nat5 +; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) nat5 +; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) nat5 +; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) nat5 +; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) nat5 +; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) nat5 +; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) nat5 +; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) nat5 +; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) nat5 +; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) nat5 ]. ndefinition opcode_table_HCS08_8 ≝ [ - quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 + quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) nat5 ]. ndefinition opcode_table_HCS08_9 ≝ [ - quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 -; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x5〉〉) 〈x0,x5〉 -; quadruple … BIT MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x5〉〉) 〈x0,x4〉 + quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) nat2 +; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) nat3 +; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) nat4 +; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) nat4 +; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) nat3 +; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) nat3 +; quadruple … BIT MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x5〉〉) nat5 +; quadruple … BIT MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x5〉〉) nat4 ]. ndefinition opcode_table_HCS08_10 ≝ [ - quadruple … MUL MODE_INH (Byte 〈x4,x2〉) 〈x0,x5〉 -; quadruple … DIV MODE_INH (Byte 〈x5,x2〉) 〈x0,x6〉 -; quadruple … NSA MODE_INH (Byte 〈x6,x2〉) 〈x0,x1〉 -; quadruple … DAA MODE_INH (Byte 〈x7,x2〉) 〈x0,x1〉 -; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) 〈x0,x9〉 -; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) 〈x0,x6〉 -; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) 〈x0,xB〉 -; quadruple … BGND MODE_INH (Byte 〈x8,x2〉) 〈x0,x5〉 -; quadruple … TAP MODE_INH (Byte 〈x8,x4〉) 〈x0,x1〉 -; quadruple … TPA MODE_INH (Byte 〈x8,x5〉) 〈x0,x1〉 -; quadruple … PULA MODE_INH (Byte 〈x8,x6〉) 〈x0,x3〉 -; quadruple … PSHA MODE_INH (Byte 〈x8,x7〉) 〈x0,x2〉 -; quadruple … PULX MODE_INH (Byte 〈x8,x8〉) 〈x0,x3〉 -; quadruple … PSHX MODE_INH (Byte 〈x8,x9〉) 〈x0,x2〉 -; quadruple … PULH MODE_INH (Byte 〈x8,xA〉) 〈x0,x3〉 -; quadruple … PSHH MODE_INH (Byte 〈x8,xB〉) 〈x0,x2〉 -; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) 〈x0,x2〉 -; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) 〈x0,x2〉 -; quadruple … TXS MODE_INH (Byte 〈x9,x4〉) 〈x0,x2〉 -; quadruple … TSX MODE_INH (Byte 〈x9,x5〉) 〈x0,x2〉 -; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) 〈x0,x1〉 -; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) 〈x0,x1〉 -; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) 〈x0,x1〉 -; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) 〈x0,x1〉 -; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) 〈x0,x1〉 -; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) 〈x0,x1〉 -; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) 〈x0,x1〉 -; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) 〈x0,x1〉 -; quadruple … AIS MODE_IMM1 (Byte 〈xA,x7〉) 〈x0,x2〉 -; quadruple … AIX MODE_IMM1 (Byte 〈xA,xF〉) 〈x0,x2〉 + quadruple … MUL MODE_INH (Byte 〈x4,x2〉) nat5 +; quadruple … DIV MODE_INH (Byte 〈x5,x2〉) nat6 +; quadruple … NSA MODE_INH (Byte 〈x6,x2〉) nat1 +; quadruple … DAA MODE_INH (Byte 〈x7,x2〉) nat1 +; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) nat9 +; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) nat6 +; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) nat11 +; quadruple … BGND MODE_INH (Byte 〈x8,x2〉) nat5 +; quadruple … TAP MODE_INH (Byte 〈x8,x4〉) nat1 +; quadruple … TPA MODE_INH (Byte 〈x8,x5〉) nat1 +; quadruple … PULA MODE_INH (Byte 〈x8,x6〉) nat3 +; quadruple … PSHA MODE_INH (Byte 〈x8,x7〉) nat2 +; quadruple … PULX MODE_INH (Byte 〈x8,x8〉) nat3 +; quadruple … PSHX MODE_INH (Byte 〈x8,x9〉) nat2 +; quadruple … PULH MODE_INH (Byte 〈x8,xA〉) nat3 +; quadruple … PSHH MODE_INH (Byte 〈x8,xB〉) nat2 +; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) nat2 +; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) nat2 +; quadruple … TXS MODE_INH (Byte 〈x9,x4〉) nat2 +; quadruple … TSX MODE_INH (Byte 〈x9,x5〉) nat2 +; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) nat1 +; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) nat1 +; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) nat1 +; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) nat1 +; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) nat1 +; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) nat1 +; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) nat1 +; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) nat1 +; quadruple … AIS MODE_IMM1 (Byte 〈xA,x7〉) nat2 +; quadruple … AIX MODE_IMM1 (Byte 〈xA,xF〉) nat2 ]. ndefinition opcode_table_HCS08_11 ≝ [ - quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 -; quadruple … CBEQX MODE_IMM1_and_IMM1 (Byte 〈x5,x1〉) 〈x0,x4〉 -; quadruple … CBEQA MODE_IX1p_and_IMM1 (Byte 〈x6,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IX0p_and_IMM1 (Byte 〈x7,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,x1〉〉) 〈x0,x6〉 + quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) nat5 +; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) nat4 +; quadruple … CBEQX MODE_IMM1_and_IMM1 (Byte 〈x5,x1〉) nat4 +; quadruple … CBEQA MODE_IX1p_and_IMM1 (Byte 〈x6,x1〉) nat5 +; quadruple … CBEQA MODE_IX0p_and_IMM1 (Byte 〈x7,x1〉) nat5 +; quadruple … CBEQA MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,x1〉〉) nat6 ]. ndefinition opcode_table_HCS08_12 ≝ [ - quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x5〉 -; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 -; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) 〈x0,x1〉 -; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x5〉 -; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x4〉 -; quadruple … CLR MODE_INHH (Byte 〈x8,xC〉) 〈x0,x1〉 -; quadruple … CLR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xF〉〉) 〈x0,x6〉 + quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) nat5 +; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) nat1 +; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) nat1 +; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) nat5 +; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) nat4 +; quadruple … CLR MODE_INHH (Byte 〈x8,xC〉) nat1 +; quadruple … CLR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xF〉〉) nat6 ]. ndefinition opcode_table_HCS08_13 ≝ [ - quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x1〉〉) 〈x0,x5〉 -; quadruple … CMP MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x1〉〉) 〈x0,x4〉 + quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) nat2 +; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) nat3 +; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) nat4 +; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) nat4 +; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) nat3 +; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) nat3 +; quadruple … CMP MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x1〉〉) nat5 +; quadruple … CMP MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x1〉〉) nat4 ]. ndefinition opcode_table_HCS08_14 ≝ [ - quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x5〉 -; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 -; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) 〈x0,x1〉 -; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x5〉 -; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x4〉 -; quadruple … COM MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x3〉〉) 〈x0,x6〉 + quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) nat5 +; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) nat1 +; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) nat1 +; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) nat5 +; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) nat4 +; quadruple … COM MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x3〉〉) nat6 ]. ndefinition opcode_table_HCS08_15 ≝ [ - quadruple … CPHX MODE_DIR2 (Byte 〈x3,xE〉) 〈x0,x6〉 -; quadruple … CPHX MODE_IMM2 (Byte 〈x6,x5〉) 〈x0,x3〉 -; quadruple … CPHX MODE_DIR1 (Byte 〈x7,x5〉) 〈x0,x5〉 -; quadruple … CPHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,x3〉〉) 〈x0,x6〉 + quadruple … CPHX MODE_DIR2 (Byte 〈x3,xE〉) nat6 +; quadruple … CPHX MODE_IMM2 (Byte 〈x6,x5〉) nat3 +; quadruple … CPHX MODE_DIR1 (Byte 〈x7,x5〉) nat5 +; quadruple … CPHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,x3〉〉) nat6 -; quadruple … LDHX MODE_DIR2 (Byte 〈x3,x2〉) 〈x0,x5〉 -; quadruple … LDHX MODE_IMM2 (Byte 〈x4,x5〉) 〈x0,x3〉 -; quadruple … LDHX MODE_DIR1 (Byte 〈x5,x5〉) 〈x0,x4〉 -; quadruple … LDHX MODE_IX0 (Word 〈〈x9,xE〉:〈xA,xE〉〉) 〈x0,x5〉 -; quadruple … LDHX MODE_IX2 (Word 〈〈x9,xE〉:〈xB,xE〉〉) 〈x0,x6〉 -; quadruple … LDHX MODE_IX1 (Word 〈〈x9,xE〉:〈xC,xE〉〉) 〈x0,x5〉 -; quadruple … LDHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,xE〉〉) 〈x0,x5〉 +; quadruple … LDHX MODE_DIR2 (Byte 〈x3,x2〉) nat5 +; quadruple … LDHX MODE_IMM2 (Byte 〈x4,x5〉) nat3 +; quadruple … LDHX MODE_DIR1 (Byte 〈x5,x5〉) nat4 +; quadruple … LDHX MODE_IX0 (Word 〈〈x9,xE〉:〈xA,xE〉〉) nat5 +; quadruple … LDHX MODE_IX2 (Word 〈〈x9,xE〉:〈xB,xE〉〉) nat6 +; quadruple … LDHX MODE_IX1 (Word 〈〈x9,xE〉:〈xC,xE〉〉) nat5 +; quadruple … LDHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,xE〉〉) nat5 -; quadruple … STHX MODE_DIR1 (Byte 〈x3,x5〉) 〈x0,x4〉 -; quadruple … STHX MODE_DIR2 (Byte 〈x9,x6〉) 〈x0,x5〉 -; quadruple … STHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,xF〉〉) 〈x0,x5〉 +; quadruple … STHX MODE_DIR1 (Byte 〈x3,x5〉) nat4 +; quadruple … STHX MODE_DIR2 (Byte 〈x9,x6〉) nat5 +; quadruple … STHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,xF〉〉) nat5 ]. ndefinition opcode_table_HCS08_16 ≝ [ - quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 -; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x3〉〉) 〈x0,x5〉 -; quadruple … CPX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x3〉〉) 〈x0,x4〉 + quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) nat2 +; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) nat3 +; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) nat4 +; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) nat4 +; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) nat3 +; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) nat3 +; quadruple … CPX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x3〉〉) nat5 +; quadruple … CPX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x3〉〉) nat4 ]. ndefinition opcode_table_HCS08_17 ≝ [ - quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x7〉 -; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x4〉 -; quadruple … DBNZ MODE_INHX_and_IMM1 (Byte 〈x5,xB〉) 〈x0,x4〉 -; quadruple … DBNZ MODE_IX1_and_IMM1 (Byte 〈x6,xB〉) 〈x0,x7〉 -; quadruple … DBNZ MODE_IX0_and_IMM1 (Byte 〈x7,xB〉) 〈x0,x6〉 -; quadruple … DBNZ MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,xB〉〉) 〈x0,x8〉 + quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) nat7 +; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) nat4 +; quadruple … DBNZ MODE_INHX_and_IMM1 (Byte 〈x5,xB〉) nat4 +; quadruple … DBNZ MODE_IX1_and_IMM1 (Byte 〈x6,xB〉) nat7 +; quadruple … DBNZ MODE_IX0_and_IMM1 (Byte 〈x7,xB〉) nat6 +; quadruple … DBNZ MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,xB〉〉) nat8 ]. ndefinition opcode_table_HCS08_18 ≝ [ - quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 -; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 -; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) 〈x0,x1〉 -; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x5〉 -; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x4〉 -; quadruple … DEC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xA〉〉) 〈x0,x6〉 + quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) nat5 +; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) nat1 +; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) nat1 +; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) nat5 +; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) nat4 +; quadruple … DEC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xA〉〉) nat6 ]. ndefinition opcode_table_HCS08_19 ≝ [ - quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x8〉〉) 〈x0,x5〉 -; quadruple … EOR MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x8〉〉) 〈x0,x4〉 + quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) nat2 +; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) nat3 +; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) nat4 +; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) nat4 +; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) nat3 +; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) nat3 +; quadruple … EOR MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x8〉〉) nat5 +; quadruple … EOR MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x8〉〉) nat4 ]. ndefinition opcode_table_HCS08_20 ≝ [ - quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 -; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 -; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) 〈x0,x1〉 -; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x5〉 -; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x4〉 -; quadruple … INC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xC〉〉) 〈x0,x6〉 + quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) nat5 +; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) nat1 +; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) nat1 +; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) nat5 +; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) nat4 +; quadruple … INC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xC〉〉) nat6 ]. ndefinition opcode_table_HCS08_21 ≝ [ - quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x4〉 -; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 -; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x3〉 + quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) nat3 +; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) nat4 +; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) nat4 +; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) nat3 +; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) nat3 ]. ndefinition opcode_table_HCS08_22 ≝ [ - quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x5〉 + quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) nat5 +; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) nat5 +; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) nat6 +; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) nat6 +; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) nat5 +; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) nat5 ]. ndefinition opcode_table_HCS08_23 ≝ [ - quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x6〉〉) 〈x0,x5〉 -; quadruple … LDA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x6〉〉) 〈x0,x4〉 + quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) nat2 +; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) nat3 +; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) nat4 +; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) nat4 +; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) nat3 +; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) nat3 +; quadruple … LDA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x6〉〉) nat5 +; quadruple … LDA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x6〉〉) nat4 ]. ndefinition opcode_table_HCS08_24 ≝ [ - quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 -; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xE〉〉) 〈x0,x5〉 -; quadruple … LDX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xE〉〉) 〈x0,x4〉 + quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) nat2 +; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) nat3 +; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) nat4 +; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) nat4 +; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) nat3 +; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) nat3 +; quadruple … LDX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xE〉〉) nat5 +; quadruple … LDX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xE〉〉) nat4 ]. ndefinition opcode_table_HCS08_25 ≝ [ - quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x5〉 -; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 -; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) 〈x0,x1〉 -; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x5〉 -; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x4〉 -; quadruple … LSR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x4〉〉) 〈x0,x6〉 + quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) nat5 +; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) nat1 +; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) nat1 +; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) nat5 +; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) nat4 +; quadruple … LSR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x4〉〉) nat6 ]. ndefinition opcode_table_HCS08_26 ≝ [ - quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 -; quadruple … MOV MODE_DIR1_to_IX0p (Byte 〈x5,xE〉) 〈x0,x5〉 -; quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x6,xE〉) 〈x0,x4〉 -; quadruple … MOV MODE_IX0p_to_DIR1 (Byte 〈x7,xE〉) 〈x0,x5〉 + quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) nat5 +; quadruple … MOV MODE_DIR1_to_IX0p (Byte 〈x5,xE〉) nat5 +; quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x6,xE〉) nat4 +; quadruple … MOV MODE_IX0p_to_DIR1 (Byte 〈x7,xE〉) nat5 ]. ndefinition opcode_table_HCS08_27 ≝ [ - quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x5〉 -; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) 〈x0,x1〉 -; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) 〈x0,x1〉 -; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x5〉 -; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x4〉 -; quadruple … NEG MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x0〉〉) 〈x0,x6〉 + quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) nat5 +; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) nat1 +; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) nat1 +; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) nat5 +; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) nat4 +; quadruple … NEG MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x0〉〉) nat6 ]. ndefinition opcode_table_HCS08_28 ≝ [ - quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xA〉〉) 〈x0,x5〉 -; quadruple … ORA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xA〉〉) 〈x0,x4〉 + quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) nat2 +; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) nat3 +; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) nat4 +; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) nat4 +; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) nat3 +; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) nat3 +; quadruple … ORA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xA〉〉) nat5 +; quadruple … ORA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xA〉〉) nat4 ]. ndefinition opcode_table_HCS08_29 ≝ [ - quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x5〉 -; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 -; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) 〈x0,x1〉 -; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x5〉 -; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x4〉 -; quadruple … ROL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x9〉〉) 〈x0,x6〉 + quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) nat5 +; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) nat1 +; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) nat1 +; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) nat5 +; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) nat4 +; quadruple … ROL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x9〉〉) nat6 ]. ndefinition opcode_table_HCS08_30 ≝ [ - quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x5〉 -; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 -; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) 〈x0,x1〉 -; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x5〉 -; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x4〉 -; quadruple … ROR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x6〉〉) 〈x0,x6〉 + quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) nat5 +; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) nat1 +; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) nat1 +; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) nat5 +; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) nat4 +; quadruple … ROR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x6〉〉) nat6 ]. ndefinition opcode_table_HCS08_31 ≝ [ - quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x2〉〉) 〈x0,x5〉 -; quadruple … SBC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x2〉〉) 〈x0,x4〉 + quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) nat2 +; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) nat3 +; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) nat4 +; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) nat4 +; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) nat3 +; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) nat3 +; quadruple … SBC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x2〉〉) nat5 +; quadruple … SBC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x2〉〉) nat4 ]. ndefinition opcode_table_HCS08_32 ≝ [ - quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 -; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x3〉 -; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x2〉 -; quadruple … STA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x7〉〉) 〈x0,x5〉 -; quadruple … STA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x7〉〉) 〈x0,x4〉 + quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) nat3 +; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) nat4 +; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) nat4 +; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) nat3 +; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) nat2 +; quadruple … STA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x7〉〉) nat5 +; quadruple … STA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x7〉〉) nat4 ]. ndefinition opcode_table_HCS08_33 ≝ [ - quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x3〉 -; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x3〉 -; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x2〉 -; quadruple … STX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xF〉〉) 〈x0,x5〉 -; quadruple … STX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xF〉〉) 〈x0,x4〉 + quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) nat3 +; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) nat4 +; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) nat4 +; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) nat3 +; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) nat2 +; quadruple … STX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xF〉〉) nat5 +; quadruple … STX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xF〉〉) nat4 ]. ndefinition opcode_table_HCS08_34 ≝ [ - quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x0〉〉) 〈x0,x5〉 -; quadruple … SUB MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x0〉〉) 〈x0,x4〉 + quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) nat2 +; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) nat3 +; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) nat4 +; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) nat4 +; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) nat3 +; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) nat3 +; quadruple … SUB MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x0〉〉) nat5 +; quadruple … SUB MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x0〉〉) nat4 ]. ndefinition opcode_table_HCS08_35 ≝ [ - quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x4〉 -; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) 〈x0,x1〉 -; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) 〈x0,x1〉 -; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x4〉 -; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xD〉〉) 〈x0,x5〉 + quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) nat4 +; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) nat1 +; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) nat1 +; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) nat4 +; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) nat3 +; quadruple … TST MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xD〉〉) nat5 ]. ndefinition opcode_table_HCS08 ≝ diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_table.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_table.ma index 287644c8d..56ef1f314 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_table.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_table.ma @@ -34,414 +34,414 @@ include "common/list.ma". ndefinition opcode_table_IP2022_1 ≝ [ - quadruple … ADD MODE_FR0_and_W (Byte 〈x1,xE〉) 〈x0,x1〉 -; quadruple … ADD MODE_FR1_and_W (Byte 〈x1,xF〉) 〈x0,x1〉 -; quadruple … ADD MODE_W_and_FR0 (Byte 〈x1,xC〉) 〈x0,x1〉 -; quadruple … ADD MODE_W_and_FR1 (Byte 〈x1,xD〉) 〈x0,x1〉 -; quadruple … ADD MODE_IMM8 (Byte 〈x7,xB〉) 〈x0,x1〉 + quadruple … ADD MODE_FR0_and_W (Byte 〈x1,xE〉) nat1 +; quadruple … ADD MODE_FR1_and_W (Byte 〈x1,xF〉) nat1 +; quadruple … ADD MODE_W_and_FR0 (Byte 〈x1,xC〉) nat1 +; quadruple … ADD MODE_W_and_FR1 (Byte 〈x1,xD〉) nat1 +; quadruple … ADD MODE_IMM8 (Byte 〈x7,xB〉) nat1 ]. ndefinition opcode_table_IP2022_2 ≝ [ - quadruple … ADDC MODE_FR0_and_W (Byte 〈x5,xE〉) 〈x0,x1〉 -; quadruple … ADDC MODE_FR1_and_W (Byte 〈x5,xF〉) 〈x0,x1〉 -; quadruple … ADDC MODE_W_and_FR0 (Byte 〈x5,xC〉) 〈x0,x1〉 -; quadruple … ADDC MODE_W_and_FR1 (Byte 〈x5,xD〉) 〈x0,x1〉 + quadruple … ADDC MODE_FR0_and_W (Byte 〈x5,xE〉) nat1 +; quadruple … ADDC MODE_FR1_and_W (Byte 〈x5,xF〉) nat1 +; quadruple … ADDC MODE_W_and_FR0 (Byte 〈x5,xC〉) nat1 +; quadruple … ADDC MODE_W_and_FR1 (Byte 〈x5,xD〉) nat1 ]. ndefinition opcode_table_IP2022_3 ≝ [ - quadruple … AND MODE_FR0_and_W (Byte 〈x1,x6〉) 〈x0,x1〉 -; quadruple … AND MODE_FR1_and_W (Byte 〈x1,x7〉) 〈x0,x1〉 -; quadruple … AND MODE_W_and_FR0 (Byte 〈x1,x4〉) 〈x0,x1〉 -; quadruple … AND MODE_W_and_FR1 (Byte 〈x1,x5〉) 〈x0,x1〉 -; quadruple … AND MODE_IMM8 (Byte 〈x7,xE〉) 〈x0,x1〉 + quadruple … AND MODE_FR0_and_W (Byte 〈x1,x6〉) nat1 +; quadruple … AND MODE_FR1_and_W (Byte 〈x1,x7〉) nat1 +; quadruple … AND MODE_W_and_FR0 (Byte 〈x1,x4〉) nat1 +; quadruple … AND MODE_W_and_FR1 (Byte 〈x1,x5〉) nat1 +; quadruple … AND MODE_IMM8 (Byte 〈x7,xE〉) nat1 ]. ndefinition opcode_table_IP2022_4 ≝ [ - quadruple … BREAK MODE_INH (Word 〈〈x0,x0〉:〈x0,x1〉〉) 〈x0,x1〉 -; quadruple … BREAKX MODE_INH (Word 〈〈x0,x0〉:〈x0,x5〉〉) 〈x0,x1〉 -; quadruple … CWDT MODE_INH (Word 〈〈x0,x0〉:〈x0,x4〉〉) 〈x0,x1〉 -; quadruple … FERASE MODE_INH (Word 〈〈x0,x0〉:〈x0,x3〉〉) 〈x0,x1〉 -; quadruple … FREAD MODE_INH (Word 〈〈x0,x0〉:〈x1,xB〉〉) 〈x0,x1〉 -; quadruple … FWRITE MODE_INH (Word 〈〈x0,x0〉:〈x1,xA〉〉) 〈x0,x1〉 -; quadruple … INT MODE_INH (Word 〈〈x0,x0〉:〈x0,x6〉〉) 〈x0,x3〉 -; quadruple … IREAD MODE_INHADDR (Word 〈〈x0,x0〉:〈x1,x9〉〉) 〈x0,x4〉 (* only blocking implemented *) -; quadruple … IREAD MODE_INHADDRpp (Word 〈〈x0,x0〉:〈x1,xD〉〉) 〈x0,x4〉 (* only blocking implemented *) -; quadruple … IWRITE MODE_INHADDR (Word 〈〈x0,x0〉:〈x1,x8〉〉) 〈x0,x4〉 (* only blocking implemented *) -; quadruple … IWRITE MODE_INHADDRpp (Word 〈〈x0,x0〉:〈x1,xC〉〉) 〈x0,x4〉 (* only blocking implemented *) -; quadruple … NOP MODE_INH (Word 〈〈x0,x0〉:〈x0,x0〉〉) 〈x0,x1〉 -; quadruple … RET MODE_INH (Word 〈〈x0,x0〉:〈x0,x7〉〉) 〈x0,x3〉 -; quadruple … RETNP MODE_INH (Word 〈〈x0,x0〉:〈x0,x2〉〉) 〈x0,x3〉 + quadruple … BREAK MODE_INH (Word 〈〈x0,x0〉:〈x0,x1〉〉) nat1 +; quadruple … BREAKX MODE_INH (Word 〈〈x0,x0〉:〈x0,x5〉〉) nat1 +; quadruple … CWDT MODE_INH (Word 〈〈x0,x0〉:〈x0,x4〉〉) nat1 +; quadruple … FERASE MODE_INH (Word 〈〈x0,x0〉:〈x0,x3〉〉) nat1 +; quadruple … FREAD MODE_INH (Word 〈〈x0,x0〉:〈x1,xB〉〉) nat1 +; quadruple … FWRITE MODE_INH (Word 〈〈x0,x0〉:〈x1,xA〉〉) nat1 +; quadruple … INT MODE_INH (Word 〈〈x0,x0〉:〈x0,x6〉〉) nat3 +; quadruple … IREAD MODE_INHADDR (Word 〈〈x0,x0〉:〈x1,x9〉〉) nat4 (* only blocking implemented *) +; quadruple … IREAD MODE_INHADDRpp (Word 〈〈x0,x0〉:〈x1,xD〉〉) nat4 (* only blocking implemented *) +; quadruple … IWRITE MODE_INHADDR (Word 〈〈x0,x0〉:〈x1,x8〉〉) nat4 (* only blocking implemented *) +; quadruple … IWRITE MODE_INHADDRpp (Word 〈〈x0,x0〉:〈x1,xC〉〉) nat4 (* only blocking implemented *) +; quadruple … NOP MODE_INH (Word 〈〈x0,x0〉:〈x0,x0〉〉) nat1 +; quadruple … RET MODE_INH (Word 〈〈x0,x0〉:〈x0,x7〉〉) nat3 +; quadruple … RETNP MODE_INH (Word 〈〈x0,x0〉:〈x0,x2〉〉) nat3 ]. ndefinition opcode_table_IP2022_5 ≝ [ - quadruple … CALL (MODE_IMM13 t00) (Byte 〈xC,x0〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t01) (Byte 〈xC,x1〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t02) (Byte 〈xC,x2〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t03) (Byte 〈xC,x3〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t04) (Byte 〈xC,x4〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t05) (Byte 〈xC,x5〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t06) (Byte 〈xC,x6〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t07) (Byte 〈xC,x7〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t08) (Byte 〈xC,x8〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t09) (Byte 〈xC,x9〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t0A) (Byte 〈xC,xA〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t0B) (Byte 〈xC,xB〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t0C) (Byte 〈xC,xC〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t0D) (Byte 〈xC,xD〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t0E) (Byte 〈xC,xE〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t0F) (Byte 〈xC,xF〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t10) (Byte 〈xD,x0〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t11) (Byte 〈xD,x1〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t12) (Byte 〈xD,x2〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t13) (Byte 〈xD,x3〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t14) (Byte 〈xD,x4〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t15) (Byte 〈xD,x5〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t16) (Byte 〈xD,x6〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t17) (Byte 〈xD,x7〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t18) (Byte 〈xD,x8〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t19) (Byte 〈xD,x9〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t1A) (Byte 〈xD,xA〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t1B) (Byte 〈xD,xB〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t1C) (Byte 〈xD,xC〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t1D) (Byte 〈xD,xD〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t1E) (Byte 〈xD,xE〉) 〈x0,x3〉 -; quadruple … CALL (MODE_IMM13 t1F) (Byte 〈xD,xF〉) 〈x0,x3〉 + quadruple … CALL (MODE_IMM13 t00) (Byte 〈xC,x0〉) nat3 +; quadruple … CALL (MODE_IMM13 t01) (Byte 〈xC,x1〉) nat3 +; quadruple … CALL (MODE_IMM13 t02) (Byte 〈xC,x2〉) nat3 +; quadruple … CALL (MODE_IMM13 t03) (Byte 〈xC,x3〉) nat3 +; quadruple … CALL (MODE_IMM13 t04) (Byte 〈xC,x4〉) nat3 +; quadruple … CALL (MODE_IMM13 t05) (Byte 〈xC,x5〉) nat3 +; quadruple … CALL (MODE_IMM13 t06) (Byte 〈xC,x6〉) nat3 +; quadruple … CALL (MODE_IMM13 t07) (Byte 〈xC,x7〉) nat3 +; quadruple … CALL (MODE_IMM13 t08) (Byte 〈xC,x8〉) nat3 +; quadruple … CALL (MODE_IMM13 t09) (Byte 〈xC,x9〉) nat3 +; quadruple … CALL (MODE_IMM13 t0A) (Byte 〈xC,xA〉) nat3 +; quadruple … CALL (MODE_IMM13 t0B) (Byte 〈xC,xB〉) nat3 +; quadruple … CALL (MODE_IMM13 t0C) (Byte 〈xC,xC〉) nat3 +; quadruple … CALL (MODE_IMM13 t0D) (Byte 〈xC,xD〉) nat3 +; quadruple … CALL (MODE_IMM13 t0E) (Byte 〈xC,xE〉) nat3 +; quadruple … CALL (MODE_IMM13 t0F) (Byte 〈xC,xF〉) nat3 +; quadruple … CALL (MODE_IMM13 t10) (Byte 〈xD,x0〉) nat3 +; quadruple … CALL (MODE_IMM13 t11) (Byte 〈xD,x1〉) nat3 +; quadruple … CALL (MODE_IMM13 t12) (Byte 〈xD,x2〉) nat3 +; quadruple … CALL (MODE_IMM13 t13) (Byte 〈xD,x3〉) nat3 +; quadruple … CALL (MODE_IMM13 t14) (Byte 〈xD,x4〉) nat3 +; quadruple … CALL (MODE_IMM13 t15) (Byte 〈xD,x5〉) nat3 +; quadruple … CALL (MODE_IMM13 t16) (Byte 〈xD,x6〉) nat3 +; quadruple … CALL (MODE_IMM13 t17) (Byte 〈xD,x7〉) nat3 +; quadruple … CALL (MODE_IMM13 t18) (Byte 〈xD,x8〉) nat3 +; quadruple … CALL (MODE_IMM13 t19) (Byte 〈xD,x9〉) nat3 +; quadruple … CALL (MODE_IMM13 t1A) (Byte 〈xD,xA〉) nat3 +; quadruple … CALL (MODE_IMM13 t1B) (Byte 〈xD,xB〉) nat3 +; quadruple … CALL (MODE_IMM13 t1C) (Byte 〈xD,xC〉) nat3 +; quadruple … CALL (MODE_IMM13 t1D) (Byte 〈xD,xD〉) nat3 +; quadruple … CALL (MODE_IMM13 t1E) (Byte 〈xD,xE〉) nat3 +; quadruple … CALL (MODE_IMM13 t1F) (Byte 〈xD,xF〉) nat3 ]. ndefinition opcode_table_IP2022_6 ≝ [ - quadruple … CLR MODE_FR0_and_W (Byte 〈x0,x6〉) 〈x0,x1〉 -; quadruple … CLR MODE_FR1_and_W (Byte 〈x0,x7〉) 〈x0,x1〉 + quadruple … CLR MODE_FR0_and_W (Byte 〈x0,x6〉) nat1 +; quadruple … CLR MODE_FR1_and_W (Byte 〈x0,x7〉) nat1 ]. ndefinition opcode_table_IP2022_7 ≝ [ - quadruple … CLRB (MODE_FR0n o0) (Byte 〈x8,x0〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR1n o0) (Byte 〈x8,x1〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR0n o1) (Byte 〈x8,x2〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR1n o1) (Byte 〈x8,x3〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR0n o2) (Byte 〈x8,x4〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR1n o2) (Byte 〈x8,x5〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR0n o3) (Byte 〈x8,x6〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR1n o3) (Byte 〈x8,x7〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR0n o4) (Byte 〈x8,x8〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR1n o4) (Byte 〈x8,x9〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR0n o5) (Byte 〈x8,xA〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR1n o5) (Byte 〈x8,xB〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR0n o6) (Byte 〈x8,xC〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR1n o6) (Byte 〈x8,xD〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR0n o7) (Byte 〈x8,xE〉) 〈x0,x1〉 -; quadruple … CLRB (MODE_FR1n o7) (Byte 〈x8,xF〉) 〈x0,x1〉 + quadruple … CLRB (MODE_FR0n o0) (Byte 〈x8,x0〉) nat1 +; quadruple … CLRB (MODE_FR1n o0) (Byte 〈x8,x1〉) nat1 +; quadruple … CLRB (MODE_FR0n o1) (Byte 〈x8,x2〉) nat1 +; quadruple … CLRB (MODE_FR1n o1) (Byte 〈x8,x3〉) nat1 +; quadruple … CLRB (MODE_FR0n o2) (Byte 〈x8,x4〉) nat1 +; quadruple … CLRB (MODE_FR1n o2) (Byte 〈x8,x5〉) nat1 +; quadruple … CLRB (MODE_FR0n o3) (Byte 〈x8,x6〉) nat1 +; quadruple … CLRB (MODE_FR1n o3) (Byte 〈x8,x7〉) nat1 +; quadruple … CLRB (MODE_FR0n o4) (Byte 〈x8,x8〉) nat1 +; quadruple … CLRB (MODE_FR1n o4) (Byte 〈x8,x9〉) nat1 +; quadruple … CLRB (MODE_FR0n o5) (Byte 〈x8,xA〉) nat1 +; quadruple … CLRB (MODE_FR1n o5) (Byte 〈x8,xB〉) nat1 +; quadruple … CLRB (MODE_FR0n o6) (Byte 〈x8,xC〉) nat1 +; quadruple … CLRB (MODE_FR1n o6) (Byte 〈x8,xD〉) nat1 +; quadruple … CLRB (MODE_FR0n o7) (Byte 〈x8,xE〉) nat1 +; quadruple … CLRB (MODE_FR1n o7) (Byte 〈x8,xF〉) nat1 ]. ndefinition opcode_table_IP2022_8 ≝ [ - quadruple … CMP MODE_W_and_FR0 (Byte 〈x0,x4〉) 〈x0,x1〉 -; quadruple … CMP MODE_W_and_FR1 (Byte 〈x0,x5〉) 〈x0,x1〉 -; quadruple … CMP MODE_IMM8 (Byte 〈x7,x9〉) 〈x0,x1〉 + quadruple … CMP MODE_W_and_FR0 (Byte 〈x0,x4〉) nat1 +; quadruple … CMP MODE_W_and_FR1 (Byte 〈x0,x5〉) nat1 +; quadruple … CMP MODE_IMM8 (Byte 〈x7,x9〉) nat1 ]. ndefinition opcode_table_IP2022_9 ≝ [ - quadruple … CSE MODE_W_and_FR0 (Byte 〈x4,x2〉) 〈x0,x1〉 -; quadruple … CSE MODE_W_and_FR1 (Byte 〈x4,x3〉) 〈x0,x1〉 -; quadruple … CSE MODE_IMM8 (Byte 〈x7,x7〉) 〈x0,x1〉 + quadruple … CSE MODE_W_and_FR0 (Byte 〈x4,x2〉) nat1 +; quadruple … CSE MODE_W_and_FR1 (Byte 〈x4,x3〉) nat1 +; quadruple … CSE MODE_IMM8 (Byte 〈x7,x7〉) nat1 ]. ndefinition opcode_table_IP2022_10 ≝ [ - quadruple … CSNE MODE_W_and_FR0 (Byte 〈x4,x0〉) 〈x0,x1〉 -; quadruple … CSNE MODE_W_and_FR1 (Byte 〈x4,x1〉) 〈x0,x1〉 -; quadruple … CSNE MODE_IMM8 (Byte 〈x7,x6〉) 〈x0,x1〉 + quadruple … CSNE MODE_W_and_FR0 (Byte 〈x4,x0〉) nat1 +; quadruple … CSNE MODE_W_and_FR1 (Byte 〈x4,x1〉) nat1 +; quadruple … CSNE MODE_IMM8 (Byte 〈x7,x6〉) nat1 ]. ndefinition opcode_table_IP2022_11 ≝ [ - quadruple … DEC MODE_FR0_and_W (Byte 〈x0,xE〉) 〈x0,x1〉 -; quadruple … DEC MODE_FR1_and_W (Byte 〈x0,xF〉) 〈x0,x1〉 -; quadruple … DEC MODE_W_and_FR0 (Byte 〈x0,xC〉) 〈x0,x1〉 -; quadruple … DEC MODE_W_and_FR1 (Byte 〈x0,xD〉) 〈x0,x1〉 + quadruple … DEC MODE_FR0_and_W (Byte 〈x0,xE〉) nat1 +; quadruple … DEC MODE_FR1_and_W (Byte 〈x0,xF〉) nat1 +; quadruple … DEC MODE_W_and_FR0 (Byte 〈x0,xC〉) nat1 +; quadruple … DEC MODE_W_and_FR1 (Byte 〈x0,xD〉) nat1 ]. ndefinition opcode_table_IP2022_12 ≝ [ - quadruple … DECSNZ MODE_FR0_and_W (Byte 〈x4,xE〉) 〈x0,x1〉 -; quadruple … DECSNZ MODE_FR1_and_W (Byte 〈x4,xF〉) 〈x0,x1〉 -; quadruple … DECSNZ MODE_W_and_FR0 (Byte 〈x4,xC〉) 〈x0,x1〉 -; quadruple … DECSNZ MODE_W_and_FR1 (Byte 〈x4,xD〉) 〈x0,x1〉 + quadruple … DECSNZ MODE_FR0_and_W (Byte 〈x4,xE〉) nat1 +; quadruple … DECSNZ MODE_FR1_and_W (Byte 〈x4,xF〉) nat1 +; quadruple … DECSNZ MODE_W_and_FR0 (Byte 〈x4,xC〉) nat1 +; quadruple … DECSNZ MODE_W_and_FR1 (Byte 〈x4,xD〉) nat1 ]. ndefinition opcode_table_IP2022_13 ≝ [ - quadruple … DECSZ MODE_FR0_and_W (Byte 〈x2,xE〉) 〈x0,x1〉 -; quadruple … DECSZ MODE_FR1_and_W (Byte 〈x2,xF〉) 〈x0,x1〉 -; quadruple … DECSZ MODE_W_and_FR0 (Byte 〈x2,xC〉) 〈x0,x1〉 -; quadruple … DECSZ MODE_W_and_FR1 (Byte 〈x2,xD〉) 〈x0,x1〉 + quadruple … DECSZ MODE_FR0_and_W (Byte 〈x2,xE〉) nat1 +; quadruple … DECSZ MODE_FR1_and_W (Byte 〈x2,xF〉) nat1 +; quadruple … DECSZ MODE_W_and_FR0 (Byte 〈x2,xC〉) nat1 +; quadruple … DECSZ MODE_W_and_FR1 (Byte 〈x2,xD〉) nat1 ]. ndefinition opcode_table_IP2022_14 ≝ [ - quadruple … INC MODE_FR0_and_W (Byte 〈x2,xA〉) 〈x0,x1〉 -; quadruple … INC MODE_FR1_and_W (Byte 〈x2,xB〉) 〈x0,x1〉 -; quadruple … INC MODE_W_and_FR0 (Byte 〈x2,x8〉) 〈x0,x1〉 -; quadruple … INC MODE_W_and_FR1 (Byte 〈x2,x9〉) 〈x0,x1〉 + quadruple … INC MODE_FR0_and_W (Byte 〈x2,xA〉) nat1 +; quadruple … INC MODE_FR1_and_W (Byte 〈x2,xB〉) nat1 +; quadruple … INC MODE_W_and_FR0 (Byte 〈x2,x8〉) nat1 +; quadruple … INC MODE_W_and_FR1 (Byte 〈x2,x9〉) nat1 ]. ndefinition opcode_table_IP2022_15 ≝ [ - quadruple … INCSNZ MODE_FR0_and_W (Byte 〈x5,xA〉) 〈x0,x1〉 -; quadruple … INCSNZ MODE_FR1_and_W (Byte 〈x5,xB〉) 〈x0,x1〉 -; quadruple … INCSNZ MODE_W_and_FR0 (Byte 〈x5,x8〉) 〈x0,x1〉 -; quadruple … INCSNZ MODE_W_and_FR1 (Byte 〈x5,x9〉) 〈x0,x1〉 + quadruple … INCSNZ MODE_FR0_and_W (Byte 〈x5,xA〉) nat1 +; quadruple … INCSNZ MODE_FR1_and_W (Byte 〈x5,xB〉) nat1 +; quadruple … INCSNZ MODE_W_and_FR0 (Byte 〈x5,x8〉) nat1 +; quadruple … INCSNZ MODE_W_and_FR1 (Byte 〈x5,x9〉) nat1 ]. ndefinition opcode_table_IP2022_16 ≝ [ - quadruple … INCSZ MODE_FR0_and_W (Byte 〈x3,xE〉) 〈x0,x1〉 -; quadruple … INCSZ MODE_FR1_and_W (Byte 〈x3,xF〉) 〈x0,x1〉 -; quadruple … INCSZ MODE_W_and_FR0 (Byte 〈x3,xC〉) 〈x0,x1〉 -; quadruple … INCSZ MODE_W_and_FR1 (Byte 〈x3,xD〉) 〈x0,x1〉 + quadruple … INCSZ MODE_FR0_and_W (Byte 〈x3,xE〉) nat1 +; quadruple … INCSZ MODE_FR1_and_W (Byte 〈x3,xF〉) nat1 +; quadruple … INCSZ MODE_W_and_FR0 (Byte 〈x3,xC〉) nat1 +; quadruple … INCSZ MODE_W_and_FR1 (Byte 〈x3,xD〉) nat1 ]. ndefinition opcode_table_IP2022_17 ≝ [ - quadruple … JMP (MODE_IMM13 t00) (Byte 〈xE,x0〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t01) (Byte 〈xE,x1〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t02) (Byte 〈xE,x2〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t03) (Byte 〈xE,x3〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t04) (Byte 〈xE,x4〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t05) (Byte 〈xE,x5〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t06) (Byte 〈xE,x6〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t07) (Byte 〈xE,x7〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t08) (Byte 〈xE,x8〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t09) (Byte 〈xE,x9〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t0A) (Byte 〈xE,xA〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t0B) (Byte 〈xE,xB〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t0C) (Byte 〈xE,xC〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t0D) (Byte 〈xE,xD〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t0E) (Byte 〈xE,xE〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t0F) (Byte 〈xE,xF〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t10) (Byte 〈xF,x0〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t11) (Byte 〈xF,x1〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t12) (Byte 〈xF,x2〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t13) (Byte 〈xF,x3〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t14) (Byte 〈xF,x4〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t15) (Byte 〈xF,x5〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t16) (Byte 〈xF,x6〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t17) (Byte 〈xF,x7〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t18) (Byte 〈xF,x8〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t19) (Byte 〈xF,x9〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t1A) (Byte 〈xF,xA〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t1B) (Byte 〈xF,xB〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t1C) (Byte 〈xF,xC〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t1D) (Byte 〈xF,xD〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t1E) (Byte 〈xF,xE〉) 〈x0,x3〉 -; quadruple … JMP (MODE_IMM13 t1F) (Byte 〈xF,xF〉) 〈x0,x3〉 + quadruple … JMP (MODE_IMM13 t00) (Byte 〈xE,x0〉) nat3 +; quadruple … JMP (MODE_IMM13 t01) (Byte 〈xE,x1〉) nat3 +; quadruple … JMP (MODE_IMM13 t02) (Byte 〈xE,x2〉) nat3 +; quadruple … JMP (MODE_IMM13 t03) (Byte 〈xE,x3〉) nat3 +; quadruple … JMP (MODE_IMM13 t04) (Byte 〈xE,x4〉) nat3 +; quadruple … JMP (MODE_IMM13 t05) (Byte 〈xE,x5〉) nat3 +; quadruple … JMP (MODE_IMM13 t06) (Byte 〈xE,x6〉) nat3 +; quadruple … JMP (MODE_IMM13 t07) (Byte 〈xE,x7〉) nat3 +; quadruple … JMP (MODE_IMM13 t08) (Byte 〈xE,x8〉) nat3 +; quadruple … JMP (MODE_IMM13 t09) (Byte 〈xE,x9〉) nat3 +; quadruple … JMP (MODE_IMM13 t0A) (Byte 〈xE,xA〉) nat3 +; quadruple … JMP (MODE_IMM13 t0B) (Byte 〈xE,xB〉) nat3 +; quadruple … JMP (MODE_IMM13 t0C) (Byte 〈xE,xC〉) nat3 +; quadruple … JMP (MODE_IMM13 t0D) (Byte 〈xE,xD〉) nat3 +; quadruple … JMP (MODE_IMM13 t0E) (Byte 〈xE,xE〉) nat3 +; quadruple … JMP (MODE_IMM13 t0F) (Byte 〈xE,xF〉) nat3 +; quadruple … JMP (MODE_IMM13 t10) (Byte 〈xF,x0〉) nat3 +; quadruple … JMP (MODE_IMM13 t11) (Byte 〈xF,x1〉) nat3 +; quadruple … JMP (MODE_IMM13 t12) (Byte 〈xF,x2〉) nat3 +; quadruple … JMP (MODE_IMM13 t13) (Byte 〈xF,x3〉) nat3 +; quadruple … JMP (MODE_IMM13 t14) (Byte 〈xF,x4〉) nat3 +; quadruple … JMP (MODE_IMM13 t15) (Byte 〈xF,x5〉) nat3 +; quadruple … JMP (MODE_IMM13 t16) (Byte 〈xF,x6〉) nat3 +; quadruple … JMP (MODE_IMM13 t17) (Byte 〈xF,x7〉) nat3 +; quadruple … JMP (MODE_IMM13 t18) (Byte 〈xF,x8〉) nat3 +; quadruple … JMP (MODE_IMM13 t19) (Byte 〈xF,x9〉) nat3 +; quadruple … JMP (MODE_IMM13 t1A) (Byte 〈xF,xA〉) nat3 +; quadruple … JMP (MODE_IMM13 t1B) (Byte 〈xF,xB〉) nat3 +; quadruple … JMP (MODE_IMM13 t1C) (Byte 〈xF,xC〉) nat3 +; quadruple … JMP (MODE_IMM13 t1D) (Byte 〈xF,xD〉) nat3 +; quadruple … JMP (MODE_IMM13 t1E) (Byte 〈xF,xE〉) nat3 +; quadruple … JMP (MODE_IMM13 t1F) (Byte 〈xF,xF〉) nat3 ]. ndefinition opcode_table_IP2022_18 ≝ [ - quadruple … LOADH MODE_IMM8 (Byte 〈x7,x0〉) 〈x0,x1〉 -; quadruple … LOADL MODE_IMM8 (Byte 〈x7,x1〉) 〈x0,x1〉 + quadruple … LOADH MODE_IMM8 (Byte 〈x7,x0〉) nat1 +; quadruple … LOADL MODE_IMM8 (Byte 〈x7,x1〉) nat1 ]. ndefinition opcode_table_IP2022_19 ≝ [ - quadruple … MOV MODE_FR0_and_W (Byte 〈x0,x2〉) 〈x0,x1〉 -; quadruple … MOV MODE_FR1_and_W (Byte 〈x0,x3〉) 〈x0,x1〉 -; quadruple … MOV MODE_W_and_FR0 (Byte 〈x2,x0〉) 〈x0,x1〉 -; quadruple … MOV MODE_W_and_FR1 (Byte 〈x2,x1〉) 〈x0,x1〉 -; quadruple … MOV MODE_IMM8 (Byte 〈x7,xC〉) 〈x0,x1〉 + quadruple … MOV MODE_FR0_and_W (Byte 〈x0,x2〉) nat1 +; quadruple … MOV MODE_FR1_and_W (Byte 〈x0,x3〉) nat1 +; quadruple … MOV MODE_W_and_FR0 (Byte 〈x2,x0〉) nat1 +; quadruple … MOV MODE_W_and_FR1 (Byte 〈x2,x1〉) nat1 +; quadruple … MOV MODE_IMM8 (Byte 〈x7,xC〉) nat1 ]. ndefinition opcode_table_IP2022_20 ≝ [ - quadruple … MULS MODE_W_and_FR0 (Byte 〈x5,x4〉) 〈x0,x1〉 -; quadruple … MULS MODE_W_and_FR1 (Byte 〈x5,x5〉) 〈x0,x1〉 -; quadruple … MULS MODE_IMM8 (Byte 〈x7,x3〉) 〈x0,x1〉 + quadruple … MULS MODE_W_and_FR0 (Byte 〈x5,x4〉) nat1 +; quadruple … MULS MODE_W_and_FR1 (Byte 〈x5,x5〉) nat1 +; quadruple … MULS MODE_IMM8 (Byte 〈x7,x3〉) nat1 ]. ndefinition opcode_table_IP2022_21 ≝ [ - quadruple … MULU MODE_W_and_FR0 (Byte 〈x5,x0〉) 〈x0,x1〉 -; quadruple … MULU MODE_W_and_FR1 (Byte 〈x5,x1〉) 〈x0,x1〉 -; quadruple … MULU MODE_IMM8 (Byte 〈x7,x2〉) 〈x0,x1〉 + quadruple … MULU MODE_W_and_FR0 (Byte 〈x5,x0〉) nat1 +; quadruple … MULU MODE_W_and_FR1 (Byte 〈x5,x1〉) nat1 +; quadruple … MULU MODE_IMM8 (Byte 〈x7,x2〉) nat1 ]. ndefinition opcode_table_IP2022_22 ≝ [ - quadruple … NOT MODE_FR0_and_W (Byte 〈x2,x6〉) 〈x0,x1〉 -; quadruple … NOT MODE_FR1_and_W (Byte 〈x2,x7〉) 〈x0,x1〉 -; quadruple … NOT MODE_W_and_FR0 (Byte 〈x2,x4〉) 〈x0,x1〉 -; quadruple … NOT MODE_W_and_FR1 (Byte 〈x2,x5〉) 〈x0,x1〉 + quadruple … NOT MODE_FR0_and_W (Byte 〈x2,x6〉) nat1 +; quadruple … NOT MODE_FR1_and_W (Byte 〈x2,x7〉) nat1 +; quadruple … NOT MODE_W_and_FR0 (Byte 〈x2,x4〉) nat1 +; quadruple … NOT MODE_W_and_FR1 (Byte 〈x2,x5〉) nat1 ]. ndefinition opcode_table_IP2022_23 ≝ [ - quadruple … OR MODE_FR0_and_W (Byte 〈x1,x2〉) 〈x0,x1〉 -; quadruple … OR MODE_FR1_and_W (Byte 〈x1,x3〉) 〈x0,x1〉 -; quadruple … OR MODE_W_and_FR0 (Byte 〈x1,x0〉) 〈x0,x1〉 -; quadruple … OR MODE_W_and_FR1 (Byte 〈x1,x1〉) 〈x0,x1〉 -; quadruple … OR MODE_IMM8 (Byte 〈x7,xD〉) 〈x0,x1〉 + quadruple … OR MODE_FR0_and_W (Byte 〈x1,x2〉) nat1 +; quadruple … OR MODE_FR1_and_W (Byte 〈x1,x3〉) nat1 +; quadruple … OR MODE_W_and_FR0 (Byte 〈x1,x0〉) nat1 +; quadruple … OR MODE_W_and_FR1 (Byte 〈x1,x1〉) nat1 +; quadruple … OR MODE_IMM8 (Byte 〈x7,xD〉) nat1 ]. ndefinition opcode_table_IP2022_24 ≝ [ - quadruple … PAGE (MODE_IMM3 o0) (Word 〈〈x0,x0〉:〈x1,x0〉〉) 〈x0,x1〉 -; quadruple … PAGE (MODE_IMM3 o1) (Word 〈〈x0,x0〉:〈x1,x1〉〉) 〈x0,x1〉 -; quadruple … PAGE (MODE_IMM3 o2) (Word 〈〈x0,x0〉:〈x1,x2〉〉) 〈x0,x1〉 -; quadruple … PAGE (MODE_IMM3 o3) (Word 〈〈x0,x0〉:〈x1,x3〉〉) 〈x0,x1〉 -; quadruple … PAGE (MODE_IMM3 o4) (Word 〈〈x0,x0〉:〈x1,x4〉〉) 〈x0,x1〉 -; quadruple … PAGE (MODE_IMM3 o5) (Word 〈〈x0,x0〉:〈x1,x5〉〉) 〈x0,x1〉 -; quadruple … PAGE (MODE_IMM3 o6) (Word 〈〈x0,x0〉:〈x1,x6〉〉) 〈x0,x1〉 -; quadruple … PAGE (MODE_IMM3 o7) (Word 〈〈x0,x0〉:〈x1,x7〉〉) 〈x0,x1〉 + quadruple … PAGE (MODE_IMM3 o0) (Word 〈〈x0,x0〉:〈x1,x0〉〉) nat1 +; quadruple … PAGE (MODE_IMM3 o1) (Word 〈〈x0,x0〉:〈x1,x1〉〉) nat1 +; quadruple … PAGE (MODE_IMM3 o2) (Word 〈〈x0,x0〉:〈x1,x2〉〉) nat1 +; quadruple … PAGE (MODE_IMM3 o3) (Word 〈〈x0,x0〉:〈x1,x3〉〉) nat1 +; quadruple … PAGE (MODE_IMM3 o4) (Word 〈〈x0,x0〉:〈x1,x4〉〉) nat1 +; quadruple … PAGE (MODE_IMM3 o5) (Word 〈〈x0,x0〉:〈x1,x5〉〉) nat1 +; quadruple … PAGE (MODE_IMM3 o6) (Word 〈〈x0,x0〉:〈x1,x6〉〉) nat1 +; quadruple … PAGE (MODE_IMM3 o7) (Word 〈〈x0,x0〉:〈x1,x7〉〉) nat1 ]. ndefinition opcode_table_IP2022_25 ≝ [ - quadruple … POP MODE_FR0_and_W (Byte 〈x4,x6〉) 〈x0,x1〉 -; quadruple … POP MODE_FR1_and_W (Byte 〈x4,x7〉) 〈x0,x1〉 -; quadruple … PUSH MODE_W_and_FR0 (Byte 〈x4,x4〉) 〈x0,x1〉 -; quadruple … PUSH MODE_W_and_FR1 (Byte 〈x4,x5〉) 〈x0,x1〉 -; quadruple … PUSH MODE_IMM8 (Byte 〈x7,x4〉) 〈x0,x1〉 + quadruple … POP MODE_FR0_and_W (Byte 〈x4,x6〉) nat1 +; quadruple … POP MODE_FR1_and_W (Byte 〈x4,x7〉) nat1 +; quadruple … PUSH MODE_W_and_FR0 (Byte 〈x4,x4〉) nat1 +; quadruple … PUSH MODE_W_and_FR1 (Byte 〈x4,x5〉) nat1 +; quadruple … PUSH MODE_IMM8 (Byte 〈x7,x4〉) nat1 ]. ndefinition opcode_table_IP2022_26 ≝ [ - quadruple … RETI (MODE_IMM3 o0) (Word 〈〈x0,x0〉:〈x0,x8〉〉) 〈x0,x3〉 -; quadruple … RETI (MODE_IMM3 o1) (Word 〈〈x0,x0〉:〈x0,x9〉〉) 〈x0,x3〉 -; quadruple … RETI (MODE_IMM3 o2) (Word 〈〈x0,x0〉:〈x0,xA〉〉) 〈x0,x3〉 -; quadruple … RETI (MODE_IMM3 o3) (Word 〈〈x0,x0〉:〈x0,xB〉〉) 〈x0,x3〉 -; quadruple … RETI (MODE_IMM3 o4) (Word 〈〈x0,x0〉:〈x0,xC〉〉) 〈x0,x3〉 -; quadruple … RETI (MODE_IMM3 o5) (Word 〈〈x0,x0〉:〈x0,xD〉〉) 〈x0,x3〉 -; quadruple … RETI (MODE_IMM3 o6) (Word 〈〈x0,x0〉:〈x0,xE〉〉) 〈x0,x3〉 -; quadruple … RETI (MODE_IMM3 o7) (Word 〈〈x0,x0〉:〈x0,xF〉〉) 〈x0,x3〉 + quadruple … RETI (MODE_IMM3 o0) (Word 〈〈x0,x0〉:〈x0,x8〉〉) nat3 +; quadruple … RETI (MODE_IMM3 o1) (Word 〈〈x0,x0〉:〈x0,x9〉〉) nat3 +; quadruple … RETI (MODE_IMM3 o2) (Word 〈〈x0,x0〉:〈x0,xA〉〉) nat3 +; quadruple … RETI (MODE_IMM3 o3) (Word 〈〈x0,x0〉:〈x0,xB〉〉) nat3 +; quadruple … RETI (MODE_IMM3 o4) (Word 〈〈x0,x0〉:〈x0,xC〉〉) nat3 +; quadruple … RETI (MODE_IMM3 o5) (Word 〈〈x0,x0〉:〈x0,xD〉〉) nat3 +; quadruple … RETI (MODE_IMM3 o6) (Word 〈〈x0,x0〉:〈x0,xE〉〉) nat3 +; quadruple … RETI (MODE_IMM3 o7) (Word 〈〈x0,x0〉:〈x0,xF〉〉) nat3 ]. ndefinition opcode_table_IP2022_27 ≝ -[ quadruple … RETW MODE_IMM8 (Byte 〈x7,x8〉) 〈x0,x3〉 ]. +[ quadruple … RETW MODE_IMM8 (Byte 〈x7,x8〉) nat3 ]. ndefinition opcode_table_IP2022_28 ≝ [ - quadruple … RL MODE_FR0_and_W (Byte 〈x3,x6〉) 〈x0,x1〉 -; quadruple … RL MODE_FR1_and_W (Byte 〈x3,x7〉) 〈x0,x1〉 -; quadruple … RL MODE_W_and_FR0 (Byte 〈x3,x4〉) 〈x0,x1〉 -; quadruple … RL MODE_W_and_FR1 (Byte 〈x3,x5〉) 〈x0,x1〉 + quadruple … RL MODE_FR0_and_W (Byte 〈x3,x6〉) nat1 +; quadruple … RL MODE_FR1_and_W (Byte 〈x3,x7〉) nat1 +; quadruple … RL MODE_W_and_FR0 (Byte 〈x3,x4〉) nat1 +; quadruple … RL MODE_W_and_FR1 (Byte 〈x3,x5〉) nat1 ]. ndefinition opcode_table_IP2022_29 ≝ [ - quadruple … RR MODE_FR0_and_W (Byte 〈x3,x2〉) 〈x0,x1〉 -; quadruple … RR MODE_FR1_and_W (Byte 〈x3,x3〉) 〈x0,x1〉 -; quadruple … RR MODE_W_and_FR0 (Byte 〈x3,x0〉) 〈x0,x1〉 -; quadruple … RR MODE_W_and_FR1 (Byte 〈x3,x1〉) 〈x0,x1〉 + quadruple … RR MODE_FR0_and_W (Byte 〈x3,x2〉) nat1 +; quadruple … RR MODE_FR1_and_W (Byte 〈x3,x3〉) nat1 +; quadruple … RR MODE_W_and_FR0 (Byte 〈x3,x0〉) nat1 +; quadruple … RR MODE_W_and_FR1 (Byte 〈x3,x1〉) nat1 ]. ndefinition opcode_table_IP2022_30 ≝ [ - quadruple … SB (MODE_FR0n o0) (Byte 〈xB,x0〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR1n o0) (Byte 〈xB,x1〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR0n o1) (Byte 〈xB,x2〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR1n o1) (Byte 〈xB,x3〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR0n o2) (Byte 〈xB,x4〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR1n o2) (Byte 〈xB,x5〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR0n o3) (Byte 〈xB,x6〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR1n o3) (Byte 〈xB,x7〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR0n o4) (Byte 〈xB,x8〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR1n o4) (Byte 〈xB,x9〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR0n o5) (Byte 〈xB,xA〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR1n o5) (Byte 〈xB,xB〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR0n o6) (Byte 〈xB,xC〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR1n o6) (Byte 〈xB,xD〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR0n o7) (Byte 〈xB,xE〉) 〈x0,x1〉 -; quadruple … SB (MODE_FR1n o7) (Byte 〈xB,xF〉) 〈x0,x1〉 + quadruple … SB (MODE_FR0n o0) (Byte 〈xB,x0〉) nat1 +; quadruple … SB (MODE_FR1n o0) (Byte 〈xB,x1〉) nat1 +; quadruple … SB (MODE_FR0n o1) (Byte 〈xB,x2〉) nat1 +; quadruple … SB (MODE_FR1n o1) (Byte 〈xB,x3〉) nat1 +; quadruple … SB (MODE_FR0n o2) (Byte 〈xB,x4〉) nat1 +; quadruple … SB (MODE_FR1n o2) (Byte 〈xB,x5〉) nat1 +; quadruple … SB (MODE_FR0n o3) (Byte 〈xB,x6〉) nat1 +; quadruple … SB (MODE_FR1n o3) (Byte 〈xB,x7〉) nat1 +; quadruple … SB (MODE_FR0n o4) (Byte 〈xB,x8〉) nat1 +; quadruple … SB (MODE_FR1n o4) (Byte 〈xB,x9〉) nat1 +; quadruple … SB (MODE_FR0n o5) (Byte 〈xB,xA〉) nat1 +; quadruple … SB (MODE_FR1n o5) (Byte 〈xB,xB〉) nat1 +; quadruple … SB (MODE_FR0n o6) (Byte 〈xB,xC〉) nat1 +; quadruple … SB (MODE_FR1n o6) (Byte 〈xB,xD〉) nat1 +; quadruple … SB (MODE_FR0n o7) (Byte 〈xB,xE〉) nat1 +; quadruple … SB (MODE_FR1n o7) (Byte 〈xB,xF〉) nat1 ]. ndefinition opcode_table_IP2022_31 ≝ [ - quadruple … SETB (MODE_FR0n o0) (Byte 〈x9,x0〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR1n o0) (Byte 〈x9,x1〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR0n o1) (Byte 〈x9,x2〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR1n o1) (Byte 〈x9,x3〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR0n o2) (Byte 〈x9,x4〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR1n o2) (Byte 〈x9,x5〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR0n o3) (Byte 〈x9,x6〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR1n o3) (Byte 〈x9,x7〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR0n o4) (Byte 〈x9,x8〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR1n o4) (Byte 〈x9,x9〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR0n o5) (Byte 〈x9,xA〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR1n o5) (Byte 〈x9,xB〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR0n o6) (Byte 〈x9,xC〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR1n o6) (Byte 〈x9,xD〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR0n o7) (Byte 〈x9,xE〉) 〈x0,x1〉 -; quadruple … SETB (MODE_FR1n o7) (Byte 〈x9,xF〉) 〈x0,x1〉 + quadruple … SETB (MODE_FR0n o0) (Byte 〈x9,x0〉) nat1 +; quadruple … SETB (MODE_FR1n o0) (Byte 〈x9,x1〉) nat1 +; quadruple … SETB (MODE_FR0n o1) (Byte 〈x9,x2〉) nat1 +; quadruple … SETB (MODE_FR1n o1) (Byte 〈x9,x3〉) nat1 +; quadruple … SETB (MODE_FR0n o2) (Byte 〈x9,x4〉) nat1 +; quadruple … SETB (MODE_FR1n o2) (Byte 〈x9,x5〉) nat1 +; quadruple … SETB (MODE_FR0n o3) (Byte 〈x9,x6〉) nat1 +; quadruple … SETB (MODE_FR1n o3) (Byte 〈x9,x7〉) nat1 +; quadruple … SETB (MODE_FR0n o4) (Byte 〈x9,x8〉) nat1 +; quadruple … SETB (MODE_FR1n o4) (Byte 〈x9,x9〉) nat1 +; quadruple … SETB (MODE_FR0n o5) (Byte 〈x9,xA〉) nat1 +; quadruple … SETB (MODE_FR1n o5) (Byte 〈x9,xB〉) nat1 +; quadruple … SETB (MODE_FR0n o6) (Byte 〈x9,xC〉) nat1 +; quadruple … SETB (MODE_FR1n o6) (Byte 〈x9,xD〉) nat1 +; quadruple … SETB (MODE_FR0n o7) (Byte 〈x9,xE〉) nat1 +; quadruple … SETB (MODE_FR1n o7) (Byte 〈x9,xF〉) nat1 ]. ndefinition opcode_table_IP2022_32 ≝ [ - quadruple … SNB (MODE_FR0n o0) (Byte 〈xA,x0〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR1n o0) (Byte 〈xA,x1〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR0n o1) (Byte 〈xA,x2〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR1n o1) (Byte 〈xA,x3〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR0n o2) (Byte 〈xA,x4〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR1n o2) (Byte 〈xA,x5〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR0n o3) (Byte 〈xA,x6〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR1n o3) (Byte 〈xA,x7〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR0n o4) (Byte 〈xA,x8〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR1n o4) (Byte 〈xA,x9〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR0n o5) (Byte 〈xA,xA〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR1n o5) (Byte 〈xA,xB〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR0n o6) (Byte 〈xA,xC〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR1n o6) (Byte 〈xA,xD〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR0n o7) (Byte 〈xA,xE〉) 〈x0,x1〉 -; quadruple … SNB (MODE_FR1n o7) (Byte 〈xA,xF〉) 〈x0,x1〉 + quadruple … SNB (MODE_FR0n o0) (Byte 〈xA,x0〉) nat1 +; quadruple … SNB (MODE_FR1n o0) (Byte 〈xA,x1〉) nat1 +; quadruple … SNB (MODE_FR0n o1) (Byte 〈xA,x2〉) nat1 +; quadruple … SNB (MODE_FR1n o1) (Byte 〈xA,x3〉) nat1 +; quadruple … SNB (MODE_FR0n o2) (Byte 〈xA,x4〉) nat1 +; quadruple … SNB (MODE_FR1n o2) (Byte 〈xA,x5〉) nat1 +; quadruple … SNB (MODE_FR0n o3) (Byte 〈xA,x6〉) nat1 +; quadruple … SNB (MODE_FR1n o3) (Byte 〈xA,x7〉) nat1 +; quadruple … SNB (MODE_FR0n o4) (Byte 〈xA,x8〉) nat1 +; quadruple … SNB (MODE_FR1n o4) (Byte 〈xA,x9〉) nat1 +; quadruple … SNB (MODE_FR0n o5) (Byte 〈xA,xA〉) nat1 +; quadruple … SNB (MODE_FR1n o5) (Byte 〈xA,xB〉) nat1 +; quadruple … SNB (MODE_FR0n o6) (Byte 〈xA,xC〉) nat1 +; quadruple … SNB (MODE_FR1n o6) (Byte 〈xA,xD〉) nat1 +; quadruple … SNB (MODE_FR0n o7) (Byte 〈xA,xE〉) nat1 +; quadruple … SNB (MODE_FR1n o7) (Byte 〈xA,xF〉) nat1 ]. ndefinition opcode_table_IP2022_33 ≝ -[ quadruple … SPEED MODE_IMM8 (Byte 〈x0,x1〉) 〈x0,x1〉 ]. +[ quadruple … SPEED MODE_IMM8 (Byte 〈x0,x1〉) nat1 ]. ndefinition opcode_table_IP2022_34 ≝ [ - quadruple … SUB MODE_FR0_and_W (Byte 〈x0,xA〉) 〈x0,x1〉 -; quadruple … SUB MODE_FR1_and_W (Byte 〈x0,xB〉) 〈x0,x1〉 -; quadruple … SUB MODE_W_and_FR0 (Byte 〈x0,x8〉) 〈x0,x1〉 -; quadruple … SUB MODE_W_and_FR1 (Byte 〈x0,x9〉) 〈x0,x1〉 -; quadruple … SUB MODE_IMM8 (Byte 〈x7,xA〉) 〈x0,x1〉 + quadruple … SUB MODE_FR0_and_W (Byte 〈x0,xA〉) nat1 +; quadruple … SUB MODE_FR1_and_W (Byte 〈x0,xB〉) nat1 +; quadruple … SUB MODE_W_and_FR0 (Byte 〈x0,x8〉) nat1 +; quadruple … SUB MODE_W_and_FR1 (Byte 〈x0,x9〉) nat1 +; quadruple … SUB MODE_IMM8 (Byte 〈x7,xA〉) nat1 ]. ndefinition opcode_table_IP2022_35 ≝ [ - quadruple … SUBC MODE_FR0_and_W (Byte 〈x4,xA〉) 〈x0,x1〉 -; quadruple … SUBC MODE_FR1_and_W (Byte 〈x4,xB〉) 〈x0,x1〉 -; quadruple … SUBC MODE_W_and_FR0 (Byte 〈x4,x8〉) 〈x0,x1〉 -; quadruple … SUBC MODE_W_and_FR1 (Byte 〈x4,x9〉) 〈x0,x1〉 + quadruple … SUBC MODE_FR0_and_W (Byte 〈x4,xA〉) nat1 +; quadruple … SUBC MODE_FR1_and_W (Byte 〈x4,xB〉) nat1 +; quadruple … SUBC MODE_W_and_FR0 (Byte 〈x4,x8〉) nat1 +; quadruple … SUBC MODE_W_and_FR1 (Byte 〈x4,x9〉) nat1 ]. ndefinition opcode_table_IP2022_36 ≝ [ - quadruple … SWAP MODE_FR0_and_W (Byte 〈x3,xA〉) 〈x0,x1〉 -; quadruple … SWAP MODE_FR1_and_W (Byte 〈x3,xB〉) 〈x0,x1〉 -; quadruple … SWAP MODE_W_and_FR0 (Byte 〈x3,x8〉) 〈x0,x1〉 -; quadruple … SWAP MODE_W_and_FR1 (Byte 〈x3,x9〉) 〈x0,x1〉 + quadruple … SWAP MODE_FR0_and_W (Byte 〈x3,xA〉) nat1 +; quadruple … SWAP MODE_FR1_and_W (Byte 〈x3,xB〉) nat1 +; quadruple … SWAP MODE_W_and_FR0 (Byte 〈x3,x8〉) nat1 +; quadruple … SWAP MODE_W_and_FR1 (Byte 〈x3,x9〉) nat1 ]. ndefinition opcode_table_IP2022_37 ≝ [ - quadruple … TEST MODE_FR0_and_W (Byte 〈x2,x2〉) 〈x0,x1〉 -; quadruple … TEST MODE_FR1_and_W (Byte 〈x2,x3〉) 〈x0,x1〉 + quadruple … TEST MODE_FR0_and_W (Byte 〈x2,x2〉) nat1 +; quadruple … TEST MODE_FR1_and_W (Byte 〈x2,x3〉) nat1 ]. ndefinition opcode_table_IP2022_38 ≝ [ - quadruple … XOR MODE_FR0_and_W (Byte 〈x1,xA〉) 〈x0,x1〉 -; quadruple … XOR MODE_FR1_and_W (Byte 〈x1,xB〉) 〈x0,x1〉 -; quadruple … XOR MODE_W_and_FR0 (Byte 〈x1,x8〉) 〈x0,x1〉 -; quadruple … XOR MODE_W_and_FR1 (Byte 〈x1,x9〉) 〈x0,x1〉 -; quadruple … XOR MODE_IMM8 (Byte 〈x7,xF〉) 〈x0,x1〉 + quadruple … XOR MODE_FR0_and_W (Byte 〈x1,xA〉) nat1 +; quadruple … XOR MODE_FR1_and_W (Byte 〈x1,xB〉) nat1 +; quadruple … XOR MODE_W_and_FR0 (Byte 〈x1,x8〉) nat1 +; quadruple … XOR MODE_W_and_FR1 (Byte 〈x1,x9〉) nat1 +; quadruple … XOR MODE_IMM8 (Byte 〈x7,xF〉) nat1 ]. ndefinition opcode_table_IP2022 ≝ diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/RS08_table.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/RS08_table.ma index 5640c506a..d142d9984 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/RS08_table.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/RS08_table.ma @@ -34,355 +34,355 @@ include "common/list.ma". ndefinition opcode_table_RS08_1 ≝ [ - quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 + quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) nat2 +; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) nat3 ]. ndefinition opcode_table_RS08_2 ≝ [ - quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x0) (Byte 〈x6,x0〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x1) (Byte 〈x6,x1〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x2) (Byte 〈x6,x2〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x3) (Byte 〈x6,x3〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x4) (Byte 〈x6,x4〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x5) (Byte 〈x6,x5〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x6) (Byte 〈x6,x6〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x7) (Byte 〈x6,x7〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x8) (Byte 〈x6,x8〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x9) (Byte 〈x6,x9〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xA) (Byte 〈x6,xA〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xB) (Byte 〈x6,xB〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xC) (Byte 〈x6,xC〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xD) (Byte 〈x6,xD〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xE) (Byte 〈x6,xE〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xF) (Byte 〈x6,xF〉) 〈x0,x3〉 + quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) nat2 +; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) nat3 +; quadruple … ADD (MODE_TNY x0) (Byte 〈x6,x0〉) nat3 +; quadruple … ADD (MODE_TNY x1) (Byte 〈x6,x1〉) nat3 +; quadruple … ADD (MODE_TNY x2) (Byte 〈x6,x2〉) nat3 +; quadruple … ADD (MODE_TNY x3) (Byte 〈x6,x3〉) nat3 +; quadruple … ADD (MODE_TNY x4) (Byte 〈x6,x4〉) nat3 +; quadruple … ADD (MODE_TNY x5) (Byte 〈x6,x5〉) nat3 +; quadruple … ADD (MODE_TNY x6) (Byte 〈x6,x6〉) nat3 +; quadruple … ADD (MODE_TNY x7) (Byte 〈x6,x7〉) nat3 +; quadruple … ADD (MODE_TNY x8) (Byte 〈x6,x8〉) nat3 +; quadruple … ADD (MODE_TNY x9) (Byte 〈x6,x9〉) nat3 +; quadruple … ADD (MODE_TNY xA) (Byte 〈x6,xA〉) nat3 +; quadruple … ADD (MODE_TNY xB) (Byte 〈x6,xB〉) nat3 +; quadruple … ADD (MODE_TNY xC) (Byte 〈x6,xC〉) nat3 +; quadruple … ADD (MODE_TNY xD) (Byte 〈x6,xD〉) nat3 +; quadruple … ADD (MODE_TNY xE) (Byte 〈x6,xE〉) nat3 +; quadruple … ADD (MODE_TNY xF) (Byte 〈x6,xF〉) nat3 ]. ndefinition opcode_table_RS08_3 ≝ [ - quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 + quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) nat2 +; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) nat3 ]. ndefinition opcode_table_RS08_4 ≝ [ - quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 + quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) nat1 ]. ndefinition opcode_table_RS08_5 ≝ [ - quadruple … BRA MODE_IMM1 (Byte 〈x3,x0〉) 〈x0,x3〉 -; quadruple … BCC MODE_IMM1 (Byte 〈x3,x4〉) 〈x0,x3〉 -; quadruple … BCS MODE_IMM1 (Byte 〈x3,x5〉) 〈x0,x3〉 -; quadruple … BNE MODE_IMM1 (Byte 〈x3,x6〉) 〈x0,x3〉 -; quadruple … BEQ MODE_IMM1 (Byte 〈x3,x7〉) 〈x0,x3〉 + quadruple … BRA MODE_IMM1 (Byte 〈x3,x0〉) nat3 +; quadruple … BCC MODE_IMM1 (Byte 〈x3,x4〉) nat3 +; quadruple … BCS MODE_IMM1 (Byte 〈x3,x5〉) nat3 +; quadruple … BNE MODE_IMM1 (Byte 〈x3,x6〉) nat3 +; quadruple … BEQ MODE_IMM1 (Byte 〈x3,x7〉) nat3 ]. ndefinition opcode_table_RS08_6 ≝ [ - quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 + quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) nat5 +; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) nat5 +; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) nat5 +; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) nat5 +; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) nat5 +; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) nat5 +; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) nat5 +; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) nat5 +; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) nat5 +; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) nat5 +; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) nat5 +; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) nat5 +; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) nat5 +; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) nat5 +; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) nat5 +; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) nat5 ]. ndefinition opcode_table_RS08_7 ≝ [ - quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 + quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) nat5 +; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) nat5 +; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) nat5 ]. ndefinition opcode_table_RS08_8 ≝ [ - quadruple … CLC MODE_INH (Byte 〈x3,x8〉) 〈x0,x1〉 -; quadruple … SEC MODE_INH (Byte 〈x3,x9〉) 〈x0,x1〉 -; quadruple … SLA MODE_INH (Byte 〈x4,x2〉) 〈x0,x1〉 -; quadruple … SHA MODE_INH (Byte 〈x4,x5〉) 〈x0,x1〉 -; quadruple … NOP MODE_INH (Byte 〈xA,xC〉) 〈x0,x1〉 -; quadruple … STOP MODE_INH (Byte 〈xA,xE〉) 〈x0,x2〉 -; quadruple … WAIT MODE_INH (Byte 〈xA,xF〉) 〈x0,x2〉 -; quadruple … RTS MODE_INH (Byte 〈xB,xE〉) 〈x0,x3〉 -; quadruple … BGND MODE_INH (Byte 〈xB,xF〉) 〈x0,x5〉 + quadruple … CLC MODE_INH (Byte 〈x3,x8〉) nat1 +; quadruple … SEC MODE_INH (Byte 〈x3,x9〉) nat1 +; quadruple … SLA MODE_INH (Byte 〈x4,x2〉) nat1 +; quadruple … SHA MODE_INH (Byte 〈x4,x5〉) nat1 +; quadruple … NOP MODE_INH (Byte 〈xA,xC〉) nat1 +; quadruple … STOP MODE_INH (Byte 〈xA,xE〉) nat2 +; quadruple … WAIT MODE_INH (Byte 〈xA,xF〉) nat2 +; quadruple … RTS MODE_INH (Byte 〈xB,xE〉) nat3 +; quadruple … BGND MODE_INH (Byte 〈xB,xF〉) nat5 ]. ndefinition opcode_table_RS08_9 ≝ [ - quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 + quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) nat5 +; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) nat4 ]. ndefinition opcode_table_RS08_10 ≝ [ - quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 -; quadruple … CLR (MODE_SRT t00) (Byte 〈x8,x0〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t01) (Byte 〈x8,x1〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t02) (Byte 〈x8,x2〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t03) (Byte 〈x8,x3〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t04) (Byte 〈x8,x4〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t05) (Byte 〈x8,x5〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t06) (Byte 〈x8,x6〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t07) (Byte 〈x8,x7〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t08) (Byte 〈x8,x8〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t09) (Byte 〈x8,x9〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0A) (Byte 〈x8,xA〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0B) (Byte 〈x8,xB〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0C) (Byte 〈x8,xC〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0D) (Byte 〈x8,xD〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0E) (Byte 〈x8,xE〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0F) (Byte 〈x8,xF〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t10) (Byte 〈x9,x0〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t11) (Byte 〈x9,x1〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t12) (Byte 〈x9,x2〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t13) (Byte 〈x9,x3〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t14) (Byte 〈x9,x4〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t15) (Byte 〈x9,x5〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t16) (Byte 〈x9,x6〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t17) (Byte 〈x9,x7〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t18) (Byte 〈x9,x8〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t19) (Byte 〈x9,x9〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1A) (Byte 〈x9,xA〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1B) (Byte 〈x9,xB〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1C) (Byte 〈x9,xC〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1D) (Byte 〈x9,xD〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1E) (Byte 〈x9,xE〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1F) (Byte 〈x9,xF〉) 〈x0,x2〉 + quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) nat3 +; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) nat1 +; quadruple … CLR (MODE_SRT t00) (Byte 〈x8,x0〉) nat2 +; quadruple … CLR (MODE_SRT t01) (Byte 〈x8,x1〉) nat2 +; quadruple … CLR (MODE_SRT t02) (Byte 〈x8,x2〉) nat2 +; quadruple … CLR (MODE_SRT t03) (Byte 〈x8,x3〉) nat2 +; quadruple … CLR (MODE_SRT t04) (Byte 〈x8,x4〉) nat2 +; quadruple … CLR (MODE_SRT t05) (Byte 〈x8,x5〉) nat2 +; quadruple … CLR (MODE_SRT t06) (Byte 〈x8,x6〉) nat2 +; quadruple … CLR (MODE_SRT t07) (Byte 〈x8,x7〉) nat2 +; quadruple … CLR (MODE_SRT t08) (Byte 〈x8,x8〉) nat2 +; quadruple … CLR (MODE_SRT t09) (Byte 〈x8,x9〉) nat2 +; quadruple … CLR (MODE_SRT t0A) (Byte 〈x8,xA〉) nat2 +; quadruple … CLR (MODE_SRT t0B) (Byte 〈x8,xB〉) nat2 +; quadruple … CLR (MODE_SRT t0C) (Byte 〈x8,xC〉) nat2 +; quadruple … CLR (MODE_SRT t0D) (Byte 〈x8,xD〉) nat2 +; quadruple … CLR (MODE_SRT t0E) (Byte 〈x8,xE〉) nat2 +; quadruple … CLR (MODE_SRT t0F) (Byte 〈x8,xF〉) nat2 +; quadruple … CLR (MODE_SRT t10) (Byte 〈x9,x0〉) nat2 +; quadruple … CLR (MODE_SRT t11) (Byte 〈x9,x1〉) nat2 +; quadruple … CLR (MODE_SRT t12) (Byte 〈x9,x2〉) nat2 +; quadruple … CLR (MODE_SRT t13) (Byte 〈x9,x3〉) nat2 +; quadruple … CLR (MODE_SRT t14) (Byte 〈x9,x4〉) nat2 +; quadruple … CLR (MODE_SRT t15) (Byte 〈x9,x5〉) nat2 +; quadruple … CLR (MODE_SRT t16) (Byte 〈x9,x6〉) nat2 +; quadruple … CLR (MODE_SRT t17) (Byte 〈x9,x7〉) nat2 +; quadruple … CLR (MODE_SRT t18) (Byte 〈x9,x8〉) nat2 +; quadruple … CLR (MODE_SRT t19) (Byte 〈x9,x9〉) nat2 +; quadruple … CLR (MODE_SRT t1A) (Byte 〈x9,xA〉) nat2 +; quadruple … CLR (MODE_SRT t1B) (Byte 〈x9,xB〉) nat2 +; quadruple … CLR (MODE_SRT t1C) (Byte 〈x9,xC〉) nat2 +; quadruple … CLR (MODE_SRT t1D) (Byte 〈x9,xD〉) nat2 +; quadruple … CLR (MODE_SRT t1E) (Byte 〈x9,xE〉) nat2 +; quadruple … CLR (MODE_SRT t1F) (Byte 〈x9,xF〉) nat2 ]. ndefinition opcode_table_RS08_11 ≝ [ - quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 + quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) nat2 +; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) nat3 ]. ndefinition opcode_table_RS08_12 ≝ [ - quadruple … COM MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 + quadruple … COM MODE_INHA (Byte 〈x4,x3〉) nat1 ]. ndefinition opcode_table_RS08_13 ≝ [ - quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x7〉 -; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x4〉 + quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) nat7 +; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) nat4 ]. ndefinition opcode_table_RS08_14 ≝ [ - quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 -; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 -; quadruple … DEC (MODE_TNY x0) (Byte 〈x5,x0〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x1) (Byte 〈x5,x1〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x2) (Byte 〈x5,x2〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x3) (Byte 〈x5,x3〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x4) (Byte 〈x5,x4〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x5) (Byte 〈x5,x5〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x6) (Byte 〈x5,x6〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x7) (Byte 〈x5,x7〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x8) (Byte 〈x5,x8〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x9) (Byte 〈x5,x9〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xA) (Byte 〈x5,xA〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xB) (Byte 〈x5,xB〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xC) (Byte 〈x5,xC〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xD) (Byte 〈x5,xD〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xE) (Byte 〈x5,xE〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xF) (Byte 〈x5,xF〉) 〈x0,x4〉 + quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) nat5 +; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) nat1 +; quadruple … DEC (MODE_TNY x0) (Byte 〈x5,x0〉) nat4 +; quadruple … DEC (MODE_TNY x1) (Byte 〈x5,x1〉) nat4 +; quadruple … DEC (MODE_TNY x2) (Byte 〈x5,x2〉) nat4 +; quadruple … DEC (MODE_TNY x3) (Byte 〈x5,x3〉) nat4 +; quadruple … DEC (MODE_TNY x4) (Byte 〈x5,x4〉) nat4 +; quadruple … DEC (MODE_TNY x5) (Byte 〈x5,x5〉) nat4 +; quadruple … DEC (MODE_TNY x6) (Byte 〈x5,x6〉) nat4 +; quadruple … DEC (MODE_TNY x7) (Byte 〈x5,x7〉) nat4 +; quadruple … DEC (MODE_TNY x8) (Byte 〈x5,x8〉) nat4 +; quadruple … DEC (MODE_TNY x9) (Byte 〈x5,x9〉) nat4 +; quadruple … DEC (MODE_TNY xA) (Byte 〈x5,xA〉) nat4 +; quadruple … DEC (MODE_TNY xB) (Byte 〈x5,xB〉) nat4 +; quadruple … DEC (MODE_TNY xC) (Byte 〈x5,xC〉) nat4 +; quadruple … DEC (MODE_TNY xD) (Byte 〈x5,xD〉) nat4 +; quadruple … DEC (MODE_TNY xE) (Byte 〈x5,xE〉) nat4 +; quadruple … DEC (MODE_TNY xF) (Byte 〈x5,xF〉) nat4 ]. ndefinition opcode_table_RS08_15 ≝ [ - quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 + quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) nat2 +; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) nat3 ]. ndefinition opcode_table_RS08_16 ≝ [ - quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 -; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 -; quadruple … INC (MODE_TNY x0) (Byte 〈x2,x0〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x1) (Byte 〈x2,x1〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x2) (Byte 〈x2,x2〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x3) (Byte 〈x2,x3〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x4) (Byte 〈x2,x4〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x5) (Byte 〈x2,x5〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x6) (Byte 〈x2,x6〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x7) (Byte 〈x2,x7〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x8) (Byte 〈x2,x8〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x9) (Byte 〈x2,x9〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xA) (Byte 〈x2,xA〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xB) (Byte 〈x2,xB〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xC) (Byte 〈x2,xC〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xD) (Byte 〈x2,xD〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xE) (Byte 〈x2,xE〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xF) (Byte 〈x2,xF〉) 〈x0,x4〉 + quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) nat5 +; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) nat1 +; quadruple … INC (MODE_TNY x0) (Byte 〈x2,x0〉) nat4 +; quadruple … INC (MODE_TNY x1) (Byte 〈x2,x1〉) nat4 +; quadruple … INC (MODE_TNY x2) (Byte 〈x2,x2〉) nat4 +; quadruple … INC (MODE_TNY x3) (Byte 〈x2,x3〉) nat4 +; quadruple … INC (MODE_TNY x4) (Byte 〈x2,x4〉) nat4 +; quadruple … INC (MODE_TNY x5) (Byte 〈x2,x5〉) nat4 +; quadruple … INC (MODE_TNY x6) (Byte 〈x2,x6〉) nat4 +; quadruple … INC (MODE_TNY x7) (Byte 〈x2,x7〉) nat4 +; quadruple … INC (MODE_TNY x8) (Byte 〈x2,x8〉) nat4 +; quadruple … INC (MODE_TNY x9) (Byte 〈x2,x9〉) nat4 +; quadruple … INC (MODE_TNY xA) (Byte 〈x2,xA〉) nat4 +; quadruple … INC (MODE_TNY xB) (Byte 〈x2,xB〉) nat4 +; quadruple … INC (MODE_TNY xC) (Byte 〈x2,xC〉) nat4 +; quadruple … INC (MODE_TNY xD) (Byte 〈x2,xD〉) nat4 +; quadruple … INC (MODE_TNY xE) (Byte 〈x2,xE〉) nat4 +; quadruple … INC (MODE_TNY xF) (Byte 〈x2,xF〉) nat4 ]. ndefinition opcode_table_RS08_17 ≝ [ - quadruple … JMP MODE_IMM2 (Byte 〈xB,xC〉) 〈x0,x4〉 + quadruple … JMP MODE_IMM2 (Byte 〈xB,xC〉) nat4 ]. ndefinition opcode_table_RS08_18 ≝ [ - quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x3〉 -; quadruple … JSR MODE_IMM2 (Byte 〈xB,xD〉) 〈x0,x4〉 + quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) nat3 +; quadruple … JSR MODE_IMM2 (Byte 〈xB,xD〉) nat4 ]. ndefinition opcode_table_RS08_19 ≝ [ - quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t00) (Byte 〈xC,x0〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t01) (Byte 〈xC,x1〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t02) (Byte 〈xC,x2〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t03) (Byte 〈xC,x3〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t04) (Byte 〈xC,x4〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t05) (Byte 〈xC,x5〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t06) (Byte 〈xC,x6〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t07) (Byte 〈xC,x7〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t08) (Byte 〈xC,x8〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t09) (Byte 〈xC,x9〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0A) (Byte 〈xC,xA〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0B) (Byte 〈xC,xB〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0C) (Byte 〈xC,xC〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0D) (Byte 〈xC,xD〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0E) (Byte 〈xC,xE〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0F) (Byte 〈xC,xF〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t10) (Byte 〈xD,x0〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t11) (Byte 〈xD,x1〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t12) (Byte 〈xD,x2〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t13) (Byte 〈xD,x3〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t14) (Byte 〈xD,x4〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t15) (Byte 〈xD,x5〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t16) (Byte 〈xD,x6〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t17) (Byte 〈xD,x7〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t18) (Byte 〈xD,x8〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t19) (Byte 〈xD,x9〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1A) (Byte 〈xD,xA〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1B) (Byte 〈xD,xB〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1C) (Byte 〈xD,xC〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1D) (Byte 〈xD,xD〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1E) (Byte 〈xD,xE〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1F) (Byte 〈xD,xF〉) 〈x0,x3〉 + quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) nat2 +; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) nat3 +; quadruple … LDA (MODE_SRT t00) (Byte 〈xC,x0〉) nat3 +; quadruple … LDA (MODE_SRT t01) (Byte 〈xC,x1〉) nat3 +; quadruple … LDA (MODE_SRT t02) (Byte 〈xC,x2〉) nat3 +; quadruple … LDA (MODE_SRT t03) (Byte 〈xC,x3〉) nat3 +; quadruple … LDA (MODE_SRT t04) (Byte 〈xC,x4〉) nat3 +; quadruple … LDA (MODE_SRT t05) (Byte 〈xC,x5〉) nat3 +; quadruple … LDA (MODE_SRT t06) (Byte 〈xC,x6〉) nat3 +; quadruple … LDA (MODE_SRT t07) (Byte 〈xC,x7〉) nat3 +; quadruple … LDA (MODE_SRT t08) (Byte 〈xC,x8〉) nat3 +; quadruple … LDA (MODE_SRT t09) (Byte 〈xC,x9〉) nat3 +; quadruple … LDA (MODE_SRT t0A) (Byte 〈xC,xA〉) nat3 +; quadruple … LDA (MODE_SRT t0B) (Byte 〈xC,xB〉) nat3 +; quadruple … LDA (MODE_SRT t0C) (Byte 〈xC,xC〉) nat3 +; quadruple … LDA (MODE_SRT t0D) (Byte 〈xC,xD〉) nat3 +; quadruple … LDA (MODE_SRT t0E) (Byte 〈xC,xE〉) nat3 +; quadruple … LDA (MODE_SRT t0F) (Byte 〈xC,xF〉) nat3 +; quadruple … LDA (MODE_SRT t10) (Byte 〈xD,x0〉) nat3 +; quadruple … LDA (MODE_SRT t11) (Byte 〈xD,x1〉) nat3 +; quadruple … LDA (MODE_SRT t12) (Byte 〈xD,x2〉) nat3 +; quadruple … LDA (MODE_SRT t13) (Byte 〈xD,x3〉) nat3 +; quadruple … LDA (MODE_SRT t14) (Byte 〈xD,x4〉) nat3 +; quadruple … LDA (MODE_SRT t15) (Byte 〈xD,x5〉) nat3 +; quadruple … LDA (MODE_SRT t16) (Byte 〈xD,x6〉) nat3 +; quadruple … LDA (MODE_SRT t17) (Byte 〈xD,x7〉) nat3 +; quadruple … LDA (MODE_SRT t18) (Byte 〈xD,x8〉) nat3 +; quadruple … LDA (MODE_SRT t19) (Byte 〈xD,x9〉) nat3 +; quadruple … LDA (MODE_SRT t1A) (Byte 〈xD,xA〉) nat3 +; quadruple … LDA (MODE_SRT t1B) (Byte 〈xD,xB〉) nat3 +; quadruple … LDA (MODE_SRT t1C) (Byte 〈xD,xC〉) nat3 +; quadruple … LDA (MODE_SRT t1D) (Byte 〈xD,xD〉) nat3 +; quadruple … LDA (MODE_SRT t1E) (Byte 〈xD,xE〉) nat3 +; quadruple … LDA (MODE_SRT t1F) (Byte 〈xD,xF〉) nat3 ]. ndefinition opcode_table_RS08_20 ≝ [ - quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 + quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) nat1 ]. ndefinition opcode_table_RS08_21 ≝ [ - quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x3,xE〉) 〈x0,x4〉 -; quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 + quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x3,xE〉) nat4 +; quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) nat5 ]. ndefinition opcode_table_RS08_22 ≝ [ - quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 + quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) nat2 +; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) nat3 ]. ndefinition opcode_table_RS08_23 ≝ [ - quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 + quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) nat1 ]. ndefinition opcode_table_RS08_24 ≝ [ - quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 + quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) nat1 ]. ndefinition opcode_table_RS08_25 ≝ [ - quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 + quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) nat2 +; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) nat3 ]. ndefinition opcode_table_RS08_26 ≝ [ - quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 -; quadruple … STA (MODE_SRT t00) (Byte 〈xE,x0〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t01) (Byte 〈xE,x1〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t02) (Byte 〈xE,x2〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t03) (Byte 〈xE,x3〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t04) (Byte 〈xE,x4〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t05) (Byte 〈xE,x5〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t06) (Byte 〈xE,x6〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t07) (Byte 〈xE,x7〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t08) (Byte 〈xE,x8〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t09) (Byte 〈xE,x9〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0A) (Byte 〈xE,xA〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0B) (Byte 〈xE,xB〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0C) (Byte 〈xE,xC〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0D) (Byte 〈xE,xD〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0E) (Byte 〈xE,xE〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0F) (Byte 〈xE,xF〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t10) (Byte 〈xF,x0〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t11) (Byte 〈xF,x1〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t12) (Byte 〈xF,x2〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t13) (Byte 〈xF,x3〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t14) (Byte 〈xF,x4〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t15) (Byte 〈xF,x5〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t16) (Byte 〈xF,x6〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t17) (Byte 〈xF,x7〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t18) (Byte 〈xF,x8〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t19) (Byte 〈xF,x9〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1A) (Byte 〈xF,xA〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1B) (Byte 〈xF,xB〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1C) (Byte 〈xF,xC〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1D) (Byte 〈xF,xD〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1E) (Byte 〈xF,xE〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1F) (Byte 〈xF,xF〉) 〈x0,x2〉 + quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) nat3 +; quadruple … STA (MODE_SRT t00) (Byte 〈xE,x0〉) nat2 +; quadruple … STA (MODE_SRT t01) (Byte 〈xE,x1〉) nat2 +; quadruple … STA (MODE_SRT t02) (Byte 〈xE,x2〉) nat2 +; quadruple … STA (MODE_SRT t03) (Byte 〈xE,x3〉) nat2 +; quadruple … STA (MODE_SRT t04) (Byte 〈xE,x4〉) nat2 +; quadruple … STA (MODE_SRT t05) (Byte 〈xE,x5〉) nat2 +; quadruple … STA (MODE_SRT t06) (Byte 〈xE,x6〉) nat2 +; quadruple … STA (MODE_SRT t07) (Byte 〈xE,x7〉) nat2 +; quadruple … STA (MODE_SRT t08) (Byte 〈xE,x8〉) nat2 +; quadruple … STA (MODE_SRT t09) (Byte 〈xE,x9〉) nat2 +; quadruple … STA (MODE_SRT t0A) (Byte 〈xE,xA〉) nat2 +; quadruple … STA (MODE_SRT t0B) (Byte 〈xE,xB〉) nat2 +; quadruple … STA (MODE_SRT t0C) (Byte 〈xE,xC〉) nat2 +; quadruple … STA (MODE_SRT t0D) (Byte 〈xE,xD〉) nat2 +; quadruple … STA (MODE_SRT t0E) (Byte 〈xE,xE〉) nat2 +; quadruple … STA (MODE_SRT t0F) (Byte 〈xE,xF〉) nat2 +; quadruple … STA (MODE_SRT t10) (Byte 〈xF,x0〉) nat2 +; quadruple … STA (MODE_SRT t11) (Byte 〈xF,x1〉) nat2 +; quadruple … STA (MODE_SRT t12) (Byte 〈xF,x2〉) nat2 +; quadruple … STA (MODE_SRT t13) (Byte 〈xF,x3〉) nat2 +; quadruple … STA (MODE_SRT t14) (Byte 〈xF,x4〉) nat2 +; quadruple … STA (MODE_SRT t15) (Byte 〈xF,x5〉) nat2 +; quadruple … STA (MODE_SRT t16) (Byte 〈xF,x6〉) nat2 +; quadruple … STA (MODE_SRT t17) (Byte 〈xF,x7〉) nat2 +; quadruple … STA (MODE_SRT t18) (Byte 〈xF,x8〉) nat2 +; quadruple … STA (MODE_SRT t19) (Byte 〈xF,x9〉) nat2 +; quadruple … STA (MODE_SRT t1A) (Byte 〈xF,xA〉) nat2 +; quadruple … STA (MODE_SRT t1B) (Byte 〈xF,xB〉) nat2 +; quadruple … STA (MODE_SRT t1C) (Byte 〈xF,xC〉) nat2 +; quadruple … STA (MODE_SRT t1D) (Byte 〈xF,xD〉) nat2 +; quadruple … STA (MODE_SRT t1E) (Byte 〈xF,xE〉) nat2 +; quadruple … STA (MODE_SRT t1F) (Byte 〈xF,xF〉) nat2 ]. ndefinition opcode_table_RS08_27 ≝ [ - quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x0) (Byte 〈x7,x0〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x1) (Byte 〈x7,x1〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x2) (Byte 〈x7,x2〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x3) (Byte 〈x7,x3〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x4) (Byte 〈x7,x4〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x5) (Byte 〈x7,x5〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x6) (Byte 〈x7,x6〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x7) (Byte 〈x7,x7〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x8) (Byte 〈x7,x8〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x9) (Byte 〈x7,x9〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xA) (Byte 〈x7,xA〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xB) (Byte 〈x7,xB〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xC) (Byte 〈x7,xC〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xD) (Byte 〈x7,xD〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xE) (Byte 〈x7,xE〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xF) (Byte 〈x7,xF〉) 〈x0,x3〉 + quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) nat2 +; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) nat3 +; quadruple … SUB (MODE_TNY x0) (Byte 〈x7,x0〉) nat3 +; quadruple … SUB (MODE_TNY x1) (Byte 〈x7,x1〉) nat3 +; quadruple … SUB (MODE_TNY x2) (Byte 〈x7,x2〉) nat3 +; quadruple … SUB (MODE_TNY x3) (Byte 〈x7,x3〉) nat3 +; quadruple … SUB (MODE_TNY x4) (Byte 〈x7,x4〉) nat3 +; quadruple … SUB (MODE_TNY x5) (Byte 〈x7,x5〉) nat3 +; quadruple … SUB (MODE_TNY x6) (Byte 〈x7,x6〉) nat3 +; quadruple … SUB (MODE_TNY x7) (Byte 〈x7,x7〉) nat3 +; quadruple … SUB (MODE_TNY x8) (Byte 〈x7,x8〉) nat3 +; quadruple … SUB (MODE_TNY x9) (Byte 〈x7,x9〉) nat3 +; quadruple … SUB (MODE_TNY xA) (Byte 〈x7,xA〉) nat3 +; quadruple … SUB (MODE_TNY xB) (Byte 〈x7,xB〉) nat3 +; quadruple … SUB (MODE_TNY xC) (Byte 〈x7,xC〉) nat3 +; quadruple … SUB (MODE_TNY xD) (Byte 〈x7,xD〉) nat3 +; quadruple … SUB (MODE_TNY xE) (Byte 〈x7,xE〉) nat3 +; quadruple … SUB (MODE_TNY xF) (Byte 〈x7,xF〉) nat3 ]. ndefinition opcode_table_RS08 ≝ diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma index c881965ac..4c5e3afe8 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma @@ -139,7 +139,7 @@ unification hint 0 ≔ M:mcu_type ⊢ carr (im_is_comparable M) ≡ aux_im_type (* STRUMENTI PER LE DIMOSTRAZIONI DI CORRETTEZZA *) (* ********************************************* *) -ndefinition aux_table_type ≝ λmcu:mcu_type.Prod4T (aux_pseudo_type mcu) (aux_im_type mcu) byte8_or_word16 byte8. +ndefinition aux_table_type ≝ λmcu:mcu_type.Prod4T (aux_pseudo_type mcu) (aux_im_type mcu) byte8_or_word16 nat. (* su tutta la lista quante volte compare il byte *) nlet rec get_byte_count (m:mcu_type) (b:byte8) (c:word16) (l:list (aux_table_type m)) on l ≝ diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/Freescale_fetch.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/Freescale_fetch.ma new file mode 100755 index 000000000..976d1202f --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/Freescale_fetch.ma @@ -0,0 +1,47 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/fetch_base.ma". +include "emulator/status/status.ma". + +(* opcode a byte : HC05 / RS08 *) +(* caricamento solo da segmento 0 *) +ndefinition fetch_byte ≝ +λm,t.λs:any_status m t.λpc:word16. + match mem_read t (mem_desc … s) (chk_desc … s) o0 pc with + [ None ⇒ FetchERR ? ILL_FETCH_AD + | Some bh ⇒ fetch_byte_aux m (succc ? pc) bh ]. + +(* opcode a byte o 0x9E + byte : HC08 / HCS08 *) +(* caricamento solo da segmento 0 *) +ndefinition Freescale_fetch_byte_or_word ≝ +λm,t.λs:any_status m t.λpc:word16. + match mem_read t (mem_desc … s) (chk_desc … s) o0 pc with + [ None ⇒ FetchERR ? ILL_FETCH_AD + | Some bh ⇒ match eqc ? bh 〈x9,xE〉 with + [ true ⇒ match mem_read t (mem_desc … s) (chk_desc … s) o0 (succc ? pc) with + [ None ⇒ FetchERR ? ILL_FETCH_AD + | Some bl ⇒ fetch_word_aux m (succc ? (succc ? pc)) 〈bh:bl〉 + ] + | false ⇒ fetch_byte_aux m (succc ? pc) bh + ] + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/Freescale_load_write.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/Freescale_load_write.ma new file mode 100755 index 000000000..d1da76949 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/Freescale_load_write.ma @@ -0,0 +1,589 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/load_write_base.ma". +include "emulator/status/status_getter.ma". + +(* accesso argomenti immediati solo da segmento 0 [mem_read_s … o0] *) +(* accesso indiretto solo da segmento 0 filtrato [aux_load] *) + +ndefinition code_seg ≝ o0. + +(* lettura da [curpc]: IMM1 *) +ndefinition mode_IMM1_load ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (mem_read_s … s code_seg cur_pc) + (λb.Some ? (triple … s b (succc ? cur_pc))). + +(* lettura da [curpc]: IMM1 + estensione a word *) +ndefinition mode_IMM1EXT_load ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (mem_read_s … s code_seg cur_pc) + (λb.Some ? (triple … s (extu_w16 b) (succc ? cur_pc))). + +(* lettura da [curpc]: IMM2 *) +ndefinition mode_IMM2_load ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (mem_read_s … s code_seg cur_pc) + (λbh.opt_map … (mem_read_s … s code_seg (succc ? cur_pc)) + (λbl.Some ? (triple … s 〈bh:bl〉 (succc ? (succc ? cur_pc))))). + +(* lettura da [byte [curpc]]: true=DIR1 loadb, false=DIR1 loadw *) +ndefinition mode_DIR1_load ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (mem_read_s … s code_seg cur_pc) + (λaddr.(aux_load … byteflag) s (extu_w16 addr) cur_pc x1). + +(* lettura da [byte [curpc]]: loadbit *) +ndefinition mode_DIR1n_load ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λsub:oct. + opt_map … (mem_read_s … s code_seg cur_pc) + (λaddr.loadbit_from … s (extu_w16 addr) sub cur_pc x1). + +(* scrittura su [byte [curpc]]: true=DIR1 writeb, false=DIR1 writew *) +ndefinition mode_DIR1_write ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. +λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. + opt_map … (mem_read_s … s code_seg cur_pc) + (λaddr.(aux_write … byteflag) s (extu_w16 addr) auxMode_ok cur_pc x1 writebw). + +(* scrittura su [byte [curpc]]: writebit *) +ndefinition mode_DIR1n_write ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λsub:oct.λwriteb:bool. + opt_map … (mem_read_s … s code_seg cur_pc) + (λaddr.writebit_to … s (extu_w16 addr) sub cur_pc x1 writeb). + +(* lettura da [word [curpc]]: true=DIR2 loadb, false=DIR2 loadw *) +ndefinition mode_DIR2_load ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (mem_read_s … s code_seg cur_pc) + (λaddrh.opt_map … (mem_read_s … s code_seg (succc ? cur_pc)) + (λaddrl.(aux_load … byteflag) s 〈addrh:addrl〉 cur_pc x2)). + +(* scrittura su [word [curpc]]: true=DIR2 writeb, false=DIR2 writew *) +ndefinition mode_DIR2_write ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. +λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. + opt_map … (mem_read_s … s code_seg cur_pc) + (λaddrh.opt_map … (mem_read_s … s code_seg (succc ? cur_pc)) + (λaddrl.(aux_write … byteflag) s 〈addrh:addrl〉 auxMode_ok cur_pc x2 writebw)). + +ndefinition get_IX ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m with + [ HC05 ⇒ opt_map … (get_indX_8_low_reg … s) (λindx.Some ? (extu_w16 indx)) + | HC08 ⇒ opt_map … (get_indX_16_reg … s) (λindx.Some ? indx) + | HCS08 ⇒ opt_map … (get_indX_16_reg … s) (λindx.Some ? indx) + | RS08 ⇒ None ? + | IP2022 ⇒ None ? ]. + +(* lettura da [IX]: true=IX0 loadb, false=IX0 loadw *) +ndefinition mode_IX0_load ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (get_IX … s) + (λaddr.(aux_load … byteflag) s addr cur_pc x0). + +(* scrittura su [IX]: true=IX0 writeb, false=IX0 writew *) +ndefinition mode_IX0_write ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. +λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. + opt_map … (get_IX … s) + (λaddr.(aux_write … byteflag) s addr auxMode_ok cur_pc x0 writebw). + +(* lettura da [IX+byte [pc]]: true=IX1 loadb, false=IX1 loadw *) +ndefinition mode_IX1_load ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (get_IX … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λoffs.(aux_load … byteflag) s (plusc_d_d ? addr (extu_w16 offs)) cur_pc x1)). + +(* lettura da X+[byte curpc] *) +ndefinition mode_IX1ADD_load ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (get_IX … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λb.Some ? (triple … s (plusc_d_d ? addr (extu_w16 b)) (succc ? cur_pc)))). + +(* scrittura su [IX+byte [pc]]: true=IX1 writeb, false=IX1 writew *) +ndefinition mode_IX1_write ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. +λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. + opt_map … (get_IX … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λoffs.(aux_write … byteflag) s (plusc_d_d ? addr (extu_w16 offs)) auxMode_ok cur_pc x1 writebw)). + +(* lettura da [IX+word [pc]]: true=IX2 loadb, false=IX2 loadw *) +ndefinition mode_IX2_load ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (get_IX … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λoffsh.opt_map … (mem_read_s … s code_seg (succc ? cur_pc)) + (λoffsl.(aux_load … byteflag) s (plusc_d_d ? addr 〈offsh:offsl〉) cur_pc x2))). + +(* lettura da X+[word curpc] *) +ndefinition mode_IX2ADD_load ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (get_IX … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λbh.opt_map … (mem_read_s … s code_seg (succc ? cur_pc)) + (λbl.Some ? (triple … s (plusc_d_d ? addr 〈bh:bl〉) (succc ? (succc ? cur_pc)))))). + +(* scrittura su [IX+word [pc]]: true=IX2 writeb, false=IX2 writew *) +ndefinition mode_IX2_write ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. +λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. + opt_map … (get_IX … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λoffsh.opt_map … (mem_read_s … s code_seg (succc ? cur_pc)) + (λoffsl.(aux_write … byteflag) s (plusc_d_d ? addr 〈offsh:offsl〉) auxMode_ok cur_pc x2 writebw))). + +(* lettura da [SP+byte [pc]]: true=SP1 loadb, false=SP1 loadw *) +ndefinition mode_SP1_load ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (get_sp_reg … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λoffs.(aux_load … byteflag) s (plusc_d_d ? addr (extu_w16 offs)) cur_pc x1)). + +(* scrittura su [SP+byte [pc]]: true=SP1 writeb, false=SP1 writew *) +ndefinition mode_SP1_write ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. +λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. + opt_map … (get_sp_reg … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λoffs.(aux_write … byteflag) s (plusc_d_d ? addr (extu_w16 offs)) auxMode_ok cur_pc x1 writebw)). + +(* lettura da [SP+word [pc]]: true=SP2 loadb, false=SP2 loadw *) +ndefinition mode_SP2_load ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. + opt_map … (get_sp_reg … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λoffsh.opt_map … (mem_read_s … s code_seg (succc ? cur_pc)) + (λoffsl.(aux_load … byteflag) s (plusc_d_d ? addr 〈offsh:offsl〉) cur_pc x2))). + +(* scrittura su [SP+word [pc]]: true=SP2 writeb, false=SP2 writew *) +ndefinition mode_SP2_write ≝ +λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. +λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. + opt_map … (get_sp_reg … s) + (λaddr.opt_map … (mem_read_s … s code_seg cur_pc) + (λoffsh.opt_map … (mem_read_s … s code_seg (succc ? cur_pc)) + (λoffsl.(aux_write … byteflag) s (plusc_d_d ? addr 〈offsh:offsl〉) auxMode_ok cur_pc x2 writebw))). + +(* ************************************** *) +(* raccordo di tutte le possibili letture *) +(* ************************************** *) + +(* H:X++ *) +ndefinition aux_inc_indX_16 ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + opt_map … (get_indX_16_reg … s) + (λX_op.opt_map … (set_indX_16_reg … s (succc ? X_op)) + (λs_tmp.Some ? s_tmp)). + +ndefinition Freescale_multi_mode_load_auxb ≝ +λm,t.λs:any_status m t.λcur_pc:word16.λi:Freescale_instr_mode.match i with +(* NO: non ci sono indicazioni *) + [ MODE_INH ⇒ None ? +(* restituisce A *) + | MODE_INHA ⇒ Some ? (triple … s (get_acc_8_low_reg … s) cur_pc) +(* restituisce X *) + | MODE_INHX ⇒ opt_map … (get_indX_8_low_reg … s) + (λindx.Some ? (triple … s indx cur_pc)) +(* restituisce H *) + | MODE_INHH ⇒ opt_map … (get_indX_8_high_reg … s) + (λindx.Some ? (triple … s indx cur_pc)) + +(* NO: solo lettura word *) + | MODE_INHX0ADD ⇒ None ? +(* NO: solo lettura word *) + | MODE_INHX1ADD ⇒ None ? +(* NO: solo lettura word *) + | MODE_INHX2ADD ⇒ None ? + +(* preleva 1 byte immediato *) + | MODE_IMM1 ⇒ mode_IMM1_load … s cur_pc +(* NO: solo lettura word *) + | MODE_IMM1EXT ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM2 ⇒ None ? +(* preleva 1 byte da indirizzo diretto 1 byte *) + | MODE_DIR1 ⇒ mode_DIR1_load true … s cur_pc +(* preleva 1 byte da indirizzo diretto 1 word *) + | MODE_DIR2 ⇒ mode_DIR2_load true … s cur_pc +(* preleva 1 byte da H:X *) + | MODE_IX0 ⇒ mode_IX0_load true … s cur_pc +(* preleva 1 byte da H:X+1 byte offset *) + | MODE_IX1 ⇒ mode_IX1_load true … s cur_pc +(* preleva 1 byte da H:X+1 word offset *) + | MODE_IX2 ⇒ mode_IX2_load true … s cur_pc +(* preleva 1 byte da SP+1 byte offset *) + | MODE_SP1 ⇒ mode_SP1_load true … s cur_pc +(* preleva 1 byte da SP+1 word offset *) + | MODE_SP2 ⇒ mode_SP2_load true … s cur_pc + +(* come DIR1, chiamare scrittura per passo2: scrittura su DIR1 *) + | MODE_DIR1_to_DIR1 ⇒ mode_DIR1_load true … s cur_pc +(* come IMM1, chiamare scrittura per passo2: scrittura su DIR1 *) + | MODE_IMM1_to_DIR1 ⇒ mode_IMM1_load … s cur_pc +(* come IX0, chiamare scrittura per passo2: scrittura su DIR1 e X++ *) + | MODE_IX0p_to_DIR1 ⇒ mode_IX0_load true … s cur_pc +(* come DIR1, chiamare scrittura per passo2: scrittura su IX0 e X++ *) + | MODE_DIR1_to_IX0p ⇒ mode_DIR1_load true … s cur_pc + +(* NO: solo lettura word/scrittura byte *) + | MODE_INHA_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_INHX_and_IMM1 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM1_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_DIR1_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_IX0_and_IMM1 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IX0p_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_IX1_and_IMM1 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IX1p_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_SP1_and_IMM1 ⇒ None ? + +(* NO: solo scrittura byte *) + | MODE_DIRn _ ⇒ None ? +(* NO: solo lettura word *) + | MODE_DIRn_and_IMM1 _ ⇒ None ? +(* preleva 1 byte da 0000 0000 0000 xxxxb *) + | MODE_TNY e ⇒ opt_map … (memory_filter_read … s (extu2_w16 e)) + (λb.Some ? (triple … s b cur_pc)) +(* preleva 1 byte da 0000 0000 000x xxxxb *) + | MODE_SRT t ⇒ opt_map … (memory_filter_read … s (extu_w16 (b8_of_bit t))) + (λb.Some ? (triple … s b cur_pc)) + ]. + +ndefinition Freescale_multi_mode_load_auxw ≝ +λm,t.λs:any_status m t.λcur_pc:word16.λi:Freescale_instr_mode.match i with +(* NO: non ci sono indicazioni *) + [ MODE_INH ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_INHA ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_INHX ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_INHH ⇒ None ? + +(* preleva 1 word immediato *) + | MODE_INHX0ADD ⇒ opt_map … (get_IX … s) + (λw.Some ? (triple … s w cur_pc)) +(* preleva 1 word immediato *) + | MODE_INHX1ADD ⇒ mode_IX1ADD_load … s cur_pc +(* preleva 1 word immediato *) + | MODE_INHX2ADD ⇒ mode_IX2ADD_load … s cur_pc + +(* NO: solo lettura byte *) + | MODE_IMM1 ⇒ None ? +(* preleva 1 word immediato *) + | MODE_IMM1EXT ⇒ mode_IMM1EXT_load … s cur_pc +(* preleva 1 word immediato *) + | MODE_IMM2 ⇒ mode_IMM2_load … s cur_pc +(* preleva 1 word da indirizzo diretto 1 byte *) + | MODE_DIR1 ⇒ mode_DIR1_load false … s cur_pc +(* preleva 1 word da indirizzo diretto 1 word *) + | MODE_DIR2 ⇒ mode_DIR2_load false … s cur_pc +(* preleva 1 word da H:X *) + | MODE_IX0 ⇒ mode_IX0_load false … s cur_pc +(* preleva 1 word da H:X+1 byte offset *) + | MODE_IX1 ⇒ mode_IX1_load false … s cur_pc +(* preleva 1 word da H:X+1 word offset *) + | MODE_IX2 ⇒ mode_IX2_load false … s cur_pc +(* preleva 1 word da SP+1 byte offset *) + | MODE_SP1 ⇒ mode_SP1_load false … s cur_pc +(* preleva 1 word da SP+1 word offset *) + | MODE_SP2 ⇒ mode_SP2_load false … s cur_pc + +(* NO: solo lettura/scrittura byte *) + | MODE_DIR1_to_DIR1 ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_IMM1_to_DIR1 ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_IX0p_to_DIR1 ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_DIR1_to_IX0p ⇒ None ? + +(* preleva 2 byte, possibilita' modificare Io argomento *) + | MODE_INHA_and_IMM1 ⇒ opt_map … (mode_IMM1_load … s cur_pc) + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc' ⇒ + Some ? (triple … s 〈(get_acc_8_low_reg … s):immb〉 cur_pc')]) +(* preleva 2 byte, possibilita' modificare Io argomento *) + | MODE_INHX_and_IMM1 ⇒ opt_map … (get_indX_8_low_reg … s) + (λX_op.opt_map … (mode_IMM1_load … s cur_pc) + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc' ⇒ + Some ? (triple … s 〈X_op:immb〉 cur_pc')])) +(* preleva 2 byte, NO possibilita' modificare Io argomento *) + | MODE_IMM1_and_IMM1 ⇒ opt_map … (mode_IMM1_load … s cur_pc) + (λS_immb1_and_PC.match S_immb1_and_PC with + [ triple _ immb1 cur_pc' ⇒ + opt_map … (mode_IMM1_load … s cur_pc') + (λS_immb2_and_PC.match S_immb2_and_PC with + [ triple _ immb2 cur_pc'' ⇒ + Some ? (triple … s 〈immb1:immb2〉 cur_pc'')])]) +(* preleva 2 byte, possibilita' modificare Io argomento *) + | MODE_DIR1_and_IMM1 ⇒ opt_map … (mode_DIR1_load true … s cur_pc) + (λS_dirb_and_PC.match S_dirb_and_PC with + [ triple _ dirb cur_pc' ⇒ + opt_map … (mode_IMM1_load … s cur_pc') + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc'' ⇒ + Some ? (triple … s 〈dirb:immb〉 cur_pc'')])]) +(* preleva 2 byte, possibilita' modificare Io argomento *) + | MODE_IX0_and_IMM1 ⇒ opt_map … (mode_IX0_load true … s cur_pc) + (λS_ixb_and_PC.match S_ixb_and_PC with + [ triple _ ixb cur_pc' ⇒ + opt_map … (mode_IMM1_load … s cur_pc') + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc'' ⇒ + Some ? (triple … s 〈ixb:immb〉 cur_pc'')])]) +(* preleva 2 byte, H:X++, NO possibilita' modificare Io argomento *) + | MODE_IX0p_and_IMM1 ⇒ opt_map … (mode_IX0_load true … s cur_pc) + (λS_ixb_and_PC.match S_ixb_and_PC with + [ triple _ ixb cur_pc' ⇒ + opt_map … (mode_IMM1_load … s cur_pc') + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc'' ⇒ + (* H:X++ *) + opt_map … (aux_inc_indX_16 … s) + (λs'.Some ? (triple … s' 〈ixb:immb〉 cur_pc''))])]) +(* preleva 2 byte, possibilita' modificare Io argomento *) + | MODE_IX1_and_IMM1 ⇒ opt_map … (mode_IX1_load true … s cur_pc) + (λS_ixb_and_PC.match S_ixb_and_PC with + [ triple _ ixb cur_pc' ⇒ + opt_map … (mode_IMM1_load … s cur_pc') + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc'' ⇒ + Some ? (triple … s 〈ixb:immb〉 cur_pc'')])]) +(* preleva 2 byte, H:X++, NO possibilita' modificare Io argomento *) + | MODE_IX1p_and_IMM1 ⇒ opt_map … (mode_IX1_load true … s cur_pc) + (λS_ixb_and_PC.match S_ixb_and_PC with + [ triple _ ixb cur_pc' ⇒ + opt_map … (mode_IMM1_load … s cur_pc') + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc'' ⇒ + (* H:X++ *) + opt_map … (aux_inc_indX_16 … s) + (λs'.Some ? (triple … s' 〈ixb:immb〉 cur_pc''))])]) +(* preleva 2 byte, possibilita' modificare Io argomento *) + | MODE_SP1_and_IMM1 ⇒ opt_map … (mode_SP1_load true … s cur_pc) + (λS_spb_and_PC.match S_spb_and_PC with + [ triple _ spb cur_pc' ⇒ + opt_map … (mode_IMM1_load … s cur_pc') + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc'' ⇒ + Some ? (triple … s 〈spb:immb〉 cur_pc'')])]) + +(* NO: solo scrittura byte *) + | MODE_DIRn _ ⇒ None ? +(* preleva 2 byte, il primo e' filtrato per azzerare tutti i bit tranne n-simo *) + | MODE_DIRn_and_IMM1 msk ⇒ opt_map … (mode_DIR1n_load … s cur_pc msk) + (λS_dirbn_and_PC.match S_dirbn_and_PC with + [ triple _ dirbn cur_pc' ⇒ + opt_map … (mode_IMM1_load … s cur_pc') + (λS_immb_and_PC.match S_immb_and_PC with + [ triple _ immb cur_pc'' ⇒ + Some ? (triple … s 〈(extu_b8 match dirbn with [ true ⇒ x1 | false ⇒ x0 ]):immb〉 cur_pc'') ])]) +(* NO: solo lettura/scrittura byte *) + | MODE_TNY _ ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_SRT _ ⇒ None ? + ]. + +(* **************************************** *) +(* raccordo di tutte le possibili scritture *) +(* **************************************** *) + +ndefinition Freescale_multi_mode_write_auxb ≝ +λm,t.λs:any_status m t.λcur_pc:word16.λflag:aux_mod_type.λi:Freescale_instr_mode.λwriteb:byte8.match i with +(* NO: non ci sono indicazioni *) + [ MODE_INH ⇒ None ? +(* scrive A *) + | MODE_INHA ⇒ Some ? (pair … (set_acc_8_low_reg … s writeb) cur_pc) +(* scrive X *) + | MODE_INHX ⇒ opt_map … (set_indX_8_low_reg … s writeb) + (λtmps.Some ? (pair … tmps cur_pc)) +(* scrive H *) + | MODE_INHH ⇒ opt_map … (set_indX_8_high_reg … s writeb) + (λtmps.Some ? (pair … tmps cur_pc)) + +(* NO: solo lettura word *) + | MODE_INHX0ADD ⇒ None ? +(* NO: solo lettura word *) + | MODE_INHX1ADD ⇒ None ? +(* NO: solo lettura word *) + | MODE_INHX2ADD ⇒ None ? + +(* NO: solo lettura byte *) + | MODE_IMM1 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM1EXT ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM2 ⇒ None ? +(* scrive 1 byte su indirizzo diretto 1 byte *) + | MODE_DIR1 ⇒ mode_DIR1_write true … s cur_pc writeb +(* scrive 1 byte su indirizzo diretto 1 word *) + | MODE_DIR2 ⇒ mode_DIR2_write true … s cur_pc writeb +(* scrive 1 byte su H:X *) + | MODE_IX0 ⇒ mode_IX0_write true … s cur_pc writeb +(* scrive 1 byte su H:X+1 byte offset *) + | MODE_IX1 ⇒ mode_IX1_write true … s cur_pc writeb +(* scrive 1 byte su H:X+1 word offset *) + | MODE_IX2 ⇒ mode_IX2_write true … s cur_pc writeb +(* scrive 1 byte su SP+1 byte offset *) + | MODE_SP1 ⇒ mode_SP1_write true … s cur_pc writeb +(* scrive 1 byte su SP+1 word offset *) + | MODE_SP2 ⇒ mode_SP2_write true … s cur_pc writeb + +(* passo2: scrittura su DIR1, passo1: lettura da DIR1 *) + | MODE_DIR1_to_DIR1 ⇒ mode_DIR1_write true … s cur_pc writeb +(* passo2: scrittura su DIR1, passo1: lettura da IMM1 *) + | MODE_IMM1_to_DIR1 ⇒ mode_DIR1_write true … s cur_pc writeb +(* passo2: scrittura su DIR1 e X++, passo1: lettura da IX0 *) + | MODE_IX0p_to_DIR1 ⇒ opt_map … (mode_DIR1_write true … s cur_pc writeb) + (λS_and_PC.match S_and_PC with [ pair S_op PC_op ⇒ + (* H:X++ *) + opt_map … (aux_inc_indX_16 … S_op) + (λS_op'.Some ? (pair … S_op' PC_op))]) +(* passo2: scrittura su IX0 e X++, passo1: lettura da DIR1 *) + | MODE_DIR1_to_IX0p ⇒ opt_map … (mode_IX0_write true … s cur_pc writeb) + (λS_and_PC.match S_and_PC with [ pair S_op PC_op ⇒ + (* H:X++ *) + opt_map … (aux_inc_indX_16 … S_op) + (λS_op'.Some ? (pair … S_op' PC_op))]) + +(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = INHA *) + | MODE_INHA_and_IMM1 ⇒ Some ? (pair … (set_acc_8_low_reg … s writeb) cur_pc) +(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = INHX *) + | MODE_INHX_and_IMM1 ⇒ opt_map … (set_indX_8_low_reg … s writeb) + (λtmps.Some ? (pair … tmps cur_pc)) +(* NO: solo lettura word *) + | MODE_IMM1_and_IMM1 ⇒ None ? +(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = DIR1 *) + | MODE_DIR1_and_IMM1 ⇒ mode_DIR1_write true … s cur_pc writeb +(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = IX0 *) + | MODE_IX0_and_IMM1 ⇒ mode_IX0_write true … s cur_pc writeb +(* NO: solo lettura word *) + | MODE_IX0p_and_IMM1 ⇒ None ? +(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = IX1 *) + | MODE_IX1_and_IMM1 ⇒ mode_IX1_write true … s cur_pc writeb +(* NO: solo lettura word *) + | MODE_IX1p_and_IMM1 ⇒ None ? +(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = SP1 *) + | MODE_SP1_and_IMM1 ⇒ mode_SP1_write true … s cur_pc writeb + +(* scrive 1 byte, ma la scrittura avviene solo per n-simo bit = leggi/modifica bit/scrivi *) + | MODE_DIRn msk ⇒ mode_DIR1n_write … s cur_pc msk (getn_array8T msk bool (bits_of_byte8 writeb)) +(* NO: solo lettura word *) + | MODE_DIRn_and_IMM1 _ ⇒ None ? +(* scrive 1 byte su 0000 0000 0000 xxxxb *) + | MODE_TNY e ⇒ opt_map … (memory_filter_write … s (extu2_w16 e) auxMode_ok writeb) + (λtmps.Some ? (pair … tmps cur_pc)) +(* scrive 1 byte su 0000 0000 000x xxxxb *) + | MODE_SRT e ⇒ opt_map … (memory_filter_write … s (extu_w16 (b8_of_bit e)) auxMode_ok writeb) + (λtmps.Some ? (pair … tmps cur_pc)) + ]. + +ndefinition Freescale_multi_mode_write_auxw ≝ +λm,t.λs:any_status m t.λcur_pc:word16.λi:Freescale_instr_mode.λwritew:word16.match i with +(* NO: non ci sono indicazioni *) + [ MODE_INH ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_INHA ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_INHX ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_INHH ⇒ None ? + +(* NO: solo lettura word *) + | MODE_INHX0ADD ⇒ None ? +(* NO: solo lettura word *) + | MODE_INHX1ADD ⇒ None ? +(* NO: solo lettura word *) + | MODE_INHX2ADD ⇒ None ? + +(* NO: solo lettura byte *) + | MODE_IMM1 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM1EXT ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM2 ⇒ None ? +(* scrive 1 word su indirizzo diretto 1 byte *) + | MODE_DIR1 ⇒ mode_DIR1_write false … s cur_pc writew +(* scrive 1 word su indirizzo diretto 1 word *) + | MODE_DIR2 ⇒ mode_DIR2_write false … s cur_pc writew +(* scrive 1 word su H:X *) + | MODE_IX0 ⇒ mode_IX0_write false … s cur_pc writew +(* scrive 1 word su H:X+1 byte offset *) + | MODE_IX1 ⇒ mode_IX1_write false … s cur_pc writew +(* scrive 1 word su H:X+1 word offset *) + | MODE_IX2 ⇒ mode_IX2_write false … s cur_pc writew +(* scrive 1 word su SP+1 byte offset *) + | MODE_SP1 ⇒ mode_SP1_write false … s cur_pc writew +(* scrive 1 word su SP+1 word offset *) + | MODE_SP2 ⇒ mode_SP2_write false … s cur_pc writew + +(* NO: solo lettura/scrittura byte *) + | MODE_DIR1_to_DIR1 ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_IMM1_to_DIR1 ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_IX0p_to_DIR1 ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_DIR1_to_IX0p ⇒ None ? + +(* NO: solo lettura word/scrittura byte *) + | MODE_INHA_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_INHX_and_IMM1 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM1_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_DIR1_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_IX0_and_IMM1 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IX0p_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_IX1_and_IMM1 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IX1p_and_IMM1 ⇒ None ? +(* NO: solo lettura word/scrittura byte *) + | MODE_SP1_and_IMM1 ⇒ None ? + +(* NO: solo scrittura byte *) + | MODE_DIRn _ ⇒ None ? +(* NO: solo lettura word *) + | MODE_DIRn_and_IMM1 _ ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_TNY _ ⇒ None ? +(* NO: solo lettura/scrittura byte *) + | MODE_SRT _ ⇒ None ? + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_fetch.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_fetch.ma new file mode 100755 index 000000000..b5799d760 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_fetch.ma @@ -0,0 +1,54 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/fetch_base.ma". +include "emulator/status/status.ma". + +(* PC word aligned *) +(* PC < 0x8000 → segmento 1 program ram *) +(*else → segmento 2 program flash *) +ndefinition IP2022_pc_flashtest ≝ +λpc:word16.getMSBc ? pc. + +ndefinition IP2022_pc_translation ≝ +λpc:word16.match shlc ? pc with + [ pair msb pc' ⇒ pair … + match msb with [ true ⇒ o2 | false ⇒ o1 ] pc' ]. + +(* opcode a byte o 0x00 + byte : IP2022 *) +(* opcode + operando a dimensione fissa 16bit *) +ndefinition IP2022_fetch_byte_or_word ≝ +λm,t.λs:any_status m t.λpc:word16. + match mem_read t (mem_desc … s) (chk_desc … s) + (fst … (IP2022_pc_translation pc)) + (snd … (IP2022_pc_translation pc)) with + [ None ⇒ FetchERR ? ILL_FETCH_AD + | Some bh ⇒ match eqc ? bh 〈x0,x0〉 with + [ true ⇒ match mem_read t (mem_desc … s) (chk_desc … s) + (fst … (IP2022_pc_translation pc)) + (succc ? (snd … (IP2022_pc_translation pc))) with + [ None ⇒ FetchERR ? ILL_FETCH_AD + | Some bl ⇒ fetch_word_aux m (succc ? pc) 〈bh:bl〉 + ] + | false ⇒ fetch_byte_aux m (succc ? pc) bh + ] + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_load_write.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_load_write.ma new file mode 100755 index 000000000..a9e38a703 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_load_write.ma @@ -0,0 +1,286 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/load_write_base.ma". +include "emulator/status/status_getter.ma". +include "emulator/read_write/IP2022_fetch.ma". + +(* lettura da [OLD PC<<1 + 1] : argomento non caricato dal fetch word-aligned *) +ndefinition mode_IMM1_load ≝ +λt:memory_impl.λs:any_status IP2022 t. + match IP2022_pc_translation (get_pc_reg … s) with + [ pair seg pc ⇒ mem_read_s … s seg (succc ? pc) ]. + +(* SCHEMA: + ADDRX=0x00 [ADDRH|ADDRL] 16Kb PROGRAM RAM + ADDRX=0x01 [ADDRH|ADDRL] 64Kb FLASH + ADDRX=0x80 [ADDRH|ADDRL] 64Kb EXTERNAL RAM + ADDRX=0x81 [ADDRH|ADDRL] 64Kb EXTERNAL RAM *) + +(* lettura da [ADDR] *) +ndefinition mode_ADDR_load ≝ +λt:memory_impl.λs:any_status IP2022 t. + opt_map … (get_addr_reg … s) + (λaddr.match eqc ? (w24x addr) 〈x0,x0〉 with + (* lettura della RAM, sempre non blocking *) + [ true ⇒ opt_map … (mem_read_s … s o1 (clrLSBc ? 〈(w24h addr):(w24l addr)〉)) + (λbh.opt_map … (mem_read_s … s o1 (setLSBc ? 〈(w24h addr):(w24l addr)〉)) + (λbl.Some ? 〈bh:bl〉)) + (* lettura della FLASH da codice in RAM : operazione non bloccante non implementata! *) + (* lettura da alri ADDRX, errore *) + | false ⇒ match (gtc ? (w24x addr) 〈x0,x1〉)⊕(⊖(IP2022_pc_flashtest (get_pc_reg … s))) with + [ true ⇒ None ? + | false ⇒ opt_map … (mem_read_s … s o2 (clrLSBc ? 〈(w24h addr):(w24l addr)〉)) + (λbh.opt_map … (mem_read_s … s o2 (setLSBc ? 〈(w24h addr):(w24l addr)〉)) + (λbl.Some ? 〈bh:bl〉)) + ] + ]). + +(* scrittura su [ADDR] *) +ndefinition mode_ADDR_write ≝ +λt:memory_impl.λs:any_status IP2022 t.λval:word16. + opt_map ?? (get_addr_reg … s) + (λaddr.opt_map ?? (match eqc ? (w24x addr) 〈x0,x0〉 with + [ true ⇒ Some ? o1 + | false ⇒ match eqc ? (w24x addr) 〈x0,x1〉 with + [ true ⇒ Some ? o2 + | false ⇒ None ? ]]) + (λseg.opt_map ?? (mem_write_s ?? s seg (clrLSBc ? 〈(w24h addr):(w24l addr)〉) (cnH ? val)) + (λs'.mem_write_s ?? s' seg (setLSBc ? 〈(w24h addr):(w24l addr)〉) (cnL ? val)))). + +(* IMM1 > 0 : lettura/scrittura da [IMM1] *) +(* else : lettura/scrittura da [IP] : IP ≥ 0x20 *) +ndefinition mode_DIR1IP_aux ≝ +λt:memory_impl.λs:any_status IP2022 t.λT.λf:word16 → option T. + opt_map … (mode_IMM1_load t s) + (λaddr.match eqc ? addr 〈x0,x0〉 with + (* xxxxxxx0 00000000 → [IP] *) + [ true ⇒ opt_map … (get_ip_reg … s) + (λip.match gec ? ip 〈〈x0,x0〉:〈x2,x0〉〉 with + (* IP ≥ 0x20 *) + [ true ⇒ f ip + | false ⇒ None ? ]) + (* xxxxxxx0 nnnnnnnn → [IMM1] *) + | false ⇒ f (extu_w16 addr) + ]). + +(* IMM1 < 0x80 : lettura/scrittura da [DP+IMM1] : DP+IMM1 ≥ 0x20 *) +(* else : lettura/scrittura da [SP+IMM1] : SP+IMM1 ≥ 0x20 *) +ndefinition mode_DPSP_aux ≝ +λt:memory_impl.λs:any_status IP2022 t.λT.λf:word16 → option T. + opt_map … (mode_IMM1_load t s) + (λaddr.opt_map … (match getMSBc ? addr with + (* xxxxxxx1 1nnnnnnn → [SP+IMM1] *) + [ true ⇒ get_sp_reg … s + (* xxxxxxx1 0nnnnnnn → [DP+IMM1] *) + | false ⇒ get_dp_reg … s ]) + (λreg.match gec ? (plusc_d_d ? reg (extu_w16 (clrMSBc ? addr))) 〈〈x0,x0〉:〈x2,x0〉〉 with + (* reg+IMM1 ≥ 0x20 *) + [ true ⇒ f (plusc_d_d ? reg (extu_w16 (clrMSBc ? addr))) + | false ⇒ None ? ])). + +(* FR0 *) +ndefinition mode_FR0_load ≝ +λt:memory_impl.λs:any_status IP2022 t. + mode_DIR1IP_aux t s byte8 (memory_filter_read … s). + +ndefinition mode_FR0n_load ≝ +λt:memory_impl.λs:any_status IP2022 t.λsub:oct. + mode_DIR1IP_aux t s bool (λaddr.memory_filter_read_bit … s addr sub). + +ndefinition mode_FR0_write ≝ +λt:memory_impl.λs:any_status IP2022 t.λflag:aux_mod_type.λval:byte8. + mode_DIR1IP_aux t s (any_status IP2022 t) (λaddr.memory_filter_write … s addr flag val). + +ndefinition mode_FR0n_write ≝ +λt:memory_impl.λs:any_status IP2022 t.λsub:oct.λval:bool. + mode_DIR1IP_aux t s (any_status IP2022 t) (λaddr.memory_filter_write_bit … s addr sub val). + +(* FR1 *) +ndefinition mode_FR1_load ≝ +λt:memory_impl.λs:any_status IP2022 t. + mode_DPSP_aux t s byte8 (memory_filter_read … s). + +ndefinition mode_FR1n_load ≝ +λt:memory_impl.λs:any_status IP2022 t.λsub:oct. + mode_DPSP_aux t s bool (λaddr.memory_filter_read_bit … s addr sub). + +ndefinition mode_FR1_write ≝ +λt:memory_impl.λs:any_status IP2022 t.λflag:aux_mod_type.λval:byte8. + mode_DPSP_aux t s (any_status IP2022 t) (λaddr.memory_filter_write … s addr flag val). + +ndefinition mode_FR1n_write ≝ +λt:memory_impl.λs:any_status IP2022 t.λsub:oct.λval:bool. + mode_DPSP_aux t s (any_status IP2022 t) (λaddr.memory_filter_write_bit … s addr sub val). + +(* ************************************** *) +(* raccordo di tutte le possibili letture *) +(* ************************************** *) + +(* addr+=2 *) +ndefinition aux_inc_addr2 ≝ +λt:memory_impl.λs:any_status IP2022 t. + set_addr_reg_sIP2022 t s (succ_w24 (succ_w24 (get_addr_reg_IP2022 (alu … s)))). + +ndefinition IP2022_multi_mode_load_auxb ≝ +λt.λs:any_status IP2022 t.λcur_pc:word16.λi:IP2022_instr_mode.match i with +(* NO: non ci sono indicazioni *) + [ MODE_INH ⇒ None ? +(* NO: solo word *) + | MODE_INHADDR ⇒ None ? +(* NO: solo word *) + | MODE_INHADDRpp ⇒ None ? + +(* IMM3 *) + | MODE_IMM3 o ⇒ Some ? (triple … s (extu_b8 (ex_of_oct o)) cur_pc) +(* IMM8 *) + | MODE_IMM8 ⇒ opt_map … (mode_IMM1_load t s) + (λb.Some ? (triple … s b cur_pc)) +(* NO: solo lettura word *) + | MODE_IMM13 _ ⇒ None ? + +(* NO: solo word *) + | MODE_FR0_and_W ⇒ None ? +(* NO: solo word *) + | MODE_FR1_and_W ⇒ None ? +(* NO: solo word *) + | MODE_W_and_FR0 ⇒ None ? +(* NO: solo word *) + | MODE_W_and_FR1 ⇒ None ? + +(* [FRn] *) + | MODE_FR0n o ⇒ opt_map … (mode_FR0n_load t s o) + (λb.Some ? (triple … s (extu_b8 (match b with [ true ⇒ x1 | false ⇒ x0 ])) cur_pc)) +(* [FRn] *) + | MODE_FR1n o ⇒ opt_map … (mode_FR1n_load t s o) + (λb.Some ? (triple … s (extu_b8 (match b with [ true ⇒ x1 | false ⇒ x0 ])) cur_pc)) + ]. + +ndefinition IP2022_multi_mode_load_auxw ≝ +λt.λs:any_status IP2022 t.λcur_pc:word16.λi:IP2022_instr_mode.match i with +(* NO: non ci sono indicazioni *) + [ MODE_INH ⇒ None ? +(* [ADDR] *) + | MODE_INHADDR ⇒ opt_map … (mode_ADDR_load t s) + (λw.Some ? (triple … s w cur_pc)) +(* [ADDR], ADDR+=2 *) + | MODE_INHADDRpp ⇒ opt_map … (mode_ADDR_load t s) + (λw.Some ? (triple … (aux_inc_addr2 t s) w cur_pc)) + +(* NO: solo lettura byte *) + | MODE_IMM3 _ ⇒ None ? +(* NO: solo lettura byte *) + | MODE_IMM8 ⇒ None ? +(* IMM13 *) + | MODE_IMM13 bt ⇒ opt_map … (mode_IMM1_load t s) + (λb.Some ? (triple … s 〈(b8_of_bit bt):b〉 cur_pc)) + +(* FR, W → FR *) + | MODE_FR0_and_W ⇒ opt_map … (mode_FR0_load t s) + (λfr.Some ? (triple … s 〈fr:(get_acc_8_low_reg … s)〉 cur_pc)) +(* FR, W → FR *) + | MODE_FR1_and_W ⇒ opt_map … (mode_FR1_load t s) + (λfr.Some ? (triple … s 〈fr:(get_acc_8_low_reg … s)〉 cur_pc)) +(* W, FR → W *) + | MODE_W_and_FR0 ⇒ opt_map … (mode_FR0_load t s) + (λfr.Some ? (triple … s 〈(get_acc_8_low_reg … s):fr〉 cur_pc)) +(* W, FR → W *) + | MODE_W_and_FR1 ⇒ opt_map … (mode_FR1_load t s) + (λfr.Some ? (triple … s 〈(get_acc_8_low_reg … s):fr〉 cur_pc)) + +(* NO: solo byte *) + | MODE_FR0n _ ⇒ None ? +(* NO: solo byte *) + | MODE_FR1n _ ⇒ None ? + ]. + +(* **************************************** *) +(* raccordo di tutte le possibili scritture *) +(* **************************************** *) + +ndefinition IP2022_multi_mode_write_auxb ≝ +λt.λs:any_status IP2022 t.λcur_pc:word16.λflag:aux_mod_type.λi:IP2022_instr_mode.λwriteb:byte8.match i with +(* NO: non ci sono indicazioni *) + [ MODE_INH ⇒ None ? +(* NO: solo word *) + | MODE_INHADDR ⇒ None ? +(* NO: solo word *) + | MODE_INHADDRpp ⇒ None ? + +(* NO: solo lettura byte *) + | MODE_IMM3 _ ⇒ None ? +(* NO: solo lettura byte *) + | MODE_IMM8 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM13 _ ⇒ None ? + +(* FR, W → FR *) + | MODE_FR0_and_W ⇒ opt_map … (mode_FR0_write t s flag writeb) + (λs'.Some ? (pair … s' cur_pc)) +(* FR, W → FR *) + | MODE_FR1_and_W ⇒ opt_map … (mode_FR1_write t s flag writeb) + (λs'.Some ? (pair … s' cur_pc)) +(* W, FR → W *) + | MODE_W_and_FR0 ⇒ Some ? (pair … (set_acc_8_low_reg … s writeb) cur_pc) +(* W, FR → W *) + | MODE_W_and_FR1 ⇒ Some ? (pair … (set_acc_8_low_reg … s writeb) cur_pc) + +(* [FRn] *) + | MODE_FR0n o ⇒ opt_map … (mode_FR0n_write t s o (getn_array8T o ? (bits_of_byte8 writeb))) + (λs'.Some ? (pair … s' cur_pc)) +(* [FRn] *) + | MODE_FR1n o ⇒ opt_map … (mode_FR1n_write t s o (getn_array8T o ? (bits_of_byte8 writeb))) + (λs'.Some ? (pair … s' cur_pc)) + ]. + +ndefinition IP2022_multi_mode_write_auxw ≝ +λt.λs:any_status IP2022 t.λcur_pc:word16.λi:IP2022_instr_mode.λwritew:word16.match i with +(* NO: non ci sono indicazioni *) + [ MODE_INH ⇒ None ? +(* [ADDR] *) + | MODE_INHADDR ⇒ opt_map … (mode_ADDR_write t s writew) + (λs'.Some ? (pair … s' cur_pc)) +(* [ADDR], ADDR+=2 *) + | MODE_INHADDRpp ⇒ opt_map … (mode_ADDR_write t s writew) + (λs'.Some ? (pair … (aux_inc_addr2 t s') cur_pc)) + +(* NO: solo lettura byte *) + | MODE_IMM3 _ ⇒ None ? +(* NO: solo lettura byte *) + | MODE_IMM8 ⇒ None ? +(* NO: solo lettura word *) + | MODE_IMM13 _ ⇒ None ? + +(* NO: solo byte *) + | MODE_FR0_and_W ⇒ None ? +(* NO: solo byte *) + | MODE_FR1_and_W ⇒ None ? +(* NO: solo byte *) + | MODE_W_and_FR0 ⇒ None ? +(* NO: solo byte *) + | MODE_W_and_FR1 ⇒ None ? + +(* NO: solo byte *) + | MODE_FR0n _ ⇒ None ? +(* NO: solo byte *) + | MODE_FR1n _ ⇒ None ? + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_read_write.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_read_write.ma new file mode 100755 index 000000000..297142866 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/IP2022_read_write.ma @@ -0,0 +1,287 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/read_write_base.ma". +include "emulator/status/status_setter.ma". + +ndefinition IP2022_ADDRSEL_loc ≝ 〈〈x0,x0〉:〈x0,x2〉〉. +ndefinition IP2022_ADDRX_loc ≝ 〈〈x0,x0〉:〈x0,x3〉〉. +ndefinition IP2022_IPH_loc ≝ 〈〈x0,x0〉:〈x0,x4〉〉. +ndefinition IP2022_IPL_loc ≝ 〈〈x0,x0〉:〈x0,x5〉〉. +ndefinition IP2022_SPH_loc ≝ 〈〈x0,x0〉:〈x0,x6〉〉. +ndefinition IP2022_SPL_loc ≝ 〈〈x0,x0〉:〈x0,x7〉〉. +ndefinition IP2022_PCH_loc ≝ 〈〈x0,x0〉:〈x0,x8〉〉. +ndefinition IP2022_PCL_loc ≝ 〈〈x0,x0〉:〈x0,x9〉〉. +ndefinition IP2022_W_loc ≝ 〈〈x0,x0〉:〈x0,xA〉〉. +ndefinition IP2022_STATUS_loc ≝ 〈〈x0,x0〉:〈x0,xB〉〉. +ndefinition IP2022_DPH_loc ≝ 〈〈x0,x0〉:〈x0,xC〉〉. +ndefinition IP2022_DPL_loc ≝ 〈〈x0,x0〉:〈x0,xD〉〉. +ndefinition IP2022_SPEED_loc ≝ 〈〈x0,x0〉:〈x0,xE〉〉. +ndefinition IP2022_MULH_loc ≝ 〈〈x0,x0〉:〈x0,xF〉〉. +ndefinition IP2022_ADDRH_loc ≝ 〈〈x0,x0〉:〈x1,x0〉〉. +ndefinition IP2022_ADDRL_loc ≝ 〈〈x0,x0〉:〈x1,x1〉〉. +ndefinition IP2022_DATAH_loc ≝ 〈〈x0,x0〉:〈x1,x2〉〉. +ndefinition IP2022_DATAL_loc ≝ 〈〈x0,x0〉:〈x1,x3〉〉. +ndefinition IP2022_CALLH_loc ≝ 〈〈x0,x0〉:〈x1,x4〉〉. +ndefinition IP2022_CALLL_loc ≝ 〈〈x0,x0〉:〈x1,x5〉〉. + +(* **** *) +(* READ *) +(* **** *) + +(* NB: non ci sono strane indirezioni, solo registri memory mapped da intercettare *) +ndefinition IP2022_memory_filter_read_aux ≝ +λt:memory_impl.λs:any_status IP2022 t.λaddr:word16. +λT:Type.λfREG:byte8 → option T.λfMEM:word16 → option T. +(* intercettare le locazioni memory mapped *) + match eqc ? addr IP2022_ADDRSEL_loc with + [ true ⇒ fREG (addrsel_reg_IP2022 (alu … s)) + | false ⇒ + match eqc ? addr IP2022_ADDRX_loc with + [ true ⇒ fREG (w24x (get_addrarray (addrsel_reg_IP2022 (alu … s)) + (addr_array_IP2022 (alu … s)))) + | false ⇒ + match eqc ? addr IP2022_IPH_loc with + [ true ⇒ fREG (cnH ? (ip_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_IPL_loc with + [ true ⇒ fREG (cnL ? (ip_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_SPH_loc with + [ true ⇒ fREG (cnH ? (sp_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_SPL_loc with + [ true ⇒ fREG (cnL ? (sp_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_PCH_loc with + [ true ⇒ fREG (cnH ? (pc_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_PCL_loc with + [ true ⇒ fREG (cnL ? (pc_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_W_loc with + [ true ⇒ fREG (acc_low_reg_IP2022 (alu … s)) + | false ⇒ + (* PAGE[7:5] Z[2] H[1] C [0] *) + match eqc ? addr IP2022_STATUS_loc with + [ true ⇒ fREG 〈(rolc ? (ex_of_oct (page_reg_IP2022 (alu … s)))), + (orc ? (orc ? (match z_flag_IP2022 (alu … s) with + [ true ⇒ x4 | false ⇒ x0 ]) + (match h_flag_IP2022 (alu … s) with + [ true ⇒ x2 | false ⇒ x0 ])) + (match c_flag_IP2022 (alu … s) with + [ true ⇒ x1 | false ⇒ x0 ]))〉 + | false ⇒ + match eqc ? addr IP2022_DPH_loc with + [ true ⇒ fREG (cnH ? (dp_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_DPL_loc with + [ true ⇒ fREG (cnL ? (dp_reg_IP2022 (alu … s))) + | false ⇒ + (* SPEED[3:0] *) + match eqc ? addr IP2022_SPEED_loc with + [ true ⇒ fREG (extu_b8 (speed_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_MULH_loc with + [ true ⇒ fREG (mulh_reg_IP2022 (alu … s)) + | false ⇒ + match eqc ? addr IP2022_ADDRH_loc with + [ true ⇒ fREG (w24h (get_addrarray (addrsel_reg_IP2022 (alu … s)) + (addr_array_IP2022 (alu … s)))) + | false ⇒ + match eqc ? addr IP2022_ADDRL_loc with + [ true ⇒ fREG (w24l (get_addrarray (addrsel_reg_IP2022 (alu … s)) + (addr_array_IP2022 (alu … s)))) + | false ⇒ + match eqc ? addr IP2022_DATAH_loc with + [ true ⇒ fREG (cnH ? (data_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_DATAL_loc with + [ true ⇒ fREG (cnL ? (data_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_CALLH_loc with + [ true ⇒ fREG (cnH ? (getn_array16T x0 ? (call_stack_IP2022 (alu … s)))) + | false ⇒ + match eqc ? addr IP2022_CALLL_loc with + [ true ⇒ fREG (cnL ? (getn_array16T x0 ? (call_stack_IP2022 (alu … s)))) +(* accesso normale *) + | false ⇒ fMEM addr + ]]]]]]]]]]]]]]]]]]]]. + +(* lettura IP2022 di un byte *) +ndefinition IP2022_memory_filter_read ≝ +λt:memory_impl.λs:any_status IP2022 t.λaddr:word16. + IP2022_memory_filter_read_aux t s addr byte8 + (λb.Some byte8 b) + (mem_read t (mem_desc … s) (chk_desc … s) o0). + +(* lettura IP2022 di un bit *) +ndefinition IP2022_memory_filter_read_bit ≝ +λt:memory_impl.λs:any_status IP2022 t.λaddr:word16.λsub:oct. + IP2022_memory_filter_read_aux t s addr bool + (λb.Some bool (getn_array8T sub bool (bits_of_byte8 b))) + (λa.mem_read_bit t (mem_desc … s) (chk_desc … s) o0 a sub). + +(* ***** *) +(* WRITE *) +(* ***** *) + +ndefinition high_write_aux_w16 ≝ +λf:byte8 → byte8.λw:word16.〈(f (cnH ? w)):(cnL ? w)〉. + +ndefinition lowc_write_aux_w16 ≝ +λf:byte8 → byte8.λw:word16.λflag:aux_mod_type. + 〈((match flag with + [ auxMode_ok ⇒ λx.x + | auxMode_inc ⇒ succc ? + | auxMode_dec ⇒ predc ? ]) (cnH ? w)): + (f (cnL ? w))〉. + +ndefinition lownc_write_aux_w16 ≝ +λf:byte8 → byte8.λw:word16.〈(cnH ? w):(f (cnL ? w))〉. + +ndefinition ext_write_aux_w24 ≝ +λf:byte8 → byte8.λw:word24.〈(f (w24x w));(w24h w);(w24l w)〉. + +ndefinition high_write_aux_w24 ≝ +λf:byte8 → byte8.λw:word24.〈(w24x w);(f (w24h w));(w24l w)〉. + +ndefinition low_write_aux_w24 ≝ +λf:byte8 → byte8.λw:word24.λflag:aux_mod_type. + match (match flag with + [ auxMode_ok ⇒ λx.x + | auxMode_inc ⇒ succc ? + | auxMode_dec ⇒ predc ? ]) 〈(w24x w):(w24h w)〉 with + [ mk_comp_num wx' wh' ⇒ 〈wx';wh';(w24l w)〉 ]. + +(* flag di carry: riportare il carry al byte logicamente superiore *) +(* modifica di pc: non inserita nella stato ma postposta *) +ndefinition IP2022_memory_filter_write_aux ≝ +λt:memory_impl.λs:any_status IP2022 t.λaddr:word16.λflag:aux_mod_type. +λfREG:byte8 → byte8.λfMEM:word16 → option (aux_mem_type t). +(* intercettare le locazioni memory mapped *) + match eqc ? addr IP2022_ADDRSEL_loc with + [ true ⇒ set_addrsel_reg … s (fREG (addrsel_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_ADDRX_loc with + [ true ⇒ set_addr_reg … s (ext_write_aux_w24 fREG (get_addrarray (addrsel_reg_IP2022 (alu … s)) + (addr_array_IP2022 (alu … s)))) + | false ⇒ + match eqc ? addr IP2022_IPH_loc with + [ true ⇒ set_ip_reg … s (high_write_aux_w16 fREG (ip_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_IPL_loc with + [ true ⇒ set_ip_reg … s (lowc_write_aux_w16 fREG (ip_reg_IP2022 (alu … s)) flag) + | false ⇒ + match eqc ? addr IP2022_SPH_loc with + [ true ⇒ set_sp_reg … s (high_write_aux_w16 fREG (sp_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_SPL_loc with + [ true ⇒ set_sp_reg … s (lowc_write_aux_w16 fREG (sp_reg_IP2022 (alu … s)) flag) + | false ⇒ + match eqc ? addr IP2022_PCL_loc with + [ true ⇒ Some ? (set_pc_reg … s (lowc_write_aux_w16 fREG (pc_reg_IP2022 (alu … s)) flag)) + | false ⇒ + match eqc ? addr IP2022_W_loc with + [ true ⇒ Some ? (set_acc_8_low_reg … s (fREG (acc_low_reg_IP2022 (alu … s)))) + | false ⇒ + match eqc ? addr IP2022_DPH_loc with + [ true ⇒ set_dp_reg … s (high_write_aux_w16 fREG (dp_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_DPL_loc with + [ true ⇒ set_dp_reg … s (lowc_write_aux_w16 fREG (dp_reg_IP2022 (alu … s)) flag) + | false ⇒ + match eqc ? addr IP2022_MULH_loc with + [ true ⇒ set_mulh_reg … s (fREG (mulh_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_ADDRH_loc with + [ true ⇒ set_addr_reg … s (high_write_aux_w24 fREG (get_addrarray (addrsel_reg_IP2022 (alu … s)) + (addr_array_IP2022 (alu … s)))) + | false ⇒ + match eqc ? addr IP2022_ADDRL_loc with + [ true ⇒ set_addr_reg … s (low_write_aux_w24 fREG (get_addrarray (addrsel_reg_IP2022 (alu … s)) + (addr_array_IP2022 (alu … s))) flag) + | false ⇒ + match eqc ? addr IP2022_DATAH_loc with + [ true ⇒ set_data_reg … s (high_write_aux_w16 fREG (data_reg_IP2022 (alu … s))) + | false ⇒ +(* nessun riporto automatico *) + match eqc ? addr IP2022_DATAL_loc with + [ true ⇒ set_data_reg … s (lownc_write_aux_w16 fREG (data_reg_IP2022 (alu … s))) + | false ⇒ + match eqc ? addr IP2022_CALLH_loc with + [ true ⇒ set_call_reg … s (high_write_aux_w16 fREG (getn_array16T x0 ? (call_stack_IP2022 (alu … s)))) + | false ⇒ +(* nessun riporto automatico *) + match eqc ? addr IP2022_CALLL_loc with + [ true ⇒ set_call_reg … s (lownc_write_aux_w16 fREG (getn_array16T x0 ? (call_stack_IP2022 (alu … s)))) +(* accesso normale *) + | false ⇒ opt_map … (fMEM addr) + (λmem'.Some ? (set_mem_desc … s mem')) + ]]]]]]]]]]]]]]]]]. + +(* scrittura IP2022 di un byte *) +ndefinition IP2022_memory_filter_write ≝ +λt:memory_impl.λs:any_status IP2022 t. +λaddr:word16.λflag:aux_mod_type.λval:byte8. + (* PAGE[7:5] Z[2] H[1] C [0] *) + match eqc ? addr IP2022_STATUS_loc with + [ true ⇒ Some ? + (set_alu … s + (set_page_reg_IP2022 + (set_z_flag_IP2022 + (set_h_flag_IP2022 + (set_c_flag_IP2022 (alu … s) + (getn_array8T o7 ? (bits_of_byte8 val))) + (getn_array8T o6 ? (bits_of_byte8 val))) + (getn_array8T o5 ? (bits_of_byte8 val))) + (oct_of_exH (cnH ? val)))) + (* accesso a registro_non_spezzato/normale *) + | false ⇒ IP2022_memory_filter_write_aux t s addr flag + (λb.val) + (λa.mem_update t (mem_desc … s) (chk_desc … s) o0 a val) ]. + +(* scrittura IP2022 di un bit *) +ndefinition IP2022_memory_filter_write_bit ≝ +λt:memory_impl.λs:any_status IP2022 t. +λaddr:word16.λsub:oct.λval:bool. + (* PAGE[7:5] Z[2] H[1] C [0] *) + match eqc ? addr IP2022_STATUS_loc with + [ true ⇒ Some ? (set_alu … s + (match sub with + [ o0 ⇒ set_page_reg_IP2022 (alu … s) + ((match val with [ true ⇒ or_oct o4 | false ⇒ and_oct o3 ]) + (page_reg_IP2022 (alu … s))) + | o1 ⇒ set_page_reg_IP2022 (alu … s) + ((match val with [ true ⇒ or_oct o2 | false ⇒ and_oct o5 ]) + (page_reg_IP2022 (alu … s))) + | o2 ⇒ set_page_reg_IP2022 (alu … s) + ((match val with [ true ⇒ or_oct o1 | false ⇒ and_oct o6 ]) + (page_reg_IP2022 (alu … s))) + | o5 ⇒ set_z_flag_IP2022 (alu … s) val + | o6 ⇒ set_h_flag_IP2022 (alu … s) val + | o7 ⇒ set_c_flag_IP2022 (alu … s) val + | _ ⇒ alu … s ])) + (* accesso a registro_non_spezzato/normale *) + | false ⇒ IP2022_memory_filter_write_aux t s addr auxMode_ok + (λb.byte8_of_bits (setn_array8T sub bool (bits_of_byte8 b) val)) + (λa.mem_update_bit t (mem_desc … s) (chk_desc … s) o0 a sub val) ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/RS08_read_write.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/RS08_read_write.ma new file mode 100755 index 000000000..cb1e2a12a --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/RS08_read_write.ma @@ -0,0 +1,138 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status_setter.ma". + +(* **** *) +(* READ *) +(* **** *) + +(* NB: fare molta attenzione alle note sulle combinazioni possibili perche' + il comportamento della memoria nell'RS08 e' strano e ci sono + precise condizioni che impediscono una semantica circolare dell'accesso + (divergenza=assenza di definizione) *) +ndefinition RS08_memory_filter_read_aux ≝ +λt:memory_impl.λs:any_status RS08 t.λaddr:word16. +λT:Type.λfREG:byte8 → option T.λfMEM:word16 → option T. +(* possibili accessi al registro X + 1) addr=000F: diretto + 2) addr=000E (X =0F): indiretto + 3) addr=00CF (PS=00): paging + [NB] altre combinazioni non funzionano perche' la MCU non e' un oggetto reattivo: + non si possono combinare due effetti contemporaneamente! + per esempio accesso addr=00CE (PS=00,X=0F) non puo' produrre 2 indirezioni *) + match (eqc ? addr 〈〈x0,x0〉:〈x0,xF〉〉) ⊕ + (eqc ? addr 〈〈x0,x0〉:〈x0,xE〉〉 ⊗ eqc ? (x_map_RS08 (alu … s)) 〈x0,xF〉) ⊕ + (eqc ? addr 〈〈x0,x0〉:〈xC,xF〉〉 ⊗ eqc ? (ps_map_RS08 (alu … s)) 〈x0,x0〉) with + [ true ⇒ fREG (x_map_RS08 (alu … s)) + | false ⇒ +(* possibili accessi al registro PS + 1) addr=001F: diretto + 2) addr=000E (X =1F): indiretto + 3) addr=00DF (PS=00): paging *) + match (eqc ? addr 〈〈x0,x0〉:〈x1,xF〉〉) ⊕ + (eqc ? addr 〈〈x0,x0〉:〈x0,xE〉〉 ⊗ eqc ? (x_map_RS08 (alu … s)) 〈x1,xF〉) ⊕ + (eqc ? addr 〈〈x0,x0〉:〈xD,xF〉〉 ⊗ eqc ? (ps_map_RS08 (alu … s)) 〈x0,x0〉) with + [ true ⇒ fREG (ps_map_RS08 (alu … s)) + | false ⇒ +(* accesso a D[X]: se accede a [00C0-00FF] e' la RAM fisica, non il paging + altrimenti sarebbero 2 indirezioni *) + match eqc ? addr 〈〈x0,x0〉:〈x0,xE〉〉 with + [ true ⇒ fMEM (extu_w16 (x_map_RS08 (alu … s))) + | false ⇒ +(* accesso al paging: [00pp pppp ppxx xxxx] con p=PS x=addr *) + match inrangec ? addr 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,x0〉:〈xF,xF〉〉 with + [ true ⇒ fMEM (orc ? (rorc ? (rorc ? 〈(ps_map_RS08 (alu … s)):〈x0,x0〉〉)) + (andc ? addr 〈〈x0,x0〉:〈x3,xF〉〉)) +(* accesso normale *) + | false ⇒ fMEM addr ]]]]. + +(* lettura RS08 di un byte *) +ndefinition RS08_memory_filter_read ≝ +λt:memory_impl.λs:any_status RS08 t.λaddr:word16. + RS08_memory_filter_read_aux t s addr byte8 + (λb.Some byte8 b) + (mem_read t (mem_desc … s) (chk_desc … s) o0). + +(* lettura RS08 di un bit *) +ndefinition RS08_memory_filter_read_bit ≝ +λt:memory_impl.λs:any_status RS08 t.λaddr:word16.λsub:oct. + RS08_memory_filter_read_aux t s addr bool + (λb.Some bool (getn_array8T sub bool (bits_of_byte8 b))) + (λa.mem_read_bit t (mem_desc … s) (chk_desc … s) o0 a sub). + +(* ***** *) +(* WRITE *) +(* ***** *) + +ndefinition RS08_memory_filter_write_aux ≝ +λt:memory_impl.λs:any_status RS08 t.λaddr:word16. +λfREG:byte8 → byte8.λfMEM:word16 → option (aux_mem_type t). +(* possibili accessi al registro X + 1) addr=000F: diretto + 2) addr=000E (X =0F): indiretto + 3) addr=00CF (PS=00): paging + [NB] altre combinazioni non funzionano perche' la MCU non e' un oggetto reattivo: + non si possono combinare due effetti contemporaneamente! + per esempio accesso addr=00CE (PS=00,X=0F) non puo' produrre 2 indirezioni *) + match (eqc ? addr 〈〈x0,x0〉:〈x0,xF〉〉) ⊕ + (eqc ? addr 〈〈x0,x0〉:〈x0,xE〉〉 ⊗ eqc ? (x_map_RS08 (alu … s)) 〈x0,xF〉) ⊕ + (eqc ? addr 〈〈x0,x0〉:〈xC,xF〉〉 ⊗ eqc ? (ps_map_RS08 (alu … s)) 〈x0,x0〉) with + [ true ⇒ set_x_map … s (fREG (x_map_RS08 (alu … s))) + | false ⇒ +(* possibili accessi al registro PS + 1) addr=001F: diretto + 2) addr=000E (X =1F): indiretto + 3) addr=00DF (PS=00): paging *) + match (eqc ? addr 〈〈x0,x0〉:〈x1,xF〉〉) ⊕ + (eqc ? addr 〈〈x0,x0〉:〈x0,xE〉〉 ⊗ eqc ? (x_map_RS08 (alu … s)) 〈x1,xF〉) ⊕ + (eqc ? addr 〈〈x0,x0〉:〈xD,xF〉〉 ⊗ eqc ? (ps_map_RS08 (alu … s)) 〈x0,x0〉) with + [ true ⇒ set_ps_map … s (fREG (x_map_RS08 (alu … s))) + | false ⇒ +(* accesso a D[X]: se accede a [00C0-00FF] e' la RAM fisica, non il paging + altrimenti sarebbero 2 indirezioni *) + match eqc ? addr 〈〈x0,x0〉:〈x0,xE〉〉 with + [ true ⇒ opt_map … (fMEM (extu_w16 (x_map_RS08 (alu … s)))) + (λmem'.Some ? (set_mem_desc … s mem')) + | false ⇒ +(* accesso al paging: [00pp pppp ppxx xxxx] con p=PS x=addr *) + match inrangec ? addr 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,x0〉:〈xF,xF〉〉 with + [ true ⇒ opt_map … (fMEM (orc ? (rorc ? (rorc ? 〈(ps_map_RS08 (alu … s)):〈x0,x0〉〉)) + (andc ? addr 〈〈x0,x0〉:〈x3,xF〉〉))) + (λmem'.Some ? (set_mem_desc … s mem')) +(* accesso normale *) + | false ⇒ opt_map … (fMEM addr) + (λmem'.Some ? (set_mem_desc … s mem')) ]]]]. + +(* scrittura RS08 di un byte *) +ndefinition RS08_memory_filter_write ≝ +λt:memory_impl.λs:any_status RS08 t.λaddr:word16.λval:byte8. + RS08_memory_filter_write_aux t s addr + (λb.val) + (λa.mem_update t (mem_desc … s) (chk_desc … s) o0 a val). + +(* scrittura RS08 di un bit *) +ndefinition RS08_memory_filter_write_bit ≝ +λt:memory_impl.λs:any_status RS08 t.λaddr:word16.λsub:oct.λval:bool. + RS08_memory_filter_write_aux t s addr + (λb.byte8_of_bits (setn_array8T sub bool (bits_of_byte8 b) val)) + (λa.mem_update_bit t (mem_desc … s) (chk_desc … s) o0 a sub val). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/fetch.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/fetch.ma new file mode 100755 index 000000000..3b4ed20f6 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/fetch.ma @@ -0,0 +1,35 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/Freescale_fetch.ma". +include "emulator/read_write/IP2022_fetch.ma". +include "emulator/status/status_getter.ma". + +ndefinition fetch ≝ +λm,t.λs:any_status m t. + match m with + [ HC05 ⇒ fetch_byte + | HC08 ⇒ Freescale_fetch_byte_or_word + | HCS08 ⇒ Freescale_fetch_byte_or_word + | RS08 ⇒ fetch_byte + | IP2022 ⇒ IP2022_fetch_byte_or_word + ] m t s (get_pc_reg … s). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/fetch_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/fetch_base.ma new file mode 100755 index 000000000..37ec98d14 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/fetch_base.ma @@ -0,0 +1,49 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/translation/translation.ma". + +(* errori possibili nel fetch OPCODE / ILLEGAL ADDRESS *) +ninductive error_type : Type ≝ + ILL_OP: error_type +| ILL_FETCH_AD: error_type +. + +(* - errore: interessa solo l'errore + - ok: interessa info, nuovo pc *) +ninductive fetch_result (A:Type) : Type ≝ + FetchERR : error_type → fetch_result A +| FetchOK : A → word16 → fetch_result A. + +ndefinition fetch_byte_aux ≝ +λm:mcu_type.λcur_pc:word16.λbh:byte8. + match full_info_of_word16 m (Byte bh) with + [ None ⇒ FetchERR ? ILL_FETCH_AD + | Some info ⇒ FetchOK ? info cur_pc + ]. + +ndefinition fetch_word_aux ≝ +λm:mcu_type.λcur_pc:word16.λw:word16. + match full_info_of_word16 m (Word w) with + [ None ⇒ FetchERR ? ILL_FETCH_AD + | Some info ⇒ FetchOK ? info cur_pc + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/load_write.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/load_write.ma new file mode 100755 index 000000000..3c24d528c --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/load_write.ma @@ -0,0 +1,80 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/Freescale_load_write.ma". +include "emulator/read_write/IP2022_load_write.ma". + +(* ************************************** *) +(* raccordo di tutte le possibili letture *) +(* ************************************** *) + +ndefinition multi_mode_loadb ≝ +λm.match m + return λm.Πt.any_status m t → word16 → aux_im_type m → + option (Prod3T (any_status m t) byte8 word16) + with + [ HC05 ⇒ Freescale_multi_mode_load_auxb HC05 + | HC08 ⇒ Freescale_multi_mode_load_auxb HC08 + | HCS08 ⇒ Freescale_multi_mode_load_auxb HCS08 + | RS08 ⇒ Freescale_multi_mode_load_auxb RS08 + | IP2022 ⇒ IP2022_multi_mode_load_auxb + ]. + +ndefinition multi_mode_loadw ≝ +λm.match m + return λm.Πt.any_status m t → word16 → aux_im_type m → + option (Prod3T (any_status m t) word16 word16) + with + [ HC05 ⇒ Freescale_multi_mode_load_auxw HC05 + | HC08 ⇒ Freescale_multi_mode_load_auxw HC08 + | HCS08 ⇒ Freescale_multi_mode_load_auxw HCS08 + | RS08 ⇒ Freescale_multi_mode_load_auxw RS08 + | IP2022 ⇒ IP2022_multi_mode_load_auxw + ]. + +(* **************************************** *) +(* raccordo di tutte le possibili scritture *) +(* **************************************** *) + +ndefinition multi_mode_writeb ≝ +λm.match m + return λm.Πt.any_status m t → word16 → aux_mod_type → aux_im_type m → byte8 → + option (ProdT (any_status m t) word16) + with + [ HC05 ⇒ Freescale_multi_mode_write_auxb HC05 + | HC08 ⇒ Freescale_multi_mode_write_auxb HC08 + | HCS08 ⇒ Freescale_multi_mode_write_auxb HCS08 + | RS08 ⇒ Freescale_multi_mode_write_auxb RS08 + | IP2022 ⇒ IP2022_multi_mode_write_auxb + ]. + +ndefinition multi_mode_writew ≝ +λm.match m + return λm.Πt.any_status m t → word16 → aux_im_type m → word16 → + option (ProdT (any_status m t) word16) + with + [ HC05 ⇒ Freescale_multi_mode_write_auxw HC05 + | HC08 ⇒ Freescale_multi_mode_write_auxw HC08 + | HCS08 ⇒ Freescale_multi_mode_write_auxw HCS08 + | RS08 ⇒ Freescale_multi_mode_write_auxw RS08 + | IP2022 ⇒ IP2022_multi_mode_write_auxw + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/load_write_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/load_write_base.ma new file mode 100644 index 000000000..fcd3898ed --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/load_write_base.ma @@ -0,0 +1,113 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/read_write.ma". + +(* mattoni base *) +(* - incrementano l'indirizzo normalmente *) +(* - incrementano PC attraverso il filtro *) +(* - letture filtrate, quindi da segmento 0 *) + +(* lettura byte da addr *) +ndefinition loadb_from ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. +λaddr:word16.λcur_pc:word16.λfetched:exadecim. + opt_map … (memory_filter_read … s addr) + (λb.Some ? (triple … s b (plusc_d_d ? cur_pc (extu2_w16 fetched)))). + +(* lettura bit da addr *) +ndefinition loadbit_from ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. +λaddr:word16.λsub:oct.λcur_pc:word16.λfetched:exadecim. + opt_map … (memory_filter_read_bit … s addr sub) + (λb.Some ? (triple … s b (plusc_d_d ? cur_pc (extu2_w16 fetched)))). + +(* lettura word da addr *) +ndefinition loadw_from ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. +λaddr:word16.λcur_pc:word16.λfetched:exadecim. + opt_map … (memory_filter_read … s addr) + (λbh.opt_map … (memory_filter_read … s (succc ? addr)) + (λbl.Some ? (triple … s 〈bh:bl〉 (plusc_d_d ? cur_pc (extu2_w16 fetched))))). + +(* scrittura byte su addr *) +ndefinition writeb_to ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. +λaddr:word16.λflag:aux_mod_type.λcur_pc:word16.λfetched:exadecim.λwriteb:byte8. + opt_map … (memory_filter_write … s addr flag writeb) + (λtmps.Some ? (pair … tmps (plusc_d_d ? cur_pc (extu2_w16 fetched)))). + +(* scrittura bit su addr *) +ndefinition writebit_to ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. +λaddr:word16.λsub:oct.λcur_pc:word16.λfetched:exadecim.λwriteb:bool. + opt_map … (memory_filter_write_bit … s addr sub writeb) + (λtmps.Some ? (pair … tmps (plusc_d_d ? cur_pc (extu2_w16 fetched)))). + +(* scrittura word su addr *) +ndefinition writew_to ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. +λaddr:word16.λflag:aux_mod_type.λcur_pc:word16.λfetched:exadecim.λwritew:word16. + opt_map … (memory_filter_write … s addr auxMode_ok (cnH ? writew)) + (λtmps1.opt_map … (memory_filter_write … tmps1 (succc ? addr) auxMode_ok (cnL ? writew)) + (λtmps2.Some ? (pair … tmps2 (plusc_d_d ? cur_pc (extu2_w16 fetched))))). + +(* ausiliari per definire i tipi e la lettura/scrittura *) + +(* ausiliaria per definire il tipo di aux_load *) +ndefinition aux_load_typing ≝ +λm:mcu_type.λt:memory_impl.λbyteflag:bool. + any_status m t → word16 → word16 → exadecim → + option (Prod3T (any_status m t) match byteflag with [ true ⇒ byte8 | false ⇒ word16 ] word16). + +(* per non dover ramificare i vari load in byte/word *) +ndefinition aux_load ≝ +λm:mcu_type.λt:memory_impl.λbyteflag:bool.match byteflag return aux_load_typing m t with + [ true ⇒ loadb_from m t | false ⇒ loadw_from m t ]. + +(* ausiliaria per definire il tipo di aux_write *) +ndefinition aux_write_typing ≝ +λm:mcu_type.λt:memory_impl.λbyteflag:bool. + any_status m t → word16 → aux_mod_type → word16 → exadecim → + match byteflag with [ true ⇒ byte8 | false ⇒ word16 ] → + option (ProdT (any_status m t) word16). + +(* per non dover ramificare i vari load in byte/word *) +ndefinition aux_write ≝ +λm:mcu_type.λt:memory_impl.λbyteflag:bool.match byteflag return aux_write_typing m t with + [ true ⇒ writeb_to m t | false ⇒ writew_to m t ]. + +ndefinition mem_read_s ≝ +λm,t.λs:any_status m t.mem_read t (mem_desc … s) (chk_desc … s). + +ndefinition mem_read_bit_s ≝ +λm,t.λs:any_status m t.mem_read_bit t (mem_desc … s) (chk_desc … s). + +ndefinition mem_write_s ≝ +λm,t.λs:any_status m t.λseg,a,val. + opt_map … (mem_update t (mem_desc … s) (chk_desc … s) seg a val) + (λmem'.Some ? (set_mem_desc … s mem')). + +ndefinition mem_write_bit_s ≝ +λm,t.λs:any_status m t.λseg,a,sub,val. + opt_map … (mem_update_bit t (mem_desc … s) (chk_desc … s) seg a sub val) + (λmem'.Some ? (set_mem_desc … s mem')). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/read_write.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/read_write.ma new file mode 100755 index 000000000..d0d709a1c --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/read_write.ma @@ -0,0 +1,84 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/read_write/RS08_read_write.ma". +include "emulator/read_write/IP2022_read_write.ma". + +(* filtraggio avviene sempre sul segmento 0 *) + +(* in caso di RS08/IP2022 si dirotta sul filtro, altrimenti si legge direttamente *) +ndefinition memory_filter_read ≝ +λm:mcu_type.λt:memory_impl.match m return λm:mcu_type.any_status m t → word16 → option byte8 with + [ HC05 ⇒ λs:any_status HC05 t. + mem_read t (mem_desc … s) (chk_desc … s) o0 + | HC08 ⇒ λs:any_status HC08 t. + mem_read t (mem_desc … s) (chk_desc … s) o0 + | HCS08 ⇒ λs:any_status HCS08 t. + mem_read t (mem_desc … s) (chk_desc … s) o0 + | RS08 ⇒ RS08_memory_filter_read t + | IP2022 ⇒ IP2022_memory_filter_read t + ]. + +ndefinition memory_filter_read_bit ≝ +λm:mcu_type.λt:memory_impl.match m return λm:mcu_type.any_status m t → word16 → oct → option bool with + [ HC05 ⇒ λs:any_status HC05 t. + mem_read_bit t (mem_desc … s) (chk_desc … s) o0 + | HC08 ⇒ λs:any_status HC08 t. + mem_read_bit t (mem_desc … s) (chk_desc … s) o0 + | HCS08 ⇒ λs:any_status HCS08 t. + mem_read_bit t (mem_desc … s) (chk_desc … s) o0 + | RS08 ⇒ RS08_memory_filter_read_bit t + | IP2022 ⇒ IP2022_memory_filter_read_bit t + ]. + +ndefinition memory_filter_write ≝ +λm:mcu_type.λt:memory_impl.match m + return λm:mcu_type.any_status m t → word16 → aux_mod_type → byte8 → option (any_status m t) with + [ HC05 ⇒ λs:any_status HC05 t.λaddr:word16.λflag:aux_mod_type.λval:byte8. + opt_map … (mem_update t (mem_desc … s) (chk_desc … s) o0 addr val) + (λmem.Some ? (set_mem_desc … s mem)) + | HC08 ⇒ λs:any_status HC08 t.λaddr:word16.λflag:aux_mod_type.λval:byte8. + opt_map … (mem_update t (mem_desc … s) (chk_desc … s) o0 addr val) + (λmem.Some ? (set_mem_desc … s mem)) + | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word16.λflag:aux_mod_type.λval:byte8. + opt_map … (mem_update t (mem_desc … s) (chk_desc … s) o0 addr val) + (λmem.Some ? (set_mem_desc … s mem)) + | RS08 ⇒ λs:any_status RS08 t.λaddr:word16.λflag:aux_mod_type. + RS08_memory_filter_write t s addr + | IP2022 ⇒ IP2022_memory_filter_write t + ]. + +ndefinition memory_filter_write_bit ≝ +λm:mcu_type.λt:memory_impl.match m + return λm:mcu_type.any_status m t → word16 → oct → bool → option (any_status m t) with + [ HC05 ⇒ λs:any_status HC05 t.λaddr:word16.λsub:oct.λval:bool. + opt_map … (mem_update_bit t (mem_desc … s) (chk_desc … s) o0 addr sub val) + (λmem.Some ? (set_mem_desc … s mem)) + | HC08 ⇒ λs:any_status HC08 t.λaddr:word16.λsub:oct.λval:bool. + opt_map … (mem_update_bit t (mem_desc … s) (chk_desc … s) o0 addr sub val) + (λmem.Some ? (set_mem_desc … s mem)) + | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word16.λsub:oct.λval:bool. + opt_map … (mem_update_bit t (mem_desc … s) (chk_desc … s) o0 addr sub val) + (λmem.Some ? (set_mem_desc … s mem)) + | RS08 ⇒ RS08_memory_filter_write_bit t + | IP2022 ⇒ IP2022_memory_filter_write_bit t + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/read_write/read_write_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/read_write_base.ma new file mode 100755 index 000000000..4b2e39317 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/read_write/read_write_base.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "common/theory.ma". + +(* flag ausiliario per la scrittura + normale / con riporto(+) / con riporto(-) *) +ninductive aux_mod_type : Type ≝ + auxMode_ok : aux_mod_type +| auxMode_inc : aux_mod_type +| auxMode_dec : aux_mod_type +. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status_base.ma index 340fafeb4..9cf4f2a78 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status_base.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status_base.ma @@ -76,11 +76,9 @@ unification hint 0 ≔ ⊢ carr callstack_is_comparable ≡ aux_callstack_type. ndefinition aux_addrarray_type ≝ Array8T word24. (* tutti a 0x000000 on reset *) -ndefinition new_addrarray ≝ - mk_Array8T ? (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) - (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) - (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) - (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉). +ndefinition new_addrarray : aux_addrarray_type ≝ + mk_Array8T ? (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?). ndefinition get_addrarray ≝ λaddrsel:byte8.λaa:aux_addrarray_type. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/status_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/status_base.ma index b6d394c91..b7e3ea499 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/status/status_base.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/status_base.ma @@ -33,20 +33,20 @@ include "emulator/opcodes/pseudo.ma". (* descrittore del click = stato di avanzamento dell'esecuzione *) (* 1) None = istruzione eseguita, attesa del fetch *) -(* 2) Some cur_clk,pseudo,mode,clks,cur_pc = fetch eseguito *) -ndefinition aux_clk_type ≝ λm:mcu_type.Prod5T byte8 (aux_pseudo_type m) (aux_im_type m) byte8 word16. +(* 2) Some cur_clk,clks,pseudo,mode,cur_pc = fetch eseguito *) +ndefinition aux_clk_type ≝ λm:mcu_type.Prod5T nat nat (aux_pseudo_type m) (aux_im_type m) word16. nlemma clk_is_comparable : mcu_type → comparable. #m; @ (aux_clk_type m) - ##[ napply (zeroc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) - ##| napply (forallc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) - ##| napply (eqc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) - ##| napply (eqc_to_eq (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) - ##| napply (eq_to_eqc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) - ##| napply (neqc_to_neq (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) - ##| napply (neq_to_neqc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) - ##| napply (decidable_c (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) - ##| napply (symmetric_eqc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##[ napply (zeroc (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) + ##| napply (forallc (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) + ##| napply (eqc (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) + ##| napply (eqc_to_eq (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) + ##| napply (eq_to_eqc (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) + ##| napply (neqc_to_neq (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) + ##| napply (neq_to_neqc (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) + ##| napply (decidable_c (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) + ##| napply (symmetric_eqc (quintuple_is_comparable nat_is_comparable nat_is_comparable (pseudo_is_comparable m) (im_is_comparable m) word16_is_comparable)) ##] nqed. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/status_getter.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/status_getter.ma new file mode 100755 index 000000000..96a4cad5c --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/status_getter.ma @@ -0,0 +1,348 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status_setter.ma". + +(* **************** *) +(* GETTER SPECIFICI *) +(* **************** *) + +(* funzione ausiliaria per il tipaggio dei getter *) +ndefinition aux_get_type ≝ λT:Type.λm:mcu_type.aux_alu_type m → T. + +(* 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_type byte8 with + [ HC05 ⇒ acc_low_reg_HC05 + | HC08 ⇒ acc_low_reg_HC08 + | HCS08 ⇒ acc_low_reg_HC08 + | RS08 ⇒ acc_low_reg_RS08 + | IP2022 ⇒ acc_low_reg_IP2022 ] + (alu … 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_type (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 ? + | IP2022 ⇒ λalu.None ? ] + (alu … 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_type (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 ? + | IP2022 ⇒ λalu.None ? ] + (alu … 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_type (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 ? + | IP2022 ⇒ λalu.None ? ] + (alu … 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_type (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 ? + | IP2022 ⇒ λalu.Some ? (sp_reg_IP2022 alu) ] + (alu … 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_type word16 with + [ HC05 ⇒ pc_reg_HC05 + | HC08 ⇒ pc_reg_HC08 + | HCS08 ⇒ pc_reg_HC08 + | RS08 ⇒ pc_reg_RS08 + | IP2022 ⇒ pc_reg_IP2022 ] + (alu … 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_type (option word16) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.Some ? (spc_reg_RS08 alu) + | IP2022 ⇒ λalu.None ? ] + (alu … s). + +(* getter di MULH, non esiste sempre *) +ndefinition get_mulh_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option byte8) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (mulh_reg_IP2022 alu) ] + (alu … s). + +(* getter di ADDRSEL, non esiste sempre *) +ndefinition get_addrsel_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option byte8) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (addrsel_reg_IP2022 alu) ] + (alu … s). + +(* getter di ADDR, non esiste sempre *) +ndefinition get_addr_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option word24) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (get_addr_reg_IP2022 alu) ] + (alu … s). + +(* getter di CALL, non esiste sempre *) +ndefinition get_call_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option word16) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (get_call_reg_IP2022 alu) ] + (alu … s). + +(* getter di IP, non esiste sempre *) +ndefinition get_ip_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option word16) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (ip_reg_IP2022 alu) ] + (alu … s). + +(* getter di DP, non esiste sempre *) +ndefinition get_dp_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option word16) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (dp_reg_IP2022 alu) ] + (alu … s). + +(* getter di DATA, non esiste sempre *) +ndefinition get_data_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option word16) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (data_reg_IP2022 alu) ] + (alu … s). + +(* getter di SPEED, non esiste sempre *) +ndefinition get_speed_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option exadecim) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (speed_reg_IP2022 alu) ] + (alu … s). + +(* getter di PAGE, non esiste sempre *) +ndefinition get_page_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option oct) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (page_reg_IP2022 alu) ] + (alu … s). + +(* REGISTRI SPECIALI *) + +(* 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_type (option byte8) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.Some ? (x_map_RS08 alu) + | IP2022 ⇒ λalu.None ? ] + (alu … 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_type (option byte8) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.Some ? (ps_map_RS08 alu) + | IP2022 ⇒ λalu.None ? ] + (alu … s). + +(* getter di skip mode, non esiste sempre *) +ndefinition get_skip_mode ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t. + match m + return aux_get_type (option bool) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.None ? + | HCS08 ⇒ λalu.None ? + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.Some ? (skip_mode_IP2022 alu) ] + (alu … 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_type (option bool) with + [ HC05 ⇒ λalu.None ? + | HC08 ⇒ λalu.Some ? (v_flag_HC08 alu) + | HCS08 ⇒ λalu.Some ? (v_flag_HC08 alu) + | RS08 ⇒ λalu.None ? + | IP2022 ⇒ λalu.None ? ] + (alu … 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_type (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 ? + | IP2022 ⇒ λalu.Some ? (h_flag_IP2022 alu) ] + (alu … 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_type (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 ? + | IP2022 ⇒ λalu.None ? ] + (alu … 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_type (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 ? + | IP2022 ⇒ λalu.None ? ] + (alu … 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_type bool with + [ HC05 ⇒ z_flag_HC05 + | HC08 ⇒ z_flag_HC08 + | HCS08 ⇒ z_flag_HC08 + | RS08 ⇒ z_flag_RS08 + | IP2022 ⇒ z_flag_IP2022 ] + (alu … 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_type bool with + [ HC05 ⇒ c_flag_HC05 + | HC08 ⇒ c_flag_HC08 + | HCS08 ⇒ c_flag_HC08 + | RS08 ⇒ c_flag_RS08 + | IP2022 ⇒ c_flag_IP2022 ] + (alu … 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_type (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 ? + | IP2022 ⇒ λalu.None ? ] + (alu … s). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/status_setter.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/status_setter.ma new file mode 100755 index 000000000..2605b07c5 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/status_setter.ma @@ -0,0 +1,768 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "emulator/status/status.ma". + +(* ***************************** *) +(* SETTER SPECIFICI FORTI/DEBOLI *) +(* ***************************** *) + +(* funzione ausiliaria per il tipaggio dei setter forti *) +ndefinition aux_set_type ≝ λT:Type.λm:mcu_type.aux_alu_type m → T → aux_alu_type m. + +(* funzione ausiliaria per il tipaggio dei setter deboli *) +ndefinition aux_set_type_opt ≝ λT:Type.λm:mcu_type.option (aux_set_type T m). + +(* 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 … alu' (mem_desc … s) (chk_desc … s) (clk_desc … 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 … (alu … s) mem' (chk_desc … s) (clk_desc … 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 … (alu … s) (mem_desc … s) chk' (clk_desc … s). + +(* setter forte del clik *) +ndefinition set_clk_desc ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λclk':option (aux_clk_type m). + mk_any_status … (alu … s) (mem_desc … s) (chk_desc … s) clk'. + +(* REGISTRO A *) + +(* setter forte di A *) +ndefinition set_acc_8_low_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval:byte8. + set_alu … s + (match m return aux_set_type 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 + | IP2022 ⇒ set_acc_8_low_reg_IP2022 + ] (alu … s) val). + +(* REGISTRO X *) + +ndefinition set_indX_8_low_reg_sHC05 ≝ +λt:memory_impl.λs:any_status HC05 t.λval. + set_alu … s (set_indX_8_low_reg_HC05 (alu … s) val). + +ndefinition set_indX_8_low_reg_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_indX_8_low_reg_HC08 (alu … s) val). + +ndefinition set_indX_8_low_reg_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_indX_8_low_reg_HC08 (alu … s) val). + +(* setter forte di X *) +ndefinition set_indX_8_low_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → byte8 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.Some ? (set_indX_8_low_reg_sHC05 t s val) + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_indX_8_low_reg_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_indX_8_low_reg_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di X *) +ndefinition setweak_indX_8_low_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_indX_8_low_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO H *) + +ndefinition set_indX_8_high_reg_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_indX_8_high_reg_HC08 (alu … s) val). + +ndefinition set_indX_8_high_reg_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_indX_8_high_reg_HC08 (alu … s) val). + +(* setter forte di H *) +ndefinition set_indX_8_high_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → byte8 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_indX_8_high_reg_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_indX_8_high_reg_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di H *) +ndefinition setweak_indX_8_high_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_indX_8_high_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO H:X *) + +ndefinition set_indX_16_reg_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_indX_16_reg_HC08 (alu … s) val). + +ndefinition set_indX_16_reg_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_indX_16_reg_HC08 (alu … s) val). + +(* setter forte di H:X *) +ndefinition set_indX_16_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word16 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_indX_16_reg_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_indX_16_reg_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di H:X *) +ndefinition setweak_indX_16_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_indX_16_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO SP *) + +ndefinition set_sp_reg_sHC05 ≝ +λt:memory_impl.λs:any_status HC05 t.λval. + set_alu … s (set_sp_reg_HC05 (alu … s) val). + +ndefinition set_sp_reg_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_sp_reg_HC08 (alu … s) val). + +ndefinition set_sp_reg_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_sp_reg_HC08 (alu … s) val). + +ndefinition set_sp_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_sp_reg_IP2022 (alu … s) val). + +(* setter forte di SP *) +ndefinition set_sp_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word16 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.Some ? (set_sp_reg_sHC05 t s val) + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_sp_reg_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_sp_reg_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_sp_reg_sIP2022 t s val) + ]. + +(* setter debole di SP *) +ndefinition setweak_sp_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_sp_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO PC *) + +(* setter forte di PC *) +ndefinition set_pc_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λpc':word16. + set_alu … s + (match m return aux_set_type word16 with + [ HC05 ⇒ set_pc_reg_HC05 + | HC08 ⇒ set_pc_reg_HC08 + | HCS08 ⇒ set_pc_reg_HC08 + | RS08 ⇒ set_pc_reg_RS08 + | IP2022 ⇒ set_pc_reg_IP2022 + ] (alu … s) pc'). + +(* REGISTRO SPC *) + +ndefinition set_spc_reg_sRS08 ≝ +λt:memory_impl.λs:any_status RS08 t.λval. + set_alu … s (set_spc_reg_RS08 (alu … s) val). + +(* setter forte di SPC *) +ndefinition set_spc_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word16 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.Some ? (set_spc_reg_sRS08 t s val) + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di SPC *) +ndefinition setweak_spc_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_spc_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO MULH *) + +ndefinition set_mulh_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_mulh_reg_IP2022 (alu … s) val). + +(* setter forte di MULH *) +ndefinition set_mulh_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → byte8 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_mulh_reg_sIP2022 t s val) + ]. + +(* setter debole di MULH *) +ndefinition setweak_mulh_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_mulh_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO ADDRSEL *) + +ndefinition set_addrsel_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_addrsel_reg_IP2022 (alu … s) val). + +(* setter forte di ADDRSEL *) +ndefinition set_addrsel_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → byte8 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_addrsel_reg_sIP2022 t s val) + ]. + +(* setter debole di ADDRSEL *) +ndefinition setweak_addrsel_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_addrsel_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO ADDR *) + +ndefinition set_addr_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_addr_reg_IP2022 (alu … s) val). + +(* setter forte di ADDR *) +ndefinition set_addr_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word24 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_addr_reg_sIP2022 t s val) + ]. + +(* setter debole di ADDR *) +ndefinition setweak_addr_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_addr_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO CALL *) + +ndefinition set_call_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_call_reg_IP2022 (alu … s) val). + +(* setter forte di CALL *) +ndefinition set_call_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word16 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_call_reg_sIP2022 t s val) + ]. + +(* setter debole di CALL *) +ndefinition setweak_call_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_call_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO CALL [push] *) + +ndefinition push_call_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (push_call_reg_IP2022 (alu … s) val). + +(* push forte di CALL *) +ndefinition push_call_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word16 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (push_call_reg_sIP2022 t s val) + ]. + +(* REGISTRO CALL [pop] *) + +ndefinition pop_call_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t. + match pop_call_reg_IP2022 (alu … s) with + [ pair val alu' ⇒ pair … val (set_alu … s alu') ]. + +(* pop forte di CALL *) +ndefinition pop_call_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → option (ProdT word16 (any_status m t)) + with + [ HC05 ⇒ λs:any_status ? t.None ? + | HC08 ⇒ λs:any_status ? t.None ? + | HCS08 ⇒ λs:any_status ? t.None ? + | RS08 ⇒ λs:any_status ? t.None ? + | IP2022 ⇒ λs:any_status ? t.Some ? (pop_call_reg_sIP2022 t s) + ]. + +(* REGISTRO IP *) + +ndefinition set_ip_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_ip_reg_IP2022 (alu … s) val). + +(* setter forte di IP *) +ndefinition set_ip_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word16 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_ip_reg_sIP2022 t s val) + ]. + +(* setter debole di IP *) +ndefinition setweak_ip_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_ip_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO DP *) + +ndefinition set_dp_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_dp_reg_IP2022 (alu … s) val). + +(* setter forte di DP *) +ndefinition set_dp_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word16 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_dp_reg_sIP2022 t s val) + ]. + +(* setter debole di DP *) +ndefinition setweak_dp_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_dp_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO DATA *) + +ndefinition set_data_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_data_reg_IP2022 (alu … s) val). + +(* setter forte di DATA *) +ndefinition set_data_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → word16 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_data_reg_sIP2022 t s val) + ]. + +(* setter debole di DATA *) +ndefinition setweak_data_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_data_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO SPEED *) + +ndefinition set_speed_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_speed_reg_IP2022 (alu … s) val). + +(* setter forte di SPEED *) +ndefinition set_speed_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → exadecim → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_speed_reg_sIP2022 t s val) + ]. + +(* setter debole di SPEED *) +ndefinition setweak_speed_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_speed_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO PAGE *) + +ndefinition set_page_reg_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_page_reg_IP2022 (alu … s) val). + +(* setter forte di PAGE *) +ndefinition set_page_reg ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → oct → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_page_reg_sIP2022 t s val) + ]. + +(* setter debole di PAGE *) +ndefinition setweak_page_reg ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_page_reg … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO MEMORY MAPPED X *) + +ndefinition set_x_map_sRS08 ≝ +λt:memory_impl.λs:any_status RS08 t.λval. + set_alu … s (set_x_map_RS08 (alu … s) val). + +(* setter forte di memory mapped X *) +ndefinition set_x_map ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → byte8 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.Some ? (set_x_map_sRS08 t s val) + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di memory mapped X *) +ndefinition setweak_x_map ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_x_map … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* REGISTRO MEMORY MAPPED PS *) + +ndefinition set_ps_map_sRS08 ≝ +λt:memory_impl.λs:any_status RS08 t.λval. + set_alu … s (set_ps_map_RS08 (alu … s) val). + +(* setter forte di memory mapped PS *) +ndefinition set_ps_map ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → byte8 → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.Some ? (set_ps_map_sRS08 t s val) + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di memory mapped PS *) +ndefinition setweak_ps_map ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_ps_map … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* MODALITA SKIP *) + +ndefinition set_skip_mode_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_skip_mode_IP2022 (alu … s) val). + +(* setter forte di modalita SKIP *) +ndefinition set_skip_mode ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → bool → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.None ? + | HCS08 ⇒ λs:any_status ? t.λval.None ? + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_skip_mode_sIP2022 t s val) + ]. + +(* setter debole di SKIP *) +ndefinition setweak_skip_mode ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_skip_mode … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG V *) + +ndefinition set_v_flag_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_v_flag_HC08 (alu … s) val). + +ndefinition set_v_flag_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_v_flag_HC08 (alu … s) val). + +(* setter forte di V *) +ndefinition set_v_flag ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → bool → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.None ? + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_v_flag_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_v_flag_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di V *) +ndefinition setweak_v_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_v_flag … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG H *) + +ndefinition set_h_flag_sHC05 ≝ +λt:memory_impl.λs:any_status HC05 t.λval. + set_alu … s (set_h_flag_HC05 (alu … s) val). + +ndefinition set_h_flag_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_h_flag_HC08 (alu … s) val). + +ndefinition set_h_flag_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_h_flag_HC08 (alu … s) val). + +ndefinition set_h_flag_sIP2022 ≝ +λt:memory_impl.λs:any_status IP2022 t.λval. + set_alu … s (set_h_flag_IP2022 (alu … s) val). + +(* setter forte di H *) +ndefinition set_h_flag ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → bool → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.Some ? (set_h_flag_sHC05 t s val) + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_h_flag_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_h_flag_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.Some ? (set_h_flag_sIP2022 t s val) + ]. + +(* setter debole di H *) +ndefinition setweak_h_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_h_flag … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG I *) + +ndefinition set_i_flag_sHC05 ≝ +λt:memory_impl.λs:any_status HC05 t.λval. + set_alu … s (set_i_flag_HC05 (alu … s) val). + +ndefinition set_i_flag_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_i_flag_HC08 (alu … s) val). + +ndefinition set_i_flag_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_i_flag_HC08 (alu … s) val). + +(* setter forte di I *) +ndefinition set_i_flag ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → bool → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.Some ? (set_i_flag_sHC05 t s val) + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_i_flag_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_i_flag_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di I *) +ndefinition setweak_i_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_i_flag … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG N *) + +ndefinition set_n_flag_sHC05 ≝ +λt:memory_impl.λs:any_status HC05 t.λval. + set_alu … s (set_n_flag_HC05 (alu … s) val). + +ndefinition set_n_flag_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_n_flag_HC08 (alu … s) val). + +ndefinition set_n_flag_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_n_flag_HC08 (alu … s) val). + +(* setter forte di N *) +ndefinition set_n_flag ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → bool → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.Some ? (set_n_flag_sHC05 t s val) + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_n_flag_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_n_flag_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di N *) +ndefinition setweak_n_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_n_flag … s val with + [ None ⇒ s | Some s' ⇒ s' ]. + +(* FLAG Z *) + +(* 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_type bool with + [ HC05 ⇒ set_z_flag_HC05 + | HC08 ⇒ set_z_flag_HC08 + | HCS08 ⇒ set_z_flag_HC08 + | RS08 ⇒ set_z_flag_RS08 + | IP2022 ⇒ set_z_flag_IP2022 + ] (alu m t s) zfl'). + +(* FLAG C *) + +(* 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_type bool with + [ HC05 ⇒ set_c_flag_HC05 + | HC08 ⇒ set_c_flag_HC08 + | HCS08 ⇒ set_c_flag_HC08 + | RS08 ⇒ set_c_flag_RS08 + | IP2022 ⇒ set_c_flag_IP2022 + ] (alu m t s) cfl'). + +(* FLAG IRQ *) + +ndefinition set_irq_flag_sHC05 ≝ +λt:memory_impl.λs:any_status HC05 t.λval. + set_alu … s (set_irq_flag_HC05 (alu … s) val). + +ndefinition set_irq_flag_sHC08 ≝ +λt:memory_impl.λs:any_status HC08 t.λval. + set_alu … s (set_irq_flag_HC08 (alu … s) val). + +ndefinition set_irq_flag_sHCS08 ≝ +λt:memory_impl.λs:any_status HCS08 t.λval. + set_alu … s (set_irq_flag_HC08 (alu … s) val). + +(* setter forte di IRQ *) +ndefinition set_irq_flag ≝ +λm:mcu_type.λt. + match m + return λm.any_status m t → bool → option (any_status m t) + with + [ HC05 ⇒ λs:any_status ? t.λval.Some ? (set_irq_flag_sHC05 t s val) + | HC08 ⇒ λs:any_status ? t.λval.Some ? (set_irq_flag_sHC08 t s val) + | HCS08 ⇒ λs:any_status ? t.λval.Some ? (set_irq_flag_sHCS08 t s val) + | RS08 ⇒ λs:any_status ? t.λval.None ? + | IP2022 ⇒ λs:any_status ? t.λval.None ? + ]. + +(* setter debole di IRQ *) +ndefinition setweak_irq_flag ≝ +λm:mcu_type.λt:memory_impl.λs:any_status m t.λval. + match set_irq_flag … s val with + [ None ⇒ s | Some s' ⇒ s' ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/tests/micro_tests_tools.ma b/helm/software/matita/contribs/ng_assembly2/emulator/tests/micro_tests_tools.ma new file mode 100755 index 000000000..47417a2c4 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/tests/micro_tests_tools.ma @@ -0,0 +1,80 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* ********************************************************************** *) +(* Progetto FreeScale *) +(* *) +(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) +(* Sviluppo: 2008-2010 *) +(* *) +(* ********************************************************************** *) + +include "num/word16.ma". +include "common/list.ma". + +(* ****************************************** *) +(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) +(* ****************************************** *) + +(* tabella 0x00 - 0xFF utile da caricare in RAM/ROM *) +ndefinition mTest_bytes : list byte8 ≝ + [ 〈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,x0〉 ; 〈x6,x1〉 ; 〈x6,x2〉 ; 〈x6,x3〉 ; 〈x6,x4〉 ; 〈x6,x5〉 ; 〈x6,x6〉 ; 〈x6,x7〉 + ; 〈x6,x8〉 ; 〈x6,x9〉 ; 〈x6,xA〉 ; 〈x6,xB〉 ; 〈x6,xC〉 ; 〈x6,xD〉 ; 〈x6,xE〉 ; 〈x6,xF〉 ] +@[ 〈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,x0〉 ; 〈xD,x1〉 ; 〈xD,x2〉 ; 〈xD,x3〉 ; 〈xD,x4〉 ; 〈xD,x5〉 ; 〈xD,x6〉 ; 〈xD,x7〉 + ; 〈xD,x8〉 ; 〈xD,x9〉 ; 〈xD,xA〉 ; 〈xD,xB〉 ; 〈xD,xC〉 ; 〈xD,xD〉 ; 〈xD,xE〉 ; 〈xD,xF〉 ] +@[ 〈xE,x0〉 ; 〈xE,x1〉 ; 〈xE,x2〉 ; 〈xE,x3〉 ; 〈xE,x4〉 ; 〈xE,x5〉 ; 〈xE,x6〉 ; 〈xE,x7〉 + ; 〈xE,x8〉 ; 〈xE,x9〉 ; 〈xE,xA〉 ; 〈xE,xB〉 ; 〈xE,xC〉 ; 〈xE,xD〉 ; 〈xE,xE〉 ; 〈xE,xF〉 ] +@[ 〈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〉 + ]. + +(* + 1) mTest_x_RAM : inizio della RAM + (start point per caricamento mTest_bytes in RAM) + 2) mTest_x_prog: inizio della ROM + (start point per caricamento programma in ROM) + 3) mTest_x_data: ultimi 256b della ROM + (start point per caricamento mTest_bytes in ROM) +*) +ndefinition mTest_HCS08_RAM ≝ 〈〈x0,x0〉:〈x7,x0〉〉. +ndefinition mTest_HCS08_prog ≝ 〈〈x1,x8〉:〈x6,x0〉〉. +ndefinition mTest_HCS08_data ≝ 〈〈xF,xF〉:〈x0,x0〉〉. + +ndefinition mTest_RS08_RAM ≝ 〈〈x0,x0〉:〈x2,x0〉〉. +ndefinition mTest_RS08_prog ≝ 〈〈x3,x8〉:〈x0,x0〉〉. +ndefinition mTest_RS08_data ≝ 〈〈x3,xF〉:〈x0,x0〉〉. diff --git a/helm/software/matita/contribs/ng_assembly2/num/word24.ma b/helm/software/matita/contribs/ng_assembly2/num/word24.ma index f523e996e..cdfc18533 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/word24.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/word24.ma @@ -44,6 +44,13 @@ ndefinition eq_w24 ≝ (eqc ? (w24h w1) (w24h w2)) ⊗ (eqc ? (w24l w1) (w24l w2)). +ndefinition succ_w24 ≝ +λw.match eqc ? (predc ? (zeroc ?)) (w24l w) with + [ true ⇒ match eqc ? (predc ? (zeroc ?)) (w24h w) with + [ true ⇒ 〈(succc ? (w24x w));(succc ? (w24h w));(succc ? (w24l w))〉 + | false ⇒ 〈(w24x w);(succc ? (w24h w));(succc ? (w24l w))〉 ] + | false ⇒ 〈(w24x w);(w24h w);(succc ? (w24l w))〉 ]. + nlemma word24_destruct_1 : ∀x1,x2,y1,y2,z1,z2. mk_word24 x1 y1 z1 = mk_word24 x2 y2 z2 → x1 = x2. -- 2.39.2