target: e2k: Use start+len for GET_FIELD.

This commit is contained in:
Denis Drakhnia 2020-11-23 22:26:47 +02:00
parent ceae6abea9
commit 31bfefe9fd
8 changed files with 69 additions and 137 deletions

View File

@ -93,20 +93,20 @@ static const struct e2k_def_t e2k_defs[] = {
static inline void cpu_dump_state_wd(CPUE2KState *env, FILE *f, int flags)
{
int wbs = GET_FIELD(env->cr1_lo, CR1_LO_WBS_OFF, CR1_LO_WBS_END);
int wsz = GET_FIELD(env->cr1_lo, CR1_LO_WPSZ_OFF, CR1_LO_WPSZ_END);
int wbs = GET_FIELD(env->cr1_lo, CR1_LO_WBS_OFF, CR1_LO_WBS_LEN);
int wsz = GET_FIELD(env->cr1_lo, CR1_LO_WPSZ_OFF, CR1_LO_WPSZ_LEN);
qemu_fprintf(f, "wbs = %#x, wsz = %#x\n", wbs, wsz);
}
static inline void cpu_dump_state_br(CPUE2KState *env, FILE *f, int flags)
{
uint32_t br = GET_FIELD(env->cr1_hi, CR1_HI_BR_OFF, CR1_HI_BR_END);
int rbs = GET_FIELD(br, BR_RBS_OFF, BR_RBS_END);
int rsz = GET_FIELD(br, BR_RSZ_OFF, BR_RSZ_END);
int rcur = GET_FIELD(br, BR_RCUR_OFF, BR_RCUR_END);
int psz = GET_FIELD(br, BR_PSZ_OFF, BR_PSZ_END);
int pcur = GET_FIELD(br, BR_PCUR_OFF, BR_PCUR_END);
uint32_t br = GET_FIELD(env->cr1_hi, CR1_HI_BR_OFF, CR1_HI_BR_LEN);
int rbs = GET_FIELD(br, BR_RBS_OFF, BR_RBS_LEN);
int rsz = GET_FIELD(br, BR_RSZ_OFF, BR_RSZ_LEN);
int rcur = GET_FIELD(br, BR_RCUR_OFF, BR_RCUR_LEN);
int psz = GET_FIELD(br, BR_PSZ_OFF, BR_PSZ_LEN);
int pcur = GET_FIELD(br, BR_PCUR_OFF, BR_PCUR_LEN);
qemu_fprintf(f, "br %#x\n", br);
qemu_fprintf(f, " rbs %#x\n", rbs);

View File

@ -7,19 +7,13 @@
void e2k_tcg_initialize(void);
#define GEN_MASK(start, end) \
GEN_MASK_LEN((start), (end) - (start) + 1)
#define GEN_MASK_LEN(start, len) \
(((1UL << (len)) - 1) << (start))
#define GEN_MASK(start, len) (((1UL << (len)) - 1) << (start))
#define GET_BIT(v, index) (((v) >> (index)) & 1)
#define GET_FIELD(v, start, end) \
(((v) >> (start)) & ((1UL << ((end) - (start) + 1)) - 1))
#define GET_FIELD_LEN(v, s, l) \
(((v) >> (s)) & GEN_MASK_LEN(0, l))
#define GET_FIELD(v, s, l) (((v) >> (s)) & GEN_MASK(0, l))
#define SET_FIELD(v, f, s, l) \
( \
((v) & ~GEN_MASK_LEN((s), (l))) | \
((((typeof((v))) (f)) << (s)) & GEN_MASK_LEN((s), (l))) \
((v) & ~GEN_MASK((s), (l))) | \
((((typeof((v))) (f)) << (s)) & GEN_MASK((s), (l))) \
)
#define MMU_USER_IDX 1
@ -306,7 +300,7 @@ int e2k_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n);
static inline target_ulong e2k_state_pcs_base_get(CPUE2KState *env)
{
return GET_FIELD(env->pcsp_lo, PCSP_LO_BASE_OFF, PCSP_LO_BASE_END);
return GET_FIELD(env->pcsp_lo, PCSP_LO_BASE_OFF, PCSP_LO_BASE_LEN);
}
static inline void e2k_state_pcs_base_set(CPUE2KState *env, target_ulong pcsp)
@ -317,7 +311,7 @@ static inline void e2k_state_pcs_base_set(CPUE2KState *env, target_ulong pcsp)
static inline size_t e2k_state_pcs_index_get(CPUE2KState *env)
{
return GET_FIELD(env->pcsp_hi, PCSP_HI_IND_OFF, PCSP_HI_IND_END);
return GET_FIELD(env->pcsp_hi, PCSP_HI_IND_OFF, PCSP_HI_IND_LEN);
}
static inline void e2k_state_pcs_index_set(CPUE2KState *env, size_t ind)
@ -328,7 +322,7 @@ static inline void e2k_state_pcs_index_set(CPUE2KState *env, size_t ind)
static inline size_t e2k_state_pcs_size_get(CPUE2KState *env)
{
return GET_FIELD(env->pcsp_hi, PCSP_HI_SIZE_OFF, PCSP_HI_SIZE_END);
return GET_FIELD(env->pcsp_hi, PCSP_HI_SIZE_OFF, PCSP_HI_SIZE_LEN);
}
static inline void e2k_state_pcs_size_set(CPUE2KState *env, size_t size)
@ -339,7 +333,7 @@ static inline void e2k_state_pcs_size_set(CPUE2KState *env, size_t size)
static inline target_ulong e2k_state_ps_base_get(CPUE2KState *env)
{
return GET_FIELD(env->psp_lo, PSP_LO_BASE_OFF, PSP_LO_BASE_END);
return GET_FIELD(env->psp_lo, PSP_LO_BASE_OFF, PSP_LO_BASE_LEN);
}
static inline size_t e2k_state_ps_ind_get(CPUE2KState *env)
@ -354,7 +348,7 @@ static inline void e2k_state_ps_ind_set(CPUE2KState *env, size_t ind)
static inline int e2k_state_cr1_wbs_get(CPUE2KState *env)
{
return GET_FIELD(env->cr1_lo, CR1_LO_WBS_OFF, CR1_LO_WBS_END);
return GET_FIELD(env->cr1_lo, CR1_LO_WBS_OFF, CR1_LO_WBS_LEN);
}
static inline void e2k_state_cr1_wbs_set(CPUE2KState *env, int wbs)
@ -364,7 +358,7 @@ static inline void e2k_state_cr1_wbs_set(CPUE2KState *env, int wbs)
static inline int e2k_state_cr1_wpsz_get(CPUE2KState *env)
{
return GET_FIELD(env->cr1_lo, CR1_LO_WPSZ_OFF, CR1_LO_WPSZ_END);
return GET_FIELD(env->cr1_lo, CR1_LO_WPSZ_OFF, CR1_LO_WPSZ_LEN);
}
static inline void e2k_state_cr1_wpsz_set(CPUE2KState *env, int wpsz)
@ -375,7 +369,7 @@ static inline void e2k_state_cr1_wpsz_set(CPUE2KState *env, int wpsz)
static inline uint32_t e2k_state_cr1_br_get(CPUE2KState *env)
{
return GET_FIELD(env->cr1_hi, CR1_HI_BR_OFF, CR1_HI_BR_END);
return GET_FIELD(env->cr1_hi, CR1_HI_BR_OFF, CR1_HI_BR_LEN);
}
static inline void e2k_state_cr1_br_set(CPUE2KState *env, uint32_t br)

View File

@ -38,15 +38,15 @@ static inline void restore_br_state(CPUE2KState *env)
int rbs, rsz, rcur;
env->br = e2k_state_cr1_br_get(env);
rbs = GET_FIELD(env->br, BR_RBS_OFF, BR_RBS_END);
rsz = GET_FIELD(env->br, BR_RSZ_OFF, BR_RSZ_END);
rcur = GET_FIELD(env->br, BR_RCUR_OFF, BR_RCUR_END);
rbs = GET_FIELD(env->br, BR_RBS_OFF, BR_RBS_LEN);
rsz = GET_FIELD(env->br, BR_RSZ_OFF, BR_RSZ_LEN);
rcur = GET_FIELD(env->br, BR_RCUR_OFF, BR_RCUR_LEN);
env->boff = rbs * 2;
env->bsize = rsz * 2 + 2;
env->bcur = rcur * 2;
env->psize = GET_FIELD(env->br, BR_PSZ_OFF, BR_PSZ_END);
env->pcur = GET_FIELD(env->br, BR_PCUR_OFF, BR_PCUR_END);
env->psize = GET_FIELD(env->br, BR_PSZ_OFF, BR_PSZ_LEN);
env->pcur = GET_FIELD(env->br, BR_PCUR_OFF, BR_PCUR_LEN);
}
void helper_unimpl(CPUE2KState *env)
@ -174,12 +174,12 @@ static inline void do_syscall(CPUE2KState *env, int call_wbs)
target_ulong helper_call(CPUE2KState *env, uint64_t ctpr,
int call_wbs)
{
int ctpr_tag = GET_FIELD(ctpr, CTPR_TAG_OFF, CTPR_TAG_END);
int ctpr_tag = GET_FIELD(ctpr, CTPR_TAG_OFF, CTPR_TAG_LEN);
switch (ctpr_tag) {
case CTPR_TAG_DISP:
do_call(env, call_wbs);
return GET_FIELD(ctpr, CTPR_BASE_OFF, CTPR_BASE_END);
return GET_FIELD(ctpr, CTPR_BASE_OFF, CTPR_BASE_LEN);
case CTPR_TAG_SDISP:
do_syscall(env, call_wbs);
return env->ip;
@ -327,7 +327,7 @@ void helper_state_reg_set(CPUE2KState *env, int reg, uint64_t val)
}
uint64_t helper_getsp(CPUE2KState *env, uint64_t src2) {
uint64_t base = GET_FIELD(env->usd_lo, USD_LO_BASE_OFF, USD_LO_BASE_END);
uint64_t base = GET_FIELD(env->usd_lo, USD_LO_BASE_OFF, USD_LO_BASE_LEN);
base += src2;

View File

@ -146,17 +146,17 @@ static size_t unpack_bundle(CPUE2KState *env,
/* Set POS to point to the last syllable in the current wide instruction and
extract CDSj and PLSj syllables if any. */
pos = ((GET_FIELD(hs, 4, 6) + 1) << 3) - 4;
pos = ((GET_FIELD(hs, 4, 3) + 1) << 3) - 4;
/* Check for CDSj syllables. */
for (i = 0; i < GET_FIELD(hs, 16, 17); i++) {
for (i = 0; i < GET_FIELD(hs, 16, 2); i++) {
bundle->cds_present[i] = true;
bundle->cds[i] = translator_ldl(env, pc + pos);
pos -= 4;
}
/* Check for PLSj syllables. */
for (i = 0; i < GET_FIELD(hs, 18, 19); i++) {
for (i = 0; i < GET_FIELD(hs, 18, 2); i++) {
bundle->pls_present[i] = true;
bundle->pls[i] = translator_ldl(env, pc + pos);
pos -= 4;
@ -182,7 +182,7 @@ static size_t unpack_bundle(CPUE2KState *env,
pos -= 4;
}
return 8 + GET_FIELD(hs, 4, 6) * 8;
return 8 + GET_FIELD(hs, 4, 3) * 8;
}
static inline void gen_save_pc(target_ulong pc)

View File

@ -181,68 +181,6 @@ static inline TCGv e2k_get_temp(DisasContext *dc)
return dc->ttl[dc->ttl_len++] = tcg_temp_local_new();
}
// FIXME: x must not be greater than y * 2
static inline void e2k_gen_wrap_i32(TCGv_i32 ret, TCGv_i32 x, TCGv_i32 y)
{
TCGv_i32 t0 = tcg_temp_new_i32();
tcg_gen_sub_i32(t0, x, y);
tcg_gen_movcond_i32(TCG_COND_LTU, ret, x, y, x, t0);
tcg_temp_free_i32(t0);
}
// FIXME: x must not be greater than y * 2
static inline void e2k_gen_wrapi_i32(TCGv_i32 ret, TCGv_i32 x, uint32_t y)
{
TCGv_i32 t0 = tcg_temp_new_i32();
TCGv_i32 t1 = tcg_const_i32(y);
tcg_gen_sub_i32(t0, x, t1);
tcg_gen_movcond_i32(TCG_COND_LTU, ret, x, t1, x, t0);
tcg_temp_free_i32(t1);
tcg_temp_free_i32(t0);
}
// FIXME: x must not be greater than y * 2
static inline void e2k_gen_wrap_i64(TCGv_i64 ret, TCGv_i64 x, TCGv_i64 y)
{
TCGv_i64 t0 = tcg_temp_new_i64();
tcg_gen_sub_i64(t0, x, y);
tcg_gen_movcond_i64(TCG_COND_LTU, ret, x, y, x, t0);
tcg_temp_free_i64(t0);
}
static inline void e2k_gen_get_field_i64(TCGv_i64 ret, TCGv_i64 val,
unsigned int start, unsigned int end)
{
TCGv_i64 t0 = tcg_temp_new_i64();
tcg_gen_andi_i64(t0, val, GEN_MASK(start, end));
tcg_gen_shli_i64(ret, t0, start);
tcg_temp_free_i64(t0);
}
static inline void e2k_gen_set_field_i64(TCGv_i64 ret, TCGv_i64 val,
uint64_t field, unsigned int start, unsigned int end)
{
uint64_t mask = GEN_MASK(start, end);
TCGv_i64 t0 = tcg_const_i64(~mask);
TCGv_i64 t1 = tcg_const_i64((field << start) & mask);
TCGv_i64 t2 = tcg_temp_new_i64();
tcg_gen_and_i64(t2, val, t0);
tcg_gen_or_i64(ret, t2, t1);
tcg_temp_free_i64(t2);
tcg_temp_free_i64(t1);
tcg_temp_free_i64(t0);
}
static inline void e2k_gen_lcnt(TCGv_i64 ret)
{
tcg_gen_andi_i64(ret, e2k_cs.lsr, (1UL << 32) - 1);

View File

@ -5,7 +5,7 @@
static TCGv_i64 get_src1(DisasContext *dc, uint32_t als)
{
unsigned int src1 = GET_FIELD(als, 16, 27);
unsigned int src1 = GET_FIELD(als, 16, 8);
if (IS_BASED(src1)) {
unsigned int i = GET_BASED(src1);
return e2k_get_breg(dc, i);
@ -25,7 +25,7 @@ static TCGv_i64 get_src1(DisasContext *dc, uint32_t als)
static TCGv_i64 get_src2(DisasContext *dc, uint32_t als)
{
unsigned int src2 = GET_FIELD(als, 8, 15);
unsigned int src2 = GET_FIELD(als, 8, 8);
if (IS_BASED(src2)) {
unsigned int i = GET_BASED(src2);
return e2k_get_breg(dc, i);
@ -192,7 +192,7 @@ static inline bool is_mrgc(uint16_t rlp, int chan)
{
int is_mrgc = GET_BIT(rlp, 15);
int cluster = GET_BIT(rlp, 14);
int alc_mask = GET_FIELD(rlp, 10, 12);
int alc_mask = GET_FIELD(rlp, 10, 3);
int alc = GET_BIT(alc_mask, chan % 3);
return is_mrgc && (cluster == (chan > 2)) && (alc != 0);
@ -273,7 +273,7 @@ static inline void gen_rr_i64(TCGv_i64 ret, uint8_t state_reg)
static inline void gen_rrd(DisasContext *dc, int chan)
{
uint32_t als = dc->bundle.als[chan];
uint8_t state_reg = GET_FIELD(als, 16, 23);
uint8_t state_reg = GET_FIELD(als, 16, 8);
TCGv_i64 ret = e2k_get_temp_i64(dc);
gen_rr_i64(ret, state_reg);
@ -283,7 +283,7 @@ static inline void gen_rrd(DisasContext *dc, int chan)
static inline void gen_rrs(DisasContext *dc, int chan)
{
uint32_t als = dc->bundle.als[chan];
uint8_t state_reg = GET_FIELD(als, 16, 23);
uint8_t state_reg = GET_FIELD(als, 16, 8);
TCGv_i64 t0 = tcg_temp_new_i64();
TCGv_i64 t1 = e2k_get_temp_i64(dc);
@ -465,7 +465,7 @@ static TCGCond e2k_gen_cmp_op(unsigned int cmp_op)
static void execute_alopf_simple(DisasContext *dc, int chan)
{
uint32_t als = dc->bundle.als[chan];
int opc = GET_FIELD(als, 24, 30);
int opc = GET_FIELD(als, 24, 7);
switch(opc) {
case 0x00: /* ands */ gen_alopf1_i32(dc, chan, tcg_gen_and_i32); break;
@ -506,7 +506,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan)
TCGv_i32 dst32 = tcg_temp_new_i32();
TCGv_i32 lo1 = tcg_temp_new_i32();
TCGv_i32 lo2 = tcg_temp_new_i32();
TCGCond cond = e2k_gen_cmp_op(GET_FIELD(als, 5, 7));
TCGCond cond = e2k_gen_cmp_op(GET_FIELD(als, 5, 3));
Result res = { 0 };
tcg_gen_extrl_i64_i32(lo1, s1);
@ -530,7 +530,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan)
TCGv_i64 cpu_src1 = get_src1(dc, als);
TCGv_i64 cpu_src2 = get_src2(dc, als);
TCGv_i64 tmp_dst = e2k_get_temp_i64(dc);
TCGCond cond = e2k_gen_cmp_op(GET_FIELD(als, 5, 7));
TCGCond cond = e2k_gen_cmp_op(GET_FIELD(als, 5, 3));
Result res = { 0 };
tcg_gen_setcond_i64(cond, tmp_dst, cpu_src1, cpu_src2);
@ -625,7 +625,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan)
static void execute_ext1(DisasContext *dc, int chan)
{
uint8_t opc = GET_FIELD(dc->bundle.als[chan], 24, 30);
uint8_t opc = GET_FIELD(dc->bundle.als[chan], 24, 7);
switch (opc) {
case 0x58: {
@ -657,7 +657,7 @@ void e2k_execute_alc(DisasContext *ctx, int index)
e2k_gen_exception(ctx, E2K_EXCP_ILLOPC);
break;
case ALES_PRESENT: {
uint8_t opc = GET_FIELD(bundle->ales[index], 8, 15);
uint8_t opc = GET_FIELD(bundle->ales[index], 8, 8);
switch (opc) {
case 0x01:
execute_ext1(ctx, index);

View File

@ -116,10 +116,10 @@ void e2k_commit_stubs(DisasContext *ctx)
uint32_t ss = ctx->bundle.ss;
// unsigned int vfdi = (ss & 0x04000000) >> 26;
// unsigned int abg = (ss & 0x01800000) >> 23;
int alc = GET_FIELD_LEN(ss, 16, 2);
int abp = GET_FIELD_LEN(ss, 18, 2);
int abn = GET_FIELD_LEN(ss, 21, 2);
int abg = GET_FIELD_LEN(ss, 23, 2);
int alc = GET_FIELD(ss, 16, 2);
int abp = GET_FIELD(ss, 18, 2);
int abn = GET_FIELD(ss, 21, 2);
int abg = GET_FIELD(ss, 23, 2);
if (alc) {
@ -258,9 +258,9 @@ static void gen_cs0(DisasContext *dc)
if (type == GETTSD && param_type != 1) {
e2k_gen_exception(dc, E2K_EXCP_ILLOPC);
}
int ipd = GET_FIELD(bundle->ss, 30, 31);
int ipd = GET_FIELD(bundle->ss, 30, 2);
if (type == DISP || type == LDISP) {
unsigned int disp = GET_FIELD(cs0, 0, 27);
unsigned int disp = GET_FIELD(cs0, 0, 28);
/* Calculate a signed displacement in bytes. */
int sdisp = ((int) (disp << 4)) >> 1;
uint64_t reg = (dc->pc + sdisp) |
@ -271,7 +271,7 @@ static void gen_cs0(DisasContext *dc)
}
tcg_gen_movi_tl(e2k_cs.ctprs[ctpr - 1], reg);
} else if (type == SDISP) {
unsigned int disp = GET_FIELD(cs0, 0, 27) << 11;
unsigned int disp = GET_FIELD(cs0, 0, 28) << 11;
target_ulong base = ((uint64_t) 0xe2 << 40) | disp;
uint64_t reg = (dc->pc + base) |
((uint64_t) CTPR_TAG_SDISP << CTPR_TAG_OFF) |
@ -364,7 +364,7 @@ static void gen_cs1(DisasContext *dc)
e2k_gen_exception(dc, E2K_EXCP_ILLOPC);
} else {
uint32_t lts0 = bundle->lts[0];
int wsz = GET_FIELD(lts0, 5, 11);
int wsz = GET_FIELD(lts0, 5, 7);
TCGv_i32 t0 = tcg_const_i32(lts0);
tcg_gen_movi_i32(e2k_cs.wd_size, wsz * 2);
@ -374,9 +374,9 @@ static void gen_cs1(DisasContext *dc)
}
if (setbn) {
int rbs = GET_FIELD(cs1, BR_RBS_OFF, BR_RBS_END);
int rsz = GET_FIELD(cs1, BR_RSZ_OFF, BR_RSZ_END);
int rcur = GET_FIELD(cs1, BR_RCUR_OFF, BR_RCUR_END);
int rbs = GET_FIELD(cs1, BR_RBS_OFF, BR_RBS_LEN);
int rsz = GET_FIELD(cs1, BR_RSZ_OFF, BR_RSZ_LEN);
int rcur = GET_FIELD(cs1, BR_RCUR_OFF, BR_RCUR_LEN);
tcg_gen_movi_i32(e2k_cs.boff, rbs * 2);
tcg_gen_movi_i32(e2k_cs.bsize, (rsz + 1) * 2);
@ -384,7 +384,7 @@ static void gen_cs1(DisasContext *dc)
}
if (setbp) {
int psz = GET_FIELD(cs1, BR_PSZ_OFF, BR_PSZ_END);
int psz = GET_FIELD(cs1, BR_PSZ_OFF, BR_PSZ_LEN);
tcg_gen_movi_i32(e2k_cs.psize, psz);
tcg_gen_movi_i32(e2k_cs.pcur, 0);
@ -440,7 +440,7 @@ static void gen_cs1(DisasContext *dc)
unsigned int ctop = (bundle->ss & 0x00000c00) >> 10;
if (ctop) {
dc->ct.type = CT_CALL;
dc->ct.wbs = GET_FIELD_LEN(cs1, 0, 7);
dc->ct.wbs = GET_FIELD(cs1, 0, 7);
} else {
unsigned int cs1_ctopc = (cs1 & 0x380) >> 7;
/* CS1.param.ctpopc == HCALL. CS0 is required to encode HCALL. */
@ -487,9 +487,9 @@ static void gen_cs1(DisasContext *dc)
static void gen_jmp(DisasContext *dc)
{
unsigned int psrc = GET_FIELD(dc->bundle.ss, 0, 4);
unsigned int cond_type = GET_FIELD(dc->bundle.ss, 5, 8);
unsigned int ctpr = GET_FIELD(dc->bundle.ss, 10, 11);
unsigned int psrc = GET_FIELD(dc->bundle.ss, 0, 5);
unsigned int cond_type = GET_FIELD(dc->bundle.ss, 5, 4);
unsigned int ctpr = GET_FIELD(dc->bundle.ss, 10, 2);
/* TODO: different kinds of ct */
if (ctpr != 0) {

View File

@ -5,7 +5,7 @@
static void gen_get_lp(TCGv_i32 ret, uint16_t clp, int offset, TCGv_i32 lp[7])
{
int p = GET_FIELD_LEN(clp, offset, 3);
int p = GET_FIELD(clp, offset, 3);
int neg = GET_BIT(clp, offset + 3);
tcg_gen_xori_i32(ret, lp[p], neg);
@ -14,14 +14,14 @@ static void gen_get_lp(TCGv_i32 ret, uint16_t clp, int offset, TCGv_i32 lp[7])
static void gen_elp(DisasContext *ctx, TCGv_i32 ret, uint8_t elp)
{
if (!GET_BIT(elp, 6)) {
if (GET_FIELD_LEN(elp, 0, 6) == 0) {
if (GET_FIELD(elp, 0, 6) == 0) {
e2k_gen_lcntex(ret);
} else {
// TODO: spred
gen_helper_unimpl(cpu_env);
}
} else if (GET_FIELD_LEN(elp, 5, 2) == 0x40) {
int val = GET_FIELD_LEN(elp, 0, 5);
} else if (GET_FIELD(elp, 5, 2) == 0x40) {
int val = GET_FIELD(elp, 0, 5);
if (val == 0) {
// TODO: bgrpred
gen_helper_unimpl(cpu_env);
@ -32,7 +32,7 @@ static void gen_elp(DisasContext *ctx, TCGv_i32 ret, uint8_t elp)
e2k_gen_exception(ctx, E2K_EXCP_ILLOPN);
}
} else {
int reg = GET_FIELD_LEN(elp, 0, 5);
int reg = GET_FIELD(elp, 0, 5);
TCGv_i64 t0 = tcg_temp_new_i64();
e2k_gen_preg(t0, reg);
@ -63,8 +63,8 @@ static inline void scan_needed(const UnpackedBundle *bundle, int need[7])
continue;
}
p0 = GET_FIELD_LEN(bundle->pls[i], 10, 4);
p1 = GET_FIELD_LEN(bundle->pls[i], 6, 4);
p0 = GET_FIELD(bundle->pls[i], 10, 4);
p1 = GET_FIELD(bundle->pls[i], 6, 4);
if (p0 < 7 && need[p0] == 0) {
need[p0] = 1;
@ -110,23 +110,23 @@ void e2k_plu_execute(DisasContext *ctx)
if (i < 2) {
if (need[i * 2]) {
int elp = GET_FIELD_LEN(bundle->pls[i], 24, 7);
int elp = GET_FIELD(bundle->pls[i], 24, 7);
gen_elp(ctx, lp[i * 2], elp);
}
if (need[i * 2 + 1]) {
int elp = GET_FIELD_LEN(bundle->pls[i], 16, 7);
int elp = GET_FIELD(bundle->pls[i], 16, 7);
gen_elp(ctx, lp[i * 2 + 1], elp);
}
}
if (need[4 + i]) {
uint16_t clp = GET_FIELD_LEN(bundle->pls[i], 0, 16);
int opc = GET_FIELD_LEN(clp, 14, 2);
uint16_t clp = GET_FIELD(bundle->pls[i], 0, 16);
int opc = GET_FIELD(clp, 14, 2);
TCGv_i32 p0 = tcg_temp_new_i32();
TCGv_i32 p1 = tcg_temp_new_i32();
int vdst = GET_BIT(clp, 5);
int pdst = GET_FIELD_LEN(clp, 0, 5);
int pdst = GET_FIELD(clp, 0, 5);
// TODO: check clp arg
// {C/M}LP0 0, 1 => 4