1
0
mirror of https://github.com/simh/simh.git synced 2026-01-11 23:52:58 +00:00

197 Commits

Author SHA1 Message Date
Mark Pizzolato
cbd8bd8a0a SCP : Log various initialization steps with DebugInit enabled
Removed previously added DEPOSIT ALL 0 in precalibrate routine.
That DEPOSIT was added to explicitly restore memory to 0's at simulator
startup, but the several second cost of executing that slowed down
startup of any simulator which had precalibration support.  Anyone who
explicitly cares to have zeroed memory on startup should include such a
command in their own simulator configuration.
2024-07-16 12:05:41 -10:00
Peter Schorn
c7df248f09 SIMH: Fix spelling errors in comments and strings 2024-07-16 12:04:53 -10:00
Mark Pizzolato
ca848d92d7 TIMER: Correct K and M rate throttling 2024-06-05 13:51:14 -10:00
Mark Pizzolato
62d7e94266 TIMER: Properly interpret input while setting throttle mode
Allow: n                execute n instructions/cycles per second
           nK              execute n thousand instructions/cycles per second
           nM             execute n million instructions/cycles per second
           n%             occupy x percent of the host CPU capacity
           n/t             sleep for t milliseconds after executing x
                             instructions/cycles
           n{K|M}/t    sleep for t milliseconds after executing x
                             thousand or million instructions/cycles
2024-06-05 11:13:35 -10:00
Mark Pizzolato
e57fdb877b SCP: Properly abort simulator startup when timing info is unreasonable
Erratic host system load conditions can cause timing behaviors to not
be well behaved.
2024-06-03 09:18:27 -10:00
Mark Pizzolato
81e2719d90 TIMER: Cleanup Inconsistencies and Throttling and IDLE activities
- Make time at sim> prompt consistent when in nocalibrate mode.
- Disable asynch operations when in nocalibrate mode so that all events
   occur consistently.
- Make sure that all throttling modes produce consistent behavior
  related to all timing activities including clock ticks and TMXR port
  speed timing.
- Expose all timer and throttling state variables via simh REGisters
- Only allow throttling to start execution one time.  Throttling can't
   be changed once instruction execution has started.
- Clarification of SHOW CLOCK variable units
- Avoid competing gratuitous keyboard polls with simulators
- Properly enable catchup ticks
- Fix second boot while idling
- Improve calibration while idling
- Report complete timer state when impossible timer conditions exist
   that will cause a simulator abort.
- Leave memory 0 after pre-calibration instruction execution rate.
2024-04-04 10:09:57 -10:00
Mark Pizzolato
b404ccd050 SCP: Make debug timestamps consistent when in NOCALIBRATE mode 2024-04-04 09:56:18 -10:00
Mark Pizzolato
656e489ee2 TIMER: Add VMS support for sim_os_process_cpu_time 2024-01-15 06:07:31 -10:00
Mark Pizzolato
c8cb7a875e TIMER: Provide API to determine host OS Process CPU times 2024-01-02 18:24:00 -10:00
Mark Pizzolato
df96d1dbe1 SCP: Reject throttling setting when throttling was previously enabled 2023-10-13 09:37:20 -10:00
Mark Pizzolato
91e2e4beb9 TIMER: More reliable NOCALIBRATE initialization
- Behave well when NOCALIBRATE mode is enabled after some instruction
  execution already happened.
- Properly detect the reliable calibrated clock or use the internal one.
2023-06-27 13:46:31 -10:00
Mark Pizzolato
c179fc52b3 TIMER: Fix check of timing values to properly report inconsistency 2023-06-08 07:52:26 -10:00
Mark Pizzolato
8871b819c9 TIMER: Properly report clock calibration inconsistency 2023-06-08 07:16:57 -10:00
Mark Pizzolato
287f2928ab SCP: Remove legacy support for OS2 and MetroWerks on Macintosh OS 9 2023-04-05 08:41:33 -10:00
Mark Pizzolato
194b313179 SCP: Fold up include files used by all simulators
- Add common system includes used in may places which are allowed
  and thus added directly in sim_defs.h.
- Separate completely private system data structures and system APIs
  for use only by SCP library routines into sim_scp_private.h.
2023-03-04 17:51:49 -10:00
Mark Pizzolato
65194f8a5a TIMER: Leverage first time calibration info on subsequent boots
- Also abort simulation if idle delay is crazy big which indicates a
  problem that has already happened.
