System-on-chip emulation multi-level page table generation and verification method, system and storage medium

By generating multi-level page table entries through normalization and conflict-free allocation, and combining them with verification digests for loading and comparison, the problems of low page table generation efficiency and difficult translation verification are solved, thus achieving efficient simulation verification.

CN123178289APending Publication Date: 2026-11-27BLUECORE COMPUTING POWER (SHENZHEN) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611678709.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-28
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing system-on-a-chip simulations suffer from low page table generation efficiency, easy layout conflicts, and difficulty in verifying translation results.

Method used

By acquiring virtual address mapping requirements and memory management unit configuration information, normalization processing is performed, conflict-free page table regions are allocated, and multi-level page table entries are generated. The checksum is then loaded and translated for comparison, enabling offline page table construction and simulation time zero-point verification.

Benefits of technology

This reduces bus transactions during simulation startup, avoids overlap between page table regions and mirror regions, improves simulation verification efficiency, and facilitates the location of translation errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178289A_ABST
    Figure CN123178289A_ABST
Patent Text Reader

Abstract

The application provides a multi-level page table generation verification method and system for system-on-chip simulation and a storage medium. The method normalizes mapping requirement, allocates page table area, checks conflicts and encodes page table items offline, executes independent address translation verification after loading page table data at simulation time zero, automatically checks and adjusts physical address conflicts between the page table area and other mirror areas, realizes migration of page table construction from the simulation clock domain, and distinguishes three types of errors, i.e., generation, loading and translation, thereby reducing bus transactions during simulation startup, avoiding overlap between the page table area and the mirror area, facilitating positioning of translation errors, and improving the efficiency of system-on-chip simulation verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention is applicable to the field of integrated circuit verification, and particularly relates to a multi-level page table generation and verification method, system, and storage medium for on-chip system simulation. Background Technology

[0002] Currently, full-system simulation of System-on-Chips (SoCs) is an important method for chip verification. The processor under test (DUT) translates virtual addresses into physical addresses using a Memory Management Unit (MMU) based on multi-level page tables. In verification scenarios with the MMU enabled, the DUT needs to first establish the root page table and multi-level page table directories and write them into control registers such as SATAP before it can execute the formal test program.

[0003] In some SoC verification scenarios, the following solutions can be used to solve the problems of page table generation and simulation initialization: one method is to have the test program write page table entries (PTE) one by one during the simulation run or to dynamically construct the page table; another method is to have the verification script generate the page table file and then load it through the memory model; and yet another method is to load a fixed-format HEX or BIN file through the simulator's memory initialization mechanism.

[0004] However, the above methods have the following problems: writing page tables line by line generates a large number of bus transactions, and the startup phase slows down as the page table size increases; generating only PTE data without checking the physical address layout can easily lead to overlap between the page table area and the program image, stack area, heap area, or device area; the page table level, page size, and permission bits are maintained separately by multiple scripts or manual configurations, which can easily lead to inconsistent configurations; successful simulator loading does not mean that the MMU translation is correct, and there is a lack of automatic verification of the correspondence between mapping requirements, PTE paths, and actual translation results; in multi-core scenarios, the layout of page tables for each core lacks a unified description, making it difficult to locate translation errors in a particular core.

[0005] Therefore, a new method for generating and verifying page tables for on-chip system simulation is urgently needed to solve the above-mentioned technical problems. Summary of the Invention

[0006] This invention aims to solve the problems of low page table generation efficiency, easy layout conflicts, and difficulty in verifying translation results in system-on-a-chip simulation.

[0007] To address the aforementioned technical problems, in a first aspect, the present invention provides a method for generating and verifying multi-level page tables in on-chip system simulation, comprising the following steps: S101. Obtain the virtual address mapping requirements, memory management unit configuration information, and memory layout information of the verification scenario for the full system simulation of the on-chip system. The virtual address mapping requirements include at least one mapping entry, and the memory layout information includes the physical memory range, test program image layout, and page table reserved area. S102. The virtual address mapping requirement is normalized according to the memory management unit configuration information to obtain normalized mapping entries; S103. Allocate page table regions in the reserved area of ​​the page table according to the normalized mapping entries. The page table regions include root page table regions, intermediate page table regions and final page table regions. Perform conflict verification between the allocated page table regions and the test program mirror layout, and adjust the physical address allocation of the page table regions according to the conflict verification results to obtain a conflict-free page table region allocation result. S104. Calculate the page table indexes at each level corresponding to the virtual address of each normalized mapping entry based on the memory management unit configuration information, and generate page table entries at each level according to the page table indexes at each level in the order from the root page table to the last-level page table, to obtain page table data covering the multi-level page tables of all normalized mapping entries; save the page table entry path corresponding to each mapping entry, the page table entry path is used to record the physical addresses of the page table indexes at each level and the page table entries at each level, and generate a layout list for recording the page table region allocation results and the physical address of the root page table, as well as an expected translation vector for recording the virtual address, access type, and expected translation result of each mapping entry; S105. Convert the page table data into a simulated memory initialization file with physical address offset and segment boundary information, and generate a verification digest of the page table data using a preset verification algorithm. S106. At zero point of simulation time, load the simulation memory initialization file into the physical memory model according to the layout list, and verify whether the loaded page table data is consistent with the verification digest. If so, proceed to step S107. S107. After setting the root page table control register of the processor under test according to the root page table physical address, the test platform component in the verification environment performs verification access on the virtual address in the expected translation vector according to the access type in the expected translation vector, collects the actual address translation result, and compares the actual address translation result with the expected translation result to obtain the translation comparison result. S108. If the translation comparison result is inconsistent, the translation error is located to the corresponding page table level and the physical address of the page table entry according to the page table entry path. The virtual address mapping requirement or the physical address allocation of the page table region is adjusted according to the diagnostic information obtained from the location, and the process returns to step S102. If the translation comparison result is consistent, the multi-level page table verification is determined to be successful, and the multi-level page table output is used as the verification test case generation result that conforms to the full system simulation of the on-chip system.

[0008] Furthermore, the normalization process for the virtual address mapping requirement in step S102 includes: The consecutive mapping entries in the virtual address mapping requirement are split into one or more normalized intervals; Each normalized interval is checked, including: whether the virtual address and physical address meet the alignment requirements of the selected page granularity, whether the mapping length covers the entire page, whether there is virtual address overlap between different mapping entries, whether different mapping entries set conflicting access attributes for the same physical region, and whether at least one of the constraints of the memory management unit configuration information on address width and reserved bits is met. The page granularity, alignment boundary, access permissions, and processor core to which each mapping entry belongs are determined.

[0009] Furthermore, determining the page granularity of each mapping entry in step S102 specifically involves: The normalized interval is segmented according to the strategy of prioritizing the use of large pages and using basic pages in boundary areas, and the page granularity used in each segment is determined.

[0010] Furthermore, step S103, which involves performing a conflict check between the allocated page table region and the test program mirror layout, specifically includes: Construct a physical address range table, which is used to record the start address, end address, range purpose, whether it is allowed to be occupied by the page table, and alignment granularity of each range; According to the physical address range table, the page table region is verified to not overlap with the program image region, stack region, heap region, shared memory region and device region in the test program image layout, and the starting address of each level of page table stored in the page table region meets the page alignment requirements, and the total size of the page table region does not exceed the reserved area of ​​the page table. When a conflict is detected, the range name, address range, number of conflicting bytes, and migration direction of both conflicting parties are output, and the physical address allocation of the page table region is adjusted according to the migration direction.

[0011] Furthermore, in step S106, loading the simulated memory initialization file into the physical memory model specifically involves: The segments in the simulated memory initialization file are loaded into the corresponding physical address ranges through the initialization interface, memory loading function, or binary loading interface of the physical memory model. Step S106 further includes performing at least one of the following checks during the loading process of the simulation memory initialization file into the physical memory model: Whether each segment corresponds one-to-one with the physical address range; Does the length of the simulated memory initialization file not exceed the physical address range? Whether the byte order and data word width are consistent with the physical memory model; and, Does the segment corresponding to the page table region cover the program image in the test program image layout?

[0012] Furthermore, the verification access performed on the virtual address in the expected translation vector in step S107 specifically includes: Perform read access, write access, instruction fetch access, or unauthorized access on the virtual address; When the access type is unauthorized access, the expected translation result in the expected translation vector is the expected page error or permission exception type; The actual address translation results collected in step S107 specifically include: collecting the actual physical address, access success status, page table traversal exception type, and permission check results.

[0013] Furthermore, the on-chip system includes multiple processor cores, which share the same root page table, or each processor core uses its own independent root page table. When each processor core uses its own independent root page table, step S103 further includes: Each processor core is allocated an independent root page table region, and the page table regions of different processor cores do not overlap. The layout list is also used to record the kernel identifier corresponding to each of the page table regions; the expected translation vector is also used to record the kernel identifier corresponding to each of the mapping entries; The step S106, loading the simulation memory initialization file into the physical memory model, specifically involves: The page table data corresponding to each processor core is loaded into the physical memory model according to the core identifier; Step S107, comparing the actual address translation result with the expected translation result, specifically involves: The kernel identifier is used as a comparison dimension for comparison.

[0014] Secondly, the present invention also provides a multi-level page table generation and verification system for on-chip system simulation, comprising: The initialization module is used to obtain the virtual address mapping requirements, memory management unit configuration information and memory layout information of the verification scenario of the full system simulation of the on-chip system. The virtual address mapping requirements include at least one mapping entry, and the memory layout information includes the physical memory range, test program image layout and page table reserved area. The normalization module is used to normalize the virtual address mapping requirements according to the memory management unit configuration information to obtain normalized mapping entries; The region allocation module is used to allocate page table regions in the reserved area of ​​the page table according to the normalized mapping entries. The page table regions include root page table regions, intermediate page table regions, and final page table regions. The module performs conflict verification between the allocated page table regions and the mirror layout of the test program, and adjusts the physical address allocation of the page table regions according to the conflict verification results to obtain a conflict-free page table region allocation result. The page table generation module is used to calculate the page table indexes at each level corresponding to the virtual address of each normalized mapping entry based on the memory management unit configuration information, and generate page table entries at each level according to the page table indexes at each level in the order from the root page table to the last level page table, to obtain page table data covering the multi-level page tables of all normalized mapping entries; save the page table entry path corresponding to each mapping entry, the page table entry path is used to record the physical addresses of the page table indexes at each level and the page table entries at each level, and generate a layout list for recording the page table region allocation results and the physical address of the root page table, as well as an expected translation vector for recording the virtual address, access type and expected translation result of each mapping entry; The page table conversion module is used to convert the page table data into a simulated memory initialization file with physical address offset and segment boundary information, and generate a verification digest of the page table data through a preset verification algorithm. The simulation loading module is used to load the simulation memory initialization file into the physical memory model according to the layout list at zero point of simulation time, and to verify whether the loaded page table data is consistent with the verification digest. If so, the simulation verification module is executed. The simulation verification module is used to, after setting the root page table control register of the processor under test according to the root page table physical address, perform verification access on the virtual address in the expected translation vector according to the access type in the expected translation vector through the test platform component in the verification environment, collect the actual address translation result, and compare the actual address translation result with the expected translation result to obtain the translation comparison result; The verification and comparison module is used to locate the translation error to the corresponding page table level and the physical address of the page table entry based on the page table entry path if the translation comparison result is inconsistent; adjust the virtual address mapping requirement or the physical address allocation of the page table region based on the diagnostic information obtained from the location; and return to the normalization module. If the translation comparison result is consistent, it is determined that the multi-level page table verification is passed, and the multi-level page table output is used as the verification test case generation result that conforms to the full system simulation of the on-chip system.

[0015] Thirdly, the present invention also provides a computer device, comprising: a memory, a processor, and a multi-level page table generation and verification program for system-on-chip simulation stored on the memory and executable on the processor, wherein when the processor executes the multi-level page table generation and verification program for system-on-chip simulation, it implements the steps in the multi-level page table generation and verification method for system-on-chip simulation as described in any of the above embodiments.

[0016] Fourthly, the present invention also provides a storage medium storing a multi-level page table generation and verification program for on-chip system simulation. When the multi-level page table generation and verification program for on-chip system simulation is executed by a processor, it implements the steps in the multi-level page table generation and verification method for on-chip system simulation as described in any of the above embodiments.

[0017] The beneficial effects achieved by this invention lie in providing a multi-level page table generation and verification method for on-chip system simulation. This method completes the normalization of mapping requirements, page table region allocation and conflict verification, and page table entry encoding offline. After loading the page table data at the zero point of simulation time, it performs independent address translation verification, automatically verifies and adjusts the physical address conflicts between the page table region and other mirror regions, realizes the removal of page table construction from the simulation clock domain, and distinguishes between the three types of errors: generation, loading, and translation. This reduces bus transactions at the start of simulation, avoids overlap between page table regions and mirror regions, facilitates the location of translation errors, and improves the efficiency of on-chip system simulation verification. Attached Figure Description

[0018] The present invention will now be described in detail with reference to the accompanying drawings. The above and other aspects of the present invention will become clearer and more readily understood through the detailed description following the accompanying drawings. In the drawings: Figure 1 This is a flowchart of the steps of the multi-level page table generation and verification method for on-chip system simulation provided in this embodiment of the invention; Figure 2 This is a schematic diagram of the structure of the multi-level page table generation and verification system for on-chip system simulation provided in this embodiment of the invention; Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0019] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0020] The specific embodiments / examples described herein are specific implementations of the present invention, used to illustrate the concept of the invention, and are illustrative and exemplary, and should not be construed as limiting the implementation methods or scope of the present invention. In addition to the embodiments described herein, those skilled in the art can employ other obvious technical solutions based on the content disclosed in the claims and specification of this application. These technical solutions include those that make any obvious substitutions and modifications to the embodiments described herein, all of which are within the protection scope of the present invention.

[0021] Example 1 The method of this invention is applied to bare-metal, real-time operating system (RTOS), or operating system verification scenarios where the Memory Management Unit (MMU) is enabled. In these scenarios, the processor under test typically needs to first establish a root page table and multi-level page table directories, then write them to control registers such as SATA, before executing the formal test program. The method of this invention aims to move the page table construction process offline before simulation execution without changing the Register Transfer Level (RTL) logic of the System on Chip (SoC), forming a complete closed loop of mapping requirement parsing, page table layout allocation, image conflict verification, page table entry encoding, simulation loading, and independent translation verification. For details, please refer to... Figure 1 , Figure 1 This is a flowchart illustrating the steps of a multi-level page table generation and verification method for on-chip system simulation provided in this embodiment of the invention. The multi-level page table generation and verification method for on-chip system simulation includes the following steps: S101. Obtain the virtual address mapping requirements, memory management unit configuration information, and memory layout information of the verification scenario for the full system simulation of the on-chip system. The virtual address mapping requirements include at least one mapping entry, and the memory layout information includes the physical memory range, test program image layout, and page table reserved area.

[0022] In step S101, the acquired input data includes at least: memory management unit configuration information, such as Sv39, Sv48, Sv57, or other multi-level page table modes; virtual address mapping requirements, including the starting address of the virtual address (VA), the starting address of the physical address (PA), the mapping length, and read / write / execute permissions; page granularity configuration, including basic pages, big pages, or combinations of multiple page granularities; page table layout configuration, including the root page table base address, the upper limit of the page table region, and page table alignment requirements; image layout, including program image, stack, heap, shared memory, device mapping, and reserved areas; core configuration, including multi-core shared root page table or independent root page table per core; and load configuration, including the emulator memory model, data word width, endianness, hexadecimal (HEX) format, or binary (BIN) format file format, and load range. Here, a big page refers to a page granularity larger than a basic page, and a basic page refers to the smallest page granularity supported by the processor.

[0023] S102. The virtual address mapping requirement is normalized according to the memory management unit configuration information to obtain normalized mapping entries.

[0024] S103. Allocate page table regions within the reserved area of ​​the page table according to the normalized mapping entries. The page table regions include root page table regions, intermediate-level page table regions, and final-level page table regions. Perform conflict verification between the allocated page table regions and the mirror layout of the test program, and adjust the physical address allocation of the page table regions according to the conflict verification results to obtain a conflict-free page table region allocation result.

[0025] In step S103, when allocating page table regions, physical space is allocated according to the hierarchical order of root page table, intermediate page table, and final page table. The verification rules also include: independent page table regions of different cores must not overlap; shared page tables can only be reused when their mapping attributes are consistent.

[0026] S104. Calculate the page table indexes at each level corresponding to the virtual address of each normalized mapping entry based on the memory management unit configuration information, and generate page table entries at each level according to the page table indexes in the order from the root page table to the last-level page table, to obtain page table data covering the multi-level page tables of all normalized mapping entries; save the page table entry path corresponding to each mapping entry, the page table entry path is used to record the physical addresses of the page table indexes at each level and the page table entries at each level, and generate a layout list for recording the page table region allocation results and the physical address of the root page table, as well as an expected translation vector for recording the virtual address, access type, and expected translation result of each mapping entry.

[0027] In step S104, when constructing the multi-level page table tree, for each normalized mapping entry, the generator calculates the virtual page number indexes at each level according to the target memory management unit pattern, and establishes a page table path from the root page table to the last-level page table. Existing intermediate-level page table directories are reused to avoid redundant allocation, thereby reducing the physical space occupied by the page table region. Each page table entry (PTE) includes at least: a valid bit; read, write, and execute permission bits; user-mode access bits; global mapping bits; access bits and dirty bits; physical page number; and extended attributes related to the processor implementation.

[0028] The page table entry path corresponding to each mapping entry saved in step S104 records the mapping entry identifier, virtual address page number, virtual page number indexes at each level, physical address of each page table entry, page table entry encoding value, target physical address page number, and permissions and attributes in sequence. Through this page table entry path, a traceable correspondence can be established between the mapping requirement, the page table entry path, and the actual translation result.

[0029] S105. Convert the page table data into a simulated memory initialization file with physical address offset and segment boundary information, and generate a verification digest of the page table data using a preset verification algorithm.

[0030] In step S105, the preset verification algorithm can be a commonly used data verification algorithm such as a hash algorithm or Cyclic Redundancy Check (CRC). This embodiment does not limit the specific algorithm for generating the verification digest. The generated simulation memory initialization file can be in HEX or BIN format, and the file contains physical address offsets and segment boundary information so that the simulation can load according to the corresponding segments.

[0031] In this embodiment of the invention, steps S104 and S105 can be executed synchronously, and the generated output includes at least: a page table memory initialization file; a page table region layout list; the root page table physical address; the page table entry path for each mapping entry; the expected translation vector; a page table data verification digest; and a conflict check report with the program image and other memory regions. The expected translation vector includes at least the input virtual address, the expected physical address, the access type, the expected permission result, the core to which it belongs, and the mapping entry identifier.

[0032] S106. At zero point of simulation time, load the simulation memory initialization file into the physical memory model according to the layout list, and verify whether the loaded page table data is consistent with the verification digest. If so, proceed to step S107.

[0033] In step S106, the simulation time zero point refers to the moment when the simulator starts but the simulation clock has not yet started advancing. Loading page table segments into the physical memory model at the simulation time zero point prevents page table construction from occupying simulation clock cycles, avoiding the large number of bus transactions generated by the processor under test writing page table entries one by one. This moves page table construction out of the simulation clock domain to the offline generation stage, shortening the simulation startup time.

[0034] S107. After setting the root page table control register of the processor under test according to the root page table physical address, the test platform component in the verification environment performs verification access on the virtual address in the expected translation vector according to the access type in the expected translation vector, collects the actual address translation result, and compares the actual address translation result with the expected translation result to obtain the translation comparison result.

[0035] In step S107, the processor under test only performs necessary startup operations, such as setting the root page table register (sATP) according to the root page table physical address, enabling address translation, and performing necessary cache or translation lookaside buffer (TLB) synchronization operations. The verification access is performed by a verification probe, which is implemented by test platform components or a monitor in the verification environment, rather than software code running inside the processor under test. During comparison, matching is performed based on the mapping entry identifier, virtual address page number, and access type.

[0036] S108. If the translation comparison result is inconsistent, the translation error is located to the corresponding page table level and the physical address of the page table entry according to the page table entry path. The virtual address mapping requirement or the physical address allocation of the page table region is adjusted according to the diagnostic information obtained from the location, and the process returns to step S102. If the translation comparison result is consistent, the multi-level page table verification is determined to be successful, and the multi-level page table output is used as the verification test case generation result that conforms to the full system simulation of the on-chip system.

[0037] In step S108, adjusting the virtual address mapping requirement or the physical address allocation of the page table region based on the diagnostic information obtained from the location means making local adjustments only for mapping entries with conflicts or errors. That is, updating the mapping requirement or page table layout configuration based on the diagnostic information, and then returning to step S102 to re-execute normalization and subsequent steps until the translation comparison results are consistent. By generating a digest, performing load verification, and comparing the actual translation, generation errors, loading errors, and memory management unit execution errors can be distinguished.

[0038] Furthermore, the normalization process for the virtual address mapping requirement in step S102 includes: The consecutive mapping entries in the virtual address mapping requirement are split into one or more normalized intervals; Each normalized interval is checked, including: whether the virtual address and physical address meet the alignment requirements of the selected page granularity, whether the mapping length covers the entire page, whether there is virtual address overlap between different mapping entries, whether different mapping entries set conflicting access attributes for the same physical region, and whether at least one of the constraints of the memory management unit configuration information on address width and reserved bits is met. The page granularity, alignment boundary, access permissions, and processor core to which each mapping entry belongs are determined.

[0039] The purpose of standardization is to unify mapping requirements from different sources into aligned, non-overlapping, and attribute-consistent standardized mapping entries, so that subsequent page table region allocation and page table entry encoding are executed based on consistent input, avoiding configuration inconsistencies caused by multiple scripts or manual configurations maintaining page table levels, page sizes, permission bits, and address alignment relationships separately.

[0040] Furthermore, determining the page granularity of each mapping entry in step S102 specifically involves: Following a strategy that prioritizes the use of large pages and base pages for boundary regions, the normalized interval is segmented, and the page granularity for each segment is determined. This strategy reduces the number of page table nodes while preserving the mapping capability of unaligned regions.

[0041] Furthermore, step S103, which involves performing a conflict check between the allocated page table region and the test program mirror layout, specifically includes: Construct a physical address range table, which is used to record the start address, end address, range purpose, whether it is allowed to be occupied by the page table, and alignment granularity of each range; According to the physical address range table, the page table region is verified to not overlap with the program image region, stack region, heap region, shared memory region and device region in the test program image layout, and the starting address of each level of page table stored in the page table region meets the page alignment requirements, and the total size of the page table region does not exceed the reserved area of ​​the page table. When a conflict is detected, the range name, address range, number of conflicting bytes, and migration direction of both conflicting parties are output. The physical address allocation of the page table region is adjusted according to the migration direction, instead of continuing to generate initialization files that may overwrite other images. The generator automatically updates the physical address allocation of the page table region in the physical address range table according to the suggested migration direction, and re-executes the allocation and verification, thereby automatically avoiding overlap between the page table region and the program image, stack area, heap area, shared memory area or device area during the generation stage.

[0042] Furthermore, in step S106, loading the simulated memory initialization file into the physical memory model specifically involves: The segments in the simulated memory initialization file are loaded into the corresponding physical address ranges through the initialization interface, memory loading function, or binary loading interface of the physical memory model.

[0043] During implementation, the memory loading function is, for example, the $readmemh system function provided by the emulator.

