Programmable microprocessor cache index hashing function
Claim Score by NHIP
Abstract
An embodiment of the invention provides a circuit and method for optimizing an index hashing function in a cache memory on a microprocessor. A programmable index hashing function is designed that allows the index hashing function to be programmed after the microprocessor has been fabricated. The index hashing function may be "tuned" by running an application on the microprocessor and observing the performance of the cache memory based on the type of index hashing function used. The index hashing function may be programmed by several methods.

Term
Term ended
Projected expiry passed 15 February 2023, 3.6 years ago.
- Priority and filed
- Published
- Projected expiry
- Today
14 claims: 2 independent, 12 dependent
- 11 ) A method for optimizing an index hashing function comprising:a) designing a programmable index hashing function;b) running an application several times on a CPU containing said programmable index hashing function;c) calculating an optimal hashing function based on actual performance of said application in cache memory of said CPU. d) programming said programmable index hashing function to approximate the optimal hashing function calculated in step c.
- 77 ) A circuit for programming a hashing function comprising:a set of N AND gates, wherein each AND gate in said set of N AND gates has two inputs and one output, a set of N XOR gates, wherein each XOR gate in said set of N XOR gates has two inputs and one output;a N-bit hashing mask, wherein each bit in said hashing mask is programmable;all a 2N+X bit memory address;wherein each bit from a first set of N bits from said 2N+X bit memory address is individually electrically connected to a first input of each AND gate respectively from said set of N AND gates;wherein each bit of said N-bit hashing mask is individually electrically connected to a second input of each AND gate respectively from said set of N AND gates;wherein each output of each AND gate from said set of N AND gates is individually electrically connected to a first input of each XOR gate respectively from said set of N XOR gates;wherein each bit from a second set of N bits from said 2N+X memory address is individually electrically connected to a second input of each XOR gate respectively from said set of N XOR gates.
Independent claims2
16 paragraphs in 5 sections, as filed
FIELD OF THE INVENTION
[0001] This invention relates generally to electronic circuits. More particularly, this invention relates to integrated electronic circuits and cache memory.
BACKGROUND OF THE INVENTION
[0002] Hashing is the transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string. Hashing may be used to index and retrieve items in a database or a memory hierarchy because it is usually faster to find the item using the shorter hashed key than to find it using the original value. It may also be used in many encryption algorithms.
[0003] The hashing algorithm is called a hash function. The hash function is used to index the original value or key and then used later each time the data associated with the value or key is to be retrieved. A good hash function also should not produce the same hash value from two different inputs. If it does, this is known as a “collision”. A hash function that offers an extremely low risk of collision may be considered acceptable.
[0004] If a collision occurs, another function may be used. This function is commonly called a “collision rule.” The collision rule generates a succession of locations until one is found that is not in use already.
[0005] It is desirable, for efficiency reasons, to have as few collisions as possible. To achieve this, the hash function should not be pre-disposed to favor any one particular location or set of locations. In other words, it should spread the potential keys around the table as evenly as possible. This is normally done by making the hash function depend on all parts of the key, computing a large integer from the key, dividing this integer by the table size, and using the remainder as the hash function value. Other commonly used hash functions are the “folding” method, the “radix transformation” method, and “digit rearrangement” method. The type of hash function used is dependent on the application it is designed for.
[0006] A hashing function may be designed for indexing memory addresses to cache memory. Designing such a hashing function requires considerable insight into the memory access behavior of the applications that will access the cache. It is not realistically feasible to simulate all possible programs to find an optimal hashing function before the CPU is fabricated. As a result, the hashing function used for indexing memory addresses to cache memory is most likely not optimal for any one application. Having a programmable hashing function would allow the flexibility of index calculation “tuning” after the CPU has been designed and implemented. A “tuned” hashing function would then allow the cache to operate more efficiently.
[0007] This invention allows for many different possible index mappings by programming the hashing function after the CPU has been designed and implemented. By running an application many times, information may be obtained about the application cache memory behavior. With this information, a more optimal hashing function may be derived and implemented for cache indexing. In turn, this results in significant improvement in cache memory performance.
SUMMARY OF THE INVENTION
[0008] An embodiment of the invention provides a circuit and method for optimizing an index hashing function in a cache memory on a microprocessor. A programmable index hashing function is designed that allows the index hashing function to be programmed after a microprocessor has been fabricated. The index hashing function may be “tuned” by running an application on the microprocessor and observing the performance of the cache memory based on the type of index hashing function used. The index hashing function may be programmed by several methods.
[0009] Other aspects and advantages of the present invention will become apparent from the following detailed description, taken in conjunction with the accompanying drawing, illustrating by way of example the principles of the invention.
BRIEF DESCRIPTION OF THE DRAWINGS
P-0010[0010]FIG. 1 is a schematic drawing of a generic index hashing function. Prior Art
P-0011[0011]FIG. 2 is a schematic drawing of a programmable index hashing function.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
P-0012[0012]FIG. 1 is a schematic drawing of an example of a index hashing function. The lower half, B(N)-B(1), <b>118</b>-<b>104</b>, of the memory address (2N+X bits), <b>102</b> is connected to an input of each XOR of N XORs, <b>150</b>-<b>136</b>, respectively. The upper half, B(2N)-B(N+1), <b>134</b>-<b>120</b>, of the memory address (2N+X bits), <b>102</b>, is connected to the other input of each XOR of N XORs, <b>150</b>-<b>136</b>, respectively. The outputs of the N XORs, <b>150</b>-<b>136</b>, form a new N-bit memory index, ID(N)-ID1, <b>166</b>-<b>152</b>. B1, <b>104</b>, of memory address, <b>102</b> is connected to an input of XOR1, <b>136</b>. B2, <b>106</b>, of memory address, <b>102</b> is connected to an input of XOR2, <b>138</b>. B3, <b>108</b>, of memory address, <b>102</b> is connected to an input of XOR3, <b>140</b>. B4, <b>110</b>, of memory address, <b>102</b> is connected to an input of XOR4, <b>142</b>. B(N−3), <b>112</b>, of memory address, <b>102</b> is connected to an input of XOR(N−3), <b>144</b>. B(N−2), <b>114</b>, of memory address, <b>102</b> is connected to an input of XOR(N−2), <b>146</b>. B(N−1), <b>116</b>, of memory address, <b>102</b> is connected to an input of XOR(N−1), <b>148</b>. B(N), <b>118</b>, of memory address, <b>102</b> is connected to an input of XOR(N), <b>150</b>. B(N+1), <b>120</b>, of memory address, <b>102</b> is connected to an input of XOR1, <b>136</b>. B(N+2), <b>122</b>, of memory address, <b>102</b> is connected to an input of XOR2, <b>138</b>. B(N+3), <b>124</b>, of memory address, <b>102</b> is connected to an input of XOR3, <b>140</b>. B(N+4), <b>126</b>, of memory address, <b>102</b> is connected to an input of XOR4, <b>142</b>. B(2N−3), <b>128</b>, of memory address, <b>102</b> is connected to an input of XOR(N−3), <b>144</b>. B(2N−2), <b>130</b>, of memory address, <b>102</b> is connected to an input of XOR(N−2), <b>146</b>. B(2N−1), <b>132</b>, of memory address, <b>102</b> is connected to an input of XOR(N−1), <b>148</b>. B(2N), <b>134</b>, of memory address, <b>102</b> is connected to an input of XOR(N), <b>150</b>. The outputs of XOR(N)-XOR1, <b>150</b>-<b>136</b>, form the indexed memory address, ID(N)-ID1, <b>166</b>-<b>152</b>, respectively.
P-0013[0013]FIG. 2 is a schematic drawing of one example of a programmed hashing function. In this example, the bits of the upper half, B(2N)-B(N+1), of memory address, <b>202</b>, (2N+X bits) are each connected to an input of AND gates, AND(2N)-AND(N+1) respectively. The other input of AND gates, AND(2N)-AND(N+1), are connected to programmable nodes, <b>278</b>-<b>268</b>, <b>213</b>, respectively. The programmable nodes, <b>278</b>-<b>268</b>, <b>213</b> may be programmed after a microprocessor is fabricated to improve the performance of the hashing function. The outputs of AND gates, AND(2N)-AND(N+1), <b>296</b>, <b>298</b>, <b>201</b>-<b>211</b>, are connected to an input of each XOR gate, XOR(N)-XOR1, <b>250</b>-<b>236</b> respectively. The memory address bits B(N)-B1, <b>218</b>-<b>204</b>, are connected to a second input of each XOR gate, XOR(N)-XOR1, <b>250</b>-<b>236</b>, respectively. The outputs, ID(N)-ID1, <b>266</b>-<b>252</b>, of XOR gates, XOR(N)-XOR1, <b>250</b>-<b>236</b>, form the N-bit indexed memory address.
P-0014[0014] B1, <b>204</b>, of memory address, <b>202</b> is connected to an input of XOR1, <b>236</b>. B2, <b>206</b>, of memory address, <b>202</b> is connected to an input of XOR2, <b>238</b>. B3, <b>208</b>, of memory address, <b>202</b> is connected to an input of XOR3, <b>240</b>. B4, <b>210</b>, of memory address, <b>202</b> is connected to an input of XOR4, <b>242</b>. B(N−3), <b>212</b>, of memory address, <b>202</b> is connected to an input of XOR(N−3), <b>244</b>. B(N−2), <b>214</b>, of memory address, <b>202</b> is connected to an input of XOR(N−2), <b>246</b>. B(N−1), <b>216</b>, of memory address, <b>202</b> is connected to an input of XOR(N−1), <b>248</b>. B(N), <b>218</b>, of memory address, <b>202</b> is connected to an input of XOR(N), <b>250</b>. B(N+1), <b>220</b>, of memory address, <b>202</b> is connected to an input of AND(N+1), <b>294</b>. B(N+2), <b>222</b>, of memory address, <b>202</b> is connected to an input of AND(N+2), <b>292</b>. B(N+3), <b>224</b>, of memory address, <b>202</b> is connected to an input of AND(N+3), <b>290</b>. B(N+4), <b>226</b>, of memory address, <b>202</b> is connected to an input of AND(N+4), <b>288</b>. B(2N−3), <b>228</b>, of memory address, <b>102</b> is connected to an input of AND(2N−3), <b>286</b>. B(2N−2), <b>230</b>, of memory address, <b>202</b> is connected to an input of AND(2N−2), <b>284</b>. B(2N−1), <b>232</b>, of memory address, <b>202</b> is connected to an input of AND(2N−1), <b>282</b>. B(2N), <b>234</b>, of memory address, <b>202</b> is connected to an input of AND(N), <b>280</b>. Node <b>213</b> may be programmed to a logical “high” or “low” and is connected to a second input of AND(N+1), <b>294</b>. Node <b>268</b> may be programmed to a logical “high” or “low” and is connected to a second input of AND(N+2), <b>292</b>. Node <b>270</b> may be programmed to a logical “high” or “low” and is connected to a second input of AND(N+3), <b>290</b>. Node <b>272</b> may be programmed to a logical “high” or “low” and is connected to a second input of AND(N+4), <b>288</b>. Node <b>274</b> may be programmed to a logical “high” or “low” and is connected to a second input of AND(2N−3), <b>286</b>. Node <b>276</b> may be programmed to a logical “high” or “low” and is connected to a second input of AND(2N−2), <b>284</b>. Node <b>277</b> may be programmed to a logical “high” or “low” and is connected to a second input of AND(2N−1), <b>282</b>. Node <b>278</b> may be programmed to a logical “high” or “low” and is connected to a second input of AND(2N), <b>280</b>. The output, <b>211</b>, of AND(N+1), <b>294</b>, is electrically connected to a second input of XOR1, <b>236</b>. The output, <b>209</b>, of AND(N+2), <b>292</b>, is electrically connected to a second input of XOR2, <b>238</b>. The output, <b>207</b>, of AND(N+3), <b>290</b>, is electrically connected to a second input of XOR3, <b>240</b>. The output, <b>205</b>, of AND(N+4), <b>288</b>, is electrically connected to a second input of XOR4, <b>242</b>. The output, <b>203</b>, of AND(2N−3), <b>286</b>, is electrically connected to a second input of XOR(N−3), <b>244</b>. The output, <b>201</b>, of AND(2N−2), <b>284</b>, is electrically connected to a second input of XOR(N−2), <b>246</b>. The output, <b>298</b>, of AND(2N−1), <b>282</b>, is electrically connected to a second input of XOR(N−1), <b>248</b>. The output, <b>296</b>, of AND(2N), <b>280</b>, is electrically connected to a second input of XOR(N), <b>250</b>. The outputs of XOR(N)-XOR1, <b>250</b>-<b>236</b>, form the indexed memory address, ID(N)-ID1, <b>266</b>-<b>252</b>, respectively.
P-0015[0015] Other logic gates with programmable inputs may be used in place of the AND gates, AND(2N)-AND(N+1), <b>280</b>-<b>294</b>, used in FIG. 2, to achieve a programmable hashing function.
P-0016[0016] The foregoing description of the present invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed, and other modifications and variations may be possible in light of the above teachings. The embodiment was chosen and described in order to best explain the principles of the invention and its practical application to thereby enable others skilled in the art to best utilize the invention in various embodiments and various modifications as are suited to the particular use contemplated. It is intended that the appended claims be construed to include other alternative embodiments of the invention except insofar as limited by the prior art.
Contents5
3 sheets
Sheet 1 Sheet 2 Sheet 3
Every citation, both ways
| Document | Relation | Office | Cited during |
|---|---|---|---|
| US8225027B2 | Cited by | United States of America | Applicant |
| US7366871B2 | Cited by | United States of America | Applicant |
| US2006047915A1 | Cited by | United States of America | Pre-grant |
| WO2012103816A1 | Cited by | World Intellectual Property Organization (WIPO) | International search |
| CN103339891A | Cited by | China | Search report |
| US7383418B2 | Cited by | United States of America | Search report |
| US10430102B2 | Cited by | United States of America | Search report |
| US7996597B1 | Cited by | United States of America | Search report |
| US7373480B2 | Cited by | United States of America | Applicant |
| US2017131934A1 | Cited by | United States of America | Search report |
| US7966442B1 | Cited by | United States of America | Applicant |
| CN100452043C | Cited by | China | Search report |
| US7743200B1 | Cited by | United States of America | Search report |
| US2017131934A1 | Cited by | United States of America | Search report |
| US2017131934A1 | Cited by | United States of America | Pre-grant |
| US2006107024A1 | Cited by | United States of America | Pre-grant |
| US2003182608A1 | Cites | United States of America | Pre-grant |
| US5530958A | Cites | United States of America | Pre-grant |
| US6173384B1 | Cites | United States of America | Pre-grant |
| US6253285B1 | Cites | United States of America | Pre-grant |
| US6275919B1 | Cites | United States of America | Pre-grant |
| US6449613B1 | Cites | United States of America | Pre-grant |
| US6560599B1 | Cites | United States of America | Pre-grant |
| US6690667B1 | Cites | United States of America | Pre-grant |
8 members in 2 offices; this record represents the family
Priority claims2
| Document | Office | Kind | Date |
|---|---|---|---|
| 12375502 | United States of America | A | |
| US20020123755 | – | – | – |
Members8
| Document | Office | Kind | |
|---|---|---|---|
| GB0307750D0 | United Kingdom | D0 | |
| US2003196026A1 | United States of America | A1 | |
| GB2389933A | United Kingdom | A | |
| US6804768B2 | United States of America | B2 | |
| GB0512314D0 | United Kingdom | D0 | |
| GB2389933B | United Kingdom | B | |
| GB2412987A | United Kingdom | A | |
| GB2412987B | United Kingdom | B |
10 legal events, as the office reported them to INPADOC
Over the term
Point at a mark for the eventEvents
| Event | Code | |
|---|---|---|
| Lapsed due to failure to pay maintenance feeLapsedFP | FP | |
| Information on status: patent discontinuationPATENT EXPIRED DUE TO NONPAYMENT OF MAINTENANCE FEES UNDER 37 CFR 1.362STCH | STCH | |
| Lapse for failure to pay maintenance feesLapsedLAPS | LAPS | |
| Maintenance fee reminder mailedREMI | REMI | |
| Maintenance fee reminder mailedREMI | REMI | |
| Fee paymentFPAY | FPAY | |
| AssignmentAS | AS | |
| AssignmentAS | AS | |
| AssignmentAS | AS | |
| AssignmentAS | AS |
Numbers
- Publication, DOCDB
- 2003196026
- Publication, EPODOC
- US2003196026
- Application
- 10123755
- Application, DOCDB
- 12375502
- Application, EPODOC
- US20020123755
Titles
- English
- Programmable microprocessor cache index hashing function
Classification
- CPC, 3
- G06F12/0864
- G06F12/0802
- G06F16/9014
- IPC, 2
- G06F12 08
- G06F17 30
- USPC, 8
- 711103000
- 365120000
- 365185330
- 365225700
- 707E17036
- 711216000
- 711E12017
- 711E12018