A bare metal system-level incentive cross-compilation system and compilation method

By designing a bare-metal system-level incentive cross-compilation system, the incentive compilation process is simplified, the problem of long transplantation and compilation time caused by the complexity of u-boot code is solved, flexible and efficient incentive cross-compilation is achieved, and the efficiency of bare-metal system-level simulation is improved.

CN112506517BActive Publication Date: 2024-09-06PHYTIUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011377429.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-30
Publication Date
2024-09-06
Estimated Expiration
2040-11-30

AI Technical Summary

Technical Problem

In the existing technology, during the incentive compilation process of bare-metal system-level verification, the u-boot code structure is complex and large-scale, resulting in a heavy workload for porting specific platform architectures, long compilation and loading times, and reduced simulation testing efficiency.

Method used

A bare-metal system-level incentive cross-compilation system is designed, including a test incentive module, a library file module, a CPU core configuration module, a compilation link module and a compilation environment analysis and assembly module. The cross-compilation tool is used to generate disassembly code, which simplifies the creation of binary files. The generation process improves compilation efficiency.

Benefits of technology

It realizes flexible and efficient incentive cross-compilation for specific architecture platforms, improves bare metal system-level simulation efficiency, supports simulation verification of different architecture platforms, and simplifies the incentive development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112506517B
    Figure CN112506517B
Patent Text Reader

Abstract

The present invention discloses a bare metal system-level stimulus cross-compilation system and a compilation method, the system comprising: a test stimulus module, used to write and store directional and random stimulus for corresponding bare metal system-level verification function points; a library file module, used to implement the functions of the bare metal startup program and the common functions in the stimulus development process; a CPU kernel configuration module, used to implement the target CPU configuration; a compilation link module, used to describe the link mode of the executable file, and parse the binary file to generate a disassembly code that can be used for debugging; a compilation environment parsing assembly module, used to parse the configuration to generate the corresponding file, and assemble to generate an executable binary file. The method can be implemented based on the above system. The present invention has the advantages of good flexibility, wide application range, and can improve simulation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention mainly relates to the technical field of integrated circuit verification, and in particular to a bare metal system-level stimulus cross-compilation system and a compilation method. Background Art

[0002] With the rapid development of integrated circuits, the scale of CPU (central processing unit) is getting larger and larger, the circuit complexity is getting higher and higher, the verification requirements are getting higher and higher, the verification work is getting more complicated, and the verification efficiency requirements are getting higher and higher.

[0003] From the verification process, verification is divided into module-level, subsystem-level, bare metal system-level and system-level testing. Module-level verification is used to verify the function and design of a specific module; subsystem-level verification is the combined verification of certain modules, used to test the connection between modules and functional points that cannot be covered at the module level; bare metal system-level verification is the verification of the entire chip, used to verify the connection between modules on the chip and certain system-level protocols; system-level verification is larger in scale, used to verify system functions and performance, with a slower simulation speed, and generally uses FPGA and hardware accelerator verification.

[0004] Starting the operating system on FPGA and hardware emulation accelerators for system-level verification has problems such as slow simulation speed and difficulty in locating problems; bare metal system-level verification can verify system-level functional points that cannot be covered by module level and subsystem level, and quickly locate problems, providing support for system-level verification on FPGA and hardware emulation accelerators. Therefore, bare metal system-level verification can improve verification efficiency and increase the functional coverage and code coverage of system-level verification.

[0005] In the prior art, bare metal system-level testing mainly includes random stimulus testing and directed stimulus testing. Bare metal system-level stimulus is usually written in C language. Before it is loaded into the RTL (Register Transfer Level) simulation environment, it needs to be converted into an executable binary file together with the bare metal boot program and a specific configuration file. The current common open source bare metal boot program is u-boot. As an open source bare metal boot program that can be used for a variety of different architecture platforms, the u-boot code structure is complicated and the code itself is large in size. If you want to use u-boot to build a system-level bare metal stimulus compilation environment for a specific platform architecture, there will be the following problems:

[0006] First, it is necessary to parse and separate the startup programs of different architecture platforms, which requires a lot of transplantation work and is not conducive to secondary development.

