From 0170b7c6ab22e5f09f2697bd4f0ea87df0040f9f Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sun, 8 Mar 2020 11:43:30 -0700 Subject: [PATCH] SCP: Convert more SHOW and debug output to use sim_vm_interval_units --- scp.c | 12 ++++++------ scp.h | 4 ++-- scp_help.h | 2 +- sim_console.c | 4 ++-- sim_timer.c | 30 ++++++++++++++++-------------- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/scp.c b/scp.c index f758ac2c..9e171902 100644 --- a/scp.c +++ b/scp.c @@ -1118,7 +1118,7 @@ static const char simh_help[] = " diagnostic which didn't achieve explicit success or failure within\n" " some user specified time. The RUNLIMIT command provides ways to\n" " limit execution.\n\n" - "++RUNLIMIT n {CYCLES|MICROSECONDS|SECONDS|MINUTES|HOURS}\n" + "++RUNLIMIT n {%C|MICROSECONDS|SECONDS|MINUTES|HOURS}\n" "++NORUNLIMIT\n\n" " Equivalently:\n\n" "++SET RUNLIMIT n {CYCLES|MICROSECONDS|SECONDS|MINUTES|HOURS}\n" @@ -1126,7 +1126,7 @@ static const char simh_help[] = " The run limit state can be examined with:\n\n" "++SHOW RUNLIMIT\n\n" " If the units of the run limit are not specified, the default units are\n" - " cycles. Once an execution run limit has beenn reached, any subsequent\n" + " %C. Once an execution run limit has beenn reached, any subsequent\n" " GO, RUN, CONTINUE, STEP or BOOT commands will cause the simulator to\n" " exit. A previously defined RUNLIMIT can be cleared with the NORUNLIMIT\n" " command or the establishment of a new run limit.\n" @@ -6968,7 +6968,7 @@ if ((r != SCPE_OK) || (num == 0)) /* error? */ return sim_messagef (SCPE_ARG, "Invalid argument: %s\n", gbuf); cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */ if ((gbuf[0] == '\0') || - (MATCH_CMD (gbuf, "CYCLES") == 0)) + (MATCH_CMD (gbuf, sim_vm_interval_units) == 0)) sim_switches &= ~SWMASK ('T'); else { int i; @@ -7031,14 +7031,14 @@ if (sim_runlimit_enabled) { } else { if (sim_runlimit_initial != sim_runlimit) { - fprintf (st, "%d cycles initially, ", sim_runlimit_initial); + fprintf (st, "%d %s initially, ", sim_runlimit_initial, sim_vm_interval_units); if (sim_is_active (&sim_runlimit_unit)) - fprintf (st, "and %d cycles remaining\n", sim_activate_time (&sim_runlimit_unit)); + fprintf (st, "and %d %s remaining\n", sim_activate_time (&sim_runlimit_unit), sim_vm_interval_units); else fprintf (st, "expired now\n"); } else - fprintf (st, "%d cycles\n", sim_runlimit_initial); + fprintf (st, "%d %s\n", sim_runlimit_initial, sim_vm_interval_units); } } else diff --git a/scp.h b/scp.h index d9706124..ba2db861 100644 --- a/scp.h +++ b/scp.h @@ -365,7 +365,6 @@ extern int32 sim_switches; extern int32 sim_switch_number; extern int32 sim_quiet; extern int32 sim_step; -extern const char *sim_vm_step_units; /* Simulator can change this */ extern t_stat sim_last_cmd_stat; /* Command Status */ extern FILE *sim_log; /* log file */ extern FILEREF *sim_log_ref; /* log file file reference */ @@ -430,7 +429,8 @@ extern t_bool (*sim_vm_fprint_stopped) (FILE *st, t_stat reason); extern t_value (*sim_vm_pc_value) (void); extern t_bool (*sim_vm_is_subroutine_call) (t_addr **ret_addrs); extern const char **sim_clock_precalibrate_commands; -extern const char *sim_vm_interval_units; +extern const char *sim_vm_interval_units; /* Simulator can change this - default "instructions" */ +extern const char *sim_vm_step_unit; /* Simulator can change this - default "instruction" */ /* Core SCP libraries can potentially have unit test routines. diff --git a/scp_help.h b/scp_help.h index 7b9504c2..980f9e56 100644 --- a/scp_help.h +++ b/scp_help.h @@ -48,7 +48,7 @@ * * %U - Inserts the name of the unit (e.g. "DTA0"). * * %S - Inserts the current simulator name (e.g. "PDP-10") * * %C - Inserts the current value of the sim_vm_interval_units string - * * %I - Inserts the current value of the sim_vm_step_units string + * * %I - Inserts the current value of the sim_vm_step_unit string * * %#s - Inserts the string suppled in the "#"th optional argument to the help * routine. # starts with 1. Any embedded newlines will cause following * text to be indented. diff --git a/sim_console.c b/sim_console.c index b084e6c2..888b9f4b 100644 --- a/sim_console.c +++ b/sim_console.c @@ -639,9 +639,9 @@ for (i=connections=0; ismp_sample_dither_pct) - fprintf (st, "Register Bit Sampling is occurring every %d cycles (dithered %d percent)\n", rem->smp_sample_interval, rem->smp_sample_dither_pct); + fprintf (st, "Register Bit Sampling is occurring every %d %s (dithered %d percent)\n", rem->smp_sample_interval, sim_vm_interval_units, rem->smp_sample_dither_pct); else - fprintf (st, "Register Bit Sampling is occurring every %d cycles\n", rem->smp_sample_interval); + fprintf (st, "Register Bit Sampling is occurring every %d %s\n", rem->smp_sample_interval, sim_vm_interval_units); fprintf (st, " Registers being sampled are: "); for (reg = 0; reg < rem->smp_reg_count; reg++) { if (rem->smp_regs[reg].indirect) diff --git a/sim_timer.c b/sim_timer.c index f227dcae..7fa6bd38 100644 --- a/sim_timer.c +++ b/sim_timer.c @@ -1194,7 +1194,7 @@ fprintf (st, "Minimum Host Sleep Time: %d ms (%dHz)\n", sim_os_sleep_min_ if (sim_os_sleep_min_ms != sim_os_sleep_inc_ms) fprintf (st, "Minimum Host Sleep Incr Time: %d ms\n", sim_os_sleep_inc_ms); fprintf (st, "Host Clock Resolution: %d ms\n", sim_os_clock_resoluton_ms); -fprintf (st, "Execution Rate: %s cycles/sec\n", sim_fmt_numeric (inst_per_sec)); +fprintf (st, "Execution Rate: %s %s/sec\n", sim_fmt_numeric (inst_per_sec), sim_vm_interval_units); if (sim_idle_enab) { fprintf (st, "Idling: Enabled\n"); fprintf (st, "Time before Idling starts: %d seconds\n", sim_idle_stable); @@ -1844,21 +1844,21 @@ else { switch (sim_throt_type) { case SIM_THROT_MCYC: - fprintf (st, "Throttle: %d megacycles\n", sim_throt_val); + fprintf (st, "Throttle: %d mega%s\n", sim_throt_val, sim_vm_interval_units); if (sim_throt_wait) - fprintf (st, "Throttling by sleeping for: %d ms every %d cycles\n", sim_throt_sleep_time, sim_throt_wait); + fprintf (st, "Throttling by sleeping for: %d ms every %d %s\n", sim_throt_sleep_time, sim_throt_wait, sim_vm_interval_units); break; case SIM_THROT_KCYC: - fprintf (st, "Throttle: %d kilocycles\n", sim_throt_val); + fprintf (st, "Throttle: %d kilo%s\n", sim_throt_val, sim_vm_interval_units); if (sim_throt_wait) - fprintf (st, "Throttling by sleeping for: %d ms every %d cycles\n", sim_throt_sleep_time, sim_throt_wait); + fprintf (st, "Throttling by sleeping for: %d ms every %d %s\n", sim_throt_sleep_time, sim_throt_wait, sim_vm_interval_units); break; case SIM_THROT_PCT: if (sim_throt_wait) { - fprintf (st, "Throttle: %d%% of %s cycles per second\n", sim_throt_val, sim_fmt_numeric (sim_throt_peak_cps)); - fprintf (st, "Throttling by sleeping for: %d ms every %d cycles\n", sim_throt_sleep_time, sim_throt_wait); + fprintf (st, "Throttle: %d%% of %s %s per second\n", sim_throt_val, sim_fmt_numeric (sim_throt_peak_cps), sim_vm_interval_units); + fprintf (st, "Throttling by sleeping for: %d ms every %d %s\n", sim_throt_sleep_time, sim_throt_wait, sim_vm_interval_units); } else fprintf (st, "Throttle: %d%%\n", sim_throt_val); @@ -1866,7 +1866,7 @@ else { case SIM_THROT_SPC: fprintf (st, "Throttle: %d/%d\n", sim_throt_val, sim_throt_sleep_time); - fprintf (st, "Throttling by sleeping for: %d ms every %d cycles\n", sim_throt_sleep_time, sim_throt_val); + fprintf (st, "Throttling by sleeping for: %d ms every %d %s\n", sim_throt_sleep_time, sim_throt_val, sim_vm_interval_units); break; default: @@ -2477,10 +2477,11 @@ RTC *rtc, *crtc; sim_int_clk_tps = MIN(CLK_TPS, sim_os_tick_hz); for (tmr=0; tmrhz) && - (rtc->hz <= (uint32)sim_os_tick_hz) && - (rtc->clock_unit) && - ((rtc->last_hz == 0) || (rtc->last_hz == rtc->hz))) + if ((rtc->hz) && /* is calibrated AND */ + (rtc->hz <= (uint32)sim_os_tick_hz) && /* slower than OS tick rate AND */ + (rtc->clock_unit) && /* clock has been registered AND */ + ((rtc->last_hz == 0) || /* first calibration call OR */ + (rtc->last_hz == rtc->hz))) /* subsequent calibration call with an unchanged tick rate */ break; } if (tmr == SIM_NTIMERS) { /* None found? */ @@ -2602,7 +2603,8 @@ if (sim_calb_tmr == -1) { } else { if (sim_calb_tmr == SIM_NTIMERS) { - sim_debug (DBG_CAL, &sim_timer_dev, "sim_start_timer_services() - restarting internal timer after %d cycles\n", sim_internal_timer_time); + sim_debug (DBG_CAL, &sim_timer_dev, "sim_start_timer_services() - restarting internal timer after %d %s\n", + sim_internal_timer_time, sim_vm_interval_units); sim_activate (&SIM_INTERNAL_UNIT, sim_internal_timer_time); } } @@ -2930,7 +2932,7 @@ if (NULL == uptr) { /* deregistering? */ sim_cancel (rtc->timer_unit); return SCPE_OK; } -if (NULL == rtc->clock_unit) +if (rtc->clock_unit == NULL) rtc->clock_cosched_queue = QUEUE_LIST_END; rtc->clock_unit = uptr; uptr->dynflags |= UNIT_TMR_UNIT;