4 /* Copyright 2009-2014 Free Software Foundation, Inc.
6 This file is part of the Xilinx MicroBlaze simulator.
8 This library 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.
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.
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/>. */
21 #include "../../opcodes/microblaze-opcm.h"
23 #define GET_RD ((inst & RD_MASK) >> RD_LOW)
24 #define GET_RA ((inst & RA_MASK) >> RA_LOW)
25 #define GET_RB ((inst & RB_MASK) >> RB_LOW)
27 #define CPU microblaze_state.cpu[0].microblaze_cpu
29 #define RD CPU.regs[rd]
30 #define RA CPU.regs[ra]
31 #define RB CPU.regs[rb]
32 /* #define IMM immword */
34 #define SA CPU.spregs[IMM & 0x1]
36 #define IMM_H CPU.imm_high
37 #define IMM_L ((inst & IMM_MASK) >> IMM_LOW)
39 #define IMM_ENABLE CPU.imm_enable
41 #define IMM (IMM_ENABLE ? \
42 (((uhalf)IMM_H << 16) | (uhalf)IMM_L) : \
46 (0xFFFF0000 | IMM_L) : \
47 (0x0000FFFF & IMM_L))))
49 #define PC CPU.spregs[0]
50 #define MSR CPU.spregs[1]
51 #define SP CPU.regs[29]
52 #define RETREG CPU.regs[3]
55 #define MEM(X) memory[X]
57 #define MEM_RD_BYTE(X) rbat(X)
58 #define MEM_RD_HALF(X) rhat(X)
59 #define MEM_RD_WORD(X) rlat(X)
60 #define MEM_RD_UBYTE(X) (ubyte) MEM_RD_BYTE(X)
61 #define MEM_RD_UHALF(X) (uhalf) MEM_RD_HALF(X)
62 #define MEM_RD_UWORD(X) (uword) MEM_RD_WORD(X)
64 #define MEM_WR_BYTE(X, D) wbat(X, D)
65 #define MEM_WR_HALF(X, D) what(X, D)
66 #define MEM_WR_WORD(X, D) wlat(X, D)
69 #define MICROBLAZE_SEXT8(X) ((char) X)
70 #define MICROBLAZE_SEXT16(X) ((short) X)
74 #define C_rd ((MSR & 0x4) >> 2)
75 #define C_wr(D) MSR = (D ? MSR | 0x80000004 : MSR & 0x7FFFFFFB)
77 #define C_calc(X, Y, C) ((((uword)Y == MAX_WORD) && (C == 1)) ? \
79 ((MAX_WORD - (uword)X) < ((uword)Y + C)))
81 #define BIP_MASK 0x00000008
82 #define CARRY_MASK 0x00000004
83 #define INTR_EN_MASK 0x00000002
84 #define BUSLOCK_MASK 0x00000001
86 #define DELAY_SLOT delay_slot_enable = 1
87 #define BRANCH branch_taken = 1
93 #define MAX_WORD 0xFFFFFFFF
94 #define MICROBLAZE_HALT_INST 0xb8000000
99 typedef unsigned char ubyte
;
100 typedef unsigned short uhalf
;
101 typedef unsigned int uword
;
103 #endif /* MICROBLAZE_H */
This page took 0.031595 seconds and 4 git commands to generate.