US6188411B1ExpiredUtility

Closed-loop reading of index registers using wide read and narrow write for multi-threaded system

Assignee: NEOMAGIC CORPPriority: Jul 2, 1998Filed: Jul 2, 1998Granted: Feb 13, 2001
Est. expiryJul 2, 2018(expired)· nominal 20-yr term from priority
Inventors:Michael Lai
G06F 9/3851G06F 9/35G06F 9/3861
52
PatentIndex Score
27
Cited by
19
References
20
Claims

Abstract

Indexed registers in controller chips are read in a two-step process. First, an 8-bit write instruction writes an index into an index register in the controller chip. Secondly, a 16-bit read instruction reads both the index register and a data register selected by the index from the index register. When index registers are read in a multi-threaded system, programs in two different threads could access the same index register, each writing a different index into the index register. When another thread over-writes an index written by a current thread, the wrong index and the wrong data are read by the current thread. The current thread detects that the index was overwritten by another thread by extracting the index from the 16-bit read and comparing it to the desired index. When the extracted index mis-matches, the current thread retries, again writing the index and reading back both the index and data. Additional slow I/O operations are only needed when both threads access the same index register, when the wrong data and index are read. The 16-bit read provides closed-loop feedback to the software reading the index register.

Claims

exact text as granted — not AI-modified
I claim:  
     
       1. A method for reading indexed registers comprising: 
       executing a single-width write instruction in a processor;  
       writing a desired index value to an index register in a controller chip when the single-width write instruction is executed, the desired index value having a single width of bits;  
       executing a multiple-width read instruction in the processor;  
       reading from the controller chip when the multiple-width read instruction is executed:  
       1) a stored index from the index register and  
       2) selected data from a selected data register;  
       wherein the selected data register is identified by the stored index from the index register;  
       comparing the stored index to the desired index value; and  
       re-executing the single-width write instruction and the multiple-width read instruction when the stored index does not match the desired index value,  
       whereby the stored index is read with the selected data from the selected data register that is selected by the stored index to determine when to re-execute reading the indexed registers.  
     
     
       2. The method of claim  1  further comprising: 
       executing a second program in a second thread;  
       the second thread over-writing a second index to the index register after the single-width write instruction is executed by a first thread, but before the multiple-width read instruction is executed by the first thread;  
       wherein the first thread reads the second index that mis-matches the desired index value when the second thread over-writes the index register,  
       whereby the second thread over-writing the index register is detected by the first thread comparing the stored index to the desired index value.  
     
     
       3. The method of claim  1  wherein the selected data register has the single-width of bits. 
     
     
       4. The method of claim  1  further comprising: 
       decoding the stored index from the index register;  
       selecting one of a plurality of data registers as the selected data register using the stored index,  
       whereby the stored index selects from among the plurality of data registers.  
     
     
       5. The method of claim  1  wherein the multiple-width read instruction is an atomic instruction performing a single read operation that simultaneously fetches at least two single-width values in a single access cycle. 
     
     
       6. The method of claim  1  wherein the single-width write instruction and the multiple-width read instruction both output an address of the index register to an address bus connecting the processor and the controller chip. 
     
     
       7. The method of claim  6  wherein the selected data register has an address that is a next address to the index register, 
       whereby the selected data register and the index register have sequential addresses.  
     
     
       8. The method of claim  7  wherein the selected data register and the index register are input/output ports. 
     
     
       9. The method of claim  7  further comprising: 
       transferring the stored index over a first single-width segment of a data bus connecting the controller chip to the processor when the multiple-width read instruction is executed;  
       transferring the selected data over a second single-width segment of the data bus connecting the controller chip to the processor when the multiple-width read instruction is executed.  
     
     
       10. The method of claim  9  wherein the single-width is 8 bits and wherein the multiple-width is 16 bits, 
       whereby selected data register and the index register are byte-wide registers.  
     
     
       11. The method of claim  9  further comprising: 
       storing a multiple-width variable from the data bus when the multiple-width read instruction is executed, the multiple-width variable including the stored index and the selected data;  
       extracting the stored index from the multiple-width variable to generate an extracted index; and  
       comparing the extracted index to the desired index value,  
       whereby the stored index is extracted from the multiple-width variable.  
     
     
       12. The method of claim  11  wherein extracting the stored index from the multiple-width variable comprises: 
       bit-wise ANDing ones with the first single-width segment of the multiple-width variable that contains the stored index;  
       bit-wise ANDing zeros with the second single-width segment of the multiple-width variable that contains the selected data.  
     
     
       13. A configurable computer system comprising: 
       a central processing unit (CPU) for executing instructions;  
       a controller chip having an index register and a plurality of data registers, the index register selecting, as a selected data register, one of the plurality of data registers for access;  
       a bus connecting the CPU with the controller chip;  
       a first program executing on the CPU, the first program including:  
       first means for writing a desired index to the index register;  
       second means for reading a stored index from the index register while simultaneously reading the selected data register in the plurality of data registers;  
       compare means for comparing the desired index to the stored index; and  
       repeat means, coupled to the compare means, for repeating actions of the first means and the second means when the compare means determines that the desired index does not match the stored index;  
       whereby the first program detects when the wrong data is read by simultaneously reading the index register and the data register from the controller chip.  
     
     
       14. The configurable computer system of claim  13  further comprising: 
       a second program executing on a second thread on the CPU, for writing a second index to the index register while the first program is accessing the controller chip,  
       wherein the compare means detects when the second thread over-writes the index register.  
     
     
       15. The configurable computer system of claim  14  wherein the selected data register is uniquely identified by the stored index. 
     
     
       16. The configurable computer system of claim  15  wherein controller chip outputs as a 16-bit read both the index register and the selected data register. 
     
     
       17. The configurable computer system of claim  13  wherein the controller chip is a graphics controller for controlling a display, the plurality of registers including graphics-control registers. 
     
     
       18. A computer-program product comprising: 
       a computer-usable medium having computer-readable program code means embodied therein for accessing indexed registers in a multi-threaded environment, the computer-readable program code means in the computer-program product comprising:  
       execution means for executing a single-width write instruction in a processor;  
       index-write means for writing a desired index value to an index register in a controller chip when the single-width write instruction is executed, the desired index value having the single width of bits;  
       second execution means for executing a double-width read instruction in the processor;  
       double-width means for reading from the controller chip when the double-width read instruction is executed:  
       1) a stored index from the index register and  
       2) selected data from a selected data register;  
       wherein the selected data register is identified by the stored index from the index register;  
       compare means for comparing the stored index to the desired index value; and  
       repeat means for re-executing the single-width write instruction and the double-width read instruction when the stored index does not match the desired index value,  
       whereby the stored index is read with the selected data from the selected data register that is selected by the stored index to determine when to re-execute reading the indexed registers.  
     
     
       19. The computer-program product of claim  18  further comprising: 
       second-thread means for executing a second program in a second thread;  
       the second thread including means for over-writing a second index to the index register after the single-width write instruction is executed by a first thread, but before the double-width read instruction is executed by the first thread;  
       wherein the first thread reads the second index that mis-matches the desired index value when the second thread over-writes the index register,  
       whereby the second thread over-writing the index register is detected by the first thread comparing the stored index to the desired index value.  
     
     
       20. The computer-program product of claim  19  wherein the second-thread means is operating on a second central processing unit CPU, wherein the controller chip is accessed through a shared I/O bus.

Join the waitlist — get patent alerts

Track US6188411B1 — get alerts on status changes and closely related new filings.

We store only your email — no account needed. See our privacy policy.