[0007] Second, as a relatively mature bare-metal boot program, u-boot has a complex code hierarchy. The redundant code introduced during the porting process will lead to a long compilation and loading time of the bare-metal boot program, reducing the efficiency of bare-metal system-level simulation testing.

[0008] In summary, for a bare metal incentive compilation environment of a specific architecture, directly using u-boot is not flexible and efficient enough. Therefore, it is urgent to implement a concise and flexible bare metal boot program and its supporting compilation environment to improve the flexibility of bare metal incentive development and the efficiency of bare metal system-level simulation testing. Summary of the invention

[0009] The technical problem to be solved by the present invention is: in view of the technical problems existing in the prior art, the present invention provides a bare metal system-level incentive cross-compilation system and a compilation method which have good flexibility, a wide range of applications and can improve simulation efficiency.

[0010] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0011] A bare metal system-level incentive cross-compilation system, comprising:

[0012] A test stimulus module, used to write and store directed and random stimulus for corresponding bare metal system-level verification function points;

[0013] Library file module, used to implement the bare metal boot program functions and stimulate the common functions in the development process;

[0014] CPU kernel configuration module, used to implement target CPU configuration;

[0015] Compile and link modules, which are used to describe the linking method of executable files and parse binary files to generate disassembled codes that can be used for debugging;

[0016] The compilation environment parsing assembly module is used to parse the configuration to generate the corresponding files, and assemble them to generate executable binary files.

[0017] As a further improvement of the system of the present invention: the compile and link module includes a compile and link file and a compile tool; the compile and link file is used to describe the link method in the executable file generated in different loading modes; the compile tool is used for cross-compilation of a specific platform architecture, and is used to parse the binary file to generate disassembly code that can be used for debugging.

[0018] As a further improvement of the system of the present invention: the linking method is the linking method of the data segment, code segment, stack segment and BSS segment in the execution file.

[0019] As a further improvement of the system of the present invention: the compilation environment parsing assembly module is used to parse the configuration of the test stimulus module, library file module, and CPU kernel configuration module to generate corresponding page table files, Makefile files, and target files, and assemble them to generate executable binary files.

[0020] As a further improvement of the system of the present invention: the page table file describes the mapping relationship between the memory logical page and the physical page frame. During the operation of the simulation environment, the CPU loads the program into the specified address space in the memory according to the generated page table.

[0021] As a further improvement of the system of the present invention: the generated Makefile file parses the stimulus file, initialization file, configuration file and required library files to be compiled into the Makefile file to realize the compilation of specific stimulus.

[0022] As a further improvement of the system of the present invention: the target file includes target generation files of all related source files.

[0023] As a further improvement of the system of the present invention: the excitation content of the excitation source code unit is in the form of a C language program.

[0024] As a further improvement of the system of the present invention: it also includes an SV file for verification of specific function points.

[0025] As a further improvement of the system of the present invention: the library file module includes an architecture register configuration and initialization unit, a design module controller register and peripheral initialization unit, and a shared function unit.

[0026] As a further improvement of the system of the present invention: the shared function unit includes a printing function, a search function, a lock function, a register read and write function, and a wait and delay function.

[0027] As a further improvement of the system of the present invention: it also includes a post-processing tool, which is implemented in Python language. After setting the memory access width and memory access base address parameters, the executable file generated by the assembly tool is converted into an executable file that is directly loaded into the corresponding simulation environment.

[0028] The present invention further provides a bare metal system-level incentive cross-compilation method, the steps of which include:

[0029] Step S1: forming a bare metal incentive;

[0030] Step S2: configuring a configuration file for a specific target CPU;

[0031] Step S3: compile library files;

[0032] Step S4: compile link files according to different program loading methods;

[0033] Step S5: using an assembly writing tool to parse the above files, generate files and assemble them to generate binary executable files;

[0034] Step S6: Generate disassembly code through a cross-compilation tool;

[0035] Step S7: Packaging the target file generated in step S5 into a file of a specific format.

[0036] As a further improvement of the method of the present invention: in the step S1, a directional C language bare metal stimulus is written, or a bare metal system-level random C language stimulus is generated by a tool.

