Skip to content

Commit

Permalink
SCP: Convert more SHOW and debug output to use sim_vm_interval_units
Browse files Browse the repository at this point in the history
  • Loading branch information
markpizz committed Mar 8, 2020
1 parent b2272c8 commit 0170b7c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
12 changes: 6 additions & 6 deletions scp.c
Expand Up @@ -1118,15 +1118,15 @@ 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"
"++SET NORUNLIMIT\n\n"
" 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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scp.h
Expand Up @@ -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 */
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion scp_help.h
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions sim_console.c
Expand Up @@ -639,9 +639,9 @@ for (i=connections=0; i<sim_rem_con_tmxr.lines; i++) {
DEVICE *dptr = NULL;

if (rem->smp_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)
Expand Down
30 changes: 16 additions & 14 deletions sim_timer.c
Expand Up @@ -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);
Expand Down Expand Up @@ -1844,29 +1844,29 @@ 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);
break;

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:
Expand Down Expand Up @@ -2477,10 +2477,11 @@ RTC *rtc, *crtc;
sim_int_clk_tps = MIN(CLK_TPS, sim_os_tick_hz);
for (tmr=0; tmr<SIM_NTIMERS; tmr++) {
rtc = &rtcs[tmr];
if ((rtc->hz) &&
(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? */
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0170b7c

Please sign in to comment.