Abstract:
Control circuitry is used to select M entries from an N-entry storage array by viewing the array from both ends. Beginning at both ends of the array, particular bit values or entry content is looked for by the control logic. Once found at both ends, these entries are then used to produce control signals to be sent to a pair of muxes to remove these entries. Then a subset of the original array consisting of the remaining entries of the array is then iterated upon by a similar set of control circuitry for finding and removing the next M entries from the storage array.

Description:
TECHNICAL FIELD 
     The present invention relates in general to data processing systems, and in particular, to an apparatus and method for selecting M entries from an N-entry storage array. 
     BACKGROUND INFORMATION 
     Within a data processing system, there is usually a goal to design circuitry within a processor that is efficient and has low power requirements. One of these goals for increasing efficiency includes minimizing the number of cycles needed for any action taken within a processor. 
     One action often implemented within a processor, or within any other logic circuitry, is the selection of M entries from N entries in logic. For example, some type of storage array, such as a completion queue in a processor or a group of registers, may hold N entries (e.g., bytes, words, long-words, etc.). There is often a requirement to remove certain ones of these entries. For example, in a completion queue, upon the completion and retiring of requests, such entries are removed from the completion queue. When performing such a task, the selection circuitry may choose the certain ones of the entries to be removed by looking for a particular tag or identifier associated with the entries to be removed. One such identifier may be a valid bit which is known in the art. Thus, there may be an implementation whereby M entries within an N-entry array having associated valid bits may be selected for removal from the N-entry storage array. 
     The selection of M valid entries from N entries in logic can be prohibiting within a cycle if M is large. To find the M sets of N control signals needed to select the M entries can be an iterative process with M iterations. If M is large, it is difficult to meet desired cycle time constraints. 
     Thus, there is a need in the art for an improved, more efficient process for selecting M entries from an N-entry array. 
     SUMMARY OF THE INVENTION 
     The present invention satisfies the foregoing need by reducing in half the cycle time needed to select M entries from an N-entry array. This is performed by implementing control circuitry, which (1) monitors identifier bits, such as valid bits, associated with each of the entries in the N-entry array, and (2) produces control signals to be sent to M multiplexors coupled to the array. Each control signal is sent to a separate multiplexor for selecting one of the M entries having a particular identifier to be retrieved from the storage array. 
     In an embodiment of the present invention, the content of certain bits in each entry, or associated with each entry, of the array may be monitored. The control circuitry is searching for a particular pattern within this content. As each of the entries in the array is traversed by the control circuitry, when a predetermined pattern is reached a first control signal is produced for controlling one of the multiplexors so that it will select that entry associated with the predetermined content value for outputting that entry. This is done repeatedly until M entries having the predetermined content searched by the control circuitry are retrieved from the array. 
     In another embodiment of the present invention, the control circuitry searches for this particular content at both ends of the array simultaneously. When an entry having the predetermined content is found at each end of the array, two control signals are produced, which notify two multiplexors to select one each of the two entries in the array having the predetermined content value. 
     A masking process is then performed which essentially masks out the two ends of the array up to and including the entries previously selected. The selection process is then repeated for this subset of the entries of the N-entry array in order to produce two more control signals for two more multiplexors for selecting two more entries having the desired content associated with their entries. This process may be repeated until M entries are selected. 
     The foregoing has outlined rather broadly the features and technical advantages of the present invention in order that the detailed description of the invention that follows may be better understood. Additional features and advantages of the invention will be described hereinafter which form the subject of the claims of the invention. 
    
    
     BRIEF DESCRIPTION OF THE DRAWING 
     For a more complete understanding of the present invention, and the advantages thereof, reference is now made to the following descriptions taken in conjunction with the accompanying drawings, in which: 
     FIGS. 1, 1A-B illustrate in block diagram form an embodiment of the present invention; 
     FIG. 2 illustrates in block diagram form a production of control signals in accordance with the present invention; 
     FIGS. 3A-C illustrate a logic circuit diagram of one embodiment of the present invention; 
    
    
     DETAILED DESCRIPTION 
     In the following description, numerous specific details are set forth such as specific word or byte lengths, etc. to provide a thorough understanding of the present invention. However, it will be obvious to those skilled in the art that the present invention may be practiced without such specific details. In other instances, well-known circuits have been shown in block diagram form in order not to obscure the present invention in unnecessary detail. For the most part, details concerning timing considerations and the like have been omitted inasmuch as such details are not necessary to obtain a complete understanding of the present invention and are within the skills of persons of ordinary skill in the relevant art. 
     Refer now to the drawings wherein depicted elements are not necessarily shown to scale and wherein like or similar elements are designated by the same reference numeral through the several views. 
     Referring to FIG. 1, there is illustrated an embodiment of the present invention for selecting M entries from N entries in an array. N-entry array 100 may be a storage array for storing K-bit entries 0 through N-1. Such entries are stored in array 100 via bus 101. 
     Associated with each of the N entries in array 100 are valid bits V 0! through V N-1! (also referred to herein as valid bit vector V 0!, . . . , V N-1!). The use of valid bits is well-known in data processing systems. Note, however, the remainder of the discussion with respect to the use of these valid bits is also applicable for an array that utilizes some other type of indicator bit(s) associated with stored entries, such as tag bits. Also, the present invention may monitor, in a manner discussed below, any portion of the content of each of the entries in array 100 for determining which entries to select. 
     As noted above, the valid bits represent a valid bit vector V 0!, . . . , V N-1!. Such a valid bit vector may comprise any structure, but in this example is an N×1 vector array. 
     The present invention may be configured to select M valid entries from array 100. This is performed by control circuitry 107, which monitors the valid bit vector and utilizes the valid bit vector entries to produce control vectors for controlling operation of muxes 103-106. Each of muxes 103-106 has N inputs coupled to each of the N entries of array 100. Each of muxes 103-106 may select one of the N entries in array 100 for output. 
     As briefly discussed above, each of the N entries in array 100 has an associated valid bit. The task of the present invention is to take M of the entries with a valid bit asserted and drive each of those M entries out of a unique multiplexor. Therefore, there are M multiplexors 103-106 each with N entries as input. Therefore, from the N valid bits, control circuitry 107 is to generate M sets of N control select signals to be sent to muxes 103-106. No two muxes will select the same entry. If there are less than M valid entries, some of muxes 103-106 will receive a control vector having all control signals equal to zero. 
     As briefly discussed above, one manner for performing the present invention is to begin monitoring the valid vector beginning from one end of the valid vector (e.g., V 0!). Each succeeding entry within the valid vector will be checked to determine whether it is the first valid bit. V k!, beginning from V 0! is the first asserted valid bit if it is asserted and V 0! through V k-1! are not asserted. Whenever the first valid bit is found at the kth position, a control vector C 0  will be sent to mux 103 with only the kth bit asserted. Control circuitry 107 will also check each asserted valid bit whether it is the second asserted valid bit by checking whether there exists only one asserted valid bit from V 0! through the valid bit immediately proceeding the valid bit of interest. For example, if the V i! bit is found to be the second asserted valid bit from V 0!, a control vector will be sent to mux 104 with only the ith bit asserted. To check whether an asserted valid bit is the Mth asserted valid bit, control circuitry 107 must determine whether there are exactly M-1 asserted valid bits prior to the asserted valid bit of interest. In summary, determining whether a kth valid bit is the ith asserted valid bit requires control circuitry 107 to check whether there are exactly i-1 asserted bits among the preceding k-1 valid bits. To do that, it requires a larger amount of logic than to find whether the kth valid bit is the leading asserted bit. 
     This embodiment can be described as follows. Control circuitry 107 begins with the entire valid vector, and then finds the leading asserted valid bit first. Then, control circuitry 107 finds the leading asserted valid bit from the remaining valid bits, i.e., excluding the one found in the first step. Again, after the first and the second asserted bits are found, control circuitry 107 looks for the leading asserted bit from the remaining valid bits. The procedure is reduced to only finding the leading asserted in each step with additional logic circuitry to exclude the leading asserted bits already found previously. Furthermore, the logic operation in control circuitry 107 may be implemented to find the leading asserted valid bits from both ends of the valid vector. 
     In an implementation of our embodiment, at each step control select signals are produced for two of the muxes, then the two leading 1&#39;s in the valid bit vector are deleted to produce a new valid bit vector for the next step. After M/2 steps, M sets of control select signals are found for all M muxes. As opposed to finding a leading 1 within the valid bit vector in only one direction in each step, this embodiment reduces the time required to select M entries by one-half. Please note that multiple steps may be carried out within one clock cycle. 
     Assume N valid bits V 0!, . . . , V N-1! (one for each entry). For each of the N position J, a bit vector of M elements S J   0, . . . ,M-1! is constructed such that 
     C 0  =S 0   0!,S 1   0!, . . . ,S N-1   0! will be used to control a selection mux 0 , 
     C 1  =S 0   1!,S 1   1!, . . . ,S N-1   1! will be used to control a selection mux 1 , 
     C M-1  =S 0   M-1!,S 1   M-1!, . . . ,S N-1   M-1! will be used to control a selection mux M-1 . The input to select lines of the mux i is the C i  vector. 
     The control vectors C i  make up an M×N matrix in which each row and each column can have only one bit on. When S L   k! is on, the Lth entry must be valid and will appear on the output of the kth mux. 
     The following is the algorithm to construct the M control vectors C i  to be sent to the muxes. &#34; &#34; designates a complement of a value. M, N, K, and L are positive integers. 
     From V 0!, . . . V N-1!, C 0  is constructed (control for mux 0 (mux 103)) using the following mapping function: 
     
         Fw x!=Fw(V 0!, . . . , V N-1!)=(1 V 0!,  (V 0!+V 1!), . . . , (V 0!+V 1!+ . . . +V N-2!)). 
    
     Another mapping function is also used: 
     
         Bw x!=Bw(V 0!, . . . , V N-1!)=((V 1!+ . . . +V N-1!), . . . ,  V N-1!,1) 
    
     Then, C 0  =Fw(V 0!, . . . , V N-1!) AND (V 0!, . . . , V N-1!) 
     and C 1  =Bw(V 0!, . . . , V N-1!) AND (V 0!, . . . , V N-1!) 
     The operations to produce C 0  and C 1  are in parallel. Also, a new valid bit vector is produced: 
     
         V&#39; 0!, . . , V&#39; N-1!=(Fw(V 0!, . . . , V N-1!) AND  Bw(V 0!, . . . , V N-1!) AND (V 0!, . . . , V N-1!)) 
    
     The new valid bit vector V&#39; 0!, . . . , V&#39; N-1! is then used as input instead of V 0!, . . . , V N-1!. The output will be two other control vectors C 2 , C 3  to another pair of muxes. M control vectors can be produced in M/2 steps. 
     The foregoing is implemented by control circuitry 107 of FIG. 1. 
     Referring next to FIG. 2, there is illustrated a portion of control circuitry 107, which includes circuitry 201 and circuitry 202. Circuitry 201, is further detailed and discussed below with respect to FIG. 3. Circuitry 201 receives valid bit vector V 0!, . . . , V N-1! and produces control vectors C 0  and C 1 , and the new valid bit vector V&#39; 0!, . . . , V&#39; N-1!. 
     Essentially, the new valid bit vector comprises the entries within the valid bit vector minus the entries on each end of the valid bit vector beginning with each end and including each entry up to the asserted valid bits found by circuitry 201. In other words, the present invention will receive the valid bit vector V 0!, . . . , V N-1! and will then produce control signal vector C 0  when the first asserted valid bit within the valid bit vector beginning from one end V 0! of the valid bit vector is found. Control signal vector C 1  will be produced when an asserted valid bit is found within the valid bit vector beginning from the other end V N-1! of the valid bit vector. The new valid bit vector will comprise those valid bits remaining between the first found asserted valid bits including any remaining asserted and negated valid bits. 
     As an example, suppose that N=8, i.e., array 100 is an 8-entry storage array. There may be a valid bit associated with each of the eight entries. Suppose also that there is an asserted valid bit associated with entries 1, 3, 4 and 6 of array 100 (i.e., V 1!=V 3!=V 4!=V 6!=1). Therefore, the valid bit vector will be  0,1,0,1,1,0,1,0!. Control circuitry 107 will begin by starting with entry V 0!, and proceed along the valid bit vector until reaching an asserted valid bit, which in this case occurs at entry V 1!. Control circuitry 107 will also do the same beginning with entry V N-1! and proceed along the valid bit vector in the reverse direction until reaching a valid bit, which in this example is at V 6!. The result is that control signal vector C 0  will have the following value:  0,1,0,0,0,0,0,0!. This will cause mux 103 to select the second entry within array 100 for output. 
     Control signal vector C 1  will be:  0,0,0,0,0,0,1,0!, which will be sent to mux 104, causing it to select the seventh entry from array 100 for output from mux 104. 
     Then, circuitry 201 will produce the new valid bit vector which is derived from the original valid bit vector except that entries V&#39; 0!, V&#39; 1!, V&#39; 6! and V&#39; 7! will be negated, and the rest of the bits, V&#39; 2!, . . . , V&#39; 5! will be equal to V 2!, . . . , V 5!, respectively. This new valid bit vector will be inputted into circuitry 202, which is similar to circuitry 201 for producing control signal vectors C 2  and C 3  to be sent to the next two muxes, which in this example are muxes 105 and 106. Circuitry 201 and 202 implement the first and second steps of the procedure. More circuitry may be needed if more than four valid entries are to be retrieved. The first of the succeeding stages will use as input the vector V&#34; 0!, . . . , V&#34; N-1! generated by circuit 202. 
     Referring next to FIG. 3, there is shown more detail of circuitry 201. Note, the circuitry shown in FIG. 3 is likewise implemented for circuitry 202. 
     Circuitry 301 illustrates the transformation of the valid bit vector V 0!, . . . , V N-1! into what are referred to as the forward and backward mapping functions (Fw x!, Bw x!), as discussed above. The forward mapping function Fw x!=Fw(V 0!, . . . , V N-1!) is produced by various logical combinations of the valid bit vector. Fw 0! is a logic &#34;1&#34;. Fw 1! is produced by inverting, with inverter 304, V 0!. Fw 2! is produced by a logical NOR operation using NOR gate 305, which receives V 0! and V 1!. Fw N-1! is produced by NOR gate 306 receiving V 0!, . . . , V N-2!. The remainder of the N entries of Fw x! are likewise produced in a similar manner by NOR gates (not shown). 
     Mapping function Bw x!=Bw(V 0!, . . . , V N-1!) is produced in a similar manner. Bw N-1! is an asserted bit. Bw 0! is produced. by NOR gate 307 receiving V 1!, . . . , V N-1!. The remaining entries of Bw x! are produced by similar NOR gates (not shown), in accordance with the equation of the mapping function shown above. 
     Circuitry 302 produces the control signal vectors C 0  and C 1 . C 0   0! is produced by AND gate 308 receiving Fw 0! and V 0!. C 0   1! is likewise produced by an AND gate (not shown) receiving Fw 1! and V 1!. C 0   N-1! is produced by AND gate 309 receiving Fw N-1! and V N-1!. The other entries of C 0  lying between the shown C 0   0! and C 0   N-1! are produced by a similar means. C 1   0! is produced by AND gate 310 receiving Bw 0! and V 0!. Likewise, C 1   N-1! is produced by AND gate 311 receiving Bw N-1! and V N-1!. The other entries of C 1  lying between C 1   0! and C 1   N-1! are similarly produced. 
     Note, that each of the AND gates used in producing C 1  also receive the output of inverter 312, which receives the signal Disable --  C 1 . In some steps C 0  and C 1  may be identical. This may happen in two cases, either the input vector to the particular stage implemented has only one bit asserted (this happens when the valid bit vector to the first stage has an odd number of asserted valid bits, and the number of asserted bits are less than M), or the input vector has all negated bits. If the input vector is a zero vector, C 0  and C 1  will also be zero and the rest of the steps all produce zero control vectors. If the input vector has only one bit asserted, then either C 0  or C 1  is to be reset. The solution is to look for, in a bit position, whether  Fw and  Bw are both 0 or Fw and Bw are both 1. If the answer is yes, the C 1  bits are all driven to zero. Therefore, C 1  needs to be qualified by this condition. 
     Disable --  C 1  is produced by a parallel configuration of AND gates 319 . . . 320 each receiving two signals. Shown is AND gate 319 receiving Fw 0! and Bw 0! and AND gate 320 receiving Fw N-1! and Bw N-1!. Other AND gates not shown will receiving similar values. The outputs of all of these AND gates 319 . . . 320 are then received by OR gate 321 producing the Disable --  C 1  signal. The result of this is that if the mapping functions Fw and Bw are identical, then the output of OR gate 321 will be an asserted bit for Disable --  C 1 . This asserted bit will be negated by inverter 312 resulting in the outputs of AND gates 310 . . . 311 being driven to all zeros. An alternative to using Disable --  C 1  to drive all output bits of C 1  to zero is to drive zero the valid bit of the entry selected by C 1 . This will reduce the N 3-input AND gates to N 2-input N gate at the cost of a 2-input AND gate which receives the Disable --  C 1  signal and the valid bit of the entry at the output of the mux selected by C 1 . 
     The last portion of circuitry 201 is the AND gates 313 . . . 316 producing the new valid bit vector V&#39; 0!, . . . , V&#39; N-1!. Shown is AND gate 313 for producing V&#39; 0!, receiving V 0!, the output of inverter 314, which receives Bw 0!, and the output of inverter 315, which inverts Fw 0!. 
     V&#39; N-1! is similarly produced by AND gate 316, which receives V N-1!, the output of inverter 317, which inverts Bw N-1!, and the output of inverter 318, which inverts Fw N-1!. 
     As discussed above, and referring back to FIG. 2, if there are more than two entries (M&gt;2) to be selected from array 10, then the new valid bit vector (V&#39; 0!, . . . , V&#39; N-1!) will be inputted to circuitry 202, which is similar to circuitry 201, to produce C 2  and C 3 . 
     Although the present invention and its advantages have been described in detail, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.