| false ⇒ mk_word32 wh' wl' ]]].
(* operatore rotazione destra n-volte *)
-nlet rec ror_w32_n (dw:word32) (n:bitrigesim) (r:rec_bitrigesim n) on r ≝
- match r with
- [ bi_O ⇒ dw
- | bi_S t n' ⇒ ror_w32_n (ror_w32 dw) t n' ].
+nlet rec ror_w32_n (dw:word32) (n:nat) on n ≝
+ match n with
+ [ O ⇒ dw
+ | S n' ⇒ ror_w32_n (ror_w32 dw) n' ].
(* operatore rotazione sinistra con carry *)
ndefinition rcl_w32 ≝
| false ⇒ mk_word32 wh' wl' ]]].
(* operatore rotazione sinistra n-volte *)
-nlet rec rol_w32_n (dw:word32) (n:bitrigesim) (r:rec_bitrigesim n) on r ≝
- match r with
- [ bi_O ⇒ dw
- | bi_S t n' ⇒ rol_w32_n (rol_w32 dw) t n' ].
+nlet rec rol_w32_n (dw:word32) (n:nat) on n ≝
+ match n with
+ [ O ⇒ dw
+ | S n' ⇒ rol_w32_n (rol_w32 dw) n' ].
(* operatore not/complemento a 1 *)
ndefinition not_w32 ≝
]]]]]].
(* divisione senza segno (secondo la logica delle ALU): (quoziente resto) overflow *)
-nlet rec div_w16_aux (divd:word32) (divs:word32) (molt:word16) (q:word16) (c:exadecim) (rc:rec_exadecim c) on rc ≝
+nlet rec div_w16_aux (divd:word32) (divs:word32) (molt:word16) (q:word16) (c:nat) on c ≝
let w' ≝ plus_w32_d_d divd (compl_w32 divs) in
- match rc with
- [ ex_O ⇒ match le_w32 divs divd with
+ match c with
+ [ O ⇒ match le_w32 divs divd with
[ true ⇒ triple … (or_w16 molt q) (w32l w') (⊖ (eq_w16 (w32h w') 〈〈x0,x0〉:〈x0,x0〉〉))
| false ⇒ triple … q (w32l divd) (⊖ (eq_w16 (w32h divd) 〈〈x0,x0〉:〈x0,x0〉〉)) ]
- | ex_S t c' ⇒ match le_w32 divs divd with
- [ true ⇒ div_w16_aux w' (ror_w32 divs) (ror_w16 molt) (or_w16 molt q) t c'
- | false ⇒ div_w16_aux divd (ror_w32 divs) (ror_w16 molt) q t c' ]].
+ | S c' ⇒ match le_w32 divs divd with
+ [ true ⇒ div_w16_aux w' (ror_w32 divs) (ror_w16 molt) (or_w16 molt q) c'
+ | false ⇒ div_w16_aux divd (ror_w32 divs) (ror_w16 molt) q c' ]].
ndefinition div_w16 ≝
λw:word32.λb:word16.match eq_w16 b 〈〈x0,x0〉:〈x0,x0〉〉 with
(* 3) ad ogni ciclo il divisore e il moltiplicatore vengono scalati di 1 a dx *)
(* 4) il moltiplicatore e' la quantita' aggiunta al quoziente se il divisore *)
(* puo' essere sottratto al dividendo *)
- | false ⇒ div_w16_aux w (rol_w32_n 〈〈〈x0,x0〉:〈x0,x0〉〉.b〉 ? (bit_to_recbit t0F)) 〈〈x8,x0〉:〈x0,x0〉〉 〈〈x0,x0〉:〈x0,x0〉〉 ? (ex_to_recex xF) ]].
+ | false ⇒ div_w16_aux w (rol_w32_n 〈〈〈x0,x0〉:〈x0,x0〉〉.b〉 15) 〈〈x8,x0〉:〈x0,x0〉〉 〈〈x0,x0〉:〈x0,x0〉〉 15 ]].
(* operatore x in [inf,sup] *)
ndefinition inrange_w32 ≝