1 /* Copyright 2009-2019 Free Software Foundation, Inc.
3 This file is part of the Xilinx MicroBlaze simulator.
5 This library 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.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
19 * MICROBLAZE Instruction Set Architecture
31 CARRY = C_calc(RA, RB, 0);
39 CARRY = C_calc(RB, ~RA, 1);
47 CARRY = C_calc(RA, RB, C_rd);
55 CARRY = C_calc(RB, ~RA, C_rd);
76 int tmp_reg = RB + ~RA + 1;
77 if ((RB & 0x80000000) ^ (RA & 0x80000000)) {
78 tmp_reg = ((tmp_reg & 0x7fffffff) | (RB & 0x80000000));
88 int tmp_reg = RB + ~RA + 1;
89 if ((RB & 0x80000000) ^ (RA & 0x80000000)) {
90 tmp_reg = ((tmp_reg & 0x7fffffff) | (RA & 0x80000000));
105 RD = RB + ~RA + C_rd;
111 CARRY = C_calc(RA, IMM, 0);
119 CARRY = C_calc(IMM, ~RA, 1);
127 CARRY = C_calc(RA, IMM, C_rd);
128 RD = RA + IMM + C_rd;
135 CARRY = C_calc(IMM, ~RA, C_rd);
136 RD = IMM + ~RA + C_rd;
155 RD = RA + IMM + C_rd;
161 RD = IMM + ~RA + C_rd;
173 RD = (uword)RA >> RB;
185 RD = (uword)RA << RB;
191 RD = (word) RB / (word) RA;
197 RD = (uword) RB / (uword) RA;
208 INST_TYPE_RD_RA_IMM5,
209 RD = (uword)RA >> (IMM & 0x1F);
214 INST_TYPE_RD_RA_IMM5,
215 RD = (word)RA >> (IMM & 0x1F);
220 INST_TYPE_RD_RA_IMM5,
221 RD = (uword)RA << (IMM & 0x1F);
264 INSTRUCTION(microblaze_or,
270 INSTRUCTION(microblaze_and,
276 INSTRUCTION(microblaze_xor,
292 RD = (int) (RA >> 1);
300 RD = ((((int) (RA >> 1)) & 0x7FFFFFFF) | (uword)(C_rd << 31));
308 RD = (uword) ((RA >> 1) & 0x7FFFFFFF);
315 RD = MICROBLAZE_SEXT8(RA);
321 RD = MICROBLAZE_SEXT16(RA);
388 INSTRUCTION(microblaze_brk,
393 MSR = MSR | BIP_MASK;
563 MSR = MSR | INTR_EN_MASK;
571 MSR = MSR & ~BIP_MASK;
622 MSR = MSR | BIP_MASK;
754 RD = (MEM_RD_UBYTE(RA + RB));
760 RD = (MEM_RD_UHALF((RA + RB) & ~0x1));
766 RD = (MEM_RD_WORD((RA + RB) & ~0x3));
772 MEM_WR_BYTE(RA + RB, RD);
778 MEM_WR_HALF((RA + RB) & ~0x1, RD);
784 MEM_WR_WORD((RA + RB) & ~0x3, RD);
790 RD = (MEM_RD_UBYTE(RA + IMM));
796 RD = (MEM_RD_UHALF((RA+IMM) & ~0x1));
802 RD = (MEM_RD_WORD((RA+IMM) & ~0x3));
808 MEM_WR_BYTE(RA + IMM, RD);
814 MEM_WR_HALF((RA + IMM) & ~0x1, RD);
820 MEM_WR_WORD((RA + IMM) & ~0x3, RD);