sim-main.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Simulator for Analog Devices Blackfin processors.
  2. Copyright (C) 2005-2022 Free Software Foundation, Inc.
  3. Contributed by Analog Devices, Inc.
  4. This file is part of simulators.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. #ifndef _BFIN_MAIN_SIM_H_
  16. #define _BFIN_MAIN_SIM_H_
  17. #include "sim-basics.h"
  18. #include "arch.h"
  19. #include "sim-base.h"
  20. #include "bfin-sim.h"
  21. #include "machs.h"
  22. struct _sim_cpu {
  23. /* ... simulator specific members ... */
  24. struct bfin_cpu_state state;
  25. sim_cpu_base base;
  26. };
  27. #define BFIN_CPU_STATE ((cpu)->state)
  28. #define STATE_BOARD_DATA(sd) ((struct bfin_board_data *) STATE_ARCH_DATA (sd))
  29. #include "sim-config.h"
  30. #include "sim-types.h"
  31. #include "sim-engine.h"
  32. #include "sim-options.h"
  33. #include "dv-bfin_trace.h"
  34. #undef CLAMP
  35. #define CLAMP(a, b, c) min (max (a, b), c)
  36. /* TODO: Move all this trace logic to the common code. */
  37. #define BFIN_TRACE_CORE(cpu, addr, size, map, val) \
  38. do { \
  39. TRACE_CORE (cpu, "%cBUS %s %i bytes @ 0x%08x: 0x%0*x", \
  40. map == exec_map ? 'I' : 'D', \
  41. map == write_map ? "STORE" : "FETCH", \
  42. size, addr, size * 2, val); \
  43. PROFILE_COUNT_CORE (cpu, addr, size, map); \
  44. } while (0)
  45. #define BFIN_TRACE_BRANCH(cpu, oldpc, newpc, hwloop, fmt, ...) \
  46. do { \
  47. TRACE_BRANCH (cpu, fmt " to %#x", ## __VA_ARGS__, newpc); \
  48. if (STATE_ENVIRONMENT (CPU_STATE (cpu)) == OPERATING_ENVIRONMENT) \
  49. bfin_trace_queue (cpu, oldpc, newpc, hwloop); \
  50. } while (0)
  51. /* Default memory size. */
  52. #define BFIN_DEFAULT_MEM_SIZE (128 * 1024 * 1024)
  53. #endif