[0037] As a further improvement of the method of the present invention: in the step S2, according to the file configuration of the target CPU, one or more of the following are configured: a multi-core combination, a starting address for loading executable files, different storage types and their corresponding storage spaces, serial port types and serial port printing base addresses, and macros for switching on and off initialization of different design modules.

[0038] Compared with the prior art, the advantages of the present invention are:

[0039] The bare metal system-level stimulus cross-compilation system and compilation method of the present invention flexibly and efficiently realizes the cross-compilation of bare metal system-level stimulus for a specific architecture platform, thereby improving the bare metal system-level simulation efficiency. In addition, the present invention can also flexibly compile and process random stimulus generated by third-party tools for simulation verification of different architecture platforms. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic diagram of the bare metal system-level verification process.

[0041] Figure 2 It is a schematic diagram of the topological structure principle of the bare metal system-level incentive cross-compilation system of the present invention.

[0042] Figure 3 It is a flow chart of the bare metal system level incentive cross-compilation method of the present invention. DETAILED DESCRIPTION

[0043] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0044] The bare metal system level verification process is as follows Figure 1 As shown, the bare metal system level incentive cross-compilation system of the present invention is Figure 1The compiler part of the present invention is used to convert the stimulus source code into a binary executable file, and then the binary executable file is directly used for bare metal system level simulation verification.

[0045] The bare metal system-level incentive cross-compilation system of the present invention is a multi-core bare metal system-level incentive cross-compilation system for a specific architecture, which is used to generate executable files that can be directly loaded into a simulation environment. Figure 2 As shown, the present invention includes a test stimulus module, a library file module, a target CPU configuration module, a compile link file module and a compile environment analysis assembly module.

[0046] The test stimulus module includes a stimulus source code unit, and the stimulus source code unit is directly used to write and store directional and random stimulus for corresponding bare metal system-level verification function points.

[0047] The library file module is used to implement the functions of the bare metal boot program and stimulate the common functions in the development process.

[0048] The CPU core configuration module is used to implement the target CPU configuration.

[0049] The compile link module includes a compile link file and a compile tool. The compile link file is used to describe the linking method of the data segment, code segment, stack segment, BSS segment, etc. in the executable file generated in different loading modes. The compile tool is used for cross-compilation of a specific platform architecture, and is used to parse the binary file to generate a disassembled code that can be used for debugging.

[0050] The compilation environment parsing assembly module is used to parse the configurations of the test stimulus module, library file module, and CPU kernel configuration module to generate corresponding page table files, Makefile files, and target files, and assemble them to generate executable binary files.

[0051] In a specific application example, the page table file describes the mapping relationship between memory logical pages and physical page frames. During the operation of the simulation environment, the CPU loads the program into the specified address space in the memory according to the generated page table.

[0052] In a specific application example, the generated Makefile file parses the stimulus file, initialization file, configuration file and required library files required to be compiled into the Makefile file to realize the compilation of a specific stimulus.

[0053] In a specific application example, the target file includes a target generated file of all related source files.

[0054] The compilation environment parsing assembly module finally combines the above files and assembles them to generate an executable binary file.

[0055] In a specific application example, the stimulus content of the stimulus source code unit may be in the form of a C language program; according to actual needs, it may further include a SV (system verilog) file for verification of specific function points.

[0056] In a specific application example, the library file module includes an architecture register configuration and initialization unit, a design module controller register and peripheral initialization unit, and a common function unit.

[0057] In a specific application example, since the stimulus in the bare metal system-level simulation cannot directly call the C standard library, the present invention implements some common functions through the library file module, such as: printing function, search function, lock function, register read and write function, waiting and delay function, etc.

[0058] In specific application examples, the library file module can also be redeveloped according to actual needs, based on the architecture and verification requirements of the target CPU to meet different actual needs.

