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 --- 38 unchanged lines hidden (view full) --- 47}}; 48 49def template MacroStoreConstructor {{ 50inline %(class_name)s::%(class_name)s(ExtMachInst machInst) 51 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) 52{ 53 %(constructor)s; 54 uint32_t regs_to_handle = reglist; |
55 uint32_t start_addr = 0; |
56 57 switch (puswl) 58 { 59 case 0x00: // stmda 60 case 0x01: // L ldmda_l 61 case 0x02: // W stmda_w 62 case 0x03: // WL ldmda_wl 63 start_addr = (ones << 2) - 4; |
64 break; 65 case 0x08: // U stmia_u 66 case 0x09: // U L ldmia_ul 67 case 0x0a: // U W stmia 68 case 0x0b: // U WL ldmia 69 start_addr = 0; |
70 break; 71 case 0x10: // P stmdb 72 case 0x11: // P L ldmdb 73 case 0x12: // P W stmdb 74 case 0x13: // P WL ldmdb 75 start_addr = (ones << 2); // U-bit is already 0 for subtract |
76 break; 77 case 0x18: // PU stmib 78 case 0x19: // PU L ldmib 79 case 0x1a: // PU W stmib 80 case 0x1b: // PU WL ldmib 81 start_addr = 4; |
82 break; 83 default: 84 panic("Unhandled Load/Store Multiple Instruction, " 85 "puswl = 0x%x", (unsigned) puswl); 86 break; 87 } 88 |
89 uint32_t newMachInst = 0; 90 newMachInst = machInst & 0xffff0000; 91 microOps[0] = new Addi_uop(newMachInst); 92 |
93 unsigned j = 0; |
94 for (int i = 1; i < ones+1; i++) 95 { 96 // Get next available bit for transfer 97 while (! ( regs_to_handle & (1<<j))) 98 j++; 99 regs_to_handle &= ~(1<<j); 100 101 microOps[i] = gen_ldrstr_uop(machInst, loadop, j, start_addr); 102 103 if (up) 104 start_addr += 4; 105 else 106 start_addr -= 4; 107 } 108 |
109 if (writeback) 110 { 111 uint32_t newMachInst = machInst & 0xf0000000; 112 uint32_t rn = (machInst >> 16) & 0x0f; 113 // 3322 2222 2222 1111 1111 11 114 // 1098 7654 3210 9876 5432 1098 7654 3210 115 // COND 0010 0100 [RN] [RD] 0000 [ IMM ] 116 // sub rn, rn, imm --- 150 unchanged lines hidden --- |