summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author mooglyguy <therealmogminer@gmail.com>2017-11-13 19:48:09 +0100
committer mooglyguy <therealmogminer@gmail.com>2017-11-13 20:34:40 +0100
commite2ccb54dff6a235c762f865ab9b5d504bdb0f36f (patch)
tree3d9a45be9ae2cba2bdc3d01daf17bc5d3852366b
parentedf05a30a51d5921ee874918f77b276207335453 (diff)
e132xs, cleanup now-unused functions, nw
-rw-r--r--src/devices/cpu/e132xs/e132xs.cpp214
-rw-r--r--src/devices/cpu/e132xs/e132xs.h21
-rw-r--r--src/devices/cpu/e132xs/e132xsop.hxx147
3 files changed, 81 insertions, 301 deletions
diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp
index ed80988d2d9..f6ede8da739 100644
--- a/src/devices/cpu/e132xs/e132xs.cpp
+++ b/src/devices/cpu/e132xs/e132xs.cpp
@@ -718,85 +718,6 @@ static const int32_t immediate_values[32] =
#define WRITE_ONLY_REGMASK ((1 << BCR_REGISTER) | (1 << TPR_REGISTER) | (1 << FCR_REGISTER) | (1 << MCR_REGISTER))
-#define decode_source_local(decode) \
-do \
-{ \
-} while (0)
-
-#define decode_source_noh(decode) \
-do \
-{ \
- decode.src_is_local = 0; \
- \
- SREG = get_global_register(decode.src); \
- \
- /* bound safe */ \
- if (decode.src != 15) \
- SREGF = get_global_register(decode.src + 1); \
- else \
- SREGF = 0; \
-} while (0)
-
-#define decode_source(decode, hflag) \
-do \
-{ \
- decode.src_is_local = 0; \
- \
- if (!hflag) \
- { \
- SREG = get_global_register(decode.src); \
- \
- /* bound safe */ \
- if (decode.src != 15) \
- SREGF = get_global_register(decode.src + 1); \
- else \
- SREGF = 0; \
- } \
- else \
- { \
- decode.src += 16; \
- \
- SREG = get_global_register(decode.src); \
- if ((WRITE_ONLY_REGMASK >> decode.src) & 1) \
- SREG = 0; /* write-only registers */ \
- else if (decode.src == ISR_REGISTER) \
- DEBUG_PRINTF(("read src ISR. PC = %08X\n",PPC)); \
- \
- /* bound safe */ \
- if (decode.src != 31) \
- SREGF = get_global_register(decode.src + 1); \
- else \
- SREGF = 0; \
- } \
-} while (0)
-
-#define decode_dest(decode, hflag) \
-do \
-{ \
- decode.dst_is_local = 0; \
- \
- if (!hflag) \
- { \
- DREG = get_global_register(decode.dst); \
- \
- /* bound safe */ \
- if (decode.dst != 15) \
- DREGF = get_global_register(decode.dst + 1); \
- } \
- else \
- { \
- decode.dst += 16; \
- \
- DREG = get_global_register(decode.dst); \
- if( decode.dst == ISR_REGISTER ) \
- DEBUG_PRINTF(("read dst ISR. PC = %08X\n",PPC)); \
- \
- /* bound safe */ \
- if (decode.dst != 31) \
- DREGF = get_global_register(decode.dst + 1); \
- } \
-} while (0)
-
#define check_delay_PC() \
do \
{ \
@@ -808,41 +729,6 @@ do
} \
} while (0)
-#define decode_immediate_u(decode) \
-do \
-{ \
- EXTRA_U = immediate_values[OP & 0x0f]; \
-} while (0)
-
-#define DECODE_IMMEDIATE_S(decode) \
-do \
-{ \
- switch( OP & 0x0f ) \
- { \
- default: \
- EXTRA_U = immediate_values[0x10 + (OP & 0x0f)]; \
- break; \
- \
- case 1: \
- m_instruction_length = (3<<19); \
- EXTRA_U = (READ_OP(PC) << 16) | READ_OP(PC + 2); \
- PC += 4; \
- break; \
- \
- case 2: \
- m_instruction_length = (2<<19); \
- EXTRA_U = READ_OP(PC); \
- PC += 2; \
- break; \
- \
- case 3: \
- m_instruction_length = (2<<19); \
- EXTRA_U = 0xffff0000 | READ_OP(PC); \
- PC += 2; \
- break; \
- } \
-} while (0)
-
void hyperstone_device::ignore_immediate_s()
{
static const uint32_t lengths[16] = { 1<<19, 3<<19, 2<<19, 2<<19, 1<<19, 1<<19, 1<<19, 1<<19, 1<<19, 1<<19, 1<<19, 1<<19, 1<<19, 1<<19, 1<<19, 1<<19 };
@@ -884,40 +770,6 @@ uint32_t hyperstone_device::decode_immediate_s()
}
}
-#define DECODE_CONST(decode) \
-do \
-{ \
- uint16_t imm_1 = READ_OP(PC); \
- \
- PC += 2; \
- m_instruction_length = (2<<19); \
- \
- if( E_BIT(imm_1) ) \
- { \
- uint16_t imm_2 = READ_OP(PC); \
- \
- PC += 2; \
- m_instruction_length = (3<<19); \
- \
- EXTRA_S = imm_2; \
- EXTRA_S |= ((imm_1 & 0x3fff) << 16); \
- \
- if( S_BIT_CONST(imm_1) ) \
- { \
- EXTRA_S |= 0xc0000000; \
- } \
- } \
- else \
- { \
- EXTRA_S = imm_1 & 0x3fff; \
- \
- if( S_BIT_CONST(imm_1) ) \
- { \
- EXTRA_S |= 0xffffc000; \
- } \
- } \
-} while (0)
-
uint32_t hyperstone_device::decode_const()
{
const uint16_t imm_1 = READ_OP(PC);
@@ -986,63 +838,6 @@ void hyperstone_device::ignore_pcrel()
}
}
-#define decode_dis(decode) \
-do \
-{ \
- uint16_t next_1 = READ_OP(PC); \
- \
- PC += 2; \
- m_instruction_length = (2<<19); \
- \
- decode.sub_type = DD(next_1); \
- \
- if( E_BIT(next_1) ) \
- { \
- uint16_t next_2 = READ_OP(PC); \
- \
- PC += 2; \
- m_instruction_length = (3<<19); \
- \
- EXTRA_S = next_2; \
- EXTRA_S |= ((next_1 & 0xfff) << 16); \
- \
- if( S_BIT_CONST(next_1) ) \
- { \
- EXTRA_S |= 0xf0000000; \
- } \
- } \
- else \
- { \
- EXTRA_S = next_1 & 0xfff; \
- \
- if( S_BIT_CONST(next_1) ) \
- { \
- EXTRA_S |= 0xfffff000; \
- } \
- } \
-} while (0)
-
-#define decode_lim(decode) \
-do \
-{ \
- uint32_t next = READ_OP(PC); \
- PC += 2; \
- m_instruction_length = (2<<19); \
- \
- decode.sub_type = X_CODE(next); \
- \
- if( E_BIT(next) ) \
- { \
- EXTRA_U = ((next & 0xfff) << 16) | READ_OP(PC); \
- PC += 2; \
- m_instruction_length = (3<<19); \
- } \
- else \
- { \
- EXTRA_U = next & 0xfff; \
- } \
-} while (0)
-
void hyperstone_device::execute_br()
{
const int32_t offset = decode_pcrel();
@@ -1055,15 +850,6 @@ void hyperstone_device::execute_br()
m_icount -= m_clock_cycles_2;
}
-void hyperstone_device::execute_dbr(int32_t offset)
-{
- m_delay_slot = true;
- m_delay_pc = PC + offset;
-
- m_intblock = 3;
-}
-
-
void hyperstone_device::execute_trap(uint32_t addr)
{
uint8_t reg;
diff --git a/src/devices/cpu/e132xs/e132xs.h b/src/devices/cpu/e132xs/e132xs.h
index 8b37adb23d7..daaf5d54bca 100644
--- a/src/devices/cpu/e132xs/e132xs.h
+++ b/src/devices/cpu/e132xs/e132xs.h
@@ -173,26 +173,6 @@ protected:
uint8_t m_fl_lut[16];
private:
- struct regs_decode
- {
- uint8_t src, dst; // destination and source register code
- uint32_t src_value; // current source register value
- uint32_t next_src_value; // current next source register value
- uint32_t dst_value; // current destination register value
- uint32_t next_dst_value; // current next destination register value
- uint8_t sub_type; // sub type opcode (for DD and X_CODE bits)
- union
- {
- uint32_t u;
- int32_t s;
- } extra; // extra value such as immediate value, const, pcrel, ...
- uint8_t src_is_local;
- uint8_t dst_is_local;
- uint8_t same_src_dst;
- uint8_t same_src_dstf;
- uint8_t same_srcf_dst;
- };
-
// internal functions
void check_interrupts();
@@ -211,7 +191,6 @@ private:
TIMER_CALLBACK_MEMBER(timer_callback);
void execute_br();
- void execute_dbr(int32_t offset);
void execute_trap(uint32_t addr);
void execute_int(uint32_t addr);
void execute_exception(uint32_t addr);
diff --git a/src/devices/cpu/e132xs/e132xsop.hxx b/src/devices/cpu/e132xs/e132xsop.hxx
index 52f3f9539b7..cf1fcb90254 100644
--- a/src/devices/cpu/e132xs/e132xsop.hxx
+++ b/src/devices/cpu/e132xs/e132xsop.hxx
@@ -357,22 +357,7 @@ void hyperstone_device::hyperstone_divu_global_local()
void hyperstone_device::hyperstone_divu_local_global()
{
- regs_decode decode;
check_delay_PC();
- decode.src = SRC_CODE;
- decode.dst = DST_CODE;
- decode.src_is_local = 0;
-
- SREG = m_global_regs[decode.src];
- SREGF = m_global_regs[decode.src + 1];
-
- decode.dst_is_local = 1;
- DREG = m_local_regs[(decode.dst + GET_FP) & 0x3f]; /* registers offset by frame pointer */
- DREGF = m_local_regs[(decode.dst + 1 + GET_FP) & 0x3f];
-
- decode.same_src_dst = 0;
- decode.same_src_dstf = 0;
- decode.same_srcf_dst = 0;
const uint32_t src_code = SRC_CODE;
const uint32_t sreg = m_global_regs[src_code];
@@ -3563,8 +3548,8 @@ void hyperstone_device::hyperstone_sardi()
{
check_delay_PC();
- const uint32_t dst_code = (DST_CODE + GET_FP) % 64;
- const uint32_t dstf_code = (DST_CODE + GET_FP + 1) % 64;
+ const uint32_t dst_code = (DST_CODE + GET_FP) & 0x3f;
+ const uint32_t dstf_code = (dst_code + 1) & 0x3f;
uint64_t val = concat_64(m_local_regs[dst_code], m_local_regs[dstf_code]);
@@ -3579,9 +3564,7 @@ void hyperstone_device::hyperstone_sardi()
val >>= n;
if (sign_bit)
- {
val |= 0xffffffff00000000U << (32 - n);
- }
}
m_local_regs[dst_code] = (uint32_t)(val >> 32);
@@ -3715,40 +3698,43 @@ void hyperstone_device::hyperstone_shld()
{
check_delay_PC();
- uint32_t src_code = (SRC_CODE + GET_FP) % 64;
- uint32_t dst_code = (DST_CODE + GET_FP) % 64;
- uint32_t dstf_code = (DST_CODE + GET_FP + 1) % 64;
+ const uint32_t fp = GET_FP;
+ const uint32_t d_code = DST_CODE;
+ uint32_t src_code = (SRC_CODE + fp) & 0x3f;
+ uint32_t dst_code = (d_code + fp) & 0x3f;
+ uint32_t dstf_code = (d_code + fp + 1) & 0x3f;
// result undefined if Ls denotes the same register as Ld or Ldf
if (src_code == dst_code || src_code == dstf_code)
{
DEBUG_PRINTF(("Denoted same registers in hyperstone_shld. PC = %08X\n", PC));
+ m_icount -= m_clock_cycles_2;
+ return;
}
- else
- {
- uint32_t n = m_local_regs[src_code % 64] & 0x1f;
- uint32_t high_order = m_local_regs[dst_code]; /* registers offset by frame pointer */
- uint32_t low_order = m_local_regs[dstf_code];
- uint64_t mask = ((((uint64_t)1) << (32 - n)) - 1) ^ 0xffffffff;
+ uint32_t n = m_local_regs[src_code & 0x3f] & 0x1f;
+ uint32_t high_order = m_local_regs[dst_code]; /* registers offset by frame pointer */
+ uint32_t low_order = m_local_regs[dstf_code];
+
+ uint64_t mask = ((((uint64_t)1) << (32 - n)) - 1) ^ 0xffffffff;
- uint64_t val = concat_64(high_order, low_order);
- SET_C( (n)?(((val<<(n-1))&0x8000000000000000U)?1:0):0);
- uint32_t tmp = high_order << n;
+ uint64_t val = concat_64(high_order, low_order);
- if (((high_order & mask) && (!(tmp & 0x80000000))) || (((high_order & mask) ^ mask) && (tmp & 0x80000000)))
- SET_V(1);
- else
- SR &= ~V_MASK;
+ SR &= ~(C_MASK | V_MASK | Z_MASK | N_MASK);
+ SR |= (n)?(((val<<(n-1))&0x8000000000000000U)?1:0):0;
+
+ uint32_t tmp = high_order << n;
+ if (((high_order & mask) && (!(tmp & 0x80000000))) || (((high_order & mask) ^ mask) && (tmp & 0x80000000)))
+ SR |= V_MASK;
- val <<= n;
+ val <<= n;
- m_local_regs[dst_code] = extract_64hi(val);
- m_local_regs[dstf_code] = extract_64lo(val);
+ m_local_regs[dst_code] = extract_64hi(val);
+ m_local_regs[dstf_code] = extract_64lo(val);
- SET_Z(val == 0 ? 1 : 0);
- SET_N(SIGN_BIT(high_order));
- }
+ if (val == 0)
+ SR |= Z_MASK;
+ SR |= SIGN_TO_N(m_local_regs[dst_code]);
m_icount -= m_clock_cycles_2;
}
@@ -3757,23 +3743,27 @@ void hyperstone_device::hyperstone_shl()
{
check_delay_PC();
- uint32_t src_code = SRC_CODE + GET_FP;
- uint32_t dst_code = DST_CODE + GET_FP;
+ const uint32_t fp = GET_FP;
+ uint32_t src_code = SRC_CODE + fp;
+ uint32_t dst_code = DST_CODE + fp;
- uint32_t n = m_local_regs[src_code % 64] & 0x1f;
- uint32_t base = m_local_regs[dst_code % 64]; /* registers offset by frame pointer */
+ uint32_t n = m_local_regs[src_code & 0x3f] & 0x1f;
+ uint32_t base = m_local_regs[dst_code & 0x3f]; /* registers offset by frame pointer */
uint64_t mask = ((((uint64_t)1) << (32 - n)) - 1) ^ 0xffffffff;
- SET_C( (n)?(((base<<(n-1))&0x80000000)?1:0):0);
+
+ SR &= ~(C_MASK | V_MASK | Z_MASK | N_MASK);
+
+ SR |= (n)?(((base<<(n-1))&0x80000000)?1:0):0;
uint32_t ret = base << n;
if (((base & mask) && (!(ret & 0x80000000))) || (((base & mask) ^ mask) && (ret & 0x80000000)))
- SET_V(1);
- else
- SR &= ~V_MASK;
+ SR |= V_MASK;
+
+ m_local_regs[dst_code & 0x3f] = ret;
- m_local_regs[dst_code % 64] = ret;
- SET_Z(ret == 0 ? 1 : 0);
- SET_N(SIGN_BIT(ret));
+ if (ret == 0)
+ SR |= Z_MASK;
+ SR |= SIGN_TO_N(ret);
m_icount -= m_clock_cycles_1;
}
@@ -3782,7 +3772,8 @@ void hyperstone_device::hyperstone_testlz()
{
check_delay_PC();
- uint32_t sreg = m_local_regs[(SRC_CODE + GET_FP) % 64];
+ const uint32_t fp = GET_FP;
+ const uint32_t sreg = m_local_regs[(SRC_CODE + fp) & 0x3f];
uint32_t zeros = 0;
for (uint32_t mask = 0x80000000; mask != 0; mask >>= 1 )
{
@@ -3792,7 +3783,7 @@ void hyperstone_device::hyperstone_testlz()
zeros++;
}
- m_local_regs[(DST_CODE + GET_FP) % 64] = zeros;
+ m_local_regs[(DST_CODE + fp) & 0x3f] = zeros;
m_icount -= m_clock_cycles_2;
}
@@ -6754,7 +6745,9 @@ void hyperstone_device::hyperstone_dbv()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
else
{
@@ -6776,7 +6769,9 @@ void hyperstone_device::hyperstone_dbnv()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
m_icount -= m_clock_cycles_1;
@@ -6788,7 +6783,9 @@ void hyperstone_device::hyperstone_dbe()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
else
{
@@ -6810,7 +6807,9 @@ void hyperstone_device::hyperstone_dbne()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
m_icount -= m_clock_cycles_1;
}
@@ -6821,7 +6820,9 @@ void hyperstone_device::hyperstone_dbc()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
else
{
@@ -6843,7 +6844,9 @@ void hyperstone_device::hyperstone_dbnc()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
m_icount -= m_clock_cycles_1;
@@ -6855,7 +6858,9 @@ void hyperstone_device::hyperstone_dbse()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
else
{
@@ -6877,7 +6882,9 @@ void hyperstone_device::hyperstone_dbht()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
m_icount -= m_clock_cycles_1;
@@ -6889,7 +6896,9 @@ void hyperstone_device::hyperstone_dbn()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
else
{
@@ -6911,7 +6920,9 @@ void hyperstone_device::hyperstone_dbnn()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
m_icount -= m_clock_cycles_1;
@@ -6923,7 +6934,9 @@ void hyperstone_device::hyperstone_dble()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
else
{
@@ -6945,7 +6958,9 @@ void hyperstone_device::hyperstone_dbgt()
{
const int32_t offset = decode_pcrel();
check_delay_PC();
- execute_dbr(offset);
+ m_delay_slot = true;
+ m_delay_pc = PC + offset;
+ m_intblock = 3;
}
m_icount -= m_clock_cycles_1;