util.isa (2980:eab855f06b79) | util.isa (3953:300d526414e6) |
---|---|
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 | 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 # generate code block objects 44 ea_cblk = CodeBlock(ea_code) 45 memacc_cblk = CodeBlock(memacc_code) 46 postacc_cblk = CodeBlock(postacc_code) 47 | |
48 # Some CPU models execute the memory operation as an atomic unit, 49 # while others want to separate them into an effective address 50 # computation and a memory access operation. As a result, we need 51 # to generate three StaticInst objects. Note that the latter two 52 # are nested inside the larger "atomic" one. 53 | 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 |
54 # generate InstObjParams for EAComp object 55 ea_iop = InstObjParams(name, Name, base_class, ea_cblk, inst_flags) | 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) |
56 | 61 |
57 # generate InstObjParams for MemAcc object 58 memacc_iop = InstObjParams(name, Name, base_class, memacc_cblk, inst_flags) 59 # in the split execution model, the MemAcc portion is responsible 60 # for the post-access code. 61 memacc_iop.postacc_code = postacc_cblk.code 62 63 # generate InstObjParams for InitiateAcc, CompleteAcc object 64 # The code used depends on the template being used 65 if (exec_template_base == 'Load'): 66 initiateacc_cblk = CodeBlock(ea_code + memacc_code) 67 completeacc_cblk = CodeBlock(memacc_code + postacc_code) 68 elif (exec_template_base.startswith('Store')): 69 initiateacc_cblk = CodeBlock(ea_code + memacc_code) 70 completeacc_cblk = CodeBlock(postacc_code) 71 else: 72 initiateacc_cblk = '' 73 completeacc_cblk = '' 74 75 initiateacc_iop = InstObjParams(name, Name, base_class, initiateacc_cblk, 76 inst_flags) 77 78 completeacc_iop = InstObjParams(name, Name, base_class, completeacc_cblk, 79 inst_flags) 80 81 if (exec_template_base == 'Load'): 82 initiateacc_iop.ea_code = ea_cblk.code 83 initiateacc_iop.memacc_code = memacc_cblk.code 84 completeacc_iop.memacc_code = memacc_cblk.code 85 completeacc_iop.postacc_code = postacc_cblk.code 86 elif (exec_template_base.startswith('Store')): 87 initiateacc_iop.ea_code = ea_cblk.code 88 initiateacc_iop.memacc_code = memacc_cblk.code 89 completeacc_iop.postacc_code = postacc_cblk.code 90 91 # generate InstObjParams for unified execution 92 cblk = CodeBlock(ea_code + memacc_code + postacc_code) 93 iop = InstObjParams(name, Name, base_class, cblk, inst_flags) 94 95 iop.ea_constructor = ea_cblk.constructor 96 iop.ea_code = ea_cblk.code 97 iop.memacc_constructor = memacc_cblk.constructor 98 iop.memacc_code = memacc_cblk.code 99 iop.postacc_code = postacc_cblk.code 100 | |
101 if mem_flags: 102 s = '\n\tmemAccessFlags = ' + string.join(mem_flags, '|') + ';' 103 iop.constructor += s 104 memacc_iop.constructor += s 105 106 # select templates 107 108 # define aliases... most StoreCond templates are the same as the 109 # corresponding Store templates (only CompleteAcc is different). 110 StoreCondMemAccExecute = StoreMemAccExecute 111 StoreCondExecute = StoreExecute 112 StoreCondInitiateAcc = StoreInitiateAcc 113 114 memAccExecTemplate = eval(exec_template_base + 'MemAccExecute') 115 fullExecTemplate = eval(exec_template_base + 'Execute') 116 initiateAccTemplate = eval(exec_template_base + 'InitiateAcc') 117 completeAccTemplate = eval(exec_template_base + 'CompleteAcc') 118 119 # (header_output, decoder_output, decode_block, exec_output) | 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) |
120 return (LoadStoreDeclare.subst(iop), LoadStoreConstructor.subst(iop), | 81 return (LoadStoreDeclare.subst(iop), 82 EACompConstructor.subst(ea_iop) 83 + MemAccConstructor.subst(memacc_iop) 84 + LoadStoreConstructor.subst(iop), |
121 decode_template.subst(iop), 122 EACompExecute.subst(ea_iop) 123 + memAccExecTemplate.subst(memacc_iop) 124 + fullExecTemplate.subst(iop) | 85 decode_template.subst(iop), 86 EACompExecute.subst(ea_iop) 87 + memAccExecTemplate.subst(memacc_iop) 88 + fullExecTemplate.subst(iop) |
125 + initiateAccTemplate.subst(initiateacc_iop) 126 + completeAccTemplate.subst(completeacc_iop)) | 89 + initiateAccTemplate.subst(iop) 90 + completeAccTemplate.subst(iop)) |
127}}; | 91}}; |
92 93 |
|
128output header {{ 129 std::string inst2string(MachInst machInst); 130}}; 131 132output decoder {{ 133 134std::string inst2string(MachInst machInst) 135{ --- 54 unchanged lines hidden --- | 94output header {{ 95 std::string inst2string(MachInst machInst); 96}}; 97 98output decoder {{ 99 100std::string inst2string(MachInst machInst) 101{ --- 54 unchanged lines hidden --- |