Dedicated context-cycling computer with timed context5949994Abstract A dedicated context cycling microprocessor which features a plurality of input/output circuits for receiving and transmitting information and an individual set of dedicated on-board resources for each plurality of processing contexts. A distinct processing context is provided for each of a plurality of the input/output circuits, and a timed context is also provided for concurrently scheduling multiple processing contexts and enforcing time constraints associated with this schedule. The timed context has a pseudo-queue list which represents an ordered set of data parameters and program memory addresses for scheduling each of the processing contexts. The dedicated on-board resources include a plurality of registers for each of the processing contexts, such as at least one general purpose register and a program counter. A multiplexer circuit is also provided for moving data between the input/output circuits, the dedicated registers of the processing contexts and the computational unit. The input/output circuits include at least one serial and shared memory management unit, a plurality of embedded SCSI interfaces and a plurality of memory mapped registers. The dedicated context cycling microprocessor is also adapted to work in conjunction with, and effectively control another microprocessor, as well as control the access to an external memory system which is shared between these two microprocessors. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
TABLE I
__________________________________________________________________________
Word1
Word2
Word3
& & & Word1
Word2
Word3
Word2
Word3
Word1
> > > Own/
3/2/1/10
Agree
Agree
Agree
Word2
Word3
Word1
Lowest/
In-Service
? ? ? ? ? ? Highest
Answer
__________________________________________________________________________
0 x x x x x x x word1
1 x x x x x x x word1
2 0 x x 0 x x own word1
2 0 x x 0 x x lowest
word1
2 0 x x 0 x x high
word2
2 0 x x 1 x x own word1
2 0 x x 1 x x lowest
word2
2 0 x x 1 x x high
word1
2 1 x x x x x x word1
3 0 0 0 x x x own word1
3 0 0 0 0 0 1 lowest
word1
3 0 0 0 0 0 1 highest
word3
3 0 0 0 0 1 0 lowest
word3
3 0 0 0 0 1 0 highest
word2
3 0 0 0 0 1 1 lowest
word1
3 0 0 0 0 1 1 highest
word2
3 0 0 0 1 1 0 lowest
word2
3 0 0 0 1 0 0 highest
word1
3 0 0 0 1 0 1 lowest
word2
3 0 0 0 1 0 1 highest
word3
3 0 0 0 1 1 0 lowest
word3
3 0 0 0 1 1 0 highest
word1
3 0 0 1 x x x x word1
3 0 1 x x x x x word2
3 1 x x x x x x word1
__________________________________________________________________________
Processor Timing The HI/O microprocessor 1012 further includes a clock circuit 1114, which is responsive to a 144 MHZ oscillator and an external synchronizing signal, such as the "universal time clock" (UTC) pulse signal 1116. In this regard, the UTC pulse signal effectively operates as an interrupt signal for the timed context of the HI/O microprocessor 1012. The UTC pulse signal 1116 is beamed from a satellite in the U.S. government's "global positioning system" (GPS) every second, and the clock circuit 1114 preferably is synchronized within 1 microsecond to the UTC pulse signal. The clock circuit 1114 is used to generate a set of internal clock signals (Mst, Eit, Dst and Dat), as well as produce a number of timing-dependent signals which are used by external devices (such as the memory systems). In the common core computer 1000, the H2 microprocessor 1014 receives its clock signals from the HI/O microprocessor 1012, such as the fundamental 72 MHZ clock signal 1118. The HI/O microprocessor 1012 also includes a separate 24-bit timer circuit 1120 which is used to set timeout values for the processing contexts to be discussed below. The HI/O microprocessor 1012 is also capable of temporarily suspending the operation of the H2 microprocessor 1014 by applying an Immobilize signal, without necessarily affecting the operation of the H2 microprocessor after the Immobilize signal has been restored to its normally inactive state. In this regard, the Immobilize signal may be used to prevent a clock-enabling CLEAR signal on one of the H2 microprocessor clock signals. Referring to FIG. 9, a timing diagram of some of the clock signals used by the HI/O microprocessor 1012 is shown. FIG. 9 shows the manner in which processor cycles are utilized in the presently preferred embodiment. As noted above, the clock circuit 1114 generates the internal clock signals Mst, Eit, Dst and Dat. These are shown in FIG. 9. The presently preferred embodiment subdivides the fundamental 112 ns clock period into two components, designated cycle 1 and cycle 2, each being of equal duration. The fundamental clock period is broken in two to provide timing for the active context and the new context. As will be more fully explained, the system makes a distinction between the "active" context and the "new" context. The new context becomes the active context during the next cycle. The active context is the context currently running and the new context is the context that will run next. As illustrated at 68 the value in register GP1 of the active context is used as an address to access data memory (for data memory operations). This is allocated to cycle 1. As depicted at 70, the value in the program counter of the new context may serve as an address to access program memory (to fetch the op code to be executed during the next instruction period). This is allocated to cycle 2. Although not fully illustrated in FIG. 9, the next cycle 1 would immediately follow the illustrated cycle 2. Thus, as depicted at 72, the GP1 register would again be used to address data memory. The instruction performed on that data memory would be the one fetched at 70. When used as an input/output coprocessor for the H2 microprocessor, it is desirable to skew the respective clocks of the HI/O and H2 processors by several nanoseconds. This makes it easier to access shared memory. FIG. 17 shows how this is accomplished in the preferred embodiment. FIG. 17 is similar to FIG. 9. It illustrates cycle 1 and cycle 2 of the HI/O processor at 74 and the corresponding timing of the H2 processor at 76. Note the H2 processor does not perform context switching nor does it have a shared program/data memory, and therefore it does not require having its clock period broken into two cycles. Turning now to FIG. 3 (FIGS. 3A and 3B, collectively), a detailed block diagram of the HI/O microprocessor 1012 is shown. FIG. 3 illustrates the circuits already introduced including arbitration circuit 1126. As previously noted, the arbitration circuit is used to arbitrate between corresponding signals from up to three sources (digital and digitally-represented analog data). For example, these sources could represent the input signals received from sensors in the field and the corresponding input signals received from the sibling microprocessors of the other two common core computers in a process control node. A bootstrap ROM circuit 1128 is provided to store a basic operating system routine needed to boot up the HI/O microprocessor 1012 on start up. An opcode decode and control circuit 1130 is provided for decoding the 40-bit opcode word used by the HI/O microprocessor 1012. The HI/O microprocessor 1012 electrically enables the circuits specified in the opcode instruction. A block diagram of a portion of the opcode decoder is shown in FIG. 13. Note that the memory protect range value is compared with the value on the GP1 register bus by comparator 236. The output of this comparator controls the input to the decode modifier 238 to control whether memory protection is enabled or disabled for a particular location. The presently preferred embodiment handles several different instruction types designated LIM (Long Immediate Math), LIC (Long Immediate Compare) and COMBO. These are decoded from the op code and selected as inputs to the decoder modifier 238. An example of the instruction types utilized by the HI/O microprocessor 1012 is shown in FIGS. 14A and 14B. FIG. 14A shows the COMBO instruction at 38 and the Long Immediate Math instruction at 40. FIG. 14B shows the Long Immediate Compare instruction at 42. In FIGS. 14A and 14B the numbers 39 . . . 0 at the top of each chart represent the bit field widths. These charts show how the presently preferred embodiment decodes bits in the respective bit fields. By way of example, referring to the Long Immediate Math instruction set at 40, under the main math unit operation category (bits 33 . . . 31) a 0 value would specify the AND operation, a 1 value would specify the OR operation, a 2 value would specify the exclusive OR operation, and so forth. When referring to FIGS. 14A and 14B, 40 bit operands are configured as follows. Bit 39 represents the sign, where 1 denotes a negative number; bits 38-15 represent 24 bits of the integer value; and bits 14-0 represent 15 bits of the fraction. All data source values of less than 40 bits are automatically padded with zeros. Further, bit source values, used in 40 bit operations are treated as positive integers and are aligned with the least significant bit (LSB) of all the 20 bit values at the bit 15 position of the 40 bit operand. Deviations from this practice are specifically noted in the Table below. When referring to the Table below, note that the PIMMED/GP1 field acts as an address for local RAM and memory mapped registers. There is no interrupt source modification in the LIM or LIC instruction types. Thus the interrupt source chosen during the last COMBO instruction executed is maintained while executing either Long Immediate instruction type. Interrupt source selection is forced to the "00" (binary) selection (representing "Always") when the context is descheduled or the processor goes through a hardware reset. The Table below explains the abbreviations used in FIGS. 14A and 14B.
TABLE
______________________________________
COMBO instruction type:
b39 INST TYPE Instruction Type. "0" indicates the
b38 . . . 37
INT CND instruction type is COMBO Interrupt
Condition. Selects, via context's interrupt
mux, the 1 (of 4) interrupt condition requisite
for context to execute next instruction.
Number of conditions (up to 4) along with
type of conditions, vary with context type.
Selections are:
CD0 (condition0 of interrupt mux "Always"
for all 24 contexts)
CD1 (condition1 of interrupt mux; condition
varies based on context)
CD2 (condition2 of interrupt mux; condition
varies based on context)
CD3 (condition3 of interrupt mux; condition
varies based on context)
b36 . . . 35
JMP TGT Jump Target. Value with which context's PC
will be updated at end of instruction period
in which this opcode is executed. Selections
are:
PC + 1 (PC of current instruction + 1)
PC + 1 + IM (same as previous + PIMMED
value, located at b7 . . . 0 of the opcode,
PIMMED to be interpreted as 1 bit sign, 7
bits magnitude)
GP3 (bits 34 . . . 15 of value in context's
GP3 register RAM location)
0 (Zero)
b34 . . . 33
COMP S2 Comparitor Source2 operand. Selections are:
GP2 (value in context's GP2 register RAM
location)
IMG1 (value of PIMMED/GP1 bus - the
value on this 20-bit bus is equal to the
right-justified value of the PIMMED field, as
8 bits integer, unless PIMMED = FFh, where
the bus assumes the value of GP1)
GP3 (value in context's GP3 register RAM
location)
0 (Zero)
b32 . . 30
COMP OP Comparitor Operation, in form (COMP
S1.COMP OP.COMP S2, like
GP2.GTE.LRR). Selections are:
EQ (equal)
NEQ (not equal)
GT (greater than)
GTE (greater than or equal)
LT (less than)
LTE (less than or equal)
S1@S2T (bit of comparitor source1 operand,
at bit position equivalent to comparitor
source2 operand integer value, is TRUE)
S1@S2F (bit of comparitor source1 operand,
at bit position equivalent to comparitor
source2 operand integer value, is FALSE)
b29 . . . 28
COMP S1 Comparitor Source1 operand. Selections are:
GP2 (value in context's GP2 register RAM
location)
LRR (value on multiplexed Local RAM/
(mmed) Registers bus)
MVB (value on Move Bus)
MMO (value on Main Math Output bus)
b27 . . . 25
MMU S2 Main Math Unit Source2 operand. Selections
are:
GP1 (value in context's GP1 register RAM
location)
GP2 (value in context's GP2 register RAM
location)
GP3 (value in context's GP3 register RAM
location)
LRR (value on multiplexed Local RAM/
(mmed) Registers bus)
+1 (integer value of +1)
1's (all 40 bits of operand forced to 1's)
PIMMED (8-bit Program Immediate field of
the present opcode, used as integer)
0 (Zero)
b24 . . . 21
MMU OP Main Math Unit Operation, in form (MMU
S1.MMU OP.MMU S2, like
GP1.EXOR.1's). Selections are:
AND (logical AND)
OR (logical OR)
EXOR (logical EXOR)
+ (addition)
- (subtraction)
* (integer 20-bit by 20-bit multiply; result
MSB .fwdarw. LSB will be in bit positions
14 . . . 0, 39 . . . 15.)
/ (software assisted, successive approxima-
tion divide - 40-bit numerator, 20-bit
denominator, 20 bit quotient; numerator
operand selected as COMP S2, denominator
operand as MMU S2, and interim quotient as
MMU S1. The PIMMED value, interpreted
as an 8-bit, positive integer, will be used to
point to each bit position of the temporary
quotient to be calculated)
S1 IF CO ELSE S2 (MMU Source1 operand
will be the MMU output IF the output of the
comparitor is TRUE, else the value of the
MMU Source2 operand will be the output)
S1 BSET@S2 (value of MMU Source1
operand with bit set at position pointed to by
integer value of MMU Source2 operand
value)
S1 BCLR@52 (value of MMU Source1
operand with bit cleared at position pointed
to by integer value of MMU Source2
operand value)
S1 BSUB@S2 (value of MMU Source1
operand with bit substituted with at position
pointed to by integer value of MMU Source2
operand value)
ROTATE/MERGE 8 (value of rotated
Source1 operand merged with Source2
operand on byte boundaries. Bits 7 . . . 5
of the PIMMED field furnish the code for 1
of 8 discrete rotation amounts. Bits 4 . . . 0
of the PIMMED field are the byte select bits,
a "1" translated as "from rotated Source1
operand", "0" as "from Source2 operand")
CHKSUM (new checksum calculation with
the Source1 operand as the input data value
and the Source2 operand as the previous
checksum value)
ENCR/DECR (encrypt/decrypt data with the
Source1 operand as the data to be encrypted/
decrypted, and the Source2 operand as the
encryption/decryption dynamic key to use,
with the static key provided by a Local
RAM/(mmed) register)
DYNAMIC KEY (hardware permute the
Dynamic Key value, provided as the Source1
operand)
PARITY (using Source1 operand only, exor
bits 8 . . . 0, and substitute this 1 bit value
for bit 7 of the Source1 operand, passing all
other 39 bits of the Source1 operand un-
altered)
b20 . . . 18
MMU S1 Main Math Unit Source1 operand. Selections
are:
GP1 (value in context's GP1 register RAM
location)
GP2 (value in context's GP2 register RAM
location)
GP3 (value in context's GP3 register RAM
location)
LRR (value on multiplexed Local RAM/
(mmed) Registers bus)
CP (value in context's "Context Purpose",
CP, register)
MVBUS (value on the Move Bus)
PC + 1 (PC of current instruction + 1)
RAWIN (raw, un-autodecrypted data from
context's input register)
b17 GP3 GP3 update value. Selections are:
NO/-E (no change to context's GP3 value)
MMO (update context's GP3 value to that on
Main Math Output bus)
b16 . . . 15
GP2 GP2 update value. Selections are:
NO/-E (no change to context's GP2 value)
MMO (update context's GP2 value with bits
34 . . . 15 of the value on the Main Math
Output bus)
-1 (decrement context's current GP2 value
by 1)
MVB (update context's GP2 value with bits
34 . . . 15 of the value on the Move Bus)
b14 . . . 13
GP1 GP1 update value. Selections are:
NO/-E (no change to context's GP1 value)
MMO (update context's GP1 value with bits
34 . . . 15 of the value on the Main Math
Output bus)
+1 (increment context's current GP1 value
by 1)
LRR (update context's GP1 value with bits
34 . . . 15 of the value on the multiplexed
Local RAM/(mmed) Registers bus)
b12 . . . 8
MOVE OPT. Move Bus Option. This portion of the
opcode handles 4 functions simultaneously,
in the form W.X.Y.Z, where W is the source
operand to be placed on the Move Bus, X is
the destination of the Move Bus value, Y is
the Local RAM/(mmed) Register update
source, and Z is the CP register update
source. Abbreviations are: DM - Data
Memory, DI - Context's Default Input
Register, DO - Context's Default Output
Register, LR - multiplexed Local RAM/
(mmed) Registers bus, G3 - Context's GP3
value, MB - Move Bus, NC - No Change,
and MM - Main Math Output bus. The 32
selections are as follows:
0. DM.MB.NC.NC
1. DM.MB.MM.NC
2. DM.MB.MB.NC
3.
Context Management and the Timed Context The HI/O microprocessor 1012 also includes a context management circuit 1132 for controlling each of the 24 contexts which are arranged within the HI/O microprocessor. In this regard, a separate processing context is assigned for each of the input/output circuits discussed above. For example, six processing contexts are dedicated for the six SASMMU circuits 1110, while ten processing contexts are dedicated for the ten serial circuits 1108 and so forth. At the heart of the context management circuit is an interrupt priority encoder. Referring to FIG. 6, a detailed block diagram of an interrupt priority encoder circuit 1210 is shown. The interrupt priority encoder circuit 1210 forms part of the context management circuits 1132, which are shown as a block in FIG. 3. Each context has at least one interrupt source and circuitry to select of multiple sources (if it has multiple sources). If no context is active, the processor executes a NOP so that no stored values are altered. The priority encoder receives the interrupts from all different contexts. The priority encoder interprets these, determines which job has the highest priority and then generates the new context code. As will be more fully explained, the system makes a distinction between the "active" context and the "new" context. The new context becomes the active context during the next instruction period. Demultiplexer 44 demultiplexes the new context code into one of 24 decoded lines that can be used for state machine control elsewhere in the system. Similarly, demultiplexer 46 demultiplexes the active context code into one of 24 decoded lines for a similar purpose. A detailed block diagram of the interrupt selection circuit for the timed context is shown in FIG. 7. The timed context serves a special purpose within the system of coordinating operation of the HI/O processor and the H2 processor. In FIG. 7, note that the source of the timed context interrupts can come from a UTC (universal time constant) pulse or a pulse from a global positioning satellite (GPS), for example. Note the UTC pulse input to latch 48. This is used to generate both CP-bit 30 at 50, and the UTC leading edge interrupt. The timed context must also generate an interrupt when other contexts deschedule themselves. This is how the timed context knows when the other contexts are finished with a given task. This eliminates the need to wait for a timeout based on a time-clocked event, although time-clocked events can be used and are preferred when using the pseudo-queue. The "activity change" interrupt is generated for this purpose at 52. It is generated by monitoring the falling edge on any of the scheduler bits for any of the contexts. Essentially, the falling edges on all 23 of the bits corresponding to the other contexts are ORed together at OR gate 54. External Memory Mapped Devices The input/output circuits of the HI/O microprocessor 1012 also include a set of memory mapped register control circuits, generally designated by reference numeral 1112. As with all of the various input/output circuits disclosed herein, the number of such memory mapped control circuits may be varied as required. However, in the present embodiment, a total of 32 external memory mapped locations are provided, even though all of these locations may not necessarily be decoded. These control circuits perform address decoding in order to minimize the amount of external logic required for devices that are attached to the HI/O microprocessor 1012 through the external memory mapped data bus 1066. In other words, these external devices are memory mapped within the data memory space of the HI/O microprocessor itself. For example, such external devices may include a debug panel. Dedicated Registers FIGS. 8A-8F comprise detailed block diagrams which illustrate each of the dedicated registers for the processing contexts. FIG. 8A illustrates how the GP1 register RAM is configured. In the preferred embodiment there are 24 locations of GP1 registers that are addressed by the context code (active context or new context). The update data is input through a multiplexer 56 that is switched according to the type of opcode instruction (e.g., Long Immediate Compare, COMBO). FIGS. 8B and 8C are similar to FIG. 8A but illustrating the general purpose registers GP2 and GP3, respectively. Note that the GP3 register is addressed only by the active context code, since the GP3 value is not prefetched as are the GP1 and GP2 values. Thus there is no need for an address multiplexer. Although the preferred embodiment does not require register GP3 to be addressed by both active context and new context, it would be feasible to implement register GP3 similar to register GP2, if desired. Generally, registers GP1 and GP2 are used as address generators and counters, respectively. These registers are 20 bits wide because that is the width of the address bus in the presently preferred embodiment. Register GP3 is a 40 bit wide random access memory to support the full data width (40 bits) of the current embodiment. FIG. 8D depicts the logic of the program counter. Note that the program counter, implemented by RAM 58, can be loaded from various sources. Multiplexer 60 loads the program counter register RAM 58. The timed context may map the program counters of other contexts into the local RAM space via the addressing circuitry shown generally at 62, thus controlling context program counter initialization. To help in accomplishing this, the timed context uses a register for its PC (rather than a location in the PC RAM) so that it can update the PC RAM location of another context while still updating its own PC (register). This eliminates the need for a double update of the PC RAM in one instruction period. In FIG. 8D the short PIMMED (Program Immediate) value of the COMBO instruction (8 bits) is evaluated as a signed displacement (sign/magnitude) when used to modify a PC value. This allows relative jumping 127 locations backward and forward. FIG. 8E illustrates an output register. The illustrated register is 40 bits wide. The register is written when gated by the signals supplied to AND gate 64. The signal designated Mst is the main store clock. This signal appears in numerous places throughout the circuitry. It is one of the principal timing signals that controls operation of the HI/O processor. This timing signal and the other principal timing signals will be more fully described in connection with FIG. 9. FIG. 8F illustrates a generic CP register configuration. There is a CP register for each context. This register is 40 bits wide, though size varies based on context need. It is updated by using the main math out (MMO) value. The CP register uses the "this context active" signal to ensure that the register is updated at the proper time relative to the context that is active. The multiplexer 66 supplies a signal on the CP-bus when a context's CP value is used in the main math unit. The active context code is used to select which CP register value is actually used in the main math unit. For instance, if another context is running a routine where it is required to AND out bit 26 of its CP register, the active context code (of this running context) will select its own CP value to be fed to the main math unit for ANDing. Thus its bit 26 gets ANDed out and then its CP register will be rewritten at the end of the current instruction. Substantial on-board RAM capacity is also provided for the HI/O microprocessor 1012 through a set of RAM circuits 1138 which function as a collection of registers. These RAM circuits 1138 include a local RAM circuit 1140, which may be employed to store up to 128 40-bit words in this embodiment. The RAM circuits 1138 also include a set of registers which are dedicated to the 24 processing contexts of the HI/O microprocessor 1012. Each of these sets of dedicated registers includes a general purpose register GP1, a general purpose register GP2, a general purpose register GP3 and a program counter PC, each addressed by the active context code in a 24 location RAM. A checksum circuit 1142 also provides error checking on external data transmissions for 10 of the contexts (namely the SCSI and SASMMU contexts). A dynamic key RAM 1180 is also used to provide a dynamic key for an encryption algorithm to enhance the security of external data transmissions of some contexts. FIG. 11 shows a more detailed schematic on how the external RAM and program data memory RAM is constructed. The RAM is configured into different banks and there are two pre-decoded chip enable signals (CE) to select which bank is being used. The chip enable signals are supplied at 108 in FIG. 11. The presently preferred embodiment implements multiple 64K banks of RAM. The presently preferred embodiment employs a 1 megabyte memory space for the HI/O processor. The chip enables can be selectively decoded to switch on banks of different sizes (64K, 128K, 512K and 1 meg). When operating in the 1 meg mode the 0-0FFFF chip enable signal will be active and the other chip enable signal will never be active. FIG. 11 also illustrates a portion of the move bus discussed below. The HI/O microprocessor 1012 further includes a main math unit 1134 for performing a number of mathematical and logical operations. As shown in FIG. 3, the output bus 1135 from the main math unit 1134 is connected to several on-board circuits, including the input/output circuits, such as the SASMMU circuits 1110 and the SCSI circuits 1100-1106. A separate comparator circuit 1136 is provided for performing a number of alternative compare operations. It should be noted that the comparator circuit 1136 is capable of operating concurrently with and independently from the main math unit 1134. In other words, a single compound instruction may be used to cause the main math unit 1134 to perform an addition operation on one set of input source values, while the comparator 1136 is commanded to perform one of a number of possible compare operations on its own separate input source values, one of which may be the output of the math unit. Indeed, as shown in FIG. 3, the output from the comparator provides one of the selectable input sources for the main math unit 1134 during the same clock cycle. The output from the comparator 1136 could also be used to choose the source signals for the main math unit 1134 during the same clock cycle in which the main math unit conducts a desired computational/logical operation. Centrally disposed in FIG. 3 is a mux module 1146 (move multiplexer) which represents the combination of a number of circuits used to rapidly move data between the input/output circuits and the main math unit 1134, the comparator circuit 1136, the dedicated registers of the processing contexts and the other circuits of the HI/O microprocessor 1012 as shown. The mux module 1146 is shown more fully at 90 in the schematic diagram of FIGS. 12A-12D. The mux module 1146 includes a move bus 109 (FIG. 11) which is tristate buffered onto the program and data bus 1050 of the HI/O microprocessor 1012. FIGS. 12A-12D are high level block diagrams showing, among other things, the circuitry found in the mux module. The mux module is also depicted at 1146 in FIGS. 3A-3B. Essentially this circuitry is a collection of multiplexers for different purposes. For example, the CP multiplexer 78 selects the appropriate CP register based on the active context code. The input multiplexer 80 selects raw data from the context's input registers, also based on the active context code. Also included is the encryption/decryption control module 82 that may be used to perform hardware encryption and decryption of data. The checksum control circuitry 84 generates checksums for data integrity control. FIGS. 12B-12D show high level block diagrams of the following additional circuitry: local RAM control 86, GP 1 control 88, mux module 90, output mux 92, MMU source muxes 94, comparitor source muxes 96, logic analyzer mux 98, GP3 control 100, GP2 control 102, program counter control 104 and shared context control 106. Referring back to FIG. 11, a portion of the move bus 109 is depicted in further detail. The circuitry shows how the output of the move bus can be used as a source of data when writing to external data memory. The output of the move bus is always written to data memory. The processor selects what the source of the data is going to be. It can be general purpose register GP3, main math unit MMU, local RAM/registers or default input. This is controlled by the mux module 90 based on the Move Source Selection input. Context Cycling Before proceeding to discuss the specific circuits which are associated with the processing contexts (illustrated in FIGS. 4A-8F), an overall discussion of the operation and interaction between the timed and device processing contexts may be in order. Each of the external devices coupled to the HI/O microprocessor 1012 are handled by separate subroutines running on HI/O microprocessor. Each of these subroutines will run in its own environment (referred to herein as a processing context) so that it does not need to know of the existence of other software running on the HI/O microprocessor 1012 (except for the existence of the timed context which acts as a "scheduler routine"). Because several resources are shared between different contexts (such as the computational functions of the main math unit 1134), only one context will be active at one time (with active meaning that its software instruction is currently being executed). Of course, it could be reasonable for more than one context to be active at one time, provided that more than one set of shared resources is also provided. All processing contexts are preferably controlled by a scheduling mechanism. This mechanism schedules the different processing contexts so that they are coordinated in time (some tasks should run only after others have been completed, while some tasks should be coordinated with tasks in other computer systems), so that over allocation of resources is avoided. It is recognized that much of this scheduling can be orchestrated at compile time since many of the tasks are done over and over again each second one or more times at the same times within each second. Scheduling of those tasks would then be done through the "timed context" (the context enforcing a "timeline"). However there will also be some spontaneous tasks (nonrecurring) which have to be scheduled between the recurring ones. Processing contexts are assigned different priorities and a priority encoder is used to activate the highest "bidding" context. Bidding requires (a) being scheduled, (b) having an interrupt present and (c) having that interrupt selected on the interrupt MUX. For a processing context to be scheduled, the timed context must set that processing context's scheduler bit, in order to enable the muxed interrupts of the processing context to be forwarded to the priority encoder. Each scheduler bit of a processing context is co-mapped in that processing context's CP register as well as in the timed context's CP register. A processing context will be bidding when it has been scheduled and it needs some software action. For instance, the processing context dealing with human input devices will normally only be bidding when the mouse or keyboard has been touched. After this event has been processed (meaning that this processing context has had the highest priority at least once and has executed at least one instruction), this processing context will not ask for service until the next human interaction. Until then, this processing context is said to be "inactive." Most interrupts from external sources will be handled in a single instruction, so it should be appreciated that rapid context cycling will be enabled. To make this context cycling highly efficient, each processing context is provided with its own set of registers. In the present embodiment these registers preferably include a program counter, three general purpose registers, a context purpose register (for miscellaneous context hardware configuration) as well as input and output registers. However, it should be understood that a different set of hardware assets may be employed without departing from the principles of the present invention. For example, certain processing contexts may not need input or output registers and a greater or lesser number of general purpose registers could be provided in the appropriate application. The present embodiment uses the same number of general purpose registers for all contexts. When a processing context becomes "active," its program counter and other registers will be available to access or control the shared resources, such as the private program and data memory circuits 1049 shown in FIG. 1 and main math units and comparator (and all other singly provided common use resources). A processing context can only be "active" when the context has been scheduled, it had the highest priority when priority encoding took place, its op code has been fetched, and it is now executing that op code. An interrupt can be an external event, but some may also be generated through software. Accordingly, it is preferred that each processing context have a set of different interrupt sources, with only one interrupt source selected at a given time. In the present embodiment, one to eight different interrupt sources are provided for each processing context. However, it should be appreciated that a greater or lesser number of interrupt sources may be provided in the appropriate application. As a result, the execution of each instruction effectively sets the condition to execute the next instruction (the interrupt source triggering the execution of the next instruction). The default for this condition would be "always," meaning that the next instruction should be executed regardless of external events, provided that this context is scheduled and it wins priority encoding. As an example of this process, assume a reception on Serial 5. The timed context schedules Serial 5 several instruction cycles prior to the scheduled transmission of the data from an external source. Serial 5 runs an instruction to set interrupt source to "receive word" and becomes inactive, though still scheduled. When the autonomous state machine of Serial 5 clocks in a full 8-bit word, the received word interrupt is generated, Serial 5 bids for service, and when it wins, Serial 5 awakens and runs an instruction to empty its input register. Then Serial 5 becomes inactive until the next word comes in. This method processes one 8-bit word in one instruction. Each processing context may be in one of a plurality of different states. In the present embodiment, each processing context may be in one of 4 possible states, which are summarized below. However it should be appreciated that other arrangements of processing context states may be employed without departing from the principles of the present invention. In the "idle" state, the context is waiting for the scheduler routine to set its scheduler latch. In the "inactive" state, the context has been scheduled, but it has no interrupt pending (that is, it is waiting for some event to occur). In the "bidding" state, the context has been scheduled, it also has an interrupt pending (the event has happened), and it is now competing for service based on priority of its interrupt. Priority encoding for the next instruction takes place two instruction periods before the bidding contest winner's op code is executed. When the interrupt selected by a context becomes true, and it eventually wins priority encoding, its opcode (the function of which probably is to service the interrupt) is fetched during the next instruction period. Since the instruction will not be executed until the instruction period after this, the interrupt will still be present when the subsequent priority encoding takes place. This could cause this context to be active twice for the same interrupt. To assure that a single "event" (such as receiving a word) does not make that device context active for two consecutive instruction periods, a processing context is excluded from priority encoding when it is "new" (that is, when its instruction is being fetched). This guarantees that one instruction of the processing context is executed before that context can bid again. This also means that each processing context will get no more than 50% of the instruction periods. This mechanism also avoids the need for a jump pipeline. When a jump is performed within the HI/O microprocessor 1012, the next instruction is the first at the "jumped to" location. In the present embodiment, processing contexts have preassigned priority levels. For example, those processing contexts requiring the shortest interrupt response could be assigned the highest priority. However, depending on what a processing context is doing, it might need a less immediate interrupt response than it normally does. So a mechanism is implemented that certain contexts (with preassigned high priorities) can lower their priority level in favor of contexts which are normally lower in priority. Accordingly, it should be appreciated that the HI/O microprocessor 1012 does provide a unique form of dynamic priority reassignment as warranted. A situation can also occur where no processing context is active. In this case, a "NOP" (meaning "no operation") is fetched out of internal bootstrap ROM 1128, so that all registers and memory remain unaffected. All of the timed functions within HI/O microprocessor 1012 are controlled from the timed context. Based on time, other processing contexts will be scheduled, configurations will be changed, control signals to the H2 microprocessor 1014 generated and so forth. The timed context also governs the control of external devices, such as the debug panel or a crossbar signal communication switch. Indeed, when the HI/O microprocessor 1012 is "reset," all processing context are "descheduled," so that the timed context is the only context running. At RESET, the timed context's program counter "PC" is preset to a predetermined value, which is the first address of the internal bootstrap ROM 1128 program. This bootstrap program is a mini program that loads a slightly more complex program at address zero of the external program and data memory, and then jumpts to address zero and begins execution. It should also be noted that the timed context can schedule multiple contexts at the same time up to the maximum number of processing contexts for the HI/O microprocessor 1012. In this regard, the HI/O microprocessor 1012 is provided with a total of 23 processing contexts, not including the timed context. However, it should be understood that the number of processing contexts will depend upon the particular implementation for a context cycling microprocessor according to the present invention. It should also be appreciated that in some applications it would be preferable to create the general schedule for the timed context in advance. Within this general schedule, slots in time should be left to provide for "spontaneous" needs (such as for sporadic communication, disk transfers and so forth). Since the HI/O microprocessor 1012 does the time keeping for the common core computer, it is preferred that this schedule should be enforced by the HI/O microprocessor. This schedule would provide a pseudo-queue list, which should be both application and system dependent. For example, this schedule could contain the times to start transfers from the shared memory system to the private memory system to do sibling communication, arbitration and so forth. As such, this schedule should be coordinated with tasks to be performed by the H2 microprocessor 1014 and coordinated with other computers that communicate with the system. Besides providing the "start time" for a specific context, the timed context pseudo-queue schedule should also be able to control the specific task that a context is going to accomplish. This is achieved by giving the timed context access to all program counters of other processing contexts. If tasks are to be started at specific times, the context running that task should be done with its previous task before it is scheduled again. Every scheduled context will need a certain amount of time to accomplish a specific task. Once this time has elapsed, its task should be finished and the context should have de-scheduled itself. Various reasons could cause the task not be completed in the assigned time period (broken data link, SCSI problem and so forth). In such an event, the task should be interrupted and the processing context should be "reset," so that it can resume proper operation. The timed context will set the timeout periods for each context by a scheduled "timeout" interrupt when the task should be completed. When the interrupt occurs, the timed context will determine whether the task was completed by reading the message status or scheduler latch (latch should have been cleared by that context if finished in time). If the task is unfinished, the timed context will first "deschedule" that context, then preset the PC of that context to an error service routine if appropriate, and then again schedule the context to run the error service routine. After this, this processing context's task should be ready to be rescheduled again. Note that the timed context may schedule or desechule other contexts, since it has access to the scheduler bits of the 23 other processing contexts (timed context is perpetually scheduled, thus has no need for its own scheduler bit). Each of the 23 other processing contexts, however, may not schedule itself, but only deschedule itself, since these each of these contexts must already be scheduled and active to update its scheduler bit. Software Reference Model The H2 and HI/O processors of the common core computer 1000 interact with one another through shared memory and by means of interrupts and other control signals. FIG. 18 illustrates this relationship. As previously described, the H2 processor is primarily involved in performing process control applications developed by the process control engineer to accomplish different process control tasks. The HI/O processor is principally involved in handling asynchronous events, such as communication with external devices. Both processors are capable of operating independently of one another, although in the common core computer configuration these two processors have a symbiotic relationship, the H2 processor performing most of the mathematical and logical computation functions and the HI/O processor handling communication with the outside world. Although both processors have their own internal clocks, the HI/O processor controls the overall timing of the system. The HI/O processor supplies the H2 processor with its base 72 MHz clock. Referring to FIG. 18, the timed context of the HI/O processor sends timing signals via interrupts to the H2 processor. These interrupts are responded to by the Dispatcher software routine of the H2 processor. In this way the H2 processor is able to be synchronized with the GPS system. This architecture allows all common core computers to be synchronized to a common time base (via GPS satellite, for example). Such synchronization is extremely valuable in a process control application, as many processes running concurrently will need to be coordinated possibly on a geographically large, worldwide scale. Note that the HI/O and H2 processors are able to share data through the shared memory that is accessible to both processors. In the presently preferred embodiment, the shared memory comprises a mutual data memory system of both processors. Although the presently preferred embodiment employs Harvard architecture for the H2 processor, this is not a requirement. The invention can be implemented using the Princeton or Von Neumann architecture. As noted above, the Harvard architecture is presently preferred because the illustrated Harvard implementation is able to execute instructions more quickly. As illustrated in FIG. 18, the program memory (PMem) is dedicated principally to the handling of the different functional contexts. Essentially, these functional contexts break down commonly performed input/output, arbitration and timing tasks into separate functional modules that may be rapidly cycled through without undue computational overhead to save state. In a conventional processor arrangement the machine state is saved by pushing the values of all registers onto a stack, before a jump operation is executed to begin processing a different context. When the new context procedure is completed, the conventional system restores the state of the processor by popping from the stack all of the previously stored register values. This takes a great deal of time, particularly when the processor has a large number of registers that must be saved. The present invention is able to cycle through a plurality of contexts at high speed, without this computational overhead. Because the states are always saved automatically, context switching can occur virtually instantaneously. The H2 processor of the preferred embodiment has program memory (PMem) that is dedicated to coordinating the schedule of process control tasks based on the timing information received by the Dispatcher from the timed context routines of the HI/O processor. This timing info is only one of the factors which influence the tasks to be scheduled. There are also dynamic inputs which influence this scheduling. Like the HI/O processor, the H2 processor has its own data memory. A portion of this data memory may be shared with the HI/O processor, as illustrated. The presently preferred embodiment employs a particular improvement in the Harvard architecture whereby a third queue (QMem) memory system exists in which subroutines are called and executed. Unique to this system, all process control programs are, by design, required to run once every second and to fully execute all required steps within one second. To accomplish this a very rigorously enforced software architecture is employed in which all possible data constant and variable memory locations are allocated as part of the system design. This ensures that all memory locations are accessible by direct addressing to gain speed. In addition, each operating period is subdivided into different time segments, to ensure that all time critical applications are run every second, leaving any remaining unused cycle time available for less critical applications. In the preferred embodiment three different time segments are employed. These are labeled Hz1, Hz25 and Hz.infin.. The Hz1 time segment is used for all process control applications. This is where all time critical routines are run. The Hz25 segment is optional. It may be used for nontime-cricital tasks. The Hz.infin. segment is used for any back burner or housekeeping operations that only need infrequent attention. Referring to FIG. 19, the HI/O processor's function is further illustrated. In one respect, the HI/O processor may be considered a multi-protocol data router. It supplies data to the H2 processor through shared memory. Thus the H2 processor is able to concentrate on performing all time critical tasks without concern for coordination with external devices that may require asynchronous communication capability. Thus in FIG. 19 the H2 processor entity 10 communicates with the HI/O processor entity 12. External data is input and output through the HI/O processor as illustrated at 14. The HI/O processor supports a plurality of functional contexts 16. These functional contexts may represent different protocol types (such as SCSI protocol or serial protocol) or they may represent different instances of a single protocol. (Multiple contexts, like the serial context, can execute the same routines.) Each of the functional contexts has associated with it its own dedicated program counter, depicted at 18. These individual program counters each support an individual processing program indicated at 20. Although programs 20 can be for any function, the principal function of these programs within the preferred embodiment is to handle communication and system timing, as previously discussed. The functional contexts 16 also each include dedicated general purpose (GP) registers 22. These registers are used to store the individual data 23 used by each of the functional contexts. By providing an architecture to support functional contexts that have multiple program counters and dedicated multiple general purpose registers, the system is able to save state automatically when switching from context to context. Unlike conventional systems which push and pop register values on and off of a stack, the present system allows all important state variables, such as the program counter value and all register values, to be stored automatically in their respective dedicated program counters and GP registers. As the HI/O processor cycles from context to context, the operation of a given context may be suspended, but the state is fully preserved until that context is next given CPU attention. The context cycling architecture of the HI/O processor allows for very rapid cycling between contexts. In fact, in the presently preferred embodiment, every successive instruction executed by the HI/O processor is within a different functional context. All of this is performed without the need to save state in the conventional fashion using a stack data structure. Recognizing that different functional contexts may have different priorities, the presently preferred architecture also includes a priority encoder 24 as part of the HI/O processor. The priority encoder tells the HI/O processor which of the active contexts to operate next. Further Details of Processor Components Referring now specifically to FIG. 4A, a detailed block diagram of a timer circuit 1200 for the timed context is shown. This 24-bit timer is presettable and should be synchronized to whatever synchronizing source of time is used for the HI/O microprocessor 1012 (such as the UTC or GPS pulse). The timer circuit 1200 increments at the 112 ns instruction period shown in FIG. 9 and its value is compared against a timeout value, which is also set by the timed context (or any other suitable context). The Mst and Eit clock signals are also illustrated in FIG. 9. The timer circuit 1200 includes a comparator 1202 for comparing an incrementing timer value with a preassigned timeout value. Once the timer exceeds this timeout value and timeout was selected as an interrupt source by the timed context, it will begin bidding and will immediately win priority encoding (because the timed context has the highest priority of all 24 contexts). In this particular embodiment the maximum period attainable with this 24-bit timer is approximately 1.8 seconds. However, other suitable timer periods could be provided in the appropriate application. Once active, the timed context goes through a list of items to do for that moment. While this list may initially be built by the compiler, it may also be updated dynamically, such as by the H2 microprocessor 1014. Items on the list could include the configuring of the sibling ports, scheduling of the other processing contexts, descheduling of any processing contexts (if they have "timed out") the generation of an interrupt to the H2 microprocessor 1014, and the running of specific subroutines. As mentioned above, processing contexts are scheduled by setting the "scheduler" latch bit of the corresponding context. This latch is mapped into the timed context's CP register (that is the context purpose register). When the timeout period defined for that context is reached, the timed context will diagnose whether a particular context finished its task, and if it did not finish, then the timed context will "deschedule" it by resetting the same scheduler latch. Descheduling a processing context or resetting the microprocessor will automatically change the interrupt source selected by that context to the "always" selection. It should also be noted that the timed context can always deschedule another context, whether or not the other context has finished its task. | ||||||
