From 708193c7478a5d8b11bb9d244f9e727ce01fa536 Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Mon, 15 Apr 2019 22:31:03 +0200 Subject: tms99xx: Checked min/max cycles, reverted tms9980a clock change. --- src/devices/cpu/tms9900/tms9900.cpp | 13 ++++++++++--- src/devices/cpu/tms9900/tms9980a.cpp | 14 ++++++++++---- src/devices/cpu/tms9900/tms9980a.h | 1 + src/devices/cpu/tms9900/tms9995.cpp | 12 ++++++++++-- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/devices/cpu/tms9900/tms9900.cpp b/src/devices/cpu/tms9900/tms9900.cpp index c7719cef76e..de0621bb6bd 100644 --- a/src/devices/cpu/tms9900/tms9900.cpp +++ b/src/devices/cpu/tms9900/tms9900.cpp @@ -2746,15 +2746,22 @@ void tms99xx_device::alu_int() } /**************************************************************************/ + +/* + The minimum number of cycles applies to a command like STWP R0. +*/ uint32_t tms99xx_device::execute_min_cycles() const { - return 2; + return 8; } -// TODO: Compute this value, just a wild guess for the average +/* + The maximum number of cycles applies to a DIV command, depending on the + data to be divided, and the mode of adressing. +*/ uint32_t tms99xx_device::execute_max_cycles() const { - return 10; + return 124; } uint32_t tms99xx_device::execute_input_lines() const diff --git a/src/devices/cpu/tms9900/tms9980a.cpp b/src/devices/cpu/tms9900/tms9980a.cpp index 949ad8df9a0..b48dae0de8b 100644 --- a/src/devices/cpu/tms9900/tms9980a.cpp +++ b/src/devices/cpu/tms9900/tms9980a.cpp @@ -80,7 +80,6 @@ /**************************************************************************** Constructor ****************************************************************************/ - tms9980a_device::tms9980a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : tms99xx_device(mconfig, type, tag, 8, 14, 11, owner, clock) { @@ -277,15 +276,22 @@ void tms9980a_device::acquire_instruction() /**************************************************************************/ + +/* + The minimum number of cycles applies to a command like STWP R0. +*/ uint32_t tms9980a_device::execute_min_cycles() const { - return 2; + return 12; } -// TODO: Compute this value, just a wild guess for the average +/* + The maximum number of cycles applies to a DIV command, depending on the + data to be divided, and the mode of adressing. +*/ uint32_t tms9980a_device::execute_max_cycles() const { - return 10; + return 136; } uint32_t tms9980a_device::execute_input_lines() const diff --git a/src/devices/cpu/tms9900/tms9980a.h b/src/devices/cpu/tms9900/tms9980a.h index 23abc082eb1..e290cd39ac1 100644 --- a/src/devices/cpu/tms9900/tms9980a.h +++ b/src/devices/cpu/tms9900/tms9980a.h @@ -46,6 +46,7 @@ protected: uint32_t execute_input_lines() const override; void execute_set_input(int irqline, int state) override; + // The clock is internally divided by 4 virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks + 4 - 1) / 4; } virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 4); } diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp index 6502c2c3c0b..5f1a88948e2 100644 --- a/src/devices/cpu/tms9900/tms9995.cpp +++ b/src/devices/cpu/tms9900/tms9995.cpp @@ -3471,14 +3471,22 @@ void tms9995_device::alu_int() } /**************************************************************************/ +/* + The minimum number of cycles applies to a command like SETO R0 with + R0 in on-chip RAM. +*/ uint32_t tms9995_device::execute_min_cycles() const { - return 2; + return 3; } +/* + The maximum number of cycles applies to a STCR command with the destination + operand off-chip and 16 bits of transfer. +*/ uint32_t tms9995_device::execute_max_cycles() const { - return 44; + return 47; } uint32_t tms9995_device::execute_input_lines() const -- cgit v1.2.3