A portion of the disclosure of this patent document contains material to which the claim of copyright protection is made. The copyright owner has no objection to the facsimile reproduction by any person of the patent document or the patent disclosure, as it appears in the U.S. Patent and Trademark Office file or records, but reserves all other rights whatsoever.
This invention relates generally to the ordering of execution of commands in command queues.
Computers typically contain a bus, which may be a set of hardware lines or conductors used for information transfer between the various components of the computer system, such as the processor, the memory, and the input/output ports. A bus typically consists of specialized groups of lines that carry different types of information. For example, one group of lines might carry data, while another group of lines carries memory addresses where the data can be found, and still another group carries control signals. Some computers contain multiple buses, for example a system bus and an I/O (input/output) bus. These multiple buses might not have the same number of lines, and the lines might have different meanings. Thus, at the point where these multiple buses connect with each other, specialized hardware is needed to convert the interface of one bus into the interface of another bus. This specialized hardware is often contained within a chip or chips.
The chips used in such a bus interface often receive many different types of commands. Typically, these commands are placed into separate queues in order to maximize throughput, so that if a first queue that services commands of a first type is full, a second queue can still accept and make progress executing commands of a second type. With this approach, there are occasions where commands in the various queues need to be ordered with respect to each other to prevent unintentional out-of-order execution.
Ordering commands in queues has been accomplished by designing logic that searches through the queues looking for command dependencies and sets hold-off bits in a register to indicate that a particular command is dependent on another command or commands already in one of the queues and cannot proceed until the previously accepted command or commands complete. A common problem in designs of this type is that the rules for which commands are dependent upon each other are fluid and change late in the design cycle of the chip. Additionally, design flaws on either end of the bus interface may necessitate different hold-off conditions than the designer originally contemplated. Unfortunately, the logic that searches the queues and determines command dependencies cannot be changed without redesigning the chip. Thus, there is a need for a solution that allows flexibility in ordering commands in queues.
Although the aforementioned problems have been described in the context of a chip in a bus interface, they can apply in any context where commands on command queues need to be ordered with respect to dependencies that they might have on each other.
A method, apparatus, chip, and electronic device are provided that in various embodiments determine whether to execute a command in a queue or whether to wait until another command or commands completed. The determination is based on a combination of an in-use vector and a scorecard vector. The in-use vector indicates which slots in various queues contain commands. The scorecard vector indicates the dependencies between various queues. In this way, the scorecard vector, and the thus the queue dependencies can be set and modified after the logic that processes the commands has been designed.
The processor 110 represents a central processing unit of any type of architecture, such as a CISC (Complex Instruction Set Computing), RISC (Reduced Instruction Set Computing), VLIW (Very Long Instruction Word), or a hybrid architecture, although any appropriate processor may be used. The processor 110 executes instructions and includes that portion of the electronic device 100 that controls the operation of the entire electronic device. Although not depicted in
Although the electronic device 100 is shown to contain only a single processor 110 and a single system bus 125, the present invention applies equally to electronic devices that may have multiple processors and multiple system buses with some or all performing different functions in different ways.
The storage device 115 represents one or more mechanisms for storing data. For example, the storage device 115 may include read only memory (ROM), random access memory (RAM), magnetic disk storage media, optical storage media, flash memory devices, and/or other machine-readable media. In other embodiments, any appropriate type of storage device may be used. Although only one storage device 115 is shown, multiple storage devices and multiple types of storage devices may be present.
The input device 120 may be a keyboard, mouse or other pointing device, trackball, touchpad, touchscreen, keypad, microphone, voice-recognition device, or any other appropriate mechanism for the user to input data to the electronic device 100. Although only one input device 120 is shown, in another embodiment any number and type of input devices may be present.
The output device 122 may be a printer, display device, plotter, text-to-voice device, speaker, or any other appropriate mechanism to display information to the user of the electronic device 100. Although only one output device 122 is shown, in another embodiment any number and type of output devices may be present.
The system bus 125 may represent one or more busses, e.g., PCI, ISA (Industry Standard Architecture), X-Bus, EISA (Extended Industry Standard Architecture), or any other appropriate bus and/or bridge (also called a bus controller).
The chip 126 is further connected to bus 135, which is connected to a device 130. The chip 126 receives commands and/or data from the bus 125 and sends commands and/or data to the bus 135. In another embodiment, the chip 126 receives commands and/or data from the bus 135 and sends command and/or data to the bus 125. Although only one chip 126 is shown in
In an embodiment the bus 135 is an I/O (Input/Output) bus, but in other embodiments the bus 135 may be any appropriate type of bus. In an embodiment the device 130 is an I/O device such as a storage device. In another embodiment, the device 130 is a network. In another embodiment, the device 130 is any device capable of receiving and/or sending commands and/or data. Although the device 130 is shown in
The electronic device 100 may be implemented using any suitable hardware and/or software, such as a personal computer. Portable computers, laptop or notebook computers, PDAs (Personal Digital Assistants), pocket computers, telephones, pagers, automobiles, teleconferencing systems, appliances, and mainframe computers are examples of other possible configurations of the electronic device 100. The hardware and software depicted in
As will be described in detail below, aspects of an embodiment of the invention pertain to specific apparatus and method elements implementable on a computer or electronic device. In another embodiment, the invention may be implemented as a program product for use with a computer or an electronic device. The programs defining the functions of this embodiment may be delivered to the adapter or electronic device via a variety of signal-bearing media, which include, but are not limited to:
(1) information permanently stored on a non-rewriteable storage medium, e.g., a read-only memory device attached to or within an adapter or electronic device, such as a CD-ROM readable by a CD-ROM drive;
(2) alterable information stored on a rewriteable storage medium, e.g., a hard disk drive or diskette; or
(3) information conveyed to an adapter or electronic device by a communications medium, such as through a computer or a telephone network, including wireless communications.
Such signal-bearing media, when carrying machine-readable instructions that direct the functions of the present invention, represent embodiments of the present invention.
The specific number and types of queues shown are exemplary only, and in other embodiment, any number and type of queues may be present. For example, in other embodiments, a read/write command to internal facilities queue, a read/write command to external facilities queue, or any other appropriate type of queue may be used.
Each queue has a number of command slots to hold commands. For example, the interrupt queue 205 includes command slots 206-1, 206-2, 206-3, and 206-4. In the example shown, the command slot 206-1 holds a command entitled “Command A,” while command slots 206-2, 206-3, and 206-4 are empty. The cache coherency queue 210 contains four command slots with respective commands “Command B.” “Command C,” “Command D,” and one empty slot. The load response queue 215 contains four command slots with respective commands “Command E,” “Command F,” and two empty slots. Although in the example shown, all queues have four command slots, in other embodiments, the queues may have any number and varying numbers of command slots.
In an embodiment, the queues 205, 210, and 215 are FIFO (First-In-First-Out) queues, meaning that commands are removed only in the same order in which they were inserted. But, in other embodiments, commands are assigned priorities within the queues and are removed and processed in an order based on the priorities. In another embodiment, the commands may be removed and processed from a particular queue in any appropriate order.
The chip 126 further includes scorecard registers 220-1, 220-2, and 220-3 associated with each respective queue 205, 210, and 215. In the example shown, interrupt queue 205 has associated scorecard register 220-1, cache coherency queue 210 has associated scorecard register 220-2, and load response queue 215 has associated scorecard register 220-3. Although the scorecards 220-1, 220-2, and 220-3 are shown to be registers, in another embodiment any storage location may be used to store vector values in the scorecard. In an embodiment the values in the scorecard registers are set by the designer of the chip 126 to indicate each queue's dependencies on other queues. The scorecard registers allow the designer to determine the dependencies between the queues at run time, rather than making these determinations early in the design cycle of the chip 126 before the chip has been committed to silicon and coding the command ordering rules into the silicon. Although the values in the scorecard registers have been described as being set by the designer of the chip 126, in other embodiments, the values in the scorecard registers may be set via any appropriate mechanism. In various embodiments, the values in the scorecard registers may be set using a LSSD (Level Sensitive Scan Design), or I2C (Inter Integrated Circuit Bus, JTAG (Joint Test Action Group) interface via test equipment or a computer. In another embodiment, the chip 126 may receive a store instruction from the bus 125 that contains values, which the chip 126 writes to the scorecard registers.
The chip 126 further includes hold-off vectors associated with each command slot in each queue 205, 210, and 215. For example, the command slot 206-1 is associated with the hold-off vector 221-1, the command slot 206-2 is associated with the hold-off vector 221-2, the command slot 206-3 is associated with the hold-off vector 221-3, and the command slot 206-4 is associated with the hold-off vector 221-4. Similarly, the command slots in the queues 210 and 215 also have associated respective hold-off vectors. In an embodiment, the hold-off vectors are stored in registers, but in another embodiment any appropriate storage location may be used to store the hold-off vectors.
The hold-off vectors indicate whether their respective command slots contain commands that are ready for execution or whether their respective command slots contain commands that must be held off waiting for another command or commands to execute first. The setting of the hold-off vectors is further described below with reference to
The chip 126 further includes an in-use vector 230, which indicates which slots in which queues contain commands. The in-use vector 230 includes respective in-use slots associated with each respective command slot in each of the queues 205, 210, and 215. In the example shown, each slot contains one bit, and when the bit is “1” the corresponding command slot in the corresponding queue contains a command, and when the bit is “0” the corresponding slot in the corresponding queue does not contain a command. But, in other embodiments, the slots in the in-use vector 230 may be of any size and any appropriate encoding may be used.
In the example shown, the in-use slot 232-1 contains a “0” indicating that the command slot 206-4 is empty; the in-use slot 232-2 contains a “0” indicating that the command slot 206-3 is empty; the in-use slot 232-3 contains a “0” indicating that the command slot 206-2 is empty; and the in-use slot 232-4 contains a “1” indicating that the command slot 206-1 contains a command. In an analogous fashion, the remaining in-use slots in the in-use vector 230 are encoded to correspond to the state of the cache coherency queue 210 and the load response queue 215. The setting and clearing of the in-use vector 230 is further described below with reference to
The chip 126 also includes a command processor 240, which inserts and retrieves commands to/from the queues 205, 210, and 215, and sets and clears the in-use vector 230 and the hold-off vectors. In an embodiment, the command processor 140 receives values from the bus 125 via a store instruction or other command and writes the values into the scorecard registers 220-1, 220-2, and 220-3. The functions of the command processor 240 are further described below with reference to
Although the various components in
The slots in the scorecard register 220-1 are grouped into three groups: group 301, group 302, and group 302. The scorecard slots in the group 301 are associated with the commands in the interrupt queue 205, the scorecard slots in the group 302 are associated with the commands in the cache coherency queue 210, and the scorecard slots in the group 303 are associated with the commands in the load response queue 215.
In an embodiment, when a slot in the scorecard register contains a “0,” the command associated with the slot may be execute in any order. In an embodiment, when a slot in the scorecard register contains a “1,” the command corresponding to the slot needs to be executed before other commands. But, in other embodiments any appropriate encoding may be used.
In the example shown, the slots in groups 301 and 302 are all “0,” indicating that commands in the interrupt queue 205 do not need to wait for other commands (if present) in the interrupt queue 205 and the cache coherency queue 210. In the example shown, the slots in groups 303 are all “1,” indicating that the commands in the interrupt queue 205 do need to wait for other commands (if present) in the load response queue 215. The values illustrated in the scorecard register 220-1 are examples only and any values may be used.
The slots in the hold-off vector 221-1 are grouped into three groups: group 304, group 305, and group 306. The hold-off vector slots 304 are associated with the commands in the interrupt queue 205, the hold-off vector slots 305 are associated with the commands in the cache coherency queue 210, and the hold-off vector slots 306 are associated with the commands in the load response queue 215.
In an embodiment, when a slot in the hold-off vector contains a “0,” the associated command queue slot does not contain a command that needs to execute prior to the command associated with the entire hold-off vector. In an embodiment, when a slot in the hold-off vector contains a “1,” the associated command queue slot contains a command that needs to execute prior to the command associated with the entire hold-off vector. Thus, when the entire hold-off vector is non-zero, the command in the command slot associated with the entire hold-off vector needs to wait, or hold off, until the hold-off vector becomes zero.
In an embodiment when a slot in the in-use vector 230 contains a “0,” the associated slot in the associated command queue is empty with no valid command. In an embodiment when a slot in the in-use vector 230 contains a “1,” the associated slot in the associated command queue contains a command.
Although the data structures of
Control then continues to block 405 where the command processor 240 receives a command from the bus 125 or the bus 135. In another embodiment, the command processor 240 may receive the command from any appropriate entity. Control then continues to block 410 where the command processor 240 places the received command in an empty slot in the proper queue, depending on the type of command or any other appropriate criteria.
Control then continues to block 415 where the command processor 240 sets an indicator in the in-use vector 230 that corresponds to the queue location where the command was placed. Using the example of
Control then continues to block 420 where the command processor 240 performs a logical AND operation on the scorecard register associated with the proper queue (previously selected at block 405) and the in-use vector 230 and places the result in the hold-off register associated with the command queue and slot of the received command. Again, using the example of
Control then returns to block 405 where the command processor 240 receives the next command, as previously described above.
Control then continues to block 510 where the command processor 240 selects a queue to process. In an embodiment, the command processor 240 selects a queue to process based on a round-robin selection technique. In another embodiment, the command processor 240 selects a queue based on a priority scheme where queues are given priorities and certain queues have a higher priority than other queues. In another embodiment, any appropriate technique may be used for selecting the next queue to process.
Control then continues to block 515 where the command processor 240 selects a command from a slot in the command queue that was previously selected in block 510. Using the example of
Control then continues to block 520 where the command processor 240 determines whether the hold-off vector associated with the command slot in the queue indicates that the command may be executed. Using the example of
If the determination at block 520 is false, then control returns to block 510, as previously described above. In an embodiment, the determination at block 520 is false when the hold-off vector is non-zero.
If the determination at block 520 is true, then control continues to block 525 where the command processor removes the command from the selected slot in the selected command queue and executes the command. In an embodiment, the determination at block 520 is true when the hold-off vector is zero.
Control then continues to block 530 where the command processor 240 clears the appropriate bit for the just-executed command in every other command's associated hold-off vector. Control then continues to block 535 where the command processor 240 clears the appropriate bit associated with the just-executed command in the in-use vector 230. Control then returns to block 510, as previously described above.
In the previous detailed description of exemplary embodiments of the invention, reference was made to the accompanying drawings (where like numbers represent like elements), which form a part hereof, and in which is shown by way of illustration specific exemplary embodiments in which the invention may be practiced. These embodiments were described in sufficient detail to enable those skilled in the art to practice the invention, but other embodiments may be utilized and logical, mechanical, electrical, and other changes may be made without departing from the scope of the present invention. Different instances of the word “embodiment” as used within this specification do not necessarily refer to the same embodiment, but they may. The previous detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims.
In the previous description, numerous specific details were set forth to provide a thorough understanding of the invention. But, the invention may be practiced without these specific details. In other instances, well-known circuits, structures, and techniques have not been shown in detail in order not to obscure the invention.
This is a divisional application of U.S. patent application Ser. No. 10/401,258, filed Mar. 27, 2003, entitled “Command Ordering Based on Dependencies,” which is herein incorporated by reference.
Number | Date | Country | |
---|---|---|---|
Parent | 10401258 | Mar 2003 | US |
Child | 11471043 | Jun 2006 | US |