]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/emulator/opcodes/IP2022_instr_mode.ma
freescale porting
[helm.git] / helm / software / matita / contribs / ng_assembly / emulator / opcodes / IP2022_instr_mode.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 (* ********************************************************************** *)
16 (*                          Progetto FreeScale                            *)
17 (*                                                                        *)
18 (*   Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it              *)
19 (*   Sviluppo: 2008-2010                                                  *)
20 (*                                                                        *)
21 (* ********************************************************************** *)
22
23 include "num/word16.ma".
24
25 (* ********************************************** *)
26 (* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *)
27 (* ********************************************** *)
28
29 (* enumerazione delle modalita' di indirizzamento = caricamento degli operandi *)
30 ninductive IP2022_instr_mode: Type ≝
31   (* nessun operando : formato xxxxxxxx xxxxxxxx *)
32   MODE_INH  : IP2022_instr_mode
33
34   (* #lit3 → / : formato xxxxxxxx xxxxxkkk *)
35 | MODE_IMM3 : oct → IP2022_instr_mode
36   (* W, #lit8 → W : formato xxxxxxxx kkkkkkkk [load 1 byte arg] *)
37 | MODE_IMM8 : IP2022_instr_mode
38   (* #lit13 → / : formato xxxkkkkk kkkkkkkk [load 1 byte arg] *)
39 | MODE_IMM13 : bitrigesim → IP2022_instr_mode
40
41   (* FR, W → FR : formato xxxxxxx0 ffffffff [load 1 byte arg] *)
42 | MODE_FR0_and_W : IP2022_instr_mode
43   (* FR, W → FR : formato xxxxxxx1 ffffffff [load 1 byte arg] *)
44 | MODE_FR1_and_W : IP2022_instr_mode
45   (* W, FR → W : formato xxxxxxx0 ffffffff [load 1 byte arg] *)
46 | MODE_W_and_FR0 : IP2022_instr_mode
47   (* W, FR → W : formato xxxxxxx1 ffffffff [load 1 byte arg] *)
48 | MODE_W_and_FR1 : IP2022_instr_mode
49
50   (* FR(bitN) → FR(bitN) : formato xxxxbbb0 ffffffff [load 1 byte arg] *)
51 | MODE_FR0n : oct → IP2022_instr_mode
52   (* FR(bitN) → FR(bitN) : formato xxxxbbb1 ffffffff [load 1 byte arg] *)
53 | MODE_FR1n : oct → IP2022_instr_mode
54 .
55
56 ndefinition eq_IP2022_im ≝
57 λi1,i2:IP2022_instr_mode.
58  match i1 with
59   [ MODE_INH ⇒ match i2 with [ MODE_INH ⇒ true | _ ⇒ false ]
60   | MODE_IMM3 o1 ⇒ match i2 with [ MODE_IMM3 o2 ⇒ eq_oct o1 o2 | _ ⇒ false ]
61   | MODE_IMM8 ⇒ match i2 with [ MODE_IMM8 ⇒ true | _ ⇒ false ]
62   | MODE_IMM13 t1 ⇒ match i2 with [ MODE_IMM13 t2 ⇒ eq_bit t1 t2 | _ ⇒ false ]
63   | MODE_FR0_and_W ⇒ match i2 with [ MODE_FR0_and_W ⇒ true | _ ⇒ false ]
64   | MODE_FR1_and_W ⇒ match i2 with [ MODE_FR1_and_W ⇒ true | _ ⇒ false ]
65   | MODE_W_and_FR0 ⇒ match i2 with [ MODE_W_and_FR0 ⇒ true | _ ⇒ false ]
66   | MODE_W_and_FR1 ⇒ match i2 with [ MODE_W_and_FR1 ⇒ true | _ ⇒ false ]
67   | MODE_FR0n o1 ⇒ match i2 with [ MODE_FR0n o2 ⇒ eq_oct o1 o2 | _ ⇒ false ]
68   | MODE_FR1n o1 ⇒ match i2 with [ MODE_FR1n o2 ⇒ eq_oct o1 o2 | _ ⇒ false ]
69   ].
70
71 (* iteratore sulle modalita' *)
72 ndefinition forall_IP2022_im ≝ λP:IP2022_instr_mode → bool.
73   P MODE_INH
74 ⊗ forall_oct (λo.P (MODE_IMM3 o))
75 ⊗ P MODE_IMM8
76 ⊗ forall_bit (λt.P (MODE_IMM13 t))
77 ⊗ P MODE_FR0_and_W
78 ⊗ P MODE_FR1_and_W
79 ⊗ P MODE_W_and_FR0
80 ⊗ P MODE_W_and_FR1
81 ⊗ forall_oct (λo.P (MODE_FR0n o))
82 ⊗ forall_oct (λo.P (MODE_FR1n o)).