decoder.isa (5091:662c1d7b4795) | decoder.isa (5093:7f20bc69fda5) |
---|---|
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 --- 179 unchanged lines hidden (view full) --- 188 Rd.udw = 0x7FFFFFFF; 189 else if((int64_t)Rd.udw <= std::numeric_limits<int32_t>::min()) 190 Rd.udw = ULL(0xFFFFFFFF80000000); 191 } 192 }}); 193 } 194 format IntOpCc { 195 0x10: addcc({{ | 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 --- 179 unchanged lines hidden (view full) --- 188 Rd.udw = 0x7FFFFFFF; 189 else if((int64_t)Rd.udw <= std::numeric_limits<int32_t>::min()) 190 Rd.udw = ULL(0xFFFFFFFF80000000); 191 } 192 }}); 193 } 194 format IntOpCc { 195 0x10: addcc({{ |
196 int64_t resTemp, val2 = Rs2_or_imm13; 197 Rd = resTemp = Rs1 + val2;}}, 198 {{(Rs1<31:0> + val2<31:0>)<32:>}}, 199 {{Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>}}, 200 {{(Rs1<63:1> + val2<63:1> + (Rs1 & val2)<0:>)<63:>}}, 201 {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}} 202 ); | 196 int64_t res, op1 = Rs1, op2 = Rs2_or_imm13; 197 Rd = res = op1 + op2; 198 }}); |
203 0x11: IntOpCcRes::andcc({{Rd = Rs1 & Rs2_or_imm13;}}); 204 0x12: IntOpCcRes::orcc({{Rd = Rs1 | Rs2_or_imm13;}}); 205 0x13: IntOpCcRes::xorcc({{Rd = Rs1 ^ Rs2_or_imm13;}}); 206 0x14: subcc({{ | 199 0x11: IntOpCcRes::andcc({{Rd = Rs1 & Rs2_or_imm13;}}); 200 0x12: IntOpCcRes::orcc({{Rd = Rs1 | Rs2_or_imm13;}}); 201 0x13: IntOpCcRes::xorcc({{Rd = Rs1 ^ Rs2_or_imm13;}}); 202 0x14: subcc({{ |
207 int64_t val2 = Rs2_or_imm13; 208 Rd = Rs1 - val2;}}, 209 {{(~(Rs1<31:0> + (~val2)<31:0> + 1))<32:>}}, 210 {{(Rs1<31:> != val2<31:>) && (Rs1<31:> != Rd<31:>)}}, 211 {{(~(Rs1<63:1> + (~val2)<63:1> + 212 (Rs1 | ~val2)<0:>))<63:>}}, 213 {{Rs1<63:> != val2<63:> && Rs1<63:> != Rd<63:>}} 214 ); | 203 int64_t res, op1 = Rs1, op2 = Rs2_or_imm13; 204 Rd = res = op1 - op2; 205 }}, sub=True); |
215 0x15: IntOpCcRes::andncc({{Rd = Rs1 & ~Rs2_or_imm13;}}); 216 0x16: IntOpCcRes::orncc({{Rd = Rs1 | ~Rs2_or_imm13;}}); 217 0x17: IntOpCcRes::xnorcc({{Rd = ~(Rs1 ^ Rs2_or_imm13);}}); 218 0x18: addccc({{ | 206 0x15: IntOpCcRes::andncc({{Rd = Rs1 & ~Rs2_or_imm13;}}); 207 0x16: IntOpCcRes::orncc({{Rd = Rs1 | ~Rs2_or_imm13;}}); 208 0x17: IntOpCcRes::xnorcc({{Rd = ~(Rs1 ^ Rs2_or_imm13);}}); 209 0x18: addccc({{ |
219 int64_t resTemp, val2 = Rs2_or_imm13; 220 int64_t carryin = Ccr<0:0>; 221 Rd = resTemp = Rs1 + val2 + carryin;}}, 222 {{(Rs1<31:0> + val2<31:0> + carryin)<32:>}}, 223 {{Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>}}, 224 {{((Rs1 & val2) | (~resTemp & (Rs1 | val2)))<63:>}}, 225 {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}} 226 ); | 210 int64_t res, op1 = Rs1, op2 = Rs2_or_imm13; 211 Rd = res = op1 + op2 + Ccr<0:>; 212 }}); |
227 0x1A: IntOpCcRes::umulcc({{ 228 uint64_t resTemp; 229 Rd = resTemp = Rs1.udw<31:0> * Rs2_or_imm13.udw<31:0>; 230 Y = resTemp<63:32>;}}); 231 0x1B: IntOpCcRes::smulcc({{ 232 int64_t resTemp; 233 Rd = resTemp = sext<32>(Rs1.sdw<31:0>) * sext<32>(Rs2_or_imm13<31:0>); 234 Y = resTemp<63:32>;}}); 235 0x1C: subccc({{ | 213 0x1A: IntOpCcRes::umulcc({{ 214 uint64_t resTemp; 215 Rd = resTemp = Rs1.udw<31:0> * Rs2_or_imm13.udw<31:0>; 216 Y = resTemp<63:32>;}}); 217 0x1B: IntOpCcRes::smulcc({{ 218 int64_t resTemp; 219 Rd = resTemp = sext<32>(Rs1.sdw<31:0>) * sext<32>(Rs2_or_imm13<31:0>); 220 Y = resTemp<63:32>;}}); 221 0x1C: subccc({{ |
236 int64_t resTemp, val2 = Rs2_or_imm13; 237 int64_t carryin = Ccr<0:0>; 238 Rd = resTemp = Rs1 + ~val2 + 1 - carryin;}}, 239 {{((~Rs1 & val2) | (resTemp & (~Rs1 | val2)))<31:>}}, 240 {{Rs1<31:> != val2<31:> && Rs1<31:> != resTemp<31:>}}, 241 {{((~Rs1 & val2) | (resTemp & (~Rs1 | val2)))<63:>}}, 242 {{Rs1<63:> != val2<63:> && Rs1<63:> != resTemp<63:>}} 243 ); | 222 int64_t res, op1 = Rs1, op2 = Rs2_or_imm13; 223 Rd = res = op1 - op2 - Ccr<0:>; 224 }}, sub=True); |
244 0x1D: IntOpCcRes::udivxcc({{ 245 if(Rs2_or_imm13.udw == 0) fault = new DivisionByZero; 246 else Rd = Rs1.udw / Rs2_or_imm13.udw;}}); | 225 0x1D: IntOpCcRes::udivxcc({{ 226 if(Rs2_or_imm13.udw == 0) fault = new DivisionByZero; 227 else Rd = Rs1.udw / Rs2_or_imm13.udw;}}); |
247 0x1E: udivcc({{ 248 uint32_t resTemp, val2 = Rs2_or_imm13.udw; 249 int32_t overflow = 0; 250 if(val2 == 0) fault = new DivisionByZero; 251 else 252 { 253 resTemp = (uint64_t)((Y << 32) | Rs1.udw<31:0>) / val2; 254 overflow = (resTemp<63:32> != 0); 255 if(overflow) Rd = resTemp = 0xFFFFFFFF; 256 else Rd = resTemp; 257 } }}, 258 {{0}}, 259 {{overflow}}, 260 {{0}}, 261 {{0}} 262 ); 263 0x1F: sdivcc({{ 264 int64_t val2 = Rs2_or_imm13.sdw<31:0>; 265 bool overflow = false, underflow = false; 266 if(val2 == 0) fault = new DivisionByZero; 267 else 268 { 269 Rd = (int64_t)((Y << 32) | Rs1.sdw<31:0>) / val2; 270 overflow = ((int64_t)Rd >= std::numeric_limits<int32_t>::max()); 271 underflow = ((int64_t)Rd <= std::numeric_limits<int32_t>::min()); 272 if(overflow) Rd = 0x7FFFFFFF; 273 else if(underflow) Rd = ULL(0xFFFFFFFF80000000); 274 } }}, 275 {{0}}, 276 {{overflow || underflow}}, 277 {{0}}, 278 {{0}} 279 ); | 228 0x1E: IntOpCcRes::udivcc({{ 229 uint32_t resTemp, val2 = Rs2_or_imm13.udw; 230 int32_t overflow = 0; 231 if(val2 == 0) fault = new DivisionByZero; 232 else 233 { 234 resTemp = (uint64_t)((Y << 32) | Rs1.udw<31:0>) / val2; 235 overflow = (resTemp<63:32> != 0); 236 if(overflow) Rd = resTemp = 0xFFFFFFFF; 237 else Rd = resTemp; 238 } 239 }}, iv={{overflow}}); 240 0x1F: IntOpCcRes::sdivcc({{ 241 int64_t val2 = Rs2_or_imm13.sdw<31:0>; 242 bool overflow = false, underflow = false; 243 if(val2 == 0) fault = new DivisionByZero; 244 else 245 { 246 Rd = (int64_t)((Y << 32) | Rs1.sdw<31:0>) / val2; 247 overflow = ((int64_t)Rd >= std::numeric_limits<int32_t>::max()); 248 underflow = ((int64_t)Rd <= std::numeric_limits<int32_t>::min()); 249 if(overflow) Rd = 0x7FFFFFFF; 250 else if(underflow) Rd = ULL(0xFFFFFFFF80000000); 251 } 252 }}, iv={{overflow || underflow}}); |
280 0x20: taddcc({{ | 253 0x20: taddcc({{ |
281 int64_t resTemp, val2 = Rs2_or_imm13; 282 Rd = resTemp = Rs1 + val2; 283 int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>);}}, 284 {{((Rs1<31:0> + val2<31:0>)<32:0>)}}, 285 {{overflow}}, 286 {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}}, 287 {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}} 288 ); | 254 int64_t res, op1 = Rs1, op2 = Rs2_or_imm13; 255 Rd = res = Rs1 + op2; 256 }}, iv={{ 257 (op1 & mask(2)) || (op2 & mask(2)) || 258 findOverflow(32, res, op1, op2) 259 }}); |
289 0x21: tsubcc({{ | 260 0x21: tsubcc({{ |
290 int64_t resTemp, val2 = Rs2_or_imm13; 291 Rd = resTemp = Rs1 + val2; 292 int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>);}}, 293 {{(Rs1<31:0> + val2<31:0>)<32:0>}}, 294 {{overflow}}, 295 {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}}, 296 {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}} 297 ); | 261 int64_t res, op1 = Rs1, op2 = Rs2_or_imm13; 262 Rd = res = Rs1 - op2; 263 }}, iv={{ 264 (op1 & mask(2)) || (op2 & mask(2)) || 265 findOverflow(32, res, op1, ~op2) 266 }}, sub=True); |
298 0x22: taddcctv({{ | 267 0x22: taddcctv({{ |
299 int64_t val2 = Rs2_or_imm13; 300 Rd = Rs1 + val2; 301 int32_t overflow = Rs1<1:0> || val2<1:0> || 302 (Rs1<31:> == val2<31:> && val2<31:> != Rd<31:>); 303 if(overflow) fault = new TagOverflow;}}, 304 {{((Rs1<31:0> + val2<31:0>)<32:0>)}}, 305 {{overflow}}, 306 {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}}, 307 {{Rs1<63:> == val2<63:> && val2<63:> != Rd<63:>}} 308 ); | 268 int64_t res, op1 = Rs1, op2 = Rs2_or_imm13; 269 Rd = res = op1 + op2; 270 bool overflow = (op1 & mask(2)) || (op2 & mask(2)) || 271 findOverflow(32, res, op1, op2); 272 if(overflow) fault = new TagOverflow; 273 }}, iv={{overflow}}); |
309 0x23: tsubcctv({{ | 274 0x23: tsubcctv({{ |
310 int64_t resTemp, val2 = Rs2_or_imm13; 311 Rd = resTemp = Rs1 + val2; 312 int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>); 313 if(overflow) fault = new TagOverflow;}}, 314 {{((Rs1<31:0> + val2<31:0>)<32:0>)}}, 315 {{overflow}}, 316 {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}}, 317 {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}} 318 ); | 275 int64_t res, op1 = Rs1, op2 = Rs2_or_imm13; 276 Rd = res = op1 - op2; 277 bool overflow = (op1 & mask(2)) || (op2 & mask(2)) || 278 findOverflow(32, res, op1, ~op2); 279 if(overflow) fault = new TagOverflow; 280 }}, iv={{overflow}}, sub=True); |
319 0x24: mulscc({{ | 281 0x24: mulscc({{ |
320 int32_t savedLSB = Rs1<0:>; | 282 int32_t savedLSB = Rs1<0:>; |
321 | 283 |
322 //Step 1 323 int64_t multiplicand = Rs2_or_imm13; 324 //Step 2 325 int32_t partialP = Rs1<31:1> | 326 ((Ccr<3:3> ^ Ccr<1:1>) << 31); 327 //Step 3 328 int32_t added = Y<0:> ? multiplicand : 0; 329 Rd = partialP + added; 330 //Steps 4 & 5 331 Y = Y<31:1> | (savedLSB << 31);}}, 332 {{((partialP<31:0> + added<31:0>)<32:0>)}}, 333 {{partialP<31:> == added<31:> && added<31:> != Rd<31:>}}, 334 {{((partialP >> 1) + (added >> 1) + (partialP & added & 0x1))<63:>}}, 335 {{partialP<63:> == added<63:> && partialP<63:> != Rd<63:>}} 336 ); | 284 //Step 1 285 int64_t multiplicand = Rs2_or_imm13; 286 //Step 2 287 int32_t partialP = Rs1<31:1> | 288 ((Ccr<3:3> ^ Ccr<1:1>) << 31); 289 //Step 3 290 int32_t added = Y<0:> ? multiplicand : 0; 291 int64_t res, op1 = partialP, op2 = added; 292 Rd = res = partialP + added; 293 //Steps 4 & 5 294 Y = Y<31:1> | (savedLSB << 31); 295 }}); |
337 } 338 format IntOp 339 { 340 0x25: decode X { 341 0x0: sll({{Rd = Rs1 << (I ? SHCNT32 : Rs2<4:0>);}}); 342 0x1: sllx({{Rd = Rs1 << (I ? SHCNT64 : Rs2<5:0>);}}); 343 } 344 0x26: decode X { --- 1212 unchanged lines hidden --- | 296 } 297 format IntOp 298 { 299 0x25: decode X { 300 0x0: sll({{Rd = Rs1 << (I ? SHCNT32 : Rs2<4:0>);}}); 301 0x1: sllx({{Rd = Rs1 << (I ? SHCNT64 : Rs2<5:0>);}}); 302 } 303 0x26: decode X { --- 1212 unchanged lines hidden --- |