]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/ng_assembly/emulator/translation/RS08_translation.ma
freescale porting
[helm.git] / helm / software / matita / contribs / ng_assembly / emulator / translation / RS08_translation.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 "emulator/translation/translation_base.ma".
24
25 (* ******************************************************* *)
26 (* TRADUZIONE MCU+OPCODE+MODALITA'+ARGOMENTI → ESADECIMALE *)
27 (* ******************************************************* *)
28
29 (* introduzione di un tipo dipendente (dalla modalita') per gli argomenti *)
30 ninductive RS08_MA_check : RS08_instr_mode → Type ≝
31   maINH              : RS08_MA_check MODE_INH
32 | maINHA             : RS08_MA_check MODE_INHA
33 | maIMM1             : byte8  → RS08_MA_check MODE_IMM1
34 | maIMM2             : word16 → RS08_MA_check MODE_IMM2
35 | maDIR1             : byte8  → RS08_MA_check MODE_DIR1
36 | maDIR1_to_DIR1     : byte8 → byte8 → RS08_MA_check MODE_DIR1_to_DIR1
37 | maIMM1_to_DIR1     : byte8 → byte8 → RS08_MA_check MODE_IMM1_to_DIR1
38 | maINHA_and_IMM1    : byte8 → RS08_MA_check MODE_INHA_and_IMM1
39 | maIMM1_and_IMM1    : byte8 → byte8 → RS08_MA_check MODE_IMM1_and_IMM1
40 | maDIR1_and_IMM1    : byte8 → byte8 → RS08_MA_check MODE_DIR1_and_IMM1
41 | maDIRn             : ∀n.byte8 → RS08_MA_check (MODE_DIRn n)
42 | maDIRn_and_IMM1    : ∀n.byte8 → byte8 → RS08_MA_check (MODE_DIRn_and_IMM1 n)
43 | maTNY              : ∀e.RS08_MA_check (MODE_TNY e)
44 | maSRT              : ∀t.RS08_MA_check (MODE_SRT t)
45 .
46
47 (* picker: trasforma l'argomento necessario in input a bytes_of_pseudo_instr_mode_param:
48    MA_check i → list (t_byte8 m) *)
49 ndefinition RS08_args_picker ≝
50 λi:aux_im_type RS08.λargs:RS08_MA_check i.
51  match args with
52   (* inherent: legale se nessun operando *) 
53   [ maINH    ⇒ nil ? 
54   | maINHA   ⇒ nil ? 
55   (* _0/1/2: legale se nessun operando/1 byte/1 word *)
56   | maIMM1 b ⇒ [ TByte RS08 b ]
57   | maIMM2 w ⇒ [ TByte RS08 (cnH ? w); TByte RS08 (cnL ? w) ]
58   | maDIR1 b ⇒ [ TByte RS08 b ]
59   (* movimento: legale se 2 operandi byte *)
60   | maDIR1_to_DIR1 b1 b2  ⇒ [ TByte RS08 b1 ; TByte RS08 b2 ]
61   | maIMM1_to_DIR1 b1 b2  ⇒ [ TByte RS08 b1 ; TByte RS08 b2 ]
62   (* cbeq/dbnz: legale se 1/2 operandi byte *)
63   | maINHA_and_IMM1 b     ⇒ [ TByte RS08 b]
64   | maIMM1_and_IMM1 b1 b2 ⇒ [ TByte RS08 b1 ; TByte RS08 b2 ]
65   | maDIR1_and_IMM1 b1 b2 ⇒ [ TByte RS08 b1 ; TByte RS08 b2 ]
66   (* DIRn: legale se 1 operando byte *)
67   | maDIRn _ b ⇒ [ TByte RS08 b]
68   (* DIRn_and_IMM1: legale se 2 operandi byte *)
69   | maDIRn_and_IMM1 _ b1 b2 ⇒ [ TByte RS08 b1 ; TByte RS08 b2 ]
70   (* TNY: legale se nessun operando *)
71   | maTNY _ ⇒ nil ?
72   (* SRT: legale se nessun operando *)
73   | maSRT _ ⇒ nil ?
74   ].