]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/contribs/ng_assembly/emulator/read_write/fetch.ma
mod change (-x)
[helm.git] / helm / software / matita / contribs / ng_assembly / emulator / read_write / fetch.ma
old mode 100755 (executable)
new mode 100644 (file)
index 37d0951..fbdafeb
@@ -31,23 +31,23 @@ ninductive error_type : Type ≝
 .
 
 (* - errore: interessa solo l'errore
-   - ok: interessa info e il nuovo pc *)
+   - 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.λpc:word16.λbh:byte8.
+λ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 pc
+  | Some info ⇒ FetchOK ? info cur_pc
   ].
 
 ndefinition fetch_word_aux ≝
-λm:mcu_type.λpc:word16.λw:word16.
+λ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 pc
+  | Some info ⇒ FetchOK ? info cur_pc
   ].
 
 (* opcode a byte : HC05 / RS08 *)
@@ -76,11 +76,10 @@ ndefinition Freescale_fetch_byte_or_word ≝
 (* pc word aligned, mappato in 0x02000000-0x0201FFFF *)
 ndefinition IP2022_fetch_byte_or_word ≝
 λm:mcu_type.λfR:word32 → option byte8.λpc:word16.
- let map_pc ≝ rol_w32 〈〈〈x0,x1〉:〈x0,x0〉〉.pc〉 in
- match fR map_pc with
+ match fR (rol_w32 〈〈〈x0,x1〉:〈x0,x0〉〉.pc〉) with
   [ None ⇒ FetchERR ? ILL_FETCH_AD
   | Some bh ⇒ match eq_b8 bh 〈x0,x0〉 with
-   [ true ⇒ match fR (succ_w32 map_pc) with
+   [ true ⇒ match fR (rol_w32 〈〈〈x8,x1〉:〈x0,x0〉〉.pc〉) with
     [ None ⇒ FetchERR ? ILL_FETCH_AD
     | Some bl ⇒ fetch_word_aux m (succ_w16 pc) 〈bh:bl〉
     ]