1 /* Mitsubishi Electric Corp. D30V Simulator.
2 Copyright (C) 1997, Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 This file is part of GDB, the GNU debugger.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
25 #define ALU_CARRY (PSW_VAL(PSW_C) != 0)
29 #define ALU16_END(TARG, HIGH) \
31 unsigned32 mask, value; \
32 if (ALU16_HAD_OVERFLOW) { \
33 mask = BIT32 (PSW_V) | BIT32 (PSW_VA) | BIT32 (PSW_C); \
34 value = BIT32 (PSW_V) | BIT32 (PSW_VA); \
37 mask = BIT32 (PSW_V) | BIT32 (PSW_C); \
40 if (ALU16_HAD_CARRY_BORROW) \
41 value |= BIT32 (PSW_C); \
43 WRITE32_QUEUE_MASK (TARG, ALU16_OVERFLOW_RESULT<<16, 0xffff0000); \
45 WRITE32_QUEUE_MASK (TARG, ALU16_OVERFLOW_RESULT, 0x0000ffff); \
46 WRITE32_QUEUE_MASK (&PSW, value, mask); \
49 #define ALU32_END(TARG) \
51 unsigned32 mask, value; \
52 if (ALU32_HAD_OVERFLOW) { \
53 mask = BIT32 (PSW_V) | BIT32 (PSW_VA) | BIT32 (PSW_C); \
54 value = BIT32 (PSW_V) | BIT32 (PSW_VA); \
57 mask = BIT32 (PSW_V) | BIT32 (PSW_C); \
60 if (ALU32_HAD_CARRY_BORROW) \
61 value |= BIT32 (PSW_C); \
62 WRITE32_QUEUE (TARG, ALU32_OVERFLOW_RESULT); \
63 WRITE32_QUEUE_MASK (&PSW, value, mask); \
66 #define ALU_END(TARG) ALU32_END(TARG)
69 /* PSW & Flag manipulation */
71 #define PSW_SET(BIT,VAL) BLIT32(PSW, (BIT), (VAL))
72 #define PSW_VAL(BIT) EXTRACTED32(PSW, (BIT), (BIT))
74 #define PSW_F(FLAG) (17 + ((FLAG) % 8) * 2)
75 #define PSW_FLAG_SET(FLAG,VAL) PSW_SET(PSW_F(FLAG), VAL)
76 #define PSW_FLAG_VAL(FLAG) PSW_VAL(PSW_F(FLAG))
78 #define PSW_SET_QUEUE(BIT,VAL) \
80 unsigned32 mask = BIT32 (BIT); \
81 unsigned32 bitval = (VAL) ? mask : 0; \
82 WRITE32_QUEUE_MASK (&PSW, bitval, mask); \
85 #define PSW_FLAG_SET_QUEUE(FLAG,VAL) \
87 unsigned32 mask = BIT32 (PSW_F (FLAG)); \
88 unsigned32 bitval = (VAL) ? mask : 0; \
89 WRITE32_QUEUE_MASK (&PSW, bitval, mask); \
92 /* Bring data in from the cold */
95 (sim_core_read_8(STATE_CPU (sd, 0), cia, exec_map, (EA)))
97 #define MEM(SIGN, EA, NR_BYTES) \
98 ((SIGN##_##NR_BYTES) sim_core_read_unaligned_##NR_BYTES(STATE_CPU (sd, 0), cia, read_map, (EA)))
100 #define STORE(EA, NR_BYTES, VAL) \
102 sim_core_write_unaligned_##NR_BYTES(STATE_CPU (sd, 0), cia, write_map, (EA), (VAL)); \
This page took 0.045126 seconds and 4 git commands to generate.