CN108132894B - Positioning device and method for TLB multi-hit exception in CPU - Google Patents
Positioning device and method for TLB multi-hit exception in CPU Download PDFInfo
- Publication number
- CN108132894B CN108132894B CN201711411290.9A CN201711411290A CN108132894B CN 108132894 B CN108132894 B CN 108132894B CN 201711411290 A CN201711411290 A CN 201711411290A CN 108132894 B CN108132894 B CN 108132894B
- Authority
- CN
- China
- Prior art keywords
- hit
- tlb
- exception
- cpu
- registers
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/10—Address translation
- G06F12/1027—Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The invention provides a positioning device and a method for TLB multi-hit abnormity in a CPU, wherein the method specifically comprises the following steps: the virtual address to be mapped is compared with matching addresses stored in n TLB table entries in a hit comparison module, wherein the matching addresses are configured in advance, and the matching hit numbers in the table entries are obtained; screening out the numbers of the hit table entries with the minimum number and the maximum number by adopting a multiplexer with a priority, and storing the numbers in a register; the exception handler reads the values of the two registers, locating the TLB entry number that caused the TLB multi-hit. The invention assists the TLB multi-hit exception handling program, and can quickly find out the TLB table entry number in which the TLB multi-hit occurs; two sets of multiplexers with priorities and software accessible registers are adopted, so that the time for processing the TLB multi-hit exception is saved, and the exception checking efficiency is improved.
Description
Technical Field
The invention belongs to the technical field of embedded processors in integrated circuits, and particularly relates to a positioning device and method for TLB multi-hit exception in a CPU.
Background
As a functional module commonly used in a CPU (central processing unit), a tlb (translation Lookaside buffer) is responsible for mapping a virtual address in a software program executed by the CPU to a real address on a physical bus. Ideally, each virtual address should be mapped by the TLB to a unique real address.
In practice, however, the mapping table stored in the TLB is implemented by a manual pre-writing program, which may cause some non-uniqueness of the virtual address mapping due to human reasons. As shown in the example of fig. 2; for example, the virtual address segments 0x 00001000-0 x00005000 are mapped to the real address segments 0x 10001000-0 x10005000 and stored in the TLB table entry # 1. The virtual address segments 0x 00004000-0 x00008000 are mapped to real address segments 0x 20004000-0 x20008000 and stored in TLB table entry # 2. Therefore, the virtual address subsections 0x00004000 to 0x00005000 are mapped to the real address subsections 0x10004000 to 0x10005000 by the table entry #1 and mapped to the real address subsections 0x20004000 to 0x20005000 by the table entry # 2. Such overlapping of virtual address segments in different TLB entries may result in non-unique mapping of overlapping segment addresses.
The address mapping that is not unique in a TLB is commonly referred to in the industry as TLB multi hit. Some CPUs such as PowerPC470 have internal circuitry that automatically selects one mapping and discards another mapping according to some built-in rule when TLB multiple-hit occurs. Other CPUs, such as PowerPC460, when a TLB multi-hit occurs, immediately trigger the CPU to enter a TLB multi-hit exception state. The CPU stops the execution of the normal program and jumps to the exception handling program corresponding to the TLB multi-hit programmed in advance to try to correct the error.
Because there are generally many TLB mapping table entries in the CPU, it is cumbersome to check which mapping of two (or more) table entries overlap one by one. The troubleshooting is completed through an exception handling program, so that the complexity of program writing is brought, and the time overhead of troubleshooting and error correction is influenced.
Disclosure of Invention
In view of the above, the present invention is directed to provide a positioning apparatus for TLB multiple hit exception in a CPU, which can quickly and intuitively feedback which two TLB mapping table entries are overlapped when two table entries are hit.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
a positioning device for TLB multi-hit exception in CPU comprises a virtual address input module to be mapped, a hit comparison module and a multiplexer which are connected in sequence, wherein the hit comparison module is also connected with two groups of registers through the multiplexer with priority;
the hit comparison module is used for comparing the virtual address to be mapped with the preset matching addresses stored in the n TLB table entries one by one to obtain the number of matching hits in the table entries;
the multiplexer is used for outputting the mapped real address;
and the two groups of registers are used for storing the table entry numbers with the maximum number and the minimum number screened out by the multiplexer with the priority.
Further, the bit width of each group of registers is the binary width of the TLB table entry number.
Further, the two sets of registers are readable by a software program, and the values of the registers are synchronously reset to 0 when the CPU is reset.
Compared with the prior art, the positioning device for the TLB multi-hit exception in the CPU has the following advantages: the invention assists the TLB multi-hit exception handling program, and can quickly find out the TLB table entry number in which the TLB multi-hit occurs; two sets of multiplexers with priorities and software accessible registers are adopted, so that the time for processing the TLB multi-hit exception is saved, and the exception checking efficiency is improved.
Another objective of the present invention is to provide a method for positioning TLB multiple hit exception in CPU, which can quickly and intuitively feedback which two TLB mapping table entries are overlapped when two table entries are hit.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
a method for positioning TLB multi-hit exception in CPU includes following steps:
(1) the virtual address to be mapped is compared with matching addresses stored in n TLB table entries in a hit comparison module, wherein the matching addresses are configured in advance, and the matching hit numbers in the table entries are obtained;
(2) screening out the hit table entry number with the minimum number by adopting a multiplexer with priority, and storing the hit table entry number in a register;
(3) screening out the number of the hit table entry with the largest number by adopting a multiplexer with priority, and storing the number in a register;
(4) the exception handler reads the values of the two registers, locating the TLB entry number that caused the TLB multi-hit.
Furthermore, when two or more TLB table entries are hit at the same time, the hit comparison module sets the multi hit flag signal, and the two groups of registers store the numbers of the two hit table entries by using the multi hit flag signal as an enable signal.
The method for positioning the TLB multi-hit abnormity in the CPU has the same beneficial effect as the positioning device for the TLB multi-hit abnormity in the CPU, and is not repeated herein.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a schematic structural diagram of a positioning apparatus for a TLB multi-hit exception in a CPU according to an embodiment of the present invention;
fig. 2 is a diagram illustrating non-uniqueness of virtual address mapping in the prior art.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are used only for convenience in describing the present invention and for simplicity in description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and thus, are not to be construed as limiting the present invention. Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first," "second," etc. may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless otherwise specified.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art through specific situations.
The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
As shown in fig. 1, in practical application, the virtual address to be mapped is compared with the matching addresses stored in n TLB entries in advance, and after comparison, when only one of the n TLB entries is matched and hit, the number of the hit entry is used as a routing signal of the multiplexer, and the pre-configured real address information corresponding to the hit entry is screened out and output, thereby completing a normal TLB mapping process;
when more than one TLB table entry is hit, the invention provides a diagnosis positioning device and method, which can quickly and intuitively feedback which two TLB mapping table entries are overlapped.
The positioning device comprises a virtual address input module to be mapped, a hit comparison module and a multiplexer which are sequentially connected, wherein the hit comparison module is also connected with two groups of registers through the multiplexer with priority;
the hit comparison module is used for comparing the virtual address to be mapped with the preset matching addresses stored in the n TLB table entries one by one to obtain the number of matching hits in the table entries;
the multiplexer is used for outputting the mapped real address;
and the two groups of registers are used for storing the table entry numbers with the maximum number and the minimum number screened out by the multiplexer with the priority. The bit width of each group of registers is the binary width of the TLB table entry number. When two or more TLB table entries hit at the same time, the comparison circuit sets a multi hit flag signal, and the 2 groups of registers store two hit table entry numbers by using the multi hit flag signal as an enable signal.
The input of the first group of registers adopts a multiplexer with priority to screen out the hit table entry number with the minimum number. And a second group of registers, the input of which adopts a multiplexer with priority to screen out the hit table entry number with the largest number. The two sets of registers are readable by a software program, and the values of the registers are synchronously reset to 0 when the CPU is reset. When the CPU has TLB multi-hit abnormity, the abnormity processing program can directly read the values of the two groups of registers, thereby directly positioning which two groups of TLB table items have mapping overlap, not only saving the troubleshooting program, but also saving the time overhead of one-by-one troubleshooting.
An example of an implementation on the PowerPC460 is given here. The number of TLB entries of PowerPC460 is 64, and a fully associative structure is adopted, and the entry numbers are from #0 to # 63. Each virtual address generated by the CPU running the software program is compared with the preset addresses in the 64 entries to determine which hit. The bit width of each group of the 2 groups of hit table entry number registers added in the invention is 6 bit. When TLB multi hit occurs, the first set of registers filters out the first hit entry in the order #0 to #63 and stores its number. The second set of registers selects the second hit entry in the order #63 to #0 and stores its number. The two sets of registers are software program accessible registers that access bits 26 to 31 and 18 to 23 addressed to the PowerPC460 exception status register ESR. The TLB multi hit exception handler of PowerPC460 may read the last 2 bytes of the ESR directly to locate the TLB entry number that caused the TLB multi-hit.
When more than two items are hit, the two items can be reduced to 2 items hit to process the items pair by pair.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (5)
1. A positioning device for TLB multi-hit exception in CPU is characterized in that: the virtual address mapping device comprises a virtual address input module to be mapped, a hit comparison module and a first multiplexer which are sequentially connected, wherein the hit comparison module is also connected with two groups of registers through second multiplexers with priorities respectively;
the hit comparison module is used for comparing the virtual address to be mapped with the preset matching addresses stored in the n TLB table entries one by one to obtain the number of matching hits in the table entries;
the first multiplexer is used for outputting the mapped real address;
and the two groups of registers are used for storing the table entry numbers with the maximum number and the minimum number screened out by the second multiplexer with the priority.
2. The apparatus for locating a TLB multi-hit exception in a CPU of claim 1, wherein: the bit width of each group of registers is the binary width of the TLB table entry number.
3. The apparatus for locating a TLB multi-hit exception in a CPU of claim 1, wherein: the two sets of registers are readable by a software program, and their values are synchronously reset to 0 upon a CPU reset.
4. A method for locating a TLB multiple hit exception in a CPU using the apparatus for locating a TLB multiple hit exception in a CPU as recited in any one of claims 1 to 3, wherein: the method specifically comprises the following steps:
(1) the virtual address to be mapped is compared with matching addresses stored in n TLB table entries in a hit comparison module, wherein the matching addresses are configured in advance, and the matching hit numbers in the table entries are obtained;
(2) screening out the hit table entry number with the minimum number by adopting a multiplexer with priority, and storing the hit table entry number in a register;
(3) screening out the number of the hit table entry with the largest number by adopting a multiplexer with priority, and storing the number in a register;
(4) the exception handler reads the values of the two registers, locating the TLB entry number that caused the TLB multi-hit.
5. The method for locating a TLB multi-hit exception in a CPU of claim 4, wherein: when two or more TLB table entries are hit at the same time, the hit comparison module sets a multi hit flag signal, and the two groups of registers store two hit table entry numbers by using the multi hit flag signal as an enable signal.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711411290.9A CN108132894B (en) | 2017-12-23 | 2017-12-23 | Positioning device and method for TLB multi-hit exception in CPU |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711411290.9A CN108132894B (en) | 2017-12-23 | 2017-12-23 | Positioning device and method for TLB multi-hit exception in CPU |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108132894A CN108132894A (en) | 2018-06-08 |
CN108132894B true CN108132894B (en) | 2021-11-30 |
Family
ID=62391690
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711411290.9A Active CN108132894B (en) | 2017-12-23 | 2017-12-23 | Positioning device and method for TLB multi-hit exception in CPU |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108132894B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109783265B (en) * | 2018-12-30 | 2022-08-12 | 国网北京市电力公司 | Abnormal business data processing method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104424034A (en) * | 2013-09-04 | 2015-03-18 | 华为技术有限公司 | Hardware resource access method and hardware resource access device |
CN102789429B (en) * | 2007-06-01 | 2016-06-22 | 英特尔公司 | The virtual address of page attributes is to the conversion of physical address |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1848096A (en) * | 2005-04-11 | 2006-10-18 | 美普思科技有限公司 | Improved apparatus and method for avoiding repeated matched inputting in switching side-looking buffer |
US8601234B2 (en) * | 2007-11-07 | 2013-12-03 | Qualcomm Incorporated | Configurable translation lookaside buffer |
US9292453B2 (en) * | 2013-02-01 | 2016-03-22 | International Business Machines Corporation | Storing a system-absolute address (SAA) in a first level translation look-aside buffer (TLB) |
CN104216833B (en) * | 2013-05-29 | 2017-10-10 | 华为技术有限公司 | A kind of method and device for determining physical address |
CN104239238B (en) * | 2013-06-21 | 2018-01-19 | 格芯公司 | Method and apparatus for managing translation lookaside buffering |
-
2017
- 2017-12-23 CN CN201711411290.9A patent/CN108132894B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102789429B (en) * | 2007-06-01 | 2016-06-22 | 英特尔公司 | The virtual address of page attributes is to the conversion of physical address |
CN104424034A (en) * | 2013-09-04 | 2015-03-18 | 华为技术有限公司 | Hardware resource access method and hardware resource access device |
Also Published As
Publication number | Publication date |
---|---|
CN108132894A (en) | 2018-06-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10417160B2 (en) | System and method for extended peripheral component interconnect express fabrics | |
EP3611626B1 (en) | Per-function downstream port containment | |
US11163719B2 (en) | Hybrid remote direct memory access | |
US9372750B2 (en) | Method and apparatus for non-volatile RAM error re-mapping | |
US7689806B2 (en) | Method and system to indicate an exception-triggering page within a microprocessor | |
CN107992376B (en) | Active fault tolerance method and device for data storage of DSP (digital Signal processor) | |
CN107209724A (en) | Data processing method, memory management unit and Memory control equipment | |
US9734921B2 (en) | Memory repair using external tags | |
US9417952B2 (en) | Direct memory access (DMA) unit with error detection | |
EP2240856B1 (en) | Error detector in a cache memory using configurable way redundancy | |
CN108132894B (en) | Positioning device and method for TLB multi-hit exception in CPU | |
US20160217082A1 (en) | Store merge processing device, store merge processing system, store merge processing method, and storage medium | |
US7185172B1 (en) | CAM-based search engine devices having index translation capability | |
US9442819B2 (en) | Method and apparatus for storing trace data | |
US9791509B2 (en) | Monitoring microprocessor interface information for a preset service using an address based filter | |
US9003158B2 (en) | Flexible control mechanism for store gathering in a write buffer | |
US11709776B2 (en) | Methods and systems for a stripe mode cache pool | |
US8032687B2 (en) | Method, system, and apparatus for supporting limited address mode memory access | |
US8359528B2 (en) | Parity look-ahead scheme for tag cache memory | |
US8760941B2 (en) | Data transfer circuit and data transfer method | |
US7194573B1 (en) | CAM-based search engine devices having advanced search and learn instruction handling | |
US7120733B1 (en) | CAM-based search engines having per entry age reporting capability | |
US20140085994A1 (en) | Integrated circuitry, chip, method for testing a memory device, method for manufacturing an integrated circuit and method for manufacturing a chip | |
US20240203517A1 (en) | Logical Memory Repair with a Shared Physical Memory | |
US8738969B2 (en) | Semiconductor device and method for tracing a memory of a semiconductor device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |