H316: Expose RTC INTERVAL and QUANTUM values in registers update testrtc.cmd

testrtc.cmd updated with dynamically computed timing information
This commit is contained in:
Mark Pizzolato 2018-05-24 13:39:28 -07:00
parent 5f2c7b2a48
commit 6c425cc790
2 changed files with 22 additions and 4 deletions

View file

@ -116,6 +116,8 @@ REG rtc_reg[] = {
{ FLDATA (IRQ, dev_ext_int, INT_V_RTC-INT_V_EXTD) },
{ DRDATA (TPS, rtc_tps, 32), PV_LEFT },
{ DRDATA (WAIT, rtc_unit.wait, 24), REG_NZ + PV_LEFT },
{ DRDATA (INTERVAL, rtc_interval, 32), PV_LEFT | REG_RO },
{ DRDATA (QUANTUM, rtc_quantum, 32), PV_LEFT | REG_RO },
{ NULL }
};

View file

@ -36,7 +36,23 @@ d -m 1015 177766
; That's it...
d p 1000
echo Start your stopwatch and at the same moment type "GO".
echo The program should halt in exactly 65 seconds ...
set env -a RTC_INTERVAL=RTC.INTERVAL
set env -a RTC_QUANTUM=RTC.QUANTUM
set env -a RTC_TPS=RTC.TPS
set env -a RTC_DELAY=(1000*(10*(65536/RTC_QUANTUM)))/RTC_TPS
set env -a RTC_DELAY_SECS=RTC_DELAY/1000
set env -a RTC_DELAY_MSECS=RTC_DELAY%1000
echo The RTC runs at %RTC_TPS% ticks per second an increment of %RTC_QUANTUM%
echo on each tick.
echo The program should halt in approximately %RTC_DELAY_SECS%.%RTC_DELAY_MSECS% seconds ...
echo Starting at: %TIME%.%TIME_MSEC%
set env -a S_TIME_MSEC=((UTIME%1000000)*1000)+TIME_MSEC
GO
set env -a E_TIME_MSEC=((UTIME%1000000)*1000)+TIME_MSEC
echo Done at: %TIME%.%TIME_MSEC%
set env -a D_TIME_MSEC=E_TIME_MSEC-S_TIME_MSEC
set env -a ESECS=D_TIME_MSEC/1000
set env -a EMSECS=D_TIME_MSEC%1000
echo Elapsed Time: %ESECS%.%EMSECS% seconds
set env -a IPS=TICK_RATE_0*TICK_SIZE_0
echo Running at %IPS% instructions per second