[0044] Step S106 further includes performing at least one of the following checks during the loading process of the simulation memory initialization file into the physical memory model: Whether each segment corresponds one-to-one with the physical address range; Does the length of the simulated memory initialization file not exceed the physical address range? Whether the byte order and data word width are consistent with the physical memory model; and, Does the segment corresponding to the page table region cover the program image in the test program image layout?

[0045] By performing the above loading checks and comparing the consistency between the page table data digest and the generation stage digest, it can be confirmed that no errors such as segment misalignment, length out-of-bounds, or word width endianness mismatch occurred in the initialization file during the loading stage, thus distinguishing the errors in the loading stage from the errors in the page table generation stage.

[0046] Furthermore, the verification access performed on the virtual address in the expected translation vector in step S107 specifically includes: Perform read access, write access, instruction fetch access, or unauthorized access on the virtual address; When the access type is unauthorized access, the expected translation result in the expected translation vector is the expected page error or permission exception type.

[0047] The actual address translation results collected in step S107 specifically include: collecting the actual physical address, access success status, page table traversal exception type, and permission check results.

[0048] Furthermore, the on-chip system includes multiple processor cores, which share the same root page table, or each processor core uses its own independent root page table. When each processor core uses its own independent root page table, step S103 further includes: Each processor core is allocated an independent root page table region, and the page table regions of different processor cores do not overlap. The layout list is also used to record the kernel identifier corresponding to each of the page table regions; the expected translation vector is also used to record the kernel identifier corresponding to each of the mapping entries; The step S106, loading the simulation memory initialization file into the physical memory model, specifically involves: The page table data corresponding to each processor core is loaded into the physical memory model according to the core identifier; Step S107, comparing the actual address translation result with the expected translation result, specifically involves: The kernel identifier is used as a comparison dimension for comparison.

[0049] For example, in a multi-core RISC-V instruction set architecture on-chip system, multiple cores share the same root page table. The configuration table includes: a readable, writable, and executable program mapping; a readable-only data mapping; a non-executable shared buffer; a device access region; and a page table reserved region. The generator first uses large pages to cover contiguous program regions, then uses base pages to handle boundary regions with different permissions. When allocating page table regions, the generator finds that the original page table base address overlaps with the heap area. Therefore, it migrates the page table region to a reserved address according to the physical address range table, and synchronously updates the root page table address, initialization file, and simulation startup parameters. After simulation starts, the verification probe performs instruction fetch, read, write, and unauthorized execution access respectively. For unauthorized execution access, the verification probe expects to generate permission anomalies; for legitimate access, the verification probe checks the actual physical address. If the execution permission of a page table entry is incorrect, the diagnostic result directly points to the corresponding mapping entry and page table entry address.

[0050] Furthermore, for a multi-core on-chip system with independent page tables for each core, when executing the method proposed in this embodiment of the invention, different cores in the multi-core on-chip system run in different address spaces. The generator establishes an independent root page table region and page table segment for each core and records the core identifier in the layout manifest. The simulator loads the corresponding page table according to the core, and the verification probe uses the core identifier as a comparison dimension to prevent one core from mistakenly using the root page table of another core.

[0051] During implementation, when page tables and program images are loaded together, the generator receives the physical layout of the Executable and Linkable Format (ELF) or other test program images, first locking the program image and device area, and then allocating a page table region from the reserved page table area. Finally, it outputs an initialization description file containing multiple address segments, enabling page tables and program images to be loaded in the same memory initialization process while maintaining traceability of segment boundaries and checksums.

[0052] The beneficial effects achieved by this invention lie in providing a multi-level page table generation and verification method for on-chip system simulation. This method completes the normalization of mapping requirements, page table region allocation and conflict verification, and page table entry encoding offline. After loading the page table data at the zero point of simulation time, it performs independent address translation verification, automatically verifies and adjusts the physical address conflicts between the page table region and other mirror regions, realizes the removal of page table construction from the simulation clock domain, and distinguishes between the three types of errors: generation, loading, and translation. This reduces bus transactions at the start of simulation, avoids overlap between page table regions and mirror regions, facilitates the location of translation errors, and improves the efficiency of on-chip system simulation verification.

[0053] Example 2 This invention also provides a multi-level page table generation and verification system 200 for on-chip system simulation. Please refer to [link / reference]. Figure 2 , Figure 2 This is a schematic diagram of the structure of a multi-level page table generation and verification system for on-chip system simulation provided in an embodiment of the present invention, which includes: The initialization module 201 is used to obtain the virtual address mapping requirements, memory management unit configuration information and memory layout information of the verification scenario of the full system simulation of the on-chip system. The virtual address mapping requirements include at least one mapping entry, and the memory layout information includes the physical memory range, test program image layout and page table reserved area. The normalization module 202 is used to normalize the virtual address mapping requirements according to the memory management unit configuration information to obtain normalized mapping entries; The region allocation module 203 is used to allocate page table regions in the reserved area of ​​the page table according to the normalized mapping entries. The page table regions include root page table regions, intermediate page table regions and final page table regions. The module performs conflict verification between the allocated page table regions and the mirror layout of the test program, and adjusts the physical address allocation of the page table regions according to the conflict verification results to obtain a conflict-free page table region allocation result. Page table generation module 204 is used to calculate the page table indexes at each level corresponding to the virtual address of each normalized mapping entry according to the memory management unit configuration information, and generate page table entries at each level according to the page table indexes at each level in the order from the root page table to the last level page table, to obtain page table data covering the multi-level page tables of all normalized mapping entries; save the page table entry path corresponding to each mapping entry, the page table entry path is used to record the physical addresses of the page table indexes at each level and the page table entries at each level, and generate a layout list for recording the page table region allocation results and the physical address of the root page table, as well as an expected translation vector for recording the virtual address, access type and expected translation result of each mapping entry; Page table conversion module 205 is used to convert the page table data into a simulated memory initialization file with physical address offset and segment boundary information, and generate a verification digest of the page table data through a preset verification algorithm. Simulation loading module 206 is used to load the simulation memory initialization file into the physical memory model according to the layout list at zero point of simulation time, and to verify whether the loaded page table data is consistent with the verification digest. If so, simulation verification module 207 is executed. The simulation verification module 207 is used to, after setting the root page table control register of the processor under test according to the root page table physical address, perform verification access on the virtual address in the expected translation vector according to the access type in the expected translation vector through the test platform component in the verification environment, collect the actual address translation result, and compare the actual address translation result with the expected translation result to obtain the translation comparison result; The verification and comparison module 208 is used to locate the translation error to the corresponding page table level and the physical address of the page table entry according to the page table entry path if the translation comparison result is inconsistent, adjust the virtual address mapping requirement or the physical address allocation of the page table region according to the diagnostic information obtained from the location, and return to the normalization module 202; if the translation comparison result is consistent, it is determined that the multi-level page table verification is passed, and the multi-level page table output is used as the verification test case generation result that conforms to the full system simulation of the on-chip system.