- Extend calibration initialization debug output to record optional ticks.
2023-01-29 15:57:31 -10:00
Mark Pizzolato
e741e64b0e TIMER: Add debug output for unexpected timer state 2023-01-16 18:10:16 -10:00
Mark Pizzolato
4bbc3dfd1c TIMER: Add SET CLOCK NOCALIBRATE mode
NOCALIBRATE mode allows all activity of a simulator run to occur with
precisely consistent event timing.  In this mode, every clock tick takes
precisely the same number of instructions/cycles.  Likewise, the polling
activities for MUX or other poll oriented devices occurs after precisely
the same number of instructions/cycles executed.  As a consequence of
this mode, no effort to align simulated clock ticks (and simulated access
to wall clock time) is made.

This mode might be useful for running diagnostics which expect a
particular relationship between perceived wall clock and instruction
times.  It might also be useful for running test scripts which may want
to compare output of previous executions to to current execution or
to compare execution on arbitrarily different host computers.

In NOCALIBRATE mode, the operator gets to specify the pseudo
execution rate along with the base wall clock time that access to
pseudo wall clock accesses returns.
2023-01-06 09:49:31 -10:00
Mark Pizzolato
4ae0de84c6 SCP: Double the initial & pre-calibrated instructions/cycles per second.
uint32 gives us an extra bit and negative instruction rates are not
meaningful.
2022-07-17 17:30:20 -10:00
Mark Pizzolato
7249d55f11 SCP: Avoid runaway recursion when debugging timer logic
As mentioned in #1107
2022-07-17 13:14:09 -10:00
Mark Pizzolato
ad9249d4c1 SCP: Add descriptive messages for SCPE_NOPARAM return cases 2022-05-12 13:13:15 -07:00
Heinz-Bernd Eggenstein
525215b07e TIMER: Be less aggressive to disable throttling after initial calibration
- removed a somwhat unlikely but possible division-by-zero
- in case the initial throttling calibration measures a slower cps rate than
   the desired cps rate, check whether the measured rate is well below the
   measured peak rate. If so, distrust the measured rate and instead use
   half the peak rate as measured cps rate.
   Otherwise (so measured cps is in the same ballpark as measured peak rate)
   disable throttling

As initially reported in #815
2021-10-23 13:50:48 -07:00
Mark Pizzolato
486505741c TIMER: Fix pre-calibrate 100ms setup bug 2020-11-18 22:53:24 -08:00
Mark Pizzolato
8233fdc3c1 TIMER: Run simulator pre-calibration for a minimum of 100ms
Faster host systems today can get very fast instruction execution rates
for a short duration calibration test.  These may be skewed by round
off error, so we now run the calibration for a minimum of 100ms.
2020-11-18 14:47:42 -08:00
Mark Pizzolato
a41f081e81 TIMER: Add a generic time API to return the SCP time base 2020-10-29 12:57:47 -07:00
Mark Pizzolato
7ebd22edaa TIMER: Fix sim_idle_ms_sleep() return value to be more precise
delta time computation converting the difference between two timespec
structures values to milliseconds previously truncated the difference which,
depending on the value of when the starting value in the delta happened,
along with when an OS clock tick occurred, may have resulted in a small
delta and an apparent sleep time of 0.  A more accurate result is produced
when the conversion from nanoseconds to milliseconds is rounded up
before the usecs/nsecs are truncated.
2020-04-28 07:10:57 -07:00
Mark Pizzolato
1c589030ae TIMER: Provide a means for VM to indicate its expected calibration rate
As reported and discussed in #817

This allows RUNLIMIT to provide useful results on fast or slow host systems.
2020-03-23 07:48:45 -07:00
Mark Pizzolato
ee317e0cb4 SCP: Adjust RUNLIMIT time values on slow host systems
As reported and discussed in #819
2020-03-21 21:30:58 -07:00
Mark Pizzolato
550837b15b TIMER: Prefer a stable calibrated clock which ticks slower than the host 2020-03-08 21:11:30 -07:00
Mark Pizzolato
0170b7c6ab SCP: Convert more SHOW and debug output to use sim_vm_interval_units 2020-03-08 11:43:30 -07:00
Mark Pizzolato
56f186135c TIMER: Fix startup/restart logic that accounts for time at the sim> promt 2020-03-07 21:24:03 -08:00
Mark Pizzolato
938aa58f3a SCP: Provide ways for VM to specify sim_interval adjustment and step units
This affects the output of some SCP commands (including help).  The
results are cosmetic, but allows the simulator to provide correct descriptive
information.
2020-03-07 10:13:18 -08:00
Mark Pizzolato
42bb47d961 TIMER: Be sure to empty the event queue at timer initialization
If a reset_all_p() happens before the timing subsystem is initialized,
events can be queued with unreasonable timing measurements.
2020-03-07 07:05:46 -08:00
Mark Pizzolato
26fa91a335 TIMER: Avoid clocks with changing tick rates as the primary calibrated timer
Some simulators have clocks that have dynamically programmable tick
rates. Such a clock is only a reliable candidate to be the calibrated
clock if it uses a single tick rate rather than changing the tick rate
on the fly.  Generally most systems like this, under normal conditions
don't change their tick rates unless they're running something that is
examining the behavior of the clock system (like a diagnostic).  Under
these conditions this clock is removed from the potential selection as
"the" calibrated clock that all others are relative to and if necessary,
an internal calibrated clock is selected.
2020-02-23 00:31:45 -08:00
Mark Pizzolato
73a41c4bc7 SCP: Auto detect WRU being entered for simulators without a console device 2019-12-11 12:25:18 -08:00
Mark Pizzolato
2840e3b67f SCP: Fix Coverity identified issues/noise 2019-07-15 00:04:40 -07:00
Mark Pizzolato
b3fa1f9fe8 TIMER: Stabilize timer behaviors
- Fix incomplete migration to RTC structures indicated by Coverity
  warnings.  Some Coverity were minor warnings and not real issues.
