integerop.isa (3980:9bcb2a2e9bb8) | integerop.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 --- 273 unchanged lines hidden (view full) --- 282 283 calcCcCode = ''' 284 uint16_t _ic, _iv, _iz, _in, _xc, _xv, _xz, _xn; 285 286 _in = (Rd >> 31) & 1; 287 _iz = ((Rd & 0xFFFFFFFF) == 0); 288 _xn = (Rd >> 63) & 1; 289 _xz = (Rd == 0); | 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 --- 273 unchanged lines hidden (view full) --- 282 283 calcCcCode = ''' 284 uint16_t _ic, _iv, _iz, _in, _xc, _xv, _xz, _xn; 285 286 _in = (Rd >> 31) & 1; 287 _iz = ((Rd & 0xFFFFFFFF) == 0); 288 _xn = (Rd >> 63) & 1; 289 _xz = (Rd == 0); |
290 _iv = %(ivValue)s & 1; 291 _ic = %(icValue)s & 1; 292 _xv = %(xvValue)s & 1; 293 _xc = %(xcValue)s & 1; | 290 _iv = %(iv)s & 1; 291 _ic = %(ic)s & 1; 292 _xv = %(xv)s & 1; 293 _xc = %(xc)s & 1; |
294 295 Ccr = _ic << 0 | _iv << 1 | _iz << 2 | _in << 3 | 296 _xc << 4 | _xv << 5 | _xz << 6 | _xn << 7; 297 298 299 DPRINTF(Sparc, "in = %%d\\n", _in); 300 DPRINTF(Sparc, "iz = %%d\\n", _iz); 301 DPRINTF(Sparc, "xn = %%d\\n", _xn); 302 DPRINTF(Sparc, "xz = %%d\\n", _xz); 303 DPRINTF(Sparc, "iv = %%d\\n", _iv); 304 DPRINTF(Sparc, "ic = %%d\\n", _ic); 305 DPRINTF(Sparc, "xv = %%d\\n", _xv); 306 DPRINTF(Sparc, "xc = %%d\\n", _xc); 307 ''' | 294 295 Ccr = _ic << 0 | _iv << 1 | _iz << 2 | _in << 3 | 296 _xc << 4 | _xv << 5 | _xz << 6 | _xn << 7; 297 298 299 DPRINTF(Sparc, "in = %%d\\n", _in); 300 DPRINTF(Sparc, "iz = %%d\\n", _iz); 301 DPRINTF(Sparc, "xn = %%d\\n", _xn); 302 DPRINTF(Sparc, "xz = %%d\\n", _xz); 303 DPRINTF(Sparc, "iv = %%d\\n", _iv); 304 DPRINTF(Sparc, "ic = %%d\\n", _ic); 305 DPRINTF(Sparc, "xv = %%d\\n", _xv); 306 DPRINTF(Sparc, "xc = %%d\\n", _xc); 307 ''' |
308 309 default_ic = "findCarry(32, res, op1, op2)" 310 default_iv = "findOverflow(32, res, op1, op2)" 311 default_xc = "findCarry(64, res, op1, op2)" 312 default_xv = "findOverflow(64, res, op1, op2)" 313 default_sub_ic = "!findCarry(32, res, op1, ~op2)" 314 default_sub_iv = "findOverflow(32, res, op1, ~op2)" 315 default_sub_xc = "!findCarry(64, res, op1, ~op2)" 316 default_sub_xv = "findOverflow(64, res, op1, ~op2)" |
|
308}}; 309 310// Primary format for integer operate instructions: 311def format IntOp(code, *opt_flags) {{ 312 ccCode = '' 313 (header_output, 314 decoder_output, 315 exec_output, 316 decode_block) = doIntFormat(code, ccCode, 317 name, Name, opt_flags) 318}}; 319 320// Primary format for integer operate instructions: | 317}}; 318 319// Primary format for integer operate instructions: 320def format IntOp(code, *opt_flags) {{ 321 ccCode = '' 322 (header_output, 323 decoder_output, 324 exec_output, 325 decode_block) = doIntFormat(code, ccCode, 326 name, Name, opt_flags) 327}}; 328 329// Primary format for integer operate instructions: |
321def format IntOpCc(code, icValue, ivValue, xcValue, xvValue, *opt_flags) {{ | 330def format IntOpCc(code, ic=default_ic, iv=default_iv, 331 xc=default_xc, xv=default_xv, 332 sub=False, *opt_flags) {{ 333 334 if sub == "False": 335 (def_ic, def_iv, def_xc, def_xv) = \ 336 (default_ic, default_iv, default_xc, default_xv) 337 else: 338 (def_ic, def_iv, def_xc, def_xv) = \ 339 (default_sub_ic, default_sub_iv, default_sub_xc, default_sub_xv) 340 if ic == "default_ic": 341 ic = def_ic 342 if iv == "default_iv": 343 iv = def_iv 344 if xc == "default_xc": 345 xc = def_xc 346 if xv == "default_xv": 347 xv = def_xv |
322 ccCode = calcCcCode % vars() 323 (header_output, 324 decoder_output, 325 exec_output, 326 decode_block) = doIntFormat(code, ccCode, 327 name, Name, opt_flags) 328}}; 329 330// Primary format for integer operate instructions: | 348 ccCode = calcCcCode % vars() 349 (header_output, 350 decoder_output, 351 exec_output, 352 decode_block) = doIntFormat(code, ccCode, 353 name, Name, opt_flags) 354}}; 355 356// Primary format for integer operate instructions: |
331def format IntOpCcRes(code, *opt_flags) {{ 332 ccCode = calcCcCode % {"icValue":"0", 333 "ivValue":"0", 334 "xcValue":"0", 335 "xvValue":"0"} | 357def format IntOpCcRes(code, ic=0, iv=0, xc=0, xv=0, *opt_flags) {{ 358 ccCode = calcCcCode % {"ic" : ic, "iv" : iv, "xc" : xc, "xv" : xv} |
336 (header_output, 337 decoder_output, 338 exec_output, 339 decode_block) = doIntFormat(code, ccCode, 340 name, Name, opt_flags) 341}}; 342 343def format SetHi(code, *opt_flags) {{ 344 iop = InstObjParams(name, Name, 'SetHi', 345 {"code": code, "cc_code": ''}, opt_flags) 346 header_output = BasicDeclare.subst(iop) 347 decoder_output = BasicConstructor.subst(iop) 348 exec_output = IntOpExecute.subst(iop) 349 decode_block = SetHiDecode.subst(iop) 350}}; 351 | 359 (header_output, 360 decoder_output, 361 exec_output, 362 decode_block) = doIntFormat(code, ccCode, 363 name, Name, opt_flags) 364}}; 365 366def format SetHi(code, *opt_flags) {{ 367 iop = InstObjParams(name, Name, 'SetHi', 368 {"code": code, "cc_code": ''}, opt_flags) 369 header_output = BasicDeclare.subst(iop) 370 decoder_output = BasicConstructor.subst(iop) 371 exec_output = IntOpExecute.subst(iop) 372 decode_block = SetHiDecode.subst(iop) 373}}; 374 |