[0054] During implementation, the initialization module 201, normalization module 202, region allocation module 203, page table generation module 204, and page table conversion module 205 can be implemented by an offline page table generator. The simulation loading module 206 can be implemented by a loading module in the verification environment. The simulation verification module 207 can be implemented by a test platform component or monitor in the verification environment. The verification comparison module 208 can be implemented by a comparison module in the verification environment. The data interaction relationships between the modules correspond one-to-one with the input-output relationships between steps S101 to S108 in Example 1.

[0055] The multi-level page table generation and verification system 200 for on-chip system simulation can implement the steps in the multi-level page table generation and verification method for on-chip system simulation as described in the above embodiments, and can achieve the same technical effect. Referring to the description in Embodiment 1 above, it will not be repeated here.

[0056] Example 3 This invention also provides a computer device, please refer to... Figure 3 , Figure 3This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. The computer device 300 includes: a memory 302, a processor 301, and a multi-level page table generation and verification program for system-on-a-chip simulation stored in the memory 302 and capable of running on the processor 301.

[0057] The processor 301 calls the multi-level page table generation and verification program for on-chip system simulation stored in the memory 302, and executes the steps in the multi-level page table generation and verification method for on-chip system simulation provided in this embodiment of the invention. Please refer to... Figure 1 Specifically, it includes the following steps: S101. Obtain the virtual address mapping requirements, memory management unit configuration information, and memory layout information of the verification scenario for the full system simulation of the on-chip system. The virtual address mapping requirements include at least one mapping entry, and the memory layout information includes the physical memory range, test program image layout, and page table reserved area.

[0058] S102. The virtual address mapping requirement is normalized according to the memory management unit configuration information to obtain normalized mapping entries.

[0059] S103. Allocate page table regions within the reserved area of ​​the page table according to the normalized mapping entries. The page table regions include root page table regions, intermediate-level page table regions, and final-level page table regions. Perform conflict verification between the allocated page table regions and the mirror layout of the test program, and adjust the physical address allocation of the page table regions according to the conflict verification results to obtain a conflict-free page table region allocation result.

[0060] S104. Calculate the page table indexes at each level corresponding to the virtual address of each normalized mapping entry based on the memory management unit configuration information, and generate page table entries at each level according to the page table indexes in the order from the root page table to the last-level page table, to obtain page table data covering the multi-level page tables of all normalized mapping entries; save the page table entry path corresponding to each mapping entry, the page table entry path is used to record the physical addresses of the page table indexes at each level and the page table entries at each level, and generate a layout list for recording the page table region allocation results and the physical address of the root page table, as well as an expected translation vector for recording the virtual address, access type, and expected translation result of each mapping entry.

[0061] S105. Convert the page table data into a simulated memory initialization file with physical address offset and segment boundary information, and generate a verification digest of the page table data using a preset verification algorithm.

[0062] S106. At zero point of simulation time, load the simulation memory initialization file into the physical memory model according to the layout list, and verify whether the loaded page table data is consistent with the verification digest. If so, proceed to step S107.

[0063] S107. After setting the root page table control register of the processor under test according to the root page table physical address, the test platform component in the verification environment performs verification access on the virtual address in the expected translation vector according to the access type in the expected translation vector, collects the actual address translation result, and compares the actual address translation result with the expected translation result to obtain the translation comparison result.

[0064] S108. If the translation comparison result is inconsistent, the translation error is located to the corresponding page table level and the physical address of the page table entry according to the page table entry path. The virtual address mapping requirement or the physical address allocation of the page table region is adjusted according to the diagnostic information obtained from the location, and the process returns to step S102. If the translation comparison result is consistent, the multi-level page table verification is determined to be successful, and the multi-level page table output is used as the verification test case generation result that conforms to the full system simulation of the on-chip system.

[0065] Furthermore, the normalization process for the virtual address mapping requirement in step S102 includes: The consecutive mapping entries in the virtual address mapping requirement are split into one or more normalized intervals; Each normalized interval is checked, including: whether the virtual address and physical address meet the alignment requirements of the selected page granularity, whether the mapping length covers the entire page, whether there is virtual address overlap between different mapping entries, whether different mapping entries set conflicting access attributes for the same physical region, and whether at least one of the constraints of the memory management unit configuration information on address width and reserved bits is met. The page granularity, alignment boundary, access permissions, and processor core to which each mapping entry belongs are determined.

[0066] Furthermore, determining the page granularity of each mapping entry in step S102 specifically involves: The normalized interval is segmented according to the strategy of prioritizing the use of large pages and using basic pages in boundary areas, and the page granularity used in each segment is determined.

[0067] Furthermore, step S103, which involves performing a conflict check between the allocated page table region and the test program mirror layout, specifically includes: Construct a physical address range table, which is used to record the start address, end address, range purpose, whether it is allowed to be occupied by the page table, and alignment granularity of each range; According to the physical address range table, the page table region is verified to not overlap with the program image region, stack region, heap region, shared memory region and device region in the test program image layout, and the starting address of each level of page table stored in the page table region meets the page alignment requirements, and the total size of the page table region does not exceed the reserved area of ​​the page table. When a conflict is detected, the range name, address range, number of conflicting bytes, and migration direction of both conflicting parties are output, and the physical address allocation of the page table region is adjusted according to the migration direction.

