[2601] | 1 | open Preamble |
---|
| 2 | |
---|
[2649] | 3 | open String |
---|
| 4 | |
---|
[2601] | 5 | open LabelledObjects |
---|
| 6 | |
---|
[2717] | 7 | open BitVectorTrie |
---|
| 8 | |
---|
| 9 | open Exp |
---|
| 10 | |
---|
[2601] | 11 | open Arithmetic |
---|
| 12 | |
---|
| 13 | open Integers |
---|
| 14 | |
---|
| 15 | open AST |
---|
| 16 | |
---|
| 17 | open CostLabel |
---|
| 18 | |
---|
| 19 | open Proper |
---|
| 20 | |
---|
| 21 | open PositiveMap |
---|
| 22 | |
---|
| 23 | open Deqsets |
---|
| 24 | |
---|
[2649] | 25 | open ErrorMessages |
---|
| 26 | |
---|
[2601] | 27 | open PreIdentifiers |
---|
| 28 | |
---|
| 29 | open Errors |
---|
| 30 | |
---|
| 31 | open Extralib |
---|
| 32 | |
---|
| 33 | open Setoids |
---|
| 34 | |
---|
| 35 | open Monad |
---|
| 36 | |
---|
| 37 | open Option |
---|
| 38 | |
---|
| 39 | open Lists |
---|
| 40 | |
---|
| 41 | open Positive |
---|
| 42 | |
---|
| 43 | open Identifiers |
---|
| 44 | |
---|
| 45 | open Extranat |
---|
| 46 | |
---|
| 47 | open Vector |
---|
| 48 | |
---|
| 49 | open Div_and_mod |
---|
| 50 | |
---|
| 51 | open Jmeq |
---|
| 52 | |
---|
| 53 | open Russell |
---|
| 54 | |
---|
| 55 | open Types |
---|
| 56 | |
---|
| 57 | open List |
---|
| 58 | |
---|
| 59 | open Util |
---|
| 60 | |
---|
| 61 | open FoldStuff |
---|
| 62 | |
---|
| 63 | open Bool |
---|
| 64 | |
---|
| 65 | open Hints_declaration |
---|
| 66 | |
---|
| 67 | open Core_notation |
---|
| 68 | |
---|
| 69 | open Pts |
---|
| 70 | |
---|
| 71 | open Logic |
---|
| 72 | |
---|
| 73 | open Relations |
---|
| 74 | |
---|
| 75 | open Nat |
---|
| 76 | |
---|
| 77 | open BitVector |
---|
| 78 | |
---|
| 79 | open ASM |
---|
| 80 | |
---|
| 81 | open Status |
---|
| 82 | |
---|
| 83 | open Fetch |
---|
| 84 | |
---|
| 85 | open Sets |
---|
| 86 | |
---|
| 87 | open Listb |
---|
| 88 | |
---|
| 89 | open StructuredTraces |
---|
| 90 | |
---|
| 91 | (** val aSM_classify00 : |
---|
| 92 | 'a1 ASM.preinstruction -> StructuredTraces.status_class **) |
---|
| 93 | let aSM_classify00 = function |
---|
| 94 | | ASM.ADD (x, x0) -> StructuredTraces.Cl_other |
---|
| 95 | | ASM.ADDC (x, x0) -> StructuredTraces.Cl_other |
---|
| 96 | | ASM.SUBB (x, x0) -> StructuredTraces.Cl_other |
---|
| 97 | | ASM.INC x -> StructuredTraces.Cl_other |
---|
| 98 | | ASM.DEC x -> StructuredTraces.Cl_other |
---|
| 99 | | ASM.MUL (x, x0) -> StructuredTraces.Cl_other |
---|
| 100 | | ASM.DIV (x, x0) -> StructuredTraces.Cl_other |
---|
| 101 | | ASM.DA x -> StructuredTraces.Cl_other |
---|
| 102 | | ASM.JC x -> StructuredTraces.Cl_jump |
---|
| 103 | | ASM.JNC x -> StructuredTraces.Cl_jump |
---|
| 104 | | ASM.JB (x, x0) -> StructuredTraces.Cl_jump |
---|
| 105 | | ASM.JNB (x, x0) -> StructuredTraces.Cl_jump |
---|
| 106 | | ASM.JBC (x, x0) -> StructuredTraces.Cl_jump |
---|
| 107 | | ASM.JZ x -> StructuredTraces.Cl_jump |
---|
| 108 | | ASM.JNZ x -> StructuredTraces.Cl_jump |
---|
| 109 | | ASM.CJNE (x, x0) -> StructuredTraces.Cl_jump |
---|
| 110 | | ASM.DJNZ (x, x0) -> StructuredTraces.Cl_jump |
---|
| 111 | | ASM.ANL x -> StructuredTraces.Cl_other |
---|
| 112 | | ASM.ORL x -> StructuredTraces.Cl_other |
---|
| 113 | | ASM.XRL x -> StructuredTraces.Cl_other |
---|
| 114 | | ASM.CLR x -> StructuredTraces.Cl_other |
---|
| 115 | | ASM.CPL x -> StructuredTraces.Cl_other |
---|
| 116 | | ASM.RL x -> StructuredTraces.Cl_other |
---|
| 117 | | ASM.RLC x -> StructuredTraces.Cl_other |
---|
| 118 | | ASM.RR x -> StructuredTraces.Cl_other |
---|
| 119 | | ASM.RRC x -> StructuredTraces.Cl_other |
---|
| 120 | | ASM.SWAP x -> StructuredTraces.Cl_other |
---|
| 121 | | ASM.MOV x -> StructuredTraces.Cl_other |
---|
| 122 | | ASM.MOVX x -> StructuredTraces.Cl_other |
---|
| 123 | | ASM.SETB x -> StructuredTraces.Cl_other |
---|
| 124 | | ASM.PUSH x -> StructuredTraces.Cl_other |
---|
| 125 | | ASM.POP x -> StructuredTraces.Cl_other |
---|
| 126 | | ASM.XCH (x, x0) -> StructuredTraces.Cl_other |
---|
| 127 | | ASM.XCHD (x, x0) -> StructuredTraces.Cl_other |
---|
| 128 | | ASM.RET -> StructuredTraces.Cl_return |
---|
| 129 | | ASM.RETI -> StructuredTraces.Cl_return |
---|
| 130 | | ASM.NOP -> StructuredTraces.Cl_other |
---|
[2717] | 131 | | ASM.JMP x -> StructuredTraces.Cl_call |
---|
[2601] | 132 | |
---|
| 133 | (** val aSM_classify0 : ASM.instruction -> StructuredTraces.status_class **) |
---|
| 134 | let aSM_classify0 = function |
---|
| 135 | | ASM.ACALL x -> StructuredTraces.Cl_call |
---|
| 136 | | ASM.LCALL x -> StructuredTraces.Cl_call |
---|
| 137 | | ASM.AJMP x -> StructuredTraces.Cl_other |
---|
| 138 | | ASM.LJMP x -> StructuredTraces.Cl_other |
---|
| 139 | | ASM.SJMP x -> StructuredTraces.Cl_other |
---|
| 140 | | ASM.MOVC (x, x0) -> StructuredTraces.Cl_other |
---|
| 141 | | ASM.RealInstruction pre -> aSM_classify00 pre |
---|
| 142 | |
---|
| 143 | (** val current_instruction0 : |
---|
| 144 | BitVector.byte BitVectorTrie.bitVectorTrie -> BitVector.word -> |
---|
| 145 | ASM.instruction **) |
---|
| 146 | let current_instruction0 code_memory program_counter0 = |
---|
| 147 | (Fetch.fetch code_memory program_counter0).Types.fst.Types.fst |
---|
| 148 | |
---|
| 149 | (** val current_instruction : |
---|
| 150 | BitVector.byte BitVectorTrie.bitVectorTrie -> Status.status -> |
---|
| 151 | ASM.instruction **) |
---|
| 152 | let current_instruction code_memory s = |
---|
| 153 | current_instruction0 code_memory s.Status.program_counter |
---|
| 154 | |
---|
| 155 | (** val current_instruction_label : |
---|
| 156 | BitVector.byte BitVectorTrie.bitVectorTrie -> CostLabel.costlabel |
---|
| 157 | BitVectorTrie.bitVectorTrie -> Status.status -> CostLabel.costlabel |
---|
| 158 | Types.option **) |
---|
| 159 | let current_instruction_label code_memory cost_labels s = |
---|
| 160 | let pc = s.Status.program_counter in |
---|
| 161 | BitVectorTrie.lookup_opt (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S |
---|
| 162 | (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S |
---|
| 163 | Nat.O)))))))))))))))) pc cost_labels |
---|
| 164 | |
---|
| 165 | (** val word_deqset : Deqsets.deqSet **) |
---|
| 166 | let word_deqset = |
---|
| 167 | Obj.magic |
---|
| 168 | (BitVector.eq_bv (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S |
---|
| 169 | (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S |
---|
| 170 | Nat.O))))))))))))))))) |
---|
| 171 | |
---|
| 172 | (** val aSM_classify : |
---|
| 173 | BitVector.byte BitVectorTrie.bitVectorTrie -> Status.status -> |
---|
| 174 | StructuredTraces.status_class **) |
---|
| 175 | let aSM_classify code_memory s = |
---|
| 176 | aSM_classify0 (current_instruction code_memory s) |
---|
| 177 | |
---|