[0059] In a specific application example, the CPU configuration module formats different configurations of multi-core combinations in the target CPU. For example, in actual use, the main configuration contents include the number of cores, core ID, the base address for stimulating loading from DRAM, the base address for stimulating loading from flash, the storage space type and its corresponding valid address range, the serial port type and the serial port base address for printing, and one or more of some other specific macro switches. By modifying and configuring the above-mentioned contents in this module, a target CPU configuration file with multiple different combinations can be quickly implemented.

[0060] In a specific application example, the present invention further illustrates the content of the invention by taking armv8 as the target architecture platform. Figure 2 As shown, when the compiled stimulus starts simulation, the first thing started is Figure 2 The CPU core configuration module, architecture register configuration and initialization unit, design module controller register and peripheral initialization unit in the armv8 cpu core related code and memory initialization, module controller initialization and other peripheral initialization code; then the common function unit, the source code of the test stimulus module (including the main function code) and other common code calls. Among them, the module initialization code can adjust its calling position as needed; it can be called after the kernel is initialized or after entering the main function.

[0061] The present invention further provides a method based on the above

[0062] The specific implementation process steps of the multi-core bare metal system-level incentive cross-compilation environment are as follows:

[0063] Step S1: forming a bare metal incentive;

[0064] Write targeted C language bare metal stimulus, or use tools to generate bare metal system-level random C language stimulus.

[0065] Step S2: configuring a configuration file for a specific target CPU;

[0066] The target CPU file configuration can be performed according to the needs, such as configuring multi-core (by configuring core ID and core number) combination, the starting address of executable file loading, configuring different storage types and their corresponding storage space, serial port type and serial port printing base address, configuring macros for switching on and off initialization of different design modules, etc.

[0067] Step S3: compile library files;

[0068] It mainly implements specific architecture register initialization, multi-core startup handler, and specific module initialization configuration including: enabling L2Cache, enabling L3Cache, initializing the storage management unit, initializing the serial port, etc.

[0069] Furthermore, the library file also includes some common functions that are frequently called during bare metal incentive development, such as: printing function, search function, lock function, register read and write function, wait and delay function, etc.

[0070] Step S4: compile link files according to different program loading modes.

[0071] Step S5: Use Phyton language to write an assembly tool, parse the above files, generate a Makefile file, a page table file, and a target file for a specific stimulus, and assemble them to generate a binary executable file.

[0072] Step S6: Generate disassembly code through a cross-compilation tool.

[0073] Step S7: Use Python language to write a post-processing tool to package the target file generated in step 5 into a file of a specific format, such as a HEX file.

[0074] In a specific application example, the tools described in the compilation environment formed by the above system are mainly implemented in Python language, directly realizing the management of bare metal system-level stimulus cross-compilation environment. According to the CPU architecture to be verified and the function points to be verified, the bare metal test stimulus source files, CPU configuration files, library files, compilation and linking script files, page table generation tools and cross-compilation tools based on C language that constitute the stimulus cross-compilation environment can also be configured to finally realize the generation of bare metal system-level stimulus.

[0075] The simulation program generated by the compilation environment formed by the above system of the present invention can be used not only in the soft simulation environment but also in the hardware simulation accelerator platform and the FPGA platform.

[0076] As a preferred embodiment, the present invention also provides a configurable compile script, a configuration script required to generate a target file, and a link script. For example, to compile a random stimulus generated by a third-party tool, it is necessary to load and link the third-party library file and the corresponding configuration source code. In this case, it is only necessary to create a compile script in the source code folder to define the required content, and then turn on a macro switch to compile directly without batch modification of the configuration.

[0077] like Figure 3 As shown, a post-processing tool may also be included, which is implemented in Python language. After setting parameters such as memory access width and memory access base address, the executable file generated by the assembly tool can be converted into an executable file that can be directly loaded into the corresponding simulation environment.

[0078] like Figure 3 As shown, the present invention can realize batch compilation of multiple test stimuli by configuring the parameters required for different stimuli and projects during the compilation process.

[0079] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.

Claims