[0068] Furthermore, in step S106, loading the simulated memory initialization file into the physical memory model specifically involves: The segments in the simulated memory initialization file are loaded into the corresponding physical address ranges through the initialization interface, memory loading function, or binary loading interface of the physical memory model. Step S106 further includes performing at least one of the following checks during the loading process of the simulation memory initialization file into the physical memory model: Whether each segment corresponds one-to-one with the physical address range; Does the length of the simulated memory initialization file not exceed the physical address range? Whether the byte order and data word width are consistent with the physical memory model; and, Does the segment corresponding to the page table region cover the program image in the test program image layout?

[0069] Furthermore, the verification access performed on the virtual address in the expected translation vector in step S107 specifically includes: Perform read access, write access, instruction fetch access, or unauthorized access on the virtual address; When the access type is unauthorized access, the expected translation result in the expected translation vector is the expected page error or permission exception type; The actual address translation results collected in step S107 specifically include: collecting the actual physical address, access success status, page table traversal exception type, and permission check results.

[0070] Furthermore, the on-chip system includes multiple processor cores, which share the same root page table, or each processor core uses its own independent root page table. When each processor core uses its own independent root page table, step S103 further includes: Each processor core is allocated an independent root page table region, and the page table regions of different processor cores do not overlap. The layout list is also used to record the kernel identifier corresponding to each of the page table regions; the expected translation vector is also used to record the kernel identifier corresponding to each of the mapping entries; The step S106, loading the simulation memory initialization file into the physical memory model, specifically involves: The page table data corresponding to each processor core is loaded into the physical memory model according to the core identifier; Step S107, comparing the actual address translation result with the expected translation result, specifically involves: The kernel identifier is used as a comparison dimension for comparison.

[0071] The computer device 300 provided in this embodiment of the invention can implement the steps in the multi-level page table generation and verification method for on-chip system simulation as described in the above embodiments, and can achieve the same technical effect. Referring to the description in the above embodiments, it will not be repeated here.

[0072] Example 4 This invention also provides a storage medium storing a multi-level page table generation and verification program for on-chip system simulation. When executed by a processor, this multi-level page table generation and verification program for on-chip system simulation implements the various processes and steps in the multi-level page table generation and verification method for on-chip system simulation provided in this invention, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0073] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented through hardware related to the generation of multi-level page tables in on-chip system simulation verification programs or instructions. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0074] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0075] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0076] The embodiments of the present invention have been described above with reference to the accompanying drawings. The disclosed embodiments are merely preferred embodiments of the present invention. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many equivalent changes in form under the guidance of the present invention without departing from the spirit and scope of the claims. All such changes are within the protection scope of the present invention.

Claims

1. A method for generating and verifying multi-level page tables in on-chip system simulation, characterized in that, Includes the following steps: S101. Obtain the virtual address mapping requirements, memory management unit configuration information, and memory layout information of the verification scenario for the full system simulation of the on-chip system. The virtual address mapping requirements include at least one mapping entry, and the memory layout information includes the physical memory range, test program image layout, and page table reserved area. S102. The virtual address mapping requirement is normalized according to the memory management unit configuration information to obtain normalized mapping entries; S103. Allocate page table regions in the reserved area of ​​the page table according to the normalized mapping entries. The page table regions include root page table regions, intermediate page table regions and final page table regions. Perform conflict verification between the allocated page table regions and the test program mirror layout, and adjust the physical address allocation of the page table regions according to the conflict verification results to obtain a conflict-free page table region allocation result. S104. Calculate the page table indexes at each level corresponding to the virtual address of each normalized mapping entry based on the memory management unit configuration information, and generate page table entries at each level according to the page table indexes at each level in the order from the root page table to the last-level page table, to obtain page table data covering the multi-level page tables of all normalized mapping entries; save the page table entry path corresponding to each mapping entry, the page table entry path is used to record the physical addresses of the page table indexes at each level and the page table entries at each level, and generate a layout list for recording the page table region allocation results and the physical address of the root page table, as well as an expected translation vector for recording the virtual address, access type, and expected translation result of each mapping entry; S105. Convert the page table data into a simulated memory initialization file with physical address offset and segment boundary information, and generate a verification digest of the page table data using a preset verification algorithm. S106. At zero point of simulation time, load the simulation memory initialization file into the physical memory model according to the layout list, and verify whether the loaded page table data is consistent with the verification digest. If so, proceed to step S107. S107. After setting the root page table control register of the processor under test according to the root page table physical address, the test platform component in the verification environment performs verification access on the virtual address in the expected translation vector according to the access type in the expected translation vector, collects the actual address translation result, and compares the actual address translation result with the expected translation result to obtain the translation comparison result. S108. If the translation comparison result is inconsistent, the translation error is located to the corresponding page table level and the physical address of the page table entry according to the page table entry path. The virtual address mapping requirement or the physical address allocation of the page table region is adjusted according to the diagnostic information obtained from the location, and the process returns to step S102. If the translation comparison result is consistent, the multi-level page table verification is determined to be successful, and the multi-level page table output is used as the verification test case generation result that conforms to the full system simulation of the on-chip system.

2. The method for generating and verifying multi-level page tables for on-chip system simulation according to claim 1, characterized in that, The normalization process for the virtual address mapping requirement in step S102 includes: The consecutive mapping entries in the virtual address mapping requirement are split into one or more normalized intervals; Each normalized interval is checked, including: whether the virtual address and physical address meet the alignment requirements of the selected page granularity, whether the mapping length covers the entire page, whether there is virtual address overlap between different mapping entries, whether different mapping entries set conflicting access attributes for the same physical region, and whether at least one of the constraints of the memory management unit configuration information on address width and reserved bits is met. The page granularity, alignment boundary, access permissions, and processor core to which each mapping entry belongs are determined.

3. The method for generating and verifying multi-level page tables for on-chip system simulation according to claim 2, characterized in that, Determining the page granularity of each mapping entry in step S102 specifically involves: The normalized interval is segmented according to the strategy of prioritizing the use of large pages and using basic pages in boundary areas, and the page granularity used in each segment is determined.

4. The method for generating and verifying multi-level page tables for on-chip system simulation according to claim 1, characterized in that, Step S103, which involves performing a conflict check between the allocated page table region and the test program mirror layout, specifically includes: Construct a physical address range table, which is used to record the start address, end address, range purpose, whether it is allowed to be occupied by the page table, and alignment granularity of each range; According to the physical address range table, the page table region is verified to not overlap with the program image region, stack region, heap region, shared memory region and device region in the test program image layout, and the starting address of each level of page table stored in the page table region meets the page alignment requirements, and the total size of the page table region does not exceed the reserved area of ​​the page table. When a conflict is detected, the range name, address range, number of conflicting bytes, and migration direction of both conflicting parties are output, and the physical address allocation of the page table region is adjusted according to the migration direction.

5. The method for generating and verifying multi-level page tables for on-chip system simulation according to claim 1, characterized in that, The step S106, loading the simulation memory initialization file into the physical memory model, specifically involves: The segments in the simulated memory initialization file are loaded into the corresponding physical address ranges through the initialization interface, memory loading function, or binary loading interface of the physical memory model. Step S106 further includes performing at least one of the following checks during the loading process of the simulation memory initialization file into the physical memory model: Whether each segment corresponds one-to-one with the physical address range; Does the length of the simulated memory initialization file not exceed the physical address range? Whether the byte order and data word width are consistent with the physical memory model; and, Does the segment corresponding to the page table region cover the program image in the test program image layout? 6. The method for generating and verifying multi-level page tables for on-chip system simulation according to claim 1, characterized in that, Step S107, which involves performing a verification access on the virtual address in the desired translation vector, specifically includes: Perform read access, write access, instruction fetch access, or unauthorized access on the virtual address; When the access type is unauthorized access, the expected translation result in the expected translation vector is the expected page error or permission exception type; The actual address translation results collected in step S107 specifically include: collecting the actual physical address, access success status, page table traversal exception type, and permission check results.

7. The method for generating and verifying multi-level page tables for on-chip system simulation according to claim 1, characterized in that, The on-chip system includes multiple processor cores, which share the same root page table, or each processor core uses its own independent root page table. When each processor core uses its own independent root page table, step S103 further includes: Each processor core is allocated an independent root page table region, and the page table regions of different processor cores do not overlap. The layout list is also used to record the kernel identifier corresponding to each of the page table regions; the expected translation vector is also used to record the kernel identifier corresponding to each of the mapping entries; The step S106, loading the simulation memory initialization file into the physical memory model, specifically involves: The page table data corresponding to each processor core is loaded into the physical memory model according to the core identifier; Step S107, comparing the actual address translation result with the expected translation result, specifically involves: The kernel identifier is used as a comparison dimension for comparison.

8. A multi-level page table generation and verification system for on-chip system simulation, characterized in that, include: The initialization module is used to obtain the virtual address mapping requirements, memory management unit configuration information and memory layout information of the verification scenario of the full system simulation of the on-chip system. The virtual address mapping requirements include at least one mapping entry, and the memory layout information includes the physical memory range, test program image layout and page table reserved area. The normalization module is used to normalize the virtual address mapping requirements according to the memory management unit configuration information to obtain normalized mapping entries; The region allocation module is used to allocate page table regions in the reserved area of ​​the page table according to the normalized mapping entries. The page table regions include root page table regions, intermediate page table regions, and final page table regions. The module performs conflict verification between the allocated page table regions and the mirror layout of the test program, and adjusts the physical address allocation of the page table regions according to the conflict verification results to obtain a conflict-free page table region allocation result. The page table generation module is used to calculate the page table indexes at each level corresponding to the virtual address of each normalized mapping entry based on the memory management unit configuration information, and generate page table entries at each level according to the page table indexes at each level in the order from the root page table to the last level page table, to obtain page table data covering the multi-level page tables of all normalized mapping entries; save the page table entry path corresponding to each mapping entry, the page table entry path is used to record the physical addresses of the page table indexes at each level and the page table entries at each level, and generate a layout list for recording the page table region allocation results and the physical address of the root page table, as well as an expected translation vector for recording the virtual address, access type and expected translation result of each mapping entry; The page table conversion module is used to convert the page table data into a simulated memory initialization file with physical address offset and segment boundary information, and generate a verification digest of the page table data through a preset verification algorithm. The simulation loading module is used to load the simulation memory initialization file into the physical memory model according to the layout list at zero point of simulation time, and to verify whether the loaded page table data is consistent with the verification digest. If so, the simulation verification module is executed. The simulation verification module is used to, after setting the root page table control register of the processor under test according to the root page table physical address, perform verification access on the virtual address in the expected translation vector according to the access type in the expected translation vector through the test platform component in the verification environment, collect the actual address translation result, and compare the actual address translation result with the expected translation result to obtain the translation comparison result; The verification and comparison module is used to locate the translation error to the corresponding page table level and the physical address of the page table entry based on the page table entry path if the translation comparison result is inconsistent; adjust the virtual address mapping requirement or the physical address allocation of the page table region based on the diagnostic information obtained from the location; and return to the normalization module. If the translation comparison result is consistent, it is determined that the multi-level page table verification is passed, and the multi-level page table output is used as the verification test case generation result that conforms to the full system simulation of the on-chip system.

9. A computer device, characterized in that, include: The system includes a memory, a processor, and a multi-level page table generation and verification program for on-chip system simulation stored in the memory and executable on the processor. When the processor executes the multi-level page table generation and verification program for on-chip system simulation, it implements the steps in the multi-level page table generation and verification method for on-chip system simulation as described in any one of claims 1-7.

10. A storage medium, characterized in that, The storage medium stores a multi-level page table generation and verification program for on-chip system simulation. When the processor executes the multi-level page table generation and verification program for on-chip system simulation, it implements the steps in the multi-level page table generation and verification method for on-chip system simulation as described in any one of claims 1-7.