diff options
author | 2015-12-20 20:08:12 +0200 | |
---|---|---|
committer | 2015-12-20 20:11:35 +0200 | |
commit | e2e762b21652d16ba86ffe20b16bd29fc0585689 (patch) | |
tree | fc26bdcf37b15ecd58cd6fd4296114d7edf79416 /src/devices/cpu/tms32082 | |
parent | 399692f17adaa4ea649b4dd235ced6596ba7db6a (diff) |
tms32082: FPU fixes + command callback (nw)
Diffstat (limited to 'src/devices/cpu/tms32082')
-rw-r--r-- | src/devices/cpu/tms32082/dis_mp.cpp | 9 | ||||
-rw-r--r-- | src/devices/cpu/tms32082/mp_ops.cpp | 18 | ||||
-rw-r--r-- | src/devices/cpu/tms32082/tms32082.cpp | 84 | ||||
-rw-r--r-- | src/devices/cpu/tms32082/tms32082.h | 4 |
4 files changed, 36 insertions, 79 deletions
diff --git a/src/devices/cpu/tms32082/dis_mp.cpp b/src/devices/cpu/tms32082/dis_mp.cpp index 1b89eb88129..aa13351b88b 100644 --- a/src/devices/cpu/tms32082/dis_mp.cpp +++ b/src/devices/cpu/tms32082/dis_mp.cpp @@ -231,7 +231,14 @@ static offs_t tms32082_disasm_mp(char *buffer, offs_t pc, const UINT8 *oprom) case 0x00: print("illop0 "); break; case 0x01: print("trap %d", UIMM15(uimm15)); break; case 0x02: print("cmnd 0x%04X", UIMM15(uimm15)); break; - case 0x04: print("rdcr %s, R%d", get_creg_name(UIMM15(uimm15)), rd); break; + + case 0x04: + if (op == 0x00020000) + print("nop "); + else + print("rdcr %s, R%d", get_creg_name(UIMM15(uimm15)), rd); + break; + case 0x05: print("swcr R%d, %s, R%d", rd, get_creg_name(UIMM15(uimm15)), rs); break; case 0x06: print("brcr %s", get_creg_name(UIMM15(uimm15))); break; case 0x08: print("shift%s.dz %d, %d, R%d, R%d", (op & (1 << 10)) ? "r" : "l", rotate, endmask, rs, rd); break; diff --git a/src/devices/cpu/tms32082/mp_ops.cpp b/src/devices/cpu/tms32082/mp_ops.cpp index 79c0b401392..f92f5091053 100644 --- a/src/devices/cpu/tms32082/mp_ops.cpp +++ b/src/devices/cpu/tms32082/mp_ops.cpp @@ -1393,7 +1393,7 @@ void tms32082_mp_device::execute_reg_long_imm() float src1 = u2f(m_reg[OP_SRC1()]); float src2 = u2f(m_reg[OP_RS()]); - float res = (src1 * src2) + (z ? 0.0f : m_acc[acc]); + float res = (src1 * src2) + (z ? 0.0f : m_facc[acc]); // parallel load/store op if (!(ls_bit1 == 0 && ls_bit2 == 0)) @@ -1436,7 +1436,7 @@ void tms32082_mp_device::execute_reg_long_imm() float src1 = u2f(m_reg[OP_SRC1()]); float src2 = u2f(m_reg[OP_RS()]); - float res = (z ? 0.0f : m_acc[acc]) - (src1 * src2); + float res = (z ? 0.0f : m_facc[acc]) - (src1 * src2); // parallel load/store op if (!(ls_bit1 == 0 && ls_bit2 == 0)) @@ -1663,7 +1663,11 @@ void tms32082_mp_device::execute_reg_long_imm() double src1 = has_imm ? (double)u2f(imm32) : (p1 ? u2d(m_fpair[rs1 >> 1]) : (double)u2f(m_reg[rs1])); double src2 = p2 ? u2d(m_fpair[rs2 >> 1]) : (double)u2f(m_reg[rs2]); - double res = src1 / src2; + double res; + if (src2 != 0.0) + res = src1 / src2; + else + res = 0.0f; if (pd) m_fpair[rd >> 1] = d2u(res); @@ -1710,7 +1714,7 @@ void tms32082_mp_device::execute_reg_long_imm() m_reg[rd] = f2u((float)(s)); break; case 1: - m_fpair[rd] = d2u(s); + m_fpair[rd >> 1] = d2u(s); break; case 2: m_reg[rd] = (INT32)(s); @@ -1767,7 +1771,11 @@ void tms32082_mp_device::execute_reg_long_imm() if (rd) { - double res = sqrt(source); + double res; + if (source >= 0.0f) + res = sqrt(source); + else + res = 0.0; if (pd) m_fpair[rd >> 1] = d2u(res); diff --git a/src/devices/cpu/tms32082/tms32082.cpp b/src/devices/cpu/tms32082/tms32082.cpp index c3c95f9305f..615cdc68fe1 100644 --- a/src/devices/cpu/tms32082/tms32082.cpp +++ b/src/devices/cpu/tms32082/tms32082.cpp @@ -58,6 +58,12 @@ offs_t tms32082_mp_device::disasm_disassemble(char *buffer, offs_t pc, const UIN +void tms32082_mp_device::set_command_callback(write32_delegate callback) +{ + m_cmd_callback = callback; +} + + READ32_MEMBER(tms32082_mp_device::mp_param_r) { //printf("mp_param_w: %08X, %08X\n", offset, mem_mask); @@ -277,75 +283,10 @@ void tms32082_mp_device::processor_command(UINT32 command) if (command & 0x00000001) printf("PP0 "); - printf("\n"); - - // PP0 - if (command & 1) - { - if (command & 0x00004000) - { - // simulate PP behavior for now... - m_program->write_dword(0x00000084, 3); - - UINT32 num = m_program->read_dword(0x90); - - printf("PP num %d\n", num); - - /* - UINT32 ra = 0x1000280; - - printf("FIFO push:\n"); - - for (int i=0; i < num; i++) - { - printf("Entry %d:\n", i); - for (int k=0; k < 6; k++) - { - for (int l=0; l < 4; l++) - { - UINT32 dd = m_program->read_dword(ra); - ra += 4; - - printf("%08X(%f) ", dd, u2f(dd)); - } - printf("\n"); - } - printf("\n"); - } - */ - - UINT32 ra = 0x1000280; - - int oldnum = m_program->read_dword(0x600ffffc); - UINT32 rb = 0x60000000 + (oldnum * 0x60); + if (!m_cmd_callback.isnull()) + m_cmd_callback(*m_program, 0, command, 0xffffffff); - for (int i=0; i < num; i++) - { - for (int k=0; k < 24; k++) - { - UINT32 dd = m_program->read_dword(ra); - ra += 4; - - m_program->write_dword(rb, dd); - rb += 4; - } - } - m_program->write_dword(0x600ffffc, oldnum+num); - - m_program->write_dword(0x00000090, 0); - m_program->write_dword(0x00000094, num); - - } - } - // PP1 - if (command & 2) - { - if (command & 0x00004000) - { - // simulate PP behavior for now... - m_program->write_dword(0x00001014, 3); - } - } + printf("\n"); } UINT32 tms32082_mp_device::read_creg(int reg) @@ -512,15 +453,12 @@ void tms32082_mp_device::execute_run() m_ir = fetch(); execute(); - if (m_tcount == 0) + m_tcount--; + if (m_tcount < 0) { // TODO: timer interrupt m_tcount = m_tscale; } - else - { - m_tcount--; - } m_icount--; }; diff --git a/src/devices/cpu/tms32082/tms32082.h b/src/devices/cpu/tms32082/tms32082.h index 6d3e932375c..07476c700d4 100644 --- a/src/devices/cpu/tms32082/tms32082.h +++ b/src/devices/cpu/tms32082/tms32082.h @@ -71,6 +71,8 @@ public: DECLARE_READ32_MEMBER(mp_param_r); DECLARE_WRITE32_MEMBER(mp_param_w); + void set_command_callback(write32_delegate callback); + protected: // device level overrides @@ -139,6 +141,8 @@ protected: address_space *m_program; direct_read_data* m_direct; + write32_delegate m_cmd_callback; + void check_interrupts(); void processor_command(UINT32 command); UINT32 fetch(); |