Local Time Generator for a Computer
This invention relates to a local time generator for a computer, to make the local time available when required by a central processing unit of the computer.
Various difficulties have been encountered in the past in making the local time available to a computer's central processing unit when required by the latter, without occupying processing time.
A particular application where local time is needed accurately is in a loosely coupled distributed computer system, where the individual node computers operate in their own timeframes, but where correction of the time generators of the nodes is carried out to synchronise these timeframes. In this case it is desirable for each node to record the time of receipt of each message over the communications medium from other nodes, and to apply a timestamp to each transmitted message so that the receiving node computer can compare the time of transmission, according to the timeframe of the transmitting node, with the time of receipt as measured in its own time frame. We have now devised a local time generator for a computer, which makes the local time available when required by any element or unit of the computer, e.g. a central processing unit of the computer.
In accordance with this invention there is provided a local time generator for a computer, comprising means for continuously generating signals representing local time, and a time bus to which said time signals are continuously applied.
In use, the local time is continuously available on the timebuε, and may be used by any unit connected onto the timebus.
Preferably the local time generator includes at least one register connected to the timebus. The processor of the computer, into which the local time generator is fitted, may at any instant command the register to latch its contents, which then represent the local time at that instant. After
sending this command to the register (referred to herein as th snap-shot register) , the processor can proceed with othe operations and retrieve the recorded time or timestamp from th register when free to do so. Alternatively, the processor ma command the snap-shot register to indicate when a predetermine local time is reached: for this purpose the processor load the snap-shot register with data representing the set time after which the register continuously compares that set tim with the local time appearing on the time bus, until the se time is reached.
The snap-shot register may be arranged to respond t an input signal for example received via an input interface o the computer into which the time generator is fitted, t trigger the snap-shot register to latch into itself the loca time at that instant. The processor can retrieve this recor or timestamp later on.
Any number of snap-shot registers may be provided i the computer so that a number of events may be recorded an retrieved later by the processor, before the registers ar reset.
The computer into which the time generator is fitte may comprise a plurality of processors, each with its own dat bus, memory and optionally an input/output interface, plus snap-shot register connected to the timebus. The computer into which the time generator is fitte may comprise a node computer for a loosely coupled distribute computer system, in which case it further comprises communications unit for coupling the data bus to communications medium common to a plurality of such nod computers. Preferably the communications medium has a snap shot register associated with it, for the purpose of recordin the time of receipt of each message received over th communications medium, and for applying a timestamp to eac message which the node computer transmits. Preferably the node computer compares the time o receipt of each message according to its own time frame, wit the timestamp carried by that message and representing the tim of transmission, measured according to the timeframe of th transmitting node computer. If any discrepancy is foun
(allowing for transmission time) , the time generator of the node computer can be adjusted automatically to synchronise with the other node computer(s) .
Preferably the adjustment of the time generator is carried out by altering the rate of change of time for a period
(e.g. changing the rate at which pulses are applied to a counter) , so that no instant of time is missed nor generated twice.
Preferably the time generator is formed as a unit together with at least one snap-shot register (preferably two snap-shot registers) and preferably as an integrated circuit.
An embodiment of this invention will now be described by way of example only and with reference to the accompanying drawings, in which: Figure 1 is a schematic block diagram of a node computer fitted with a local time generator in accordance with this invention, the computer being shown in a loosely coupled distributed computer system; and
Figure 2 is a schematic block diagram of the local time generator.
Referring to the example shown in Figure 1, there is shown one node computer in a loosely coupled distributed computer system. The overall system comprises a plurality of such node computers connected to a common communication medium MED. Each node computer may comprise a single processor, or as shown it may comprise a plurality of processors one of which may act as a master supervising the others. In the example shown, each processor comprises a bus to which is connected the CPU, memory MEM, an input/output interface I/O, and a snap- shot register SSR (the function of which will be described) . The computer bus CBI for one of the CPU's may extend to a communications unit COMMS which is coupled to the communications medium MED. The bus for each of the other processors may also be connected to the bus CBI by respective communications units e.g. CM. This is one of many possible architectures.
The node computer is fitted with a local time generator which comprises a time generator TIME GEN, a timebus TB and two snap-shot registers SSRl, SSR2. The snap-shot registers SSRl
and SSR2 are connected to the timebus: register SSRl i triggered from the communications unit COMMS and register SSR is connected to the databus CBI of the master processor. Th snapshot register e.g. SSR of each of the other processors i also connected to the time bus TB.
The time generator continuously generate signals defining the local time and applies these signals t the timebus TB: the signals may be updated typically ever 1 μs. The timebus TB therefore always carries the curren local time and this is available to all processors and to th communications unit COMMS via the respective snap-sho registers. Thus, if during the course of processing an processor requires the local time, it sends a command to it snap-shot register: this register latches its contents, corresponding to the data currently on the timebus; th register now holds data representing the local time at th instant the processor made the command; the processor need no retrieve this data from the snap-shot register immediately, bu may carry on with further processing and then retrieve the dat or timestamp when free to do so.
Alternatively for example, a processor may command it snap-shot register to indicate when a predetermined local tim has been reached: in this case the register holds dat representing the time set by the processor and continuousl compares this data with the local time data appearing on th timebus TB: when these two correspond, the register sends a indicating signal to its processor.
The snap-shot register SSRl is for use solely by th main communications unit COMMS. In the case of messages received by the node computer over the communicating mediu MED, the communications unit COMMS can instruct the register SSRl to record the time of receipt of the message, for retrieval later by one of the processors over the data bus. In the case of messages sent out over the communications medium MED from the node computer, the communications unit COMMS can instruct the register SSRl to record the time of transmission, so that this can be added as a timestamp to the outgoing message and also recorded by the transmitting processor.
In the example shown, the time generator TIME GEN and
two snap-shot registers SSRl and SSR2 are formed as a unit o a single chip and Figure 2 shows further details. Thus, i this example the time generator comprises a data bu connectable externally to the data bus CBI of the nod computer: also the timebus may be extended via an externa interface. Snap-shot registers SSRl and SSR2 are connecte to the data bus and timebus of the chip. A timing system T is driven by an external 16 MHz crystal and in turn drives 52 bit counter COUNT. In essence the timing system comprise a divider (÷ 16) but is adjustable as will be described. Th timebus preferably includes 16 data lines, 4 strobe lines an a status line and the time signals are applied to the timebu in multiplex manner: thus the complete data to define th local time consists of too many bits to be carrie simultaneously on the timebus, so the contents of the counte (defining the local time) are applied to the time-bus dat lines in four parts in succession, the strobe lines definin each of the four parts in turn. Each snap-shot register ha a command unit CU which acts to latch the register content upon receipt of a signal from an external trigger input TRI 1 or TRIG 2.
The local time held by the counter COUNT may be set o updated by data written into it from the data bus. The timin system can be adjusted by an adjustment register AR, fo example to synchronize with the timing systems of other nod computers coupled to the same communications medium MED. A address decode circuit DECODE receives external address an strobe inputs via a buffer, to drive the adjustment registe AR under the command of a control register CR. The maste processor of the node is able to compare the time of receip of any message, against a timestamp contained in that messag and indicating the time of transmission according to th timeframe of the transmitting node computer. An allowance i made for transmission time but if any discrepancy is foun between the time frames of the different node computers, th master processor of the appropriate node runs a known algorith to calculate a correction needed to adjust its own timin generator. The correction is applied via the data bus to th adjustment register AR and thence to the timing system TS.