1// -*- mode:c++ -*- 2 3// Copyright (c) 2006 The Regents of The University of Michigan 4// All rights reserved. 5// 6// Redistribution and use in source and binary forms, with or without 7// modification, are permitted provided that the following conditions are 8// met: redistributions of source code must retain the above copyright --- 26 unchanged lines hidden (view full) --- 35 decode_template = BasicDecode, exec_template_base = ''): 36 # Make sure flags are in lists (convert to lists if not). 37 mem_flags = makeList(mem_flags) 38 inst_flags = makeList(inst_flags) 39 40 # add hook to get effective addresses into execution trace output. 41 ea_code += '\nif (traceData) { traceData->setAddr(EA); }\n' 42 |
43 # Some CPU models execute the memory operation as an atomic unit, 44 # while others want to separate them into an effective address 45 # computation and a memory access operation. As a result, we need 46 # to generate three StaticInst objects. Note that the latter two 47 # are nested inside the larger "atomic" one. 48 |
49 # Generate InstObjParams for each of the three objects. Note that 50 # they differ only in the set of code objects contained (which in 51 # turn affects the object's overall operand list). 52 iop = InstObjParams(name, Name, base_class, 53 { 'ea_code':ea_code, 'memacc_code':memacc_code, 'postacc_code':postacc_code }, 54 inst_flags) 55 ea_iop = InstObjParams(name, Name, base_class, 56 { 'ea_code':ea_code }, 57 inst_flags) 58 memacc_iop = InstObjParams(name, Name, base_class, 59 { 'memacc_code':memacc_code, 'postacc_code':postacc_code }, 60 inst_flags) |
61 |
62 if mem_flags: 63 s = '\n\tmemAccessFlags = ' + string.join(mem_flags, '|') + ';' 64 iop.constructor += s 65 memacc_iop.constructor += s 66 67 # select templates 68 69 # define aliases... most StoreCond templates are the same as the 70 # corresponding Store templates (only CompleteAcc is different). 71 StoreCondMemAccExecute = StoreMemAccExecute 72 StoreCondExecute = StoreExecute 73 StoreCondInitiateAcc = StoreInitiateAcc 74 75 memAccExecTemplate = eval(exec_template_base + 'MemAccExecute') 76 fullExecTemplate = eval(exec_template_base + 'Execute') 77 initiateAccTemplate = eval(exec_template_base + 'InitiateAcc') 78 completeAccTemplate = eval(exec_template_base + 'CompleteAcc') 79 80 # (header_output, decoder_output, decode_block, exec_output) |
81 return (LoadStoreDeclare.subst(iop), 82 EACompConstructor.subst(ea_iop) 83 + MemAccConstructor.subst(memacc_iop) 84 + LoadStoreConstructor.subst(iop), |
85 decode_template.subst(iop), 86 EACompExecute.subst(ea_iop) 87 + memAccExecTemplate.subst(memacc_iop) 88 + fullExecTemplate.subst(iop) |
89 + initiateAccTemplate.subst(iop) 90 + completeAccTemplate.subst(iop)) |
91}}; |
92 93 |
94output header {{ 95 std::string inst2string(MachInst machInst); 96}}; 97 98output decoder {{ 99 100std::string inst2string(MachInst machInst) 101{ --- 54 unchanged lines hidden --- |