X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Fng_assembly2%2Femulator%2Fread_write%2Ffetch_base.ma;fp=matita%2Fmatita%2Fcontribs%2Fng_assembly2%2Femulator%2Fread_write%2Ffetch_base.ma;h=37ec98d142ed251e398681b4e817b3a746ad0f1f;hb=2c01ff6094173915e7023076ea48b5804dca7778;hp=0000000000000000000000000000000000000000;hpb=a050e3f80d7ea084ce0184279af98e8251c7d2a6;p=helm.git diff --git a/matita/matita/contribs/ng_assembly2/emulator/read_write/fetch_base.ma b/matita/matita/contribs/ng_assembly2/emulator/read_write/fetch_base.ma new file mode 100755 index 000000000..37ec98d14 --- /dev/null +++ b/matita/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 + ].