]> matita.cs.unibo.it Git - helm.git/blob - matitaB/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_instr_mode_base.ma
mod change (-x)
[helm.git] / matitaB / matita / contribs / ng_assembly2 / emulator / opcodes / IP2022_instr_mode_base.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/oct.ma".
24 include "num/bitrigesim.ma".
25
26 (* ********************************************** *)
27 (* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *)
28 (* ********************************************** *)
29
30 (* enumerazione delle modalita' di indirizzamento = caricamento degli operandi *)
31 ninductive IP2022_instr_mode: Type ≝
32   (* nessun operando : formato xxxxxxxx xxxxxxxx *)
33   MODE_INH  : IP2022_instr_mode
34   (* operando implicito [ADDR] : formato xxxxxxxx xxxxxxxx *)
35 | MODE_INHADDR : IP2022_instr_mode
36   (* operando implicito [ADDR]/ADDR+=2 : formato xxxxxxxx xxxxxxxx *)
37 | MODE_INHADDRpp : IP2022_instr_mode
38
39   (* #lit3 → / : formato xxxxxxxx xxxxxkkk *)
40 | MODE_IMM3 : oct → IP2022_instr_mode
41   (* W, #lit8 → W : formato xxxxxxxx kkkkkkkk [load 1 byte arg] *)
42 | MODE_IMM8 : IP2022_instr_mode
43   (* #lit13 → / : formato xxxkkkkk kkkkkkkk [load 1 byte arg] *)
44 | MODE_IMM13 : bitrigesim → IP2022_instr_mode
45
46   (* FR, W → FR : formato xxxxxxx0 ffffffff [load 1 byte arg] *)
47 | MODE_FR0_and_W : IP2022_instr_mode
48   (* FR, W → FR : formato xxxxxxx1 ffffffff [load 1 byte arg] *)
49 | MODE_FR1_and_W : IP2022_instr_mode
50   (* W, FR → W : formato xxxxxxx0 ffffffff [load 1 byte arg] *)
51 | MODE_W_and_FR0 : IP2022_instr_mode
52   (* W, FR → W : formato xxxxxxx1 ffffffff [load 1 byte arg] *)
53 | MODE_W_and_FR1 : IP2022_instr_mode
54
55   (* FR(bitN) → FR(bitN) : formato xxxxbbb0 ffffffff [load 1 byte arg] *)
56 | MODE_FR0n : oct → IP2022_instr_mode
57   (* FR(bitN) → FR(bitN) : formato xxxxbbb1 ffffffff [load 1 byte arg] *)
58 | MODE_FR1n : oct → IP2022_instr_mode
59 .
60
61 ndefinition eq_IP2022_im ≝
62 λi1,i2:IP2022_instr_mode.
63  match i1 with
64   [ MODE_INH ⇒ match i2 with [ MODE_INH ⇒ true | _ ⇒ false ]
65   | MODE_INHADDR ⇒ match i2 with [ MODE_INHADDR ⇒ true | _ ⇒ false ]
66   | MODE_INHADDRpp ⇒ match i2 with [ MODE_INHADDRpp ⇒ true | _ ⇒ false ]
67   | MODE_IMM3 o1 ⇒ match i2 with [ MODE_IMM3 o2 ⇒ eqc ? o1 o2 | _ ⇒ false ]
68   | MODE_IMM8 ⇒ match i2 with [ MODE_IMM8 ⇒ true | _ ⇒ false ]
69   | MODE_IMM13 t1 ⇒ match i2 with [ MODE_IMM13 t2 ⇒ eqc ? t1 t2 | _ ⇒ false ]
70   | MODE_FR0_and_W ⇒ match i2 with [ MODE_FR0_and_W ⇒ true | _ ⇒ false ]
71   | MODE_FR1_and_W ⇒ match i2 with [ MODE_FR1_and_W ⇒ true | _ ⇒ false ]
72   | MODE_W_and_FR0 ⇒ match i2 with [ MODE_W_and_FR0 ⇒ true | _ ⇒ false ]
73   | MODE_W_and_FR1 ⇒ match i2 with [ MODE_W_and_FR1 ⇒ true | _ ⇒ false ]
74   | MODE_FR0n o1 ⇒ match i2 with [ MODE_FR0n o2 ⇒ eqc ? o1 o2 | _ ⇒ false ]
75   | MODE_FR1n o1 ⇒ match i2 with [ MODE_FR1n o2 ⇒ eqc ? o1 o2 | _ ⇒ false ]
76   ].
77
78 ndefinition forall_IP2022_im ≝ λP:IP2022_instr_mode → bool.
79   P MODE_INH
80 ⊗ P MODE_INHADDR
81 ⊗ P MODE_INHADDRpp
82 ⊗ forallc ? (λo.P (MODE_IMM3 o))
83 ⊗ P MODE_IMM8
84 ⊗ forallc ? (λt.P (MODE_IMM13 t))
85 ⊗ P MODE_FR0_and_W
86 ⊗ P MODE_FR1_and_W
87 ⊗ P MODE_W_and_FR0
88 ⊗ P MODE_W_and_FR1
89 ⊗ forallc ? (λo.P (MODE_FR0n o))
90 ⊗ forallc ? (λo.P (MODE_FR1n o)).