1. A bare metal system-level incentive cross-compilation system, characterized in that: include: A test stimulus module, used to write and store directed and random stimulus for corresponding bare metal system-level verification function points, wherein the bare metal system-level verification is used to verify the connection relationship between modules on the chip and the system-level protocol; Library file module, used to implement the bare metal boot program functions and stimulate the common functions in the development process; CPU kernel configuration module, used to implement target CPU configuration; Compile and link modules, which are used to describe the linking method of executable files and parse binary files to generate disassembled codes that can be used for debugging; The compilation environment parsing assembly module is used to parse the configuration to generate the corresponding files, and assemble them to generate executable binary files.

2. The bare metal system-level incentive cross-compilation system according to claim 1, characterized in that: The compile and link module includes a compile and link file and a compile tool; the compile and link file is used to describe the link method in the executable file generated in different loading modes; the compile tool is used for cross-compilation of a specific platform architecture, and is used to parse the binary file to generate disassembly code that can be used for debugging.

3. The bare metal system-level incentive cross-compilation system according to claim 2, characterized in that: The linking method is the linking method of the data segment, code segment, stack segment, and BSS segment in the execution file.

4. The bare metal system-level incentive cross-compilation system according to claim 1, 2 or 3, characterized in that: The compilation environment parsing assembly module is used to parse the configurations of the test stimulus module, library file module, and CPU kernel configuration module to generate corresponding page table files, Makefile files, and target files, and assemble them to generate executable binary files.

5. The bare metal system-level incentive cross-compilation system according to claim 4, characterized in that: The page table file describes the mapping relationship between the memory logical page and the physical page frame. During the operation of the simulation environment, the CPU loads the program into the specified address space in the memory according to the generated page table file.

6. The bare metal system-level incentive cross-compilation system according to claim 4, characterized in that: The generated Makefile file parses the stimulus file, initialization file, configuration file and required library files to be compiled into the Makefile file to realize the compilation of specific stimulus.

7. The bare metal system-level incentive cross-compilation system according to claim 4, characterized in that: The target file includes the target generated files of all related source files.

8. The bare metal system-level incentive cross-compilation system according to claim 1, 2 or 3, characterized in that: The stimulus content of the stimulus source code unit is in the form of a C language program.

9. The bare metal system-level incentive cross-compilation system according to claim 8, characterized in that: Also included are SV files for specific function point verification.

10. The bare metal system-level incentive cross-compilation system according to claim 1, 2 or 3, characterized in that: The library file module includes an architecture register configuration and initialization unit, a design module controller register and peripheral initialization unit, and a common function unit.

11. The bare metal system-level incentive cross-compilation system according to claim 10, characterized in that: The shared function unit includes a printing function, a search function, a lock function, a register read and write function, and a wait and delay function.

12. The bare metal system-level incentive cross-compilation system according to claim 1, 2 or 3, characterized in that: It also includes a post-processing tool, which is implemented in Python language. After setting the memory access width and memory access base address parameters, it converts the executable file generated by the assembly tool into an executable file that is directly loaded into the corresponding simulation environment.

13. A bare metal system-level incentive cross-compilation method, characterized in that the steps include: Step S1: forming a bare metal stimulus for a corresponding bare metal system level verification, wherein the bare metal system level verification is used to verify the connection relationship between modules on the chip and the system level protocol; Step S2: configuring a configuration file for a specific target CPU; Step S3: writing a library file; the library file is used to implement the functions of the bare metal boot program and the common functions in the incentive development process; Step S4: compile link files according to different program loading methods; Step S5: using a compilation tool to parse the above files, generate files and assemble them to generate binary executable files; the generated files are Makefile files, page table files, and target files for specific incentives, and assemble them to generate binary executable files; Step S6: Generate disassembly code through a cross-compilation tool; Step S7: Packaging the generated file in step S5 into a file in a specific format.

14. The bare metal system level incentive cross-compilation method according to claim 13, characterized in that: In the step S1, a directional C language bare metal stimulus is written, or a bare metal system-level random C language stimulus is generated by a tool.

15. The bare metal system level incentive cross-compilation method according to claim 13, characterized in that: In step S2, according to the file configuration of the target CPU, one or more of the following are configured: multi-core combination, starting address for loading executable files, different storage types and their corresponding storage spaces, serial port types and serial port printing base addresses, and macros for switching on and off initialization of different design modules.