1// Copyright (c) 2006-2007 The Regents of The University of Michigan 2// All rights reserved. 3// 4// Redistribution and use in source and binary forms, with or without 5// modification, are permitted provided that the following conditions are 6// met: redistributions of source code must retain the above copyright 7// notice, this list of conditions and the following disclaimer; 8// redistributions in binary form must reproduce the above copyright --- 95 unchanged lines hidden (view full) --- 104 decode_block = BasicDecode.subst(iop) 105 exec_output = BasicExecute.subst(iop) 106}}; 107 108def format FpBasic(code, *flags) {{ 109 fp_code = """ 110 Fsr |= bits(Fsr,4,0) << 5; 111 Fsr = insertBits(Fsr,4,0,0); |
112 int newrnd = M5_FE_TONEAREST; |
113 switch (Fsr<31:30>) { |
114 case 0: newrnd = M5_FE_TONEAREST; break; 115 case 1: newrnd = M5_FE_TOWARDZERO; break; 116 case 2: newrnd = M5_FE_UPWARD; break; 117 case 3: newrnd = M5_FE_DOWNWARD; break; |
118 } |
119 int oldrnd = m5_fegetround(); 120 m5_fesetround(newrnd); |
121""" 122 123 fp_code += code 124 125 126 fp_code += """ |
127 m5_fesetround(oldrnd); |
128""" 129 fp_code = filterDoubles(fp_code) 130 iop = InstObjParams(name, Name, 'SparcStaticInst', fp_code, flags) 131 header_output = BasicDeclare.subst(iop) 132 decoder_output = BasicConstructor.subst(iop) 133 decode_block = BasicDecode.subst(iop) 134 exec_output = BasicExecute.subst(iop) 135}}; |