Changeset 146 for Deliverables/D4.1
 Timestamp:
 Sep 30, 2010, 3:27:15 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Deliverables/D4.1/Pretty.ml
r138 r146 1 1 open BitVectors;; 2 2 open ASM;; 3 4 let pp_arg = 5 function 6 `A > "A" 7  `B > "B" 8  `C > "C" 9  `DPTR > "DPTR" 10  `ADDR11 x > "addr11" 11  `ADDR16 x > "addr16" 12  `DATA x > "data" 13  `DATA16 x > "data16" 14  `BIT x > "bit" 15  `NBIT x > "nbit" 16  `REG x > "reg" 17  `REL x > "rel" 18  `A_DPTR > "@DPTR" 19  `A_PC > "@PC" 20  `DIRECT x > "direct" 21  `EXT_INDIRECT x > "ext_indirect" 22  `EXT_IND_DPTR > "ext_indirect_dptr" 23  `INDIRECT x > "indirect" 24  `IND_DPTR > "ind_dptr" 25 ;; 3 26 4 27 let pp_instruction = … … 8 31  `Jmp j > "Jump: " ^ j 9 32  `Call j > "Call: " ^ j 10  `ACALL (`ADDR11 w) > 11 "ACALL addr11 (" ^ string_of_vect w ^ ")" 12  `ADD (`A,`REG (r1,r2,r3)) > 13 "ADD `A `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 14  `ADD (`A, `DIRECT b1) > 15 "ADD `A direct (" ^ string_of_vect b1 ^ ")" 16  `ADD (`A, `INDIRECT i1) > 17 "ADD `A @Ri (" ^ string_of_bit i1 ^ ")" 18  `ADD (`A, `DATA b1) > 19 "ADD `A #data (" ^ string_of_vect b1 ^ ")" 20  `ADDC (`A, `REG(r1,r2,r3)) > 21 "ADDC `A `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 22  `ADDC (`A, `DIRECT b1) > 23 "ADDC `A direct (" ^ string_of_vect b1 ^ ")" 24  `ADDC (`A,`INDIRECT i1) > 25 "ADDC `A @Ri (" ^ string_of_bit i1 ^ ")" 26  `ADDC (`A,`DATA b1) > 27 "ADDC `A #data (" ^ string_of_vect b1 ^ ")" 28  `AJMP (`ADDR11 w) > 29 "AJMP addr11 (" ^ string_of_vect w ^ ")" 30  `ANL (`U1 (`A, `REG (r1,r2,r3))) > 31 "ANL `A `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 32  `ANL (`U1 (`A, `DIRECT b1)) > 33 "ANL `A direct (" ^ string_of_vect b1 ^ ")" 34  `ANL (`U1 (`A, `INDIRECT i1)) > 35 "ANL `A @Ri (" ^ string_of_bit i1 ^ ")" 36  `ANL (`U1 (`A, `DATA b1)) > 37 "ANL `A #data (" ^ string_of_vect b1 ^ ")" 38  `ANL (`U2 (`DIRECT b1,`A)) > 39 "ANL direct `A (" ^ string_of_vect b1 ^ ")" 40  `ANL (`U2 (`DIRECT b1,`DATA b2)) > 41 "ANL direct #data (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 42  `ANL (`U3 (`C,`BIT b1)) > 43 "ANL `C bit (" ^ string_of_vect b1 ^ ")" 44  `ANL (`U3 (`C,`NBIT b1)) > 45 "ANL `C /bit (" ^ string_of_vect b1 ^ ")" 46  `CJNE (`U1 (`A, `DIRECT b1), `REL b2) > 47 "CJNE `A direct rel (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 48  `CJNE (`U1 (`A, `DATA b1), `REL b2) > 49 "CJNE `A #data rel (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 50  `CJNE (`U2 (`REG(r1,r2,r3), `DATA b1), `REL b2) > 51 "CJNE `Rn #data rel (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 52  `CJNE (`U2 (`INDIRECT i1, `DATA b1), `REL b2) > 53 "CJNE @Ri #data rel (" ^ string_of_bit i1 ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 54  `CLR `A > "CLR `A" 55  `CLR `C > "CLR `C" 56  `CLR (`BIT b1) > "CLR bit (" ^ string_of_vect b1 ^ ")" 57  `CPL `A > "CPL A" 58  `CPL `C > "CPL C" 59  `CPL (`BIT b1) > "CPL bit (" ^ string_of_vect b1 ^ ")" 60  `DA `A > 61 "DA `A" 62  `DEC `A > 63 "DEC `A" 64  `DEC (`REG(r1,r2,r3)) > 65 "DEC `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 66  `DEC (`DIRECT b1) > 67 "DEC direct (" ^ string_of_vect b1 ^ ")" 68  `DEC (`INDIRECT i1) > 69 "DEC @Ri (" ^ string_of_bit i1 ^ ")" 70  `DIV (`A, `B) > 71 "DIV `A `B" 72  `DJNZ (`REG(r1,r2,r3), `REL b1) > 73 "DJNZ `Rn rel (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ string_of_vect b1 ^ ")" 74  `DJNZ (`DIRECT b1, `REL b2) > 75 "DJNZ direct rel (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 76  `INC `A > 77 "INC `A" 78  `INC (`REG(r1,r2,r3)) > 79 "INC `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 80  `INC (`DIRECT b1) > 81 "INC direct (" ^ string_of_vect b1 ^ ")" 82  `INC (`INDIRECT i1) > 83 "INC @Ri (" ^ string_of_bit i1 ^ ")" 84  `INC `DPTR > 85 "INC `DPTR" 86  `JB (`BIT b1, `REL b2) > 87 "JB bit rel (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 88  `JBC (`BIT b1, `REL b2) > 89 "JBC bit rel (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 90  `JC (`REL b1) > 91 "JC rel (" ^ string_of_vect b1 ^ ")" 92  `JMP `IND_DPTR > 93 "JMP @A + `DPTR" 94  `JNB (`BIT b1, `REL b2) > 95 "JNB bit rel (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 96  `JNC (`REL b1) > 97 "JNC rel (" ^ string_of_vect b1 ^ ")" 98  `JNZ (`REL b1) > 99 "JNZ rel (" ^ string_of_vect b1 ^ ")" 100  `JZ (`REL b1) > 101 "JZ rel (" ^ string_of_vect b1 ^ ")" 102  `LCALL (`ADDR16 w) > 103 "LCALL addr16 (" ^ string_of_vect w ^ ")" 104  `LJMP (`ADDR16 w) > 105 "LJMP addr16 (" ^ string_of_vect w ^ ")" 106  `MOV (`U1 (`A, `REG(r1,r2,r3))) > 107 "MOV `A `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 108  `MOV (`U1 (`A, `DIRECT b1)) > 109 "MOV `A direct (" ^ string_of_vect b1 ^ ")" 110  `MOV (`U1 (`A, `INDIRECT i1)) > 111 "MOV `A @Ri (" ^ string_of_bit i1 ^ ")" 112  `MOV (`U1 (`A, `DATA b1)) > 113 "MOV `A #data (" ^ string_of_vect b1 ^ ")" 114  `MOV (`U2 (`REG(r1,r2,r3), `A)) > 115 "MOV `Rn `A (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 116  `MOV (`U2 (`REG(r1,r2,r3), (`DIRECT b1))) > 117 "MOV `Rn direct (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 118  `MOV (`U2 (`REG(r1,r2,r3), (`DATA b1))) > 119 "MOV `Rn #data (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 120  `MOV (`U3 (`DIRECT b1, `A)) > 121 "MOV direct `A (" ^ string_of_vect b1 ^ ")" 122  `MOV (`U3 (`DIRECT b1, `REG(r1,r2,r3))) > 123 "MOV direct `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 124  `MOV (`U3 (`DIRECT b1, `DIRECT b2)) > 125 "MOV direct direct (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 126  `MOV (`U3 (`DIRECT b1, `INDIRECT i1)) > 127 "MOV direct @Ri (" ^ string_of_vect b1 ^ string_of_bit i1 ^ ")" 128  `MOV (`U3 (`DIRECT b1, `DATA b2)) > 129 "MOV direct #data (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 130  `MOV (`U2 (`INDIRECT i1, `A)) > 131 "MOV @Ri `A (" ^ string_of_bit i1 ^ ")" 132  `MOV (`U2 (`INDIRECT i1, `DIRECT b1)) > 133 "MOV @Ri direct (" ^ string_of_bit i1 ^ string_of_vect b1 ^ ")" 134  `MOV (`U2 (`INDIRECT i1, `DATA b1)) > 135 "MOV @Ri #data (" ^ string_of_bit i1 ^ string_of_vect b1 ^ ")" 136  `MOV (`U5 (`C, `BIT b1)) > 137 "MOV `C bit (" ^ string_of_vect b1 ^ ")" 138  `MOV (`U6 (`BIT b1, `C)) > 139 "MOV bit `C (" ^ string_of_vect b1 ^ ")" 140  `MOV (`U4 (`DPTR, `DATA16 w)) > 141 "MOV `DPTR #data16 (" ^ string_of_vect w ^ ")" 142  `MOVC (`A, `A_DPTR) > 143 "MOVC `A @A + `DPTR" 144  `MOVC (`A, `A_PC) > 145 "MOVC `A @A + `PC" 146  `MOVX (`U1 (`A, `EXT_INDIRECT i1)) > 147 "MOVX `A @Ri (" ^ string_of_bit i1 ^ ")" 148  `MOVX (`U1 (`A, `EXT_IND_DPTR)) > 149 "MOVX `A @DPTR" 150  `MOVX (`U2 (`EXT_INDIRECT i1, `A)) > 151 "MOVX @Ri `A ( " ^ string_of_bit i1 ^ ")" 152  `MOVX (`U2 (`EXT_IND_DPTR, `A)) > 153 "MOVX @DPTR `A" 154  `MUL(`A, `B) > 155 "MUL `A `B" 156  `NOP > 157 "NOP" 158  `ORL (`U1(`A, `REG(r1,r2,r3))) > 159 "ORL `A `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 160  `ORL (`U1(`A, `DIRECT b1)) > 161 "ORL `A direct (" ^ string_of_vect b1 ^ ")" 162  `ORL (`U1(`A, `INDIRECT i1)) > 163 "ORL `A @Ri (" ^ string_of_bit i1 ^ ")" 164  `ORL (`U1(`A, `DATA b1)) > 165 "ORL `A #data (" ^ string_of_vect b1 ^ ")" 166  `ORL (`U2(`DIRECT b1, `A)) > 167 "ORL direct `A (" ^ string_of_vect b1 ^ ")" 168  `ORL (`U2 (`DIRECT b1, `DATA b2)) > 169 "ORL direct #data (" ^ string_of_vect b1 ^ string_of_vect b2 ^ ")" 170  `ORL (`U3 (`C, `BIT b1)) > 171 "ORL `C bit (" ^ string_of_vect b1 ^ ")" 172  `ORL (`U3 (`C, `NBIT b1)) > 173 "ORL `C \\bit (" ^ string_of_vect b1 ^ ")" 174  `POP (`DIRECT b1) > 175 "POP direct (" ^ string_of_vect b1 ^ ")" 176  `PUSH (`DIRECT b1) > 177 "PUSH direct (" ^ string_of_vect b1 ^ ")" 178  `RET > 179 "RET" 180  `RETI > 181 "RETI" 182  `RL `A > 183 "RL `A" 184  `RLC `A > 185 "RLC `A" 186  `RR `A > 187 "RR `A" 188  `RRC `A > 189 "RRC `A" 190  `SETB `C > 191 "SETB `C" 192  `SETB (`BIT b1) > 193 "SETB bit (" ^ string_of_vect b1 ^ ")" 194  `SJMP (`REL b1) > 195 "SJMP rel (" ^ string_of_vect b1 ^ ")" 196  `SUBB (`A, `REG(r1,r2,r3)) > 197 "SUBB `A `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 198  `SUBB (`A, `DIRECT b1) > 199 "SUBB `A direct (" ^ string_of_vect b1 ^ ")" 200  `SUBB (`A, `INDIRECT i1) > 201 "SUBB `A @Ri (" ^ string_of_bit i1 ^ ")" 202  `SUBB (`A, `DATA b1) > 203 "SUBB `A #data (" ^ string_of_vect b1 ^ ")" 204  `SWAP `A > 205 "SWAP `A" 206  `XCH (`A, `REG(r1,r2,r3)) > 207 "XCH `A `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 208  `XCH (`A, `DIRECT b1) > 209 "XCH `A direct (" ^ string_of_vect b1 ^ ")" 210  `XCH (`A, `INDIRECT i1) > 211 "XCH `A @Ri (" ^ string_of_bit i1 ^ ")" 212  `XCHD(`A, `INDIRECT i1) > 213 "XCHD `A @Ri (" ^ string_of_bit i1 ^ ")" 214  `XRL(`U1(`A, `REG(r1,r2,r3))) > 215 "XRL `A `Rn (" ^ string_of_bit r1 ^ string_of_bit r2 ^ string_of_bit r3 ^ ")" 216  `XRL(`U1(`A, `DIRECT b1)) > 217 "XRL `A direct (" ^ string_of_vect b1 ^ ")" 218  `XRL(`U1(`A, `INDIRECT i1)) > 219 "XRL `A @Ri (" ^ string_of_bit i1 ^ ")" 220  `XRL(`U1(`A, `DATA b1)) > 221 "XRL `A #data (" ^ string_of_vect b1 ^ ")" 222  `XRL(`U2(`DIRECT b1, `A)) > 223 "XRL direct `A (" ^ string_of_vect b1 ^ ")" 224  `XRL(`U2(`DIRECT b1, `DATA b2)) > 225 "XRL direct #data (" ^ string_of_vect b2 ^ ")" 33  `ACALL a1 > "acall " ^ pp_arg a1 34  `ADD (a1,a2) > "add " ^ pp_arg a1 ^ " " ^ pp_arg a2 35  `ADDC (a1,a2) > "addc " ^ pp_arg a1 ^ " " ^ pp_arg a2 36  `AJMP a1 > "ajmp " ^ pp_arg a1 37  `ANL (`U1 (a1,a2)) > "anl " ^ pp_arg a1 ^ " " ^ pp_arg a2 38  `ANL (`U2 (a1,a2)) > "anl " ^ pp_arg a1 ^ " " ^ pp_arg a2 39  `ANL (`U3 (a1,a2)) > "anl " ^ pp_arg a1 ^ " " ^ pp_arg a2 40  `CJNE (`U1 (a1,a2),a3) > "cjne " ^ pp_arg a1 ^ " " ^ pp_arg a2 ^ " " ^ pp_arg a3 41  `CJNE (`U2 (a1,a2),a3) > "cjne " ^ pp_arg a1 ^ " " ^ pp_arg a2 ^ " " ^ pp_arg a3 42  `CLR a1 > "clr " ^ pp_arg a1 43  `CPL a1 > "cpl " ^ pp_arg a1 44  `DA a1 > "da " ^ pp_arg a1 45  `DEC a1 > "dec " ^ pp_arg a1 46  `DIV (a1,a2) > "div " ^ pp_arg a1 ^ " " ^ pp_arg a2 47  `DJNZ (a1,a2) > "djnz " ^ pp_arg a1 ^ " " ^ pp_arg a2 48  `INC a1 > "inc " ^ pp_arg a1 49  `JB (a1,a2) > "jb " ^ pp_arg a1 ^ " " ^ pp_arg a2 50  `JBC (a1,a2) > "jbc " ^ pp_arg a1 ^ " " ^ pp_arg a2 51  `JC a1 > "jc " ^ pp_arg a1 52  `JMP a1 > "jmp " ^ pp_arg a1 53  `JNB (a1,a2) > "jnb " ^ pp_arg a1 ^ " " ^ pp_arg a2 54  `JNC a1 > "jnc " ^ pp_arg a1 55  `JNZ a1 > "jnz " ^ pp_arg a1 56  `JZ a1 > "jz " ^ pp_arg a1 57  `LCALL a1 > "lcall " ^ pp_arg a1 58  `LJMP a1 > "ljmp " ^ pp_arg a1 59  `MOV (`U1 (a1,a2)) > "mov " ^ pp_arg a1 ^ " " ^ pp_arg a2 60  `MOV (`U2 (a1,a2)) > "mov " ^ pp_arg a1 ^ " " ^ pp_arg a2 61  `MOV (`U3 (a1,a2)) > "mov " ^ pp_arg a1 ^ " " ^ pp_arg a2 62  `MOV (`U4 (a1,a2)) > "mov " ^ pp_arg a1 ^ " " ^ pp_arg a2 63  `MOV (`U5 (a1,a2)) > "mov " ^ pp_arg a1 ^ " " ^ pp_arg a2 64  `MOV (`U6 (a1,a2)) > "mov " ^ pp_arg a1 ^ " " ^ pp_arg a2 65  `MOVC (a1,a2) > "movc " ^ pp_arg a1 ^ " " ^ pp_arg a2 66  `MOVX (`U1 (a1,a2)) > "movx " ^ pp_arg a1 ^ " " ^ pp_arg a2 67  `MOVX (`U2 (a1,a2)) > "movx " ^ pp_arg a1 ^ " " ^ pp_arg a2 68  `MUL(a1, a2) > "mul " ^ pp_arg a1 ^ " " ^ pp_arg a2 69  `NOP > "nop" 70  `ORL (`U1(a1,a2)) > "orl " ^ pp_arg a1 ^ " " ^ pp_arg a2 71  `ORL (`U2(a1,a2)) > "orl " ^ pp_arg a1 ^ " " ^ pp_arg a2 72  `ORL (`U3(a1,a2)) > "orl " ^ pp_arg a1 ^ " " ^ pp_arg a2 73  `POP a1 > "pop " ^ pp_arg a1 74  `PUSH a1 > "push " ^ pp_arg a1 75  `RET > "ret" 76  `RETI > "reti" 77  `RL a1 > "rl " ^ pp_arg a1 78  `RLC a1 > "rlc " ^ pp_arg a1 79  `RR a1 > "rr " ^ pp_arg a1 80  `RRC a1 > "rrc " ^ pp_arg a1 81  `SETB a1 > "setb " ^ pp_arg a1 82  `SJMP a1 > "sjmp " ^ pp_arg a1 83  `SUBB (a1,a2) > "subb " ^ pp_arg a1 ^ " " ^ pp_arg a2 84  `SWAP a1 > "swap " ^ pp_arg a1 85  `XCH (a1,a2) > "xch " ^ pp_arg a1 ^ " " ^ pp_arg a2 86  `XCHD(a1,a2) > "xchd " ^ pp_arg a1 ^ " " ^ pp_arg a2 87  `XRL(`U1(a1,a2)) > "xrl " ^ pp_arg a1 ^ " " ^ pp_arg a2 88  `XRL(`U2(a1,a2)) > "xrl " ^ pp_arg a1 ^ " " ^ pp_arg a2
Note: See TracChangeset
for help on using the changeset viewer.