1# Copyright (c) 2003-2005 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 --- 1166 unchanged lines hidden (view full) --- 1175 c += '\n\t_destRegIdx[%d] = %s;' % \ 1176 (self.dest_reg_idx, self.reg_spec) 1177 return c 1178 1179 def makeRead(self): 1180 if (self.ctype == 'float' or self.ctype == 'double'): 1181 error(0, 'Attempt to read integer register as FP') 1182 if (self.size == self.dflt_size): |
1183 return '%s = xc->readIntRegOperand(this, %d);\n' % \ |
1184 (self.base_name, self.src_reg_idx) 1185 elif (self.size > self.dflt_size): |
1186 int_reg_val = 'xc->readIntRegOperand(this, %d)' % \ 1187 (self.src_reg_idx) |
1188 if (self.is_signed): 1189 int_reg_val = 'sext<%d>(%s)' % (self.dflt_size, int_reg_val) 1190 return '%s = %s;\n' % (self.base_name, int_reg_val) 1191 else: |
1192 return '%s = bits(xc->readIntRegOperand(this, %d), %d, 0);\n' % \ |
1193 (self.base_name, self.src_reg_idx, self.size-1) 1194 1195 def makeWrite(self): 1196 if (self.ctype == 'float' or self.ctype == 'double'): 1197 error(0, 'Attempt to write integer register as FP') 1198 if (self.size != self.dflt_size and self.is_signed): 1199 final_val = 'sext<%d>(%s)' % (self.size, self.base_name) 1200 else: 1201 final_val = self.base_name 1202 wb = ''' 1203 { 1204 %s final_val = %s; |
1205 xc->setIntRegOperand(this, %d, final_val);\n |
1206 if (traceData) { traceData->setData(final_val); } 1207 }''' % (self.dflt_ctype, final_val, self.dest_reg_idx) 1208 return wb 1209 1210class FloatRegOperand(Operand): 1211 def isReg(self): 1212 return 1 1213 --- 9 unchanged lines hidden (view full) --- 1223 c += '\n\t_destRegIdx[%d] = %s + FP_Base_DepTag;' % \ 1224 (self.dest_reg_idx, self.reg_spec) 1225 return c 1226 1227 def makeRead(self): 1228 bit_select = 0 1229 width = 0; 1230 if (self.ctype == 'float'): |
1231 func = 'readFloatRegOperand' |
1232 width = 32; 1233 elif (self.ctype == 'double'): |
1234 func = 'readFloatRegOperand' |
1235 width = 64; 1236 else: |
1237 func = 'readFloatRegOperandBits' |
1238 if (self.ctype == 'uint32_t'): 1239 width = 32; 1240 elif (self.ctype == 'uint64_t'): 1241 width = 64; 1242 if (self.size != self.dflt_size): 1243 bit_select = 1 1244 if width: 1245 base = 'xc->%s(this, %d, %d)' % \ --- 9 unchanged lines hidden (view full) --- 1255 1256 def makeWrite(self): 1257 final_val = self.base_name 1258 final_ctype = self.ctype 1259 widthSpecifier = '' 1260 width = 0 1261 if (self.ctype == 'float'): 1262 width = 32 |
1263 func = 'setFloatRegOperand' |
1264 elif (self.ctype == 'double'): 1265 width = 64 |
1266 func = 'setFloatRegOperand' |
1267 elif (self.ctype == 'uint32_t'): |
1268 func = 'setFloatRegOperandBits' |
1269 width = 32 1270 elif (self.ctype == 'uint64_t'): |
1271 func = 'setFloatRegOperandBits' |
1272 width = 64 1273 else: |
1274 func = 'setFloatRegOperandBits' |
1275 final_ctype = 'uint%d_t' % self.dflt_size 1276 if (self.size != self.dflt_size and self.is_signed): 1277 final_val = 'sext<%d>(%s)' % (self.size, self.base_name) 1278 if width: 1279 widthSpecifier = ', %d' % width 1280 wb = ''' 1281 { 1282 %s final_val = %s; --- 547 unchanged lines hidden --- |