| false ⇒ mk_word16 wh' wl' ]]].
(* operatore rotazione destra n-volte *)
-nlet rec ror_w16_n (w:word16) (n:exadecim) (r:rec_exadecim n) on r ≝
- match r with
- [ ex_O ⇒ w
- | ex_S t n' ⇒ ror_w16_n (ror_w16 w) t n' ].
+nlet rec ror_w16_n (w:word16) (n:nat) on n ≝
+ match n with
+ [ O ⇒ w
+ | S n' ⇒ ror_w16_n (ror_w16 w) n' ].
(* operatore rotazione sinistra con carry *)
ndefinition rcl_w16 ≝
| false ⇒ mk_word16 wh' wl' ]]].
(* operatore rotazione sinistra n-volte *)
-nlet rec rol_w16_n (w:word16) (n:exadecim) (r:rec_exadecim n) on r ≝
- match r with
- [ ex_O ⇒ w
- | ex_S t n' ⇒ rol_w16_n (rol_w16 w) t n' ].
+nlet rec rol_w16_n (w:word16) (n:nat) on n ≝
+ match n with
+ [ O ⇒ w
+ | S n' ⇒ rol_w16_n (rol_w16 w) n' ].
(* operatore not/complemento a 1 *)
ndefinition not_w16 ≝
]]]]]].
(* divisione senza segno (secondo la logica delle ALU): (quoziente resto) overflow *)
-nlet rec div_b8_aux (divd:word16) (divs:word16) (molt:byte8) (q:byte8) (c:oct) (rc:rec_oct c) on rc ≝
+nlet rec div_b8_aux (divd:word16) (divs:word16) (molt:byte8) (q:byte8) (c:nat) on c ≝
let w' ≝ plus_w16_d_d divd (compl_w16 divs) in
- match rc with
- [ oc_O ⇒ match le_w16 divs divd with
+ match c with
+ [ O ⇒ match le_w16 divs divd with
[ true ⇒ triple … (or_b8 molt q) (w16l w') (⊖ (eq_b8 (w16h w') 〈x0,x0〉))
| false ⇒ triple … q (w16l divd) (⊖ (eq_b8 (w16h divd) 〈x0,x0〉)) ]
- | oc_S t c' ⇒ match le_w16 divs divd with
- [ true ⇒ div_b8_aux w' (ror_w16 divs) (ror_b8 molt) (or_b8 molt q) t c'
- | false ⇒ div_b8_aux divd (ror_w16 divs) (ror_b8 molt) q t c' ]].
+ | S c' ⇒ match le_w16 divs divd with
+ [ true ⇒ div_b8_aux w' (ror_w16 divs) (ror_b8 molt) (or_b8 molt q) c'
+ | false ⇒ div_b8_aux divd (ror_w16 divs) (ror_b8 molt) q c' ]].
ndefinition div_b8 ≝
λw:word16.λb:byte8.match eq_b8 b 〈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_b8_aux w (rol_w16_n 〈〈x0,x0〉:b〉 ? (ex_to_recex x7)) 〈x8,x0〉 〈x0,x0〉 ? (oct_to_recoct o7) ]].
+ | false ⇒ div_b8_aux w (rol_w16_n 〈〈x0,x0〉:b〉 7) 〈x8,x0〉 〈x0,x0〉 7 ]].
(* operatore x in [inf,sup] *)
ndefinition inrange_w16 ≝