mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
target-tricore: Add instructions of BO opcode format
Add instructions of BO opcode format. Add microcode generator functions gen_swap, gen_ldmst. Add microcode generator functions gen_st/ld_preincr, which write back the address after the memory access. Add helper for circular and bit reverse addr mode calculation. Add sign extended bitmask for BO_OFF10 field. Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Reviewed-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
@@ -27,3 +27,6 @@ DEF_HELPER_2(ldlcx, void, env, i32)
|
||||
DEF_HELPER_2(lducx, void, env, i32)
|
||||
DEF_HELPER_2(stlcx, void, env, i32)
|
||||
DEF_HELPER_2(stucx, void, env, i32)
|
||||
/* Address mode helper */
|
||||
DEF_HELPER_1(br_update, i32, i32)
|
||||
DEF_HELPER_2(circ_update, i32, i32, i32)
|
||||
|
||||
@@ -20,6 +20,42 @@
|
||||
#include "exec/helper-proto.h"
|
||||
#include "exec/cpu_ldst.h"
|
||||
|
||||
/* Addressing mode helper */
|
||||
|
||||
static uint16_t reverse16(uint16_t val)
|
||||
{
|
||||
uint8_t high = (uint8_t)(val >> 8);
|
||||
uint8_t low = (uint8_t)(val & 0xff);
|
||||
|
||||
uint16_t rh, rl;
|
||||
|
||||
rl = (uint16_t)((high * 0x0202020202ULL & 0x010884422010ULL) % 1023);
|
||||
rh = (uint16_t)((low * 0x0202020202ULL & 0x010884422010ULL) % 1023);
|
||||
|
||||
return (rh << 8) | rl;
|
||||
}
|
||||
|
||||
uint32_t helper_br_update(uint32_t reg)
|
||||
{
|
||||
uint32_t index = reg & 0xffff;
|
||||
uint32_t incr = reg >> 16;
|
||||
uint32_t new_index = reverse16(reverse16(index) + reverse16(incr));
|
||||
return reg - index + new_index;
|
||||
}
|
||||
|
||||
uint32_t helper_circ_update(uint32_t reg, uint32_t off)
|
||||
{
|
||||
uint32_t index = reg & 0xffff;
|
||||
uint32_t length = reg >> 16;
|
||||
int32_t new_index = index + off;
|
||||
if (new_index < 0) {
|
||||
new_index += length;
|
||||
} else {
|
||||
new_index %= length;
|
||||
}
|
||||
return reg - index + new_index;
|
||||
}
|
||||
|
||||
#define SSOV(env, ret, arg, len) do { \
|
||||
int64_t max_pos = INT##len ##_MAX; \
|
||||
int64_t max_neg = INT##len ##_MIN; \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -105,6 +105,8 @@
|
||||
/* BO Format */
|
||||
#define MASK_OP_BO_OFF10(op) (MASK_BITS_SHIFT(op, 16, 21) + \
|
||||
(MASK_BITS_SHIFT(op, 28, 31) << 6))
|
||||
#define MASK_OP_BO_OFF10_SEXT(op) (MASK_BITS_SHIFT_SEXT(op, 16, 21) + \
|
||||
(MASK_BITS_SHIFT_SEXT(op, 28, 31) << 6))
|
||||
#define MASK_OP_BO_OP2(op) MASK_BITS_SHIFT(op, 22, 27)
|
||||
#define MASK_OP_BO_S2(op) MASK_BITS_SHIFT(op, 12, 15)
|
||||
#define MASK_OP_BO_S1D(op) MASK_BITS_SHIFT(op, 8, 11)
|
||||
|
||||
Reference in New Issue
Block a user