KW11-P Programmable Clock Added
w11 had from from the very beginning a
line frequency clock.
KW11-L is a mandatory device and used by all operating
systems to define the system time.
And it is a very simple device, it just generates interrupts every
20 msec (w11 uses 50 Hz line frequency, simply because I live in Europe).
DEC offered for the
UNIBUS systems a more sophisticated device,
KW11-P, which can be used as programmable high-precision
The central element is a 16 bit counter, which is advanced by one of four
- 100 kHz clock
- 10 kHz clock
- line clock (in w11 50 Hz)
- external event
KW11-P can generate an interrupt when a configurable
value of the counter is reached, or just count and be used to measure time
with a resolution of down to 10 usec.
The DEC manual
DEC-11-HPWB-D describes many implementation details but lacks a
complete description of the functional behavior.
The remaining ambiguities were resolved by inspection of
- 2.11BSD clock initialization code in /usr/src/sys/pdp/clock.c
model of the
The implementation is in
The external event port
EXTEVT is connected in
to the instruction decode signal
which is usually connected in the
w11 top level design to the
DM_STAT_EXP.se_idec signal provided by
I added the
KW11-P with three use cases in mind:
- as very fast interrupt source for test benches. With the external event mode it is possible to generate an interrupt after a preset number of instructions. Presets of as low as 20 are feasible. This allows to write interrupt tests which execute in a few 100 instructions, very nice for fast behavioral simulations, like in Section B of test_kw11p_int.tcl.
- as high resolution timer for test benches. Using the 100 kHz mode allows to either measure elapsed times or generate interrupts with a precision of 10 usec. Very nice for tests of the I/O system.
- and as long shot: support 2.11BSD kernel profiling.
The 2.10BSD kernel had a very simple but very memory effective
kernel profiling feature, which simply histogramed the PC value
when in kernel mode. This was never ported to 2.11BSD, but 2.10BSD code
pieces still linger around in the 2.11BSD code base, see
- kernel overlays must be handled
- supervisor mode should be handled (the networking code)
- the interrupt code doing the sampling must be short
- the user land analysis code will certainly gain complexity