- Add calibration recovery parameters for idle and catchup ticks
- Aggressively perform catchup ticks when in simulated idle paths
  even when idling is disabled.
- All non internal clocks can have catch-up ticks triggered if they
  register a tick unit.
- Catch-up ticks will be delivered to non tick acking simulators when
  idling if regstered tick unit has been specified.
- Hosts with slow ticks can idle and keep sloppy OK time when
  simulators have faster ticks
- Default to active calibration (ALWAYS) while idling (no skipping)
2019-06-18 08:01:45 -07:00
Mark Pizzolato
8c4f8b0bff TIMER: Accelerate catchup ticks while idling
- Avoid default idle stability wait when pre-calibrate has succeeded
- Display time at sim> prompt in SHOW CLOCK output
2019-06-10 14:55:05 -07:00
Mark Pizzolato
9ab8d0e91e TIMER: Add debug of all calibration decision variables default no idle skip 2019-06-08 16:38:15 -07:00
Mark Pizzolato
7bcf407fcc TIMER: Reorganize timer control variables to use a structure for each timer
The original approach had separate parallel arrays for each relevant
state variable for each calibrated timer.  That worked when there were
only a few state variables, the state info for a timer belongs in a
structure.
2019-06-08 13:55:49 -07:00
Mark Pizzolato
da3f851d70 TIMER: Add minimal tick based calibration APIs. 2019-06-08 13:55:06 -07:00
Mark Pizzolato
9514ea5a58 TIMER: Stabilize run away clock calibration conditions
- Adjust calibration parameters to properly record catchup variables for
  odd condition cases.
- Disable idle percentage calibration skipping until the correct set of
  calibration variables are available.
- When a pre-calibrate operation has been performed, make the results
  visible in the output of SHOW CLOCK

As discussed in #705 and #699
2019-06-03 20:45:40 -07:00
Mark Pizzolato
217463c6e2 TIMER: Also account for sim> prompt time in catchup time calculations
As discussed in #705
2019-06-01 02:33:02 -07:00
Mark Pizzolato
564ce2b3f4 TIMER: Don't consider idle calibration skipping with internal timer
As discussed in #699
2019-05-30 03:23:38 -07:00
Mark Pizzolato
0195bbda4b TIMER: Fix missing catchup ticks for VAX simulators when idling
- MicroVAX I, II and 3900 don't have a DONE bit in the clock status
  register, so sim_rtcn_tick_ack() wasn't being called to acknowledge
  clock ticks.
- Timer catchup tick criteria didn't work unless the host had a slow
  clock tick.

As discussed in #705
2019-05-30 01:51:52 -07:00
Mark Pizzolato
f75f28aa21 TIMER: Add mechanism to pre-calibrate the instruction execution rate 2019-05-28 23:56:58 -07:00
Mark Pizzolato
48db10994d TIMER: Calibrated clock fixes
- Properly handle clock transitions when control flows back and forth
  between instruction execution and simh commands.
- Changed Internal Timer from 10 Hz to the MAX(100Hz, HostOSClockHz)
- Changed default idle calibration percent to 50%
- Make sure that error cases (backwards and gap too big) properly advance
  the real time while avoiding calibration.
- Fix selection of the calibrated clock.
- Fix logic that sets the idle percentage that controls calibration.
2019-05-28 22:47:06 -07:00
Mark Pizzolato
5fdc1e6d0f SCP: Add more clock adjustments while idling 2018-10-08 20:55:01 -07:00
Mark Pizzolato
948d8cc6e8 TIMER: Remove excessive adjustment of sim_interval while idling 2018-10-05 20:44:22 -07:00
Mark Pizzolato
b38cc8a367 SCP: Allow "STEP -T nnn" to work
Delay scheduling of long duration calibration events until a calibrated timer
is established.
2018-10-05 20:43:43 -07:00