| OLD | NEW |
| 1 /* Simulator for Analog Devices Blackfin processors. | 1 /* Simulator for Analog Devices Blackfin processors. |
| 2 | 2 |
| 3 Copyright (C) 2005-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2005-2012 Free Software Foundation, Inc. |
| 4 Contributed by Analog Devices, Inc. | 4 Contributed by Analog Devices, Inc. |
| 5 | 5 |
| 6 This file is part of simulators. | 6 This file is part of simulators. |
| 7 | 7 |
| 8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
| 9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
| 10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 /* For dealing with parallel instructions, we must avoid changing our register | 38 /* For dealing with parallel instructions, we must avoid changing our register |
| 39 file until all parallel insns have been simulated. This queue of stores | 39 file until all parallel insns have been simulated. This queue of stores |
| 40 can be used to delay a modification. | 40 can be used to delay a modification. |
| 41 XXX: Should go and convert all 32 bit insns to use this. */ | 41 XXX: Should go and convert all 32 bit insns to use this. */ |
| 42 struct store { | 42 struct store { |
| 43 bu32 *addr; | 43 bu32 *addr; |
| 44 bu32 val; | 44 bu32 val; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 enum bfin_parallel_group { |
| 48 BFIN_PARALLEL_NONE, |
| 49 BFIN_PARALLEL_GROUP0, /* 32bit slot. */ |
| 50 BFIN_PARALLEL_GROUP1, /* 16bit group1. */ |
| 51 BFIN_PARALLEL_GROUP2, /* 16bit group2. */ |
| 52 }; |
| 53 |
| 47 /* The KSP/USP handling wrt SP may not follow the hardware exactly (the hw | 54 /* The KSP/USP handling wrt SP may not follow the hardware exactly (the hw |
| 48 looks at current mode and uses either SP or USP based on that. We instead | 55 looks at current mode and uses either SP or USP based on that. We instead |
| 49 always operate on SP and mirror things in KSP and USP. During a CEC | 56 always operate on SP and mirror things in KSP and USP. During a CEC |
| 50 transition, we take care of syncing the values. This lowers the simulation | 57 transition, we take care of syncing the values. This lowers the simulation |
| 51 complexity and speeds things up a bit. */ | 58 complexity and speeds things up a bit. */ |
| 52 struct bfin_cpu_state | 59 struct bfin_cpu_state |
| 53 { | 60 { |
| 54 bu32 dpregs[16], iregs[4], mregs[4], bregs[4], lregs[4], cycles[3]; | 61 bu32 dpregs[16], iregs[4], mregs[4], bregs[4], lregs[4], cycles[3]; |
| 55 bu32 ax[2], aw[2]; | 62 bu32 ax[2], aw[2]; |
| 56 bu32 lt[2], lc[2], lb[2]; | 63 bu32 lt[2], lc[2], lb[2]; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 71 | 78 |
| 72 /* Used by the CEC to figure out where to return to. */ | 79 /* Used by the CEC to figure out where to return to. */ |
| 73 bu32 insn_len; | 80 bu32 insn_len; |
| 74 | 81 |
| 75 /* How many cycles did this insn take to complete ? */ | 82 /* How many cycles did this insn take to complete ? */ |
| 76 bu32 cycle_delay; | 83 bu32 cycle_delay; |
| 77 | 84 |
| 78 /* The pc currently being interpreted in parallel insns. */ | 85 /* The pc currently being interpreted in parallel insns. */ |
| 79 bu32 multi_pc; | 86 bu32 multi_pc; |
| 80 | 87 |
| 88 /* Some insns are valid in group1, and others in group2, so we |
| 89 need to keep track of the exact slot we're processing. */ |
| 90 enum bfin_parallel_group group; |
| 91 |
| 81 /* Needed for supporting the DISALGNEXCPT instruction */ | 92 /* Needed for supporting the DISALGNEXCPT instruction */ |
| 82 int dis_algn_expt; | 93 int dis_algn_expt; |
| 83 | 94 |
| 84 /* See notes above for struct store. */ | 95 /* See notes above for struct store. */ |
| 85 struct store stores[20]; | 96 struct store stores[20]; |
| 86 int n_stores; | 97 int n_stores; |
| 87 | 98 |
| 88 #if (WITH_HW) | 99 #if (WITH_HW) |
| 89 /* Cache heavily used CPU-specific device pointers. */ | 100 /* Cache heavily used CPU-specific device pointers. */ |
| 90 void *cec_cache; | 101 void *cec_cache; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 119 #define SYSCFGREG (BFIN_CPU_STATE.syscfg) | 130 #define SYSCFGREG (BFIN_CPU_STATE.syscfg) |
| 120 #define RETSREG (BFIN_CPU_STATE.rets) | 131 #define RETSREG (BFIN_CPU_STATE.rets) |
| 121 #define RETIREG (BFIN_CPU_STATE.reti) | 132 #define RETIREG (BFIN_CPU_STATE.reti) |
| 122 #define RETXREG (BFIN_CPU_STATE.retx) | 133 #define RETXREG (BFIN_CPU_STATE.retx) |
| 123 #define RETNREG (BFIN_CPU_STATE.retn) | 134 #define RETNREG (BFIN_CPU_STATE.retn) |
| 124 #define RETEREG (BFIN_CPU_STATE.rete) | 135 #define RETEREG (BFIN_CPU_STATE.rete) |
| 125 #define PCREG (BFIN_CPU_STATE.pc) | 136 #define PCREG (BFIN_CPU_STATE.pc) |
| 126 #define EMUDAT_INREG (BFIN_CPU_STATE.emudat[0]) | 137 #define EMUDAT_INREG (BFIN_CPU_STATE.emudat[0]) |
| 127 #define EMUDAT_OUTREG (BFIN_CPU_STATE.emudat[1]) | 138 #define EMUDAT_OUTREG (BFIN_CPU_STATE.emudat[1]) |
| 128 #define INSN_LEN (BFIN_CPU_STATE.insn_len) | 139 #define INSN_LEN (BFIN_CPU_STATE.insn_len) |
| 140 #define PARALLEL_GROUP (BFIN_CPU_STATE.group) |
| 129 #define CYCLE_DELAY (BFIN_CPU_STATE.cycle_delay) | 141 #define CYCLE_DELAY (BFIN_CPU_STATE.cycle_delay) |
| 130 #define DIS_ALGN_EXPT (BFIN_CPU_STATE.dis_algn_expt) | 142 #define DIS_ALGN_EXPT (BFIN_CPU_STATE.dis_algn_expt) |
| 131 | 143 |
| 132 #define EXCAUSE_SHIFT 0 | 144 #define EXCAUSE_SHIFT 0 |
| 133 #define EXCAUSE_MASK (0x3f << EXCAUSE_SHIFT) | 145 #define EXCAUSE_MASK (0x3f << EXCAUSE_SHIFT) |
| 134 #define EXCAUSE ((SEQSTATREG & EXCAUSE_MASK) >> EXCAUSE_SHIFT) | 146 #define EXCAUSE ((SEQSTATREG & EXCAUSE_MASK) >> EXCAUSE_SHIFT) |
| 135 #define HWERRCAUSE_SHIFT 14 | 147 #define HWERRCAUSE_SHIFT 14 |
| 136 #define HWERRCAUSE_MASK (0x1f << HWERRCAUSE_SHIFT) | 148 #define HWERRCAUSE_MASK (0x1f << HWERRCAUSE_SHIFT) |
| 137 #define HWERRCAUSE ((SEQSTATREG & HWERRCAUSE_MASK) >> HWERRCAUSE_SH
IFT) | 149 #define HWERRCAUSE ((SEQSTATREG & HWERRCAUSE_MASK) >> HWERRCAUSE_SH
IFT) |
| 138 | 150 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 #define BFIN_ASYNC_BASE 0x20000000 | 353 #define BFIN_ASYNC_BASE 0x20000000 |
| 342 #define BFIN_SYSTEM_MMR_BASE 0xFFC00000 | 354 #define BFIN_SYSTEM_MMR_BASE 0xFFC00000 |
| 343 #define BFIN_CORE_MMR_BASE 0xFFE00000 | 355 #define BFIN_CORE_MMR_BASE 0xFFE00000 |
| 344 #define BFIN_L1_SRAM_SCRATCH 0xFFB00000 | 356 #define BFIN_L1_SRAM_SCRATCH 0xFFB00000 |
| 345 #define BFIN_L1_SRAM_SCRATCH_SIZE 0x1000 | 357 #define BFIN_L1_SRAM_SCRATCH_SIZE 0x1000 |
| 346 #define BFIN_L1_SRAM_SCRATCH_END (BFIN_L1_SRAM_SCRATCH + BFIN_L1_SRAM_SCRATCH_S
IZE) | 358 #define BFIN_L1_SRAM_SCRATCH_END (BFIN_L1_SRAM_SCRATCH + BFIN_L1_SRAM_SCRATCH_S
IZE) |
| 347 | 359 |
| 348 #define BFIN_L1_CACHE_BYTES 32 | 360 #define BFIN_L1_CACHE_BYTES 32 |
| 349 | 361 |
| 350 #endif | 362 #endif |
| OLD | NEW |