mem.isa (6253:988a001820f8) mem.isa (6301:719e56579870)
1// -*- mode:c++ -*-
2
3// Copyright (c) 2007-2008 The Florida State University
4// All rights reserved.
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met: redistributions of source code must retain the above copyright

--- 440 unchanged lines hidden (view full) ---

449 Trace::InstRecord *traceData) const
450 {
451 panic("Misc instruction does not support split access method!");
452
453 return NoFault;
454 }
455}};
456
1// -*- mode:c++ -*-
2
3// Copyright (c) 2007-2008 The Florida State University
4// All rights reserved.
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met: redistributions of source code must retain the above copyright

--- 440 unchanged lines hidden (view full) ---

449 Trace::InstRecord *traceData) const
450 {
451 panic("Misc instruction does not support split access method!");
452
453 return NoFault;
454 }
455}};
456
457let {{
458 def buildPUBWLCase(p, u, b, w, l):
459 return (p << 4) + (u << 3) + (b << 2) + (w << 1) + (l << 0)
460
461 def buildMode3Inst(p, u, i, w, type, code, mnem):
462 op = ("-", "+")[u]
463 offset = ("%s Rm", "%s hilo")[i] % op
464 ea_code = "EA = Rn %s;" % ("", offset)[p]
465 if p == 0 or w == 1:
466 code += "Rn = Rn %s;" % offset
467 suffix = "_P%dU%dI%dW%d" % (p, u, i, w)
468 return LoadStoreBase(mnem, mnem.capitalize() + suffix,
469 ea_code, code, mem_flags = [], inst_flags = [],
470 exec_template_base = type.capitalize())
471}};
472
473def format AddrMode3(l0Type, l0Code, l1Type, l1Code) {{
474 l0Code = ArmGenericCodeSubs(l0Code);
475 l1Code = ArmGenericCodeSubs(l1Code);
476
477 header_output = decoder_output = exec_output = ""
478 decode_block = "switch(PUBWL) {\n"
479 (l0Mnem, l1Mnem) = name.split("_");
480
481 # Loop over all the values of p, u, i, w and l and build instructions and
482 # a decode block for them.
483 for (l, type, code, mnem) in ((0, l0Type, l0Code, l0Mnem),
484 (1, l1Type, l1Code, l1Mnem)):
485 for p in (0, 1):
486 wset = (0, 1)
487 if (p == 0):
488 wset = (0,)
489 for u in (0, 1):
490 for i in (0, 1):
491 for w in wset:
492 (new_header_output,
493 new_decoder_output,
494 new_decode_block,
495 new_exec_output) = buildMode3Inst(p, u, i, w,
496 type, code, mnem)
497 header_output += new_header_output
498 decoder_output += new_decoder_output
499 exec_output += new_exec_output
500 decode_block += '''
501 case %#x:
502 {%s}
503 break;
504 ''' % (buildPUBWLCase(p,u,i,w,l), new_decode_block)
505
506 decode_block += '''
507 default:
508 return new Unknown(machInst);
509 break;
510 }'''
511}};
512
457def format ArmLoadMemory(memacc_code, ea_code = {{ EA = Rn + disp; }},
458 mem_flags = [], inst_flags = []) {{
459 ea_code = ArmGenericCodeSubs(ea_code)
460 memacc_code = ArmGenericCodeSubs(memacc_code)
461 (header_output, decoder_output, decode_block, exec_output) = \
462 LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
463 decode_template = BasicDecode,
464 exec_template_base = 'Load')
465}};
466
467def format ArmStoreMemory(memacc_code, ea_code = {{ EA = Rn + disp; }},
468 mem_flags = [], inst_flags = []) {{
469 ea_code = ArmGenericCodeSubs(ea_code)
470 memacc_code = ArmGenericCodeSubs(memacc_code)
471 (header_output, decoder_output, decode_block, exec_output) = \
472 LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
473 exec_template_base = 'Store')
474}};
475
513def format ArmLoadMemory(memacc_code, ea_code = {{ EA = Rn + disp; }},
514 mem_flags = [], inst_flags = []) {{
515 ea_code = ArmGenericCodeSubs(ea_code)
516 memacc_code = ArmGenericCodeSubs(memacc_code)
517 (header_output, decoder_output, decode_block, exec_output) = \
518 LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
519 decode_template = BasicDecode,
520 exec_template_base = 'Load')
521}};
522
523def format ArmStoreMemory(memacc_code, ea_code = {{ EA = Rn + disp; }},
524 mem_flags = [], inst_flags = []) {{
525 ea_code = ArmGenericCodeSubs(ea_code)
526 memacc_code = ArmGenericCodeSubs(memacc_code)
527 (header_output, decoder_output, decode_block, exec_output) = \
528 LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
529 exec_template_base = 'Store')
530}};
531