.
(* - errore: interessa solo l'errore
- - ok: interessa info, vecchio pc, nuovo pc *)
+ - ok: interessa info, nuovo pc *)
ninductive fetch_result (A:Type) : Type ≝
FetchERR : error_type → fetch_result A
-| FetchOK : A → word16 → word16 → fetch_result A.
+| FetchOK : A → word16 → fetch_result A.
ndefinition fetch_byte_aux ≝
-λm:mcu_type.λpco,pcn: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 pco pcn
+ | Some info ⇒ FetchOK ? info cur_pc
].
ndefinition fetch_word_aux ≝
-λm:mcu_type.λpco,pcn: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 pco pcn
+ | Some info ⇒ FetchOK ? info cur_pc
].
(* opcode a byte : HC05 / RS08 *)
λm:mcu_type.λfR:word32 → option byte8.λpc:word16.
match fR (extu_w32 pc) with
[ None ⇒ FetchERR ? ILL_FETCH_AD
- | Some bh ⇒ fetch_byte_aux m pc (succ_w16 pc) bh ].
+ | Some bh ⇒ fetch_byte_aux m (succ_w16 pc) bh ].
(* opcode a byte o 0x9E + byte : HC08 / HCS08 *)
ndefinition Freescale_fetch_byte_or_word ≝
| Some bh ⇒ match eq_b8 bh 〈x9,xE〉 with
[ true ⇒ match fR (extu_w32 (succ_w16 pc)) with
[ None ⇒ FetchERR ? ILL_FETCH_AD
- | Some bl ⇒ fetch_word_aux m pc (succ_w16 (succ_w16 pc)) 〈bh:bl〉
+ | Some bl ⇒ fetch_word_aux m (succ_w16 (succ_w16 pc)) 〈bh:bl〉
]
- | false ⇒ fetch_byte_aux m pc (succ_w16 pc) bh
+ | false ⇒ fetch_byte_aux m (succ_w16 pc) bh
]
].
| Some bh ⇒ match eq_b8 bh 〈x0,x0〉 with
[ true ⇒ match fR (rol_w32 〈〈〈x8,x1〉:〈x0,x0〉〉.pc〉) with
[ None ⇒ FetchERR ? ILL_FETCH_AD
- | Some bl ⇒ fetch_word_aux m pc (succ_w16 pc) 〈bh:bl〉
+ | Some bl ⇒ fetch_word_aux m (succ_w16 pc) 〈bh:bl〉
]
- | false ⇒ fetch_byte_aux m pc (succ_w16 pc) bh
+ | false ⇒ fetch_byte_aux m (succ_w16 pc) bh
]
].