def process_trace(trace): """ Process instruction trace """ process_imm(trace) if trace.instr == 'jalr': n = ADDR_RE.search(trace.operand) if n: trace.imm = get_imm_hex_val(n.group("imm"))
def expand_trace_entry(trace, operands): '''Expands a CSV trace entry for a single instruction. Operands are added to the CSV entry, converting from the raw register naming scheme (x0, x1, etc...) to ABI naming (a1, s1, etc...). ''' operands = process_imm(trace.instr, trace.pc, operands) trace.instr, operands = \ convert_pseudo_instr(trace.instr, operands, trace.binary) # process any instructions of the form: # <instr> <reg> <imm>(<reg>) n = ADDR_RE.search(operands) if n: trace.imm = get_imm_hex_val(n.group("imm")) operands = ','.join([n.group("rd"), n.group("rs1"), n.group("imm")]) # Convert the operands into ABI format for the function coverage flow, # and store them into the CSV trace entry. trace.operand = convert_operands_to_abi(operands)