Commit | Line | Data |
---|---|---|
ef016f83 MF |
1 | /* Simulator for Analog Devices Blackfin processors. |
2 | ||
618f726f | 3 | Copyright (C) 2005-2016 Free Software Foundation, Inc. |
ef016f83 MF |
4 | Contributed by Analog Devices, Inc. |
5 | ||
6 | This file is part of simulators. | |
7 | ||
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 | |
10 | the Free Software Foundation; either version 3 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
20 | ||
21 | #ifndef _BFIN_MAIN_SIM_H_ | |
22 | #define _BFIN_MAIN_SIM_H_ | |
23 | ||
24 | #include "sim-basics.h" | |
25 | #include "sim-signal.h" | |
474a2d9f MF |
26 | #include "arch.h" |
27 | #include "sim-base.h" | |
ef016f83 MF |
28 | |
29 | #include "bfin-sim.h" | |
30 | ||
31 | #include "machs.h" | |
32 | ||
ef016f83 MF |
33 | struct _sim_cpu { |
34 | /* ... simulator specific members ... */ | |
35 | struct bfin_cpu_state state; | |
36 | sim_cpu_base base; | |
37 | }; | |
38 | #define BFIN_CPU_STATE ((cpu)->state) | |
39 | ||
40 | struct sim_state { | |
41 | sim_cpu *cpu[MAX_NR_PROCESSORS]; | |
78e9aa70 | 42 | |
ef016f83 MF |
43 | /* ... simulator specific members ... */ |
44 | struct bfin_board_data board; | |
45 | #define STATE_BOARD_DATA(sd) (&(sd)->board) | |
46 | sim_state_base base; | |
47 | }; | |
48 | ||
49 | #include "sim-config.h" | |
50 | #include "sim-types.h" | |
51 | #include "sim-engine.h" | |
52 | #include "sim-options.h" | |
ef016f83 MF |
53 | #include "dv-bfin_trace.h" |
54 | ||
ef016f83 MF |
55 | #undef CLAMP |
56 | #undef ALIGN | |
bc273e17 | 57 | #define CLAMP(a, b, c) min (max (a, b), c) |
ef016f83 MF |
58 | #define ALIGN(addr, size) (((addr) + ((size)-1)) & ~((size)-1)) |
59 | ||
bb11f3ed MF |
60 | /* TODO: Move all this trace logic to the common code. */ |
61 | #define BFIN_TRACE_CORE(cpu, addr, size, map, val) \ | |
ef016f83 | 62 | do { \ |
bb11f3ed MF |
63 | TRACE_CORE (cpu, "%cBUS %s %i bytes @ 0x%08x: 0x%0*x", \ |
64 | map == exec_map ? 'I' : 'D', \ | |
65 | map == write_map ? "STORE" : "FETCH", \ | |
66 | size, addr, size * 2, val); \ | |
ef016f83 MF |
67 | PROFILE_COUNT_CORE (cpu, addr, size, map); \ |
68 | } while (0) | |
bb11f3ed | 69 | #define BFIN_TRACE_BRANCH(cpu, oldpc, newpc, hwloop, fmt, ...) \ |
ef016f83 | 70 | do { \ |
bb11f3ed | 71 | TRACE_BRANCH (cpu, fmt " to %#x", ## __VA_ARGS__, newpc); \ |
ef016f83 MF |
72 | if (STATE_ENVIRONMENT (CPU_STATE (cpu)) == OPERATING_ENVIRONMENT) \ |
73 | bfin_trace_queue (cpu, oldpc, newpc, hwloop); \ | |
74 | } while (0) | |
75 | ||
ef016f83 MF |
76 | /* Default memory size. */ |
77 | #define BFIN_DEFAULT_MEM_SIZE (128 * 1024 * 1024) | |
78 | ||
79 | #endif |