regop.isa (5157:9c6c153af4b1) | regop.isa (5239:0920dfb94514) |
---|---|
1// Copyright (c) 2007 The Hewlett-Packard Development Company 2// All rights reserved. 3// 4// Redistribution and use of this software in source and binary forms, 5// with or without modification, are permitted provided that the 6// following conditions are met: 7// 8// The software must be used only for Non-Commercial Use which means any --- 304 unchanged lines hidden (view full) --- 313 matcher.sub("imm8", code), 314 matcher.sub("imm8", flag_code), 315 matcher.sub("imm8", cond_check), 316 matcher.sub("imm8", else_code)) 317 return 318 319 # If there's something optional to do with flags, generate 320 # a version without it and fix up this version to use it. | 1// Copyright (c) 2007 The Hewlett-Packard Development Company 2// All rights reserved. 3// 4// Redistribution and use of this software in source and binary forms, 5// with or without modification, are permitted provided that the 6// following conditions are met: 7// 8// The software must be used only for Non-Commercial Use which means any --- 304 unchanged lines hidden (view full) --- 313 matcher.sub("imm8", code), 314 matcher.sub("imm8", flag_code), 315 matcher.sub("imm8", cond_check), 316 matcher.sub("imm8", else_code)) 317 return 318 319 # If there's something optional to do with flags, generate 320 # a version without it and fix up this version to use it. |
321 if flag_code is not "" or cond_check is not "true": | 321 if flag_code != "" or cond_check != "true": |
322 self.buildCppClasses(name, Name, suffix, 323 code, "", "true", else_code) 324 suffix = "Flags" + suffix 325 326 # If psrc1 or psrc2 is used, we need to actually insert code to 327 # compute it. 328 matcher = re.compile("(?<!\w)psrc1(?!\w)") 329 if matcher.search(allCode): --- 531 unchanged lines hidden (view full) --- 861 def __init__(self, dest, imm, flags=None, \ 862 dataSize="env.dataSize"): 863 super(Ruflag, self).__init__(dest, \ 864 "NUM_INTREGS", imm, flags, dataSize) 865 866 class Sext(RegOp): 867 code = ''' 868 IntReg val = psrc1; | 322 self.buildCppClasses(name, Name, suffix, 323 code, "", "true", else_code) 324 suffix = "Flags" + suffix 325 326 # If psrc1 or psrc2 is used, we need to actually insert code to 327 # compute it. 328 matcher = re.compile("(?<!\w)psrc1(?!\w)") 329 if matcher.search(allCode): --- 531 unchanged lines hidden (view full) --- 861 def __init__(self, dest, imm, flags=None, \ 862 dataSize="env.dataSize"): 863 super(Ruflag, self).__init__(dest, \ 864 "NUM_INTREGS", imm, flags, dataSize) 865 866 class Sext(RegOp): 867 code = ''' 868 IntReg val = psrc1; |
869 int sign_bit = bits(val, imm8-1, imm8-1); 870 uint64_t maskVal = mask(imm8); | 869 // Mask the bit position so that it wraps. 870 int bitPos = op2 & (dataSize * 8 - 1); 871 int sign_bit = bits(val, bitPos, bitPos); 872 uint64_t maskVal = mask(bitPos+1); |
871 val = sign_bit ? (val | ~maskVal) : (val & maskVal); 872 DestReg = merge(DestReg, val, dataSize); 873 ''' | 873 val = sign_bit ? (val | ~maskVal) : (val & maskVal); 874 DestReg = merge(DestReg, val, dataSize); 875 ''' |
876 flag_code = ''' 877 if (!sign_bit) 878 ccFlagBits = ccFlagBits & 879 ~(ext & (CFBit | ECFBit | ZFBit | EZFBit)); 880 else 881 ccFlagBits = ccFlagBits | 882 (ext & (CFBit | ECFBit | ZFBit | EZFBit)); 883 ''' |
|
874 875 class Zext(RegOp): | 884 885 class Zext(RegOp): |
876 code = 'DestReg = bits(psrc1, imm8-1, 0);' | 886 code = 'DestReg = bits(psrc1, op2, 0);' |
877}}; | 887}}; |