1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 (* ********************************************************************** *)
16 (* Progetto FreeScale *)
18 (* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *)
19 (* Sviluppo: 2008-2010 *)
21 (* ********************************************************************** *)
23 include "num/word16.ma".
25 (* *********************************** *)
26 (* STATUS INTERNO DEL PROCESSORE (ALU) *)
27 (* *********************************** *)
30 nrecord alu_HC05: Type ≝
32 (* A: registo accumulatore *)
33 acc_low_reg_HC05 : byte8;
34 (* X: registro indice *)
35 indX_low_reg_HC05 : byte8;
36 (* SP: registo stack pointer *)
38 (* modificatori di SP: per esempio e' definito come 0000000011xxxxxxb *)
39 (* la logica della sua costruzione e' quindi (SP∧mask)∨fix *)
40 (* totalmente racchiusa nella ALU, bastera' fare get(set(SP)) *)
41 sp_mask_HC05 : word16;
43 (* PC: registro program counter *)
45 (* modificatore di PC: per esempio e' definito come 00xxxxxxxxxxxxxxb *)
46 (* la logica della sua costruzione e' quindi (PC∧mask) *)
47 (* totalmente racchiusa nella ALU, bastera' fare get(set(PC)) *)
48 pc_mask_HC05 : word16;
50 (* H: flag semi-carry (somma nibble basso) *)
52 (* I: flag mascheramento degli interrupt mascherabili: 1=mascherati *)
54 (* N: flag segno/negativita' *)
61 (* IRQ: flag che simula il pin esterno IRQ *)
65 notation "{hvbox('A_Reg' ≝ acclow ; break 'X_Reg' ≝ indxlow ; break 'Sp_Reg' ≝ sp ; break 'Sp_Mask' ≝ spm ; break 'Sp_Fix' ≝ spf ; break 'Pc_Reg' ≝ pc ; break 'Pc_Mask' ≝ pcm ; break 'H_Flag' ≝ hfl ; break 'I_Flag' ≝ ifl ; break 'N_Flag' ≝ nfl ; break 'Z_Flag' ≝ zfl ; break 'C_Flag' ≝ cfl ; break 'IRQ_Flag' ≝ irqfl)}"
66 non associative with precedence 80 for
67 @{ 'mk_alu_HC05 $acclow $indxlow $sp $spm $spf $pc $pcm $hfl $ifl $nfl $zfl $cfl $irqfl }.
68 interpretation "mk_alu_HC05" 'mk_alu_HC05 acclow indxlow sp spm spf pc pcm hfl ifl nfl zfl cfl irqfl =
69 (mk_alu_HC05 acclow indxlow sp spm spf pc pcm hfl ifl nfl zfl cfl irqfl).
71 (* ***************** *)
72 (* CONFRONTO FRA ALU *)
73 (* ***************** *)
75 (* confronto registro per registro dell'HC05 *)
76 ndefinition eq_HC05_alu ≝
78 (eq_b8 (acc_low_reg_HC05 alu1) (acc_low_reg_HC05 alu2)) ⊗
79 (eq_b8 (indX_low_reg_HC05 alu1) (indX_low_reg_HC05 alu2)) ⊗
80 (eq_w16 (sp_reg_HC05 alu1) (sp_reg_HC05 alu2)) ⊗
81 (eq_w16 (sp_mask_HC05 alu1) (sp_mask_HC05 alu2)) ⊗
82 (eq_w16 (sp_fix_HC05 alu1) (sp_fix_HC05 alu2)) ⊗
83 (eq_w16 (pc_reg_HC05 alu1) (pc_reg_HC05 alu2)) ⊗
84 (eq_w16 (pc_mask_HC05 alu1) (pc_mask_HC05 alu2)) ⊗
85 (eq_bool (h_flag_HC05 alu1) (h_flag_HC05 alu2)) ⊗
86 (eq_bool (i_flag_HC05 alu1) (i_flag_HC05 alu2)) ⊗
87 (eq_bool (n_flag_HC05 alu1) (n_flag_HC05 alu2)) ⊗
88 (eq_bool (z_flag_HC05 alu1) (z_flag_HC05 alu2)) ⊗
89 (eq_bool (c_flag_HC05 alu1) (c_flag_HC05 alu2)) ⊗
90 (eq_bool (irq_flag_HC05 alu1) (irq_flag_HC05 alu2)).