--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+(* ********************************************************************** *)
+(* Progetto FreeScale *)
+(* *)
+(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *)
+(* Sviluppo: 2008-2010 *)
+(* *)
+(* ********************************************************************** *)
+
+include "num/bool.ma".
+
+(* ********************************************** *)
+(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *)
+(* ********************************************** *)
+
+(* enumerazione delle istruzioni *)
+ninductive RS08_opcode: Type ≝
+ ADC : RS08_opcode (* add with carry *)
+| ADD : RS08_opcode (* add *)
+| AND : RS08_opcode (* and *)
+| ASL : RS08_opcode (* aritmetic shift left *)
+| BCC : RS08_opcode (* branch if C=0 *)
+| BCLRn : RS08_opcode (* clear bit n *)
+| BCS : RS08_opcode (* branch if C=1 *)
+| BEQ : RS08_opcode (* branch if Z=1 *)
+| BGND : RS08_opcode (* !!background mode!! *)
+| BNE : RS08_opcode (* branch if Z=0 *)
+| BRA : RS08_opcode (* branch always *)
+| BRCLRn : RS08_opcode (* branch if bit n clear *)
+| BRSETn : RS08_opcode (* branch if bit n set *)
+| BSETn : RS08_opcode (* set bit n *)
+| BSR : RS08_opcode (* branch to subroutine *)
+| CBEQA : RS08_opcode (* compare (A) and BEQ *)
+| CLC : RS08_opcode (* C=0 *)
+| CLR : RS08_opcode (* operand=0 *)
+| CMP : RS08_opcode (* flag = sub (compare A) *)
+| COM : RS08_opcode (* not (1 complement) *)
+| DBNZ : RS08_opcode (* dec and BNE *)
+| DEC : RS08_opcode (* operand=operand-1 (decrement) *)
+| EOR : RS08_opcode (* xor *)
+| INC : RS08_opcode (* operand=operand+1 (increment) *)
+| JMP : RS08_opcode (* jmp word [operand] *)
+| JSR : RS08_opcode (* jmp to subroutine *)
+| LDA : RS08_opcode (* load in A *)
+| LSR : RS08_opcode (* logical shift right *)
+| MOV : RS08_opcode (* move *)
+| NOP : RS08_opcode (* nop *)
+| ORA : RS08_opcode (* or *)
+| ROL : RS08_opcode (* rotate left *)
+| ROR : RS08_opcode (* rotate right *)
+| RTS : RS08_opcode (* return from subroutine *)
+| SBC : RS08_opcode (* sub with carry*)
+| SEC : RS08_opcode (* C=1 *)
+| SHA : RS08_opcode (* swap spc_high,A *)
+| SLA : RS08_opcode (* swap spc_low,A *)
+| STA : RS08_opcode (* store from A *)
+| STOP : RS08_opcode (* !!stop mode!! *)
+| SUB : RS08_opcode (* sub *)
+| WAIT : RS08_opcode (* !!wait mode!! *)
+.
+
+ndefinition eq_RS08_op ≝
+λop1,op2:RS08_opcode.
+ match op1 with
+ [ ADC ⇒ match op2 with [ ADC ⇒ true | _ ⇒ false ] | ADD ⇒ match op2 with [ ADD ⇒ true | _ ⇒ false ]
+ | AND ⇒ match op2 with [ AND ⇒ true | _ ⇒ false ] | ASL ⇒ match op2 with [ ASL ⇒ true | _ ⇒ false ]
+ | BCC ⇒ match op2 with [ BCC ⇒ true | _ ⇒ false ] | BCLRn ⇒ match op2 with [ BCLRn ⇒ true | _ ⇒ false ]
+ | BCS ⇒ match op2 with [ BCS ⇒ true | _ ⇒ false ] | BEQ ⇒ match op2 with [ BEQ ⇒ true | _ ⇒ false ]
+ | BGND ⇒ match op2 with [ BGND ⇒ true | _ ⇒ false ] | BNE ⇒ match op2 with [ BNE ⇒ true | _ ⇒ false ]
+ | BRA ⇒ match op2 with [ BRA ⇒ true | _ ⇒ false ] | BRCLRn ⇒ match op2 with [ BRCLRn ⇒ true | _ ⇒ false ]
+ | BRSETn ⇒ match op2 with [ BRSETn ⇒ true | _ ⇒ false ] | BSETn ⇒ match op2 with [ BSETn ⇒ true | _ ⇒ false ]
+ | BSR ⇒ match op2 with [ BSR ⇒ true | _ ⇒ false ] | CBEQA ⇒ match op2 with [ CBEQA ⇒ true | _ ⇒ false ]
+ | CLC ⇒ match op2 with [ CLC ⇒ true | _ ⇒ false ] | CLR ⇒ match op2 with [ CLR ⇒ true | _ ⇒ false ]
+ | CMP ⇒ match op2 with [ CMP ⇒ true | _ ⇒ false ] | COM ⇒ match op2 with [ COM ⇒ true | _ ⇒ false ]
+ | DBNZ ⇒ match op2 with [ DBNZ ⇒ true | _ ⇒ false ] | DEC ⇒ match op2 with [ DEC ⇒ true | _ ⇒ false ]
+ | EOR ⇒ match op2 with [ EOR ⇒ true | _ ⇒ false ] | INC ⇒ match op2 with [ INC ⇒ true | _ ⇒ false ]
+ | JMP ⇒ match op2 with [ JMP ⇒ true | _ ⇒ false ] | JSR ⇒ match op2 with [ JSR ⇒ true | _ ⇒ false ]
+ | LDA ⇒ match op2 with [ LDA ⇒ true | _ ⇒ false ] | LSR ⇒ match op2 with [ LSR ⇒ true | _ ⇒ false ]
+ | MOV ⇒ match op2 with [ MOV ⇒ true | _ ⇒ false ] | NOP ⇒ match op2 with [ NOP ⇒ true | _ ⇒ false ]
+ | ORA ⇒ match op2 with [ ORA ⇒ true | _ ⇒ false ] | ROL ⇒ match op2 with [ ROL ⇒ true | _ ⇒ false ]
+ | ROR ⇒ match op2 with [ ROR ⇒ true | _ ⇒ false ] | RTS ⇒ match op2 with [ RTS ⇒ true | _ ⇒ false ]
+ | SBC ⇒ match op2 with [ SBC ⇒ true | _ ⇒ false ] | SEC ⇒ match op2 with [ SEC ⇒ true | _ ⇒ false ]
+ | SHA ⇒ match op2 with [ SHA ⇒ true | _ ⇒ false ] | SLA ⇒ match op2 with [ SLA ⇒ true | _ ⇒ false ]
+ | STA ⇒ match op2 with [ STA ⇒ true | _ ⇒ false ] | STOP ⇒ match op2 with [ STOP ⇒ true | _ ⇒ false ]
+ | SUB ⇒ match op2 with [ SUB ⇒ true | _ ⇒ false ] | WAIT ⇒ match op2 with [ WAIT ⇒ true | _ ⇒ false ]
+ ].
+
+(* iteratore sugli opcode *)
+ndefinition forall_RS08_op ≝ λP:RS08_opcode → bool.
+ P ADC ⊗ P ADD ⊗ P AND ⊗ P ASL ⊗ P BCC ⊗ P BCLRn ⊗ P BCS ⊗ P BEQ ⊗
+ P BGND ⊗ P BNE ⊗ P BRA ⊗ P BRCLRn ⊗ P BRSETn ⊗ P BSETn ⊗ P BSR ⊗ P CBEQA ⊗
+ P CLC ⊗ P CLR ⊗ P CMP ⊗ P COM ⊗ P DBNZ ⊗ P DEC ⊗ P EOR ⊗ P INC ⊗
+ P JMP ⊗ P JSR ⊗ P LDA ⊗ P LSR ⊗ P MOV ⊗ P NOP ⊗ P ORA ⊗ P ROL ⊗
+ P ROR ⊗ P RTS ⊗ P SBC ⊗ P SEC ⊗ P SHA ⊗ P SLA ⊗ P STA ⊗ P STOP ⊗
+ P SUB ⊗ P WAIT.