A file export method and system for FPGA prototype verification system
By defining reserved memory nodes and Ethernet communication in the FPGA prototype verification system, the problem of long file export time under peripheralless IO devices or IO interfaces is solved, high-speed export of files is achieved, and verification efficiency is improved.
Patent Information
- Application Number
- CN202210468101.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2042-04-29
AI Technical Summary
When the existing FPGA prototype verification system does not have peripheral IO devices or IO interfaces, the file export time is too long, which seriously affects the verification efficiency.
By defining reserved memory nodes in the device tree file to store data files that need to be exported, and using Ethernet communication to export the files from the FPGA prototype verification system to the host computer, file export control software is used to achieve high-speed data transmission.
In the absence of peripheral IO devices or IO interfaces, it realizes convenient and high-speed export of files, significantly shortens the export time, and improves the efficiency of function verification and performance verification of the CPU core and memory access system.
Smart Images

Figure CN114757134B
Abstract
Description
Technical Field
[0001] This invention relates to prototype verification systems in the field of integrated circuit design, and more specifically to a file export method and system for FPGA prototype verification systems. Background Technology
[0002] With the continuous development of semiconductor technology and the increasing demand for high-performance computing, the complexity of CPU (Central Processing Unit) design is constantly increasing, leading to higher requirements for verification platforms. CPU chip prototype verification systems built on FPGA (Field Programmable Gate Array) can reflect the chip's true performance, discover real bugs, and have faster running speeds compared to software simulation and hardware simulation accelerators, making them one of the important methods for CPU chip verification.
[0003] An FPGA prototyping system typically consists of one or more FPGA prototyping boards and their daughter cards, and can also connect to a host computer, server, and other peripheral I / O devices. When the verification target of the FPGA prototyping system is the CPU core and memory access system, peripheral I / O devices such as hard drives are generally not required; only a memory daughter card used as memory needs to be inserted into the FPGA platform to complete the verification target. When using this type of verification system, the method used is as follows: the bootloader uboot, operating system kernel, device tree file, and file system are stored in an SD card, SRAM daughter card, or FLASH chip. After the FPGA prototyping system is reset, the bootloader uboot is first loaded into memory and executed. Then, under the guidance of the bootloader uboot, the operating system kernel, device tree file, and file system are loaded into memory. Since there is no hard drive, the operating system kernel and file system run in a RAMDISK built in memory. After the operating system successfully boots, the functionality and performance of the CPU core and memory access system are verified by executing test programs in the file system within the operating system environment.
[0004] When using an FPGA prototype verification system without peripheral I / O devices or I / O interfaces to verify the CPU core and memory access system, there is a need to export files, mainly in two situations: (1) when an error occurs during program execution, it is necessary to export the file generated and stored in memory when the program fails to run, in order to analyze the design defects of the CPU core and memory access system; (2) when it is necessary to analyze the performance of the CPU core and memory access system, it is also necessary to export the file generated and stored in memory when the program finishes execution. Since the FPGA prototype verification system without peripheral I / O devices does not have hard disks or other I / O devices, nor USB or PCIe I / O interfaces, it is not possible to directly export the file through I / O devices or I / O interfaces. Currently, for FPGA prototype verification systems without peripheral I / O devices or I / O interfaces, the main method for exporting files is: in the operating system environment, perform a printing operation on the file, output the file to the serial port debugging software of the host computer through the serial port, and then save the file through the serial port debugging software. However, this method has the drawback that the serial port transmission rate is too slow, and the printing time is long when the file is too large. As CPU designs become increasingly larger, files generated during FPGA prototyping system-level testing can exceed 10MB in size. Taking a common serial port baud rate of 9600bps as an example, printing one byte requires sending at least ten bits. Assuming a 10MB file needs to be printed, the time required would be approximately 3-4 hours. If the prototyping system is verifying a CPU with hundreds of millions of gates, the simulation speed may be less than 10MHz, and the serial port baud rate will be far lower than 9600bps. This means the time spent printing the file would be significantly longer than 3-4 hours, severely reducing the efficiency of the verification work and negatively impacting the chip verification schedule. Therefore, to address the problem of slow file export in FPGA prototyping systems without peripheral I / O devices or I / O interfaces, it is necessary to research a convenient and fast method for exporting files from memory. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a file export method and system for FPGA prototype verification system, which can conveniently and quickly export files stored in memory to host computer or server without the presence of peripheral I / O devices or I / O interfaces in FPGA prototype verification system, thereby shortening file export time and improving the efficiency of functional and performance verification of design code to be verified.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0007] A file export method for an FPGA prototyping system includes:
[0008] Step S1: Download the design under test to the FPGA prototype verification system;
[0009] Step S2: Use the device tree file to boot the host computer's operating system. The memory nodes in the device tree corresponding to the device tree file contain child nodes defined as reserved memory. The child nodes are used to reserve a contiguous memory space that is not used by the operating system for storing the data file to be output.
[0010] Step S3: In the host computer's operating system, move the data files to be exported to the reserved memory space;
[0011] Step S4: Send a file export command to the FPGA prototype verification system to obtain the data file to be exported.
[0012] Optionally, sending the file export command to the FPGA prototype verification system in step S4 is implemented through file export control software running on the host computer. The execution steps of the file export control software include:
[0013] Step S4.1: Program initialization, complete the initialization configuration of network communication parameters and protocols, so that the file export control software and the FPGA prototype verification system can communicate via Ethernet;
[0014] Step S4.2: Receive the user input of information about the data file to be exported, including: the name of the data file file_name, the starting address of the data file in the memory of the FPGA prototype verification system file_addr, and the file size of the data file in bytes file_size;
[0015] Step S4.3: Create a file file_name_PC and its corresponding file counter pointer pointer_file_name_PC based on the data file name file_name, and create an integer variable receive_count initialized to 0 to record the number of file data bytes received from the FPGA prototype verification system;
[0016] Step S4.4: Based on the required file command format for the data file to be exported, create an export file command and send it to the FPGA prototype verification system via the Ethernet daughter card;
[0017] Step S4.5: Wait for the FPGA prototype verification system to return the file export data packet, and extract the file data of the specified size n bytes according to the start and end characters of the file export data packet;
[0018] Step S4.6: Determine whether the difference between the file size file_size and the integer variable receive_count is greater than or equal to n bytes. If it is true, proceed to step S4.7; otherwise, proceed to step S4.8.
[0019] Step S4.7: Write all n bytes of received file data to file file_name_PC using the file count pointer pointer_file_name_PC, increment the integer variable receive_count by n, and then jump to step S4.5.
[0020] Step S4.8: Write the first file_size - receive_count bytes of the received file data into the file file_name_PC using the file counter pointer pointer_file_name_PC, and then jump to step S4.9; where file_size - receive_count is the difference between the file size file_size and the integer variable receive_count;
[0021] Step S4.9: Close the file counter pointer pointer_file_name_PC, and display a message to the user on the host computer terminal indicating that the data file export is complete and terminate the program execution.
[0022] Optionally, the file data of size n bytes specified in step 4.5 refers to 54 bytes of file data.
[0023] Optionally, in step S3, moving the data files to be exported to the reserved memory space in the operating system is achieved by a data moving program running in the host computer's operating system. The execution steps of the data moving program include:
[0024] Step S3.1: Create a file pointer pointer_file_name pointing to the data file file_name to be exported; create an integer variable write_count and initialize it to 0;
[0025] Step S3.2: Read 1 byte of data from the data file file_name using the file pointer pointer_file_name and store it in the character variable write_data;
[0026] Step S3.3: Write the data of the character variable write_data into the reserved memory space;
[0027] Step S3.4: Increment the integer variable write_count by 1;
[0028] Step S3.5: Determine whether the data file file_name has been read completely by checking the file pointer pointer_file_name. If it has been read completely, proceed to step S3.6; otherwise, proceed to step S3.2.
[0029] Step S3.6: Close the file pointer pointer_file_name, print the integer variable write_count to the operating system terminal, and end the program execution. The integer variable write_count is the file size file_size of the data file file_name.
[0030] Optionally, step S3.3 includes: calling the devmem function provided by the operating system to write the data of the character variable write_data into the reserved memory space. The devmem function contains two parameters: the first parameter is the data to be written to memory, and the second parameter is the address of the data to be written. The value of the first parameter is set to the character variable write_data, and the value of the second parameter is the sum of the starting address of the data file file_name in the memory of the FPGA prototype verification system, file_addr, and the integer variable write_count.
[0031] Furthermore, the present invention also provides a file export system for an FPGA prototyping system, comprising a microprocessor and a memory interconnected thereto, the microprocessor being programmed or configured to perform the steps of the file export method for the FPGA prototyping system.
[0032] Furthermore, the present invention also provides a computer-readable storage medium storing a computer program that is programmed or configured by a microprocessor to perform the steps of the file export method for the FPGA prototyping system.
[0033] Furthermore, the present invention also provides an FPGA prototype verification system for applying the file export method for the FPGA prototype verification system described above, comprising a host computer, an Ethernet daughter card, and an FPGA chip. The host computer is connected to the FPGA chip via the Ethernet daughter card. The FPGA chip includes a verification function unit and a verified unit. The verification function unit includes:
[0034] The media access control module is used to implement the data link layer for Ethernet communication.
[0035] Receive FIFO to buffer input file export commands;
[0036] Send a FIFO to buffer the output data file;
[0037] The control state machine is used to analyze and verify the received file export command, and after the file export command has been analyzed and verified, it controls the DFI interface conversion module and memory controller to realize the data file output;
[0038] FPGA DDR PHY module, used to connect to the memory daughter card;
[0039] The DFI interface conversion module is used to implement interface conversion between the FPGA DDR PHY module, the verified unit, the memory controller, and the control state machine.
[0040] The memory controller is used to send read requests from the control state machine to the verified unit via the DFI interface conversion module, and to send file data read from memory by the verified unit back to the control state machine via the DFI interface conversion module; the memory controller has an AXI interface and a DFI interface, the AXI interface is connected to the control state machine, and the DFI interface is connected to the uplink DFI interface of the DFI interface conversion module.
[0041] The division calculation module is used to perform division calculations for the control state machine to determine the number of memory reads (read_num).
[0042] The clock control module is used to provide clock signals to the unit being verified.
[0043] The media access control module is connected to the receive FIFO and the transmit FIFO respectively. The output of the receive FIFO is connected to the input of the control state machine. The control state machine is interconnected with the division calculation module, the memory controller, and the DFI interface conversion module. The control state machine is also connected to the control terminal of the clock control module. The DFI interface conversion module is also connected to the verified unit, the FPGA DDR PHY module, and the memory controller. The memory controller is connected to the transmit FIFO.
[0044] Optionally, the control state machine includes eight states, S0 to S7, where: State S0 is the initial state of the control state machine. Upon reset, the control state machine is in state S0. When the control state machine receives a file export command from the FIFO, it jumps from state S0 to state S1; otherwise, it remains in state S0. State S1 involves the control state machine analyzing and verifying the received file export command according to its format. If the verification passes, it jumps from state S1 to state S2; otherwise, it jumps back to state S0. State S2 involves the control state machine calculating the number of memory reads (read_num) and jumping to state S3. State S3 involves the control state machine listening for any incomplete memory access requests from the verified unit. If no incomplete memory access requests are found, the control state machine jumps to state S4; otherwise, it remains in state S3. State S4 involves the control state machine controlling the clock... The enable signal output by the control module is set to 1, and the working mode of the DFI interface conversion module is set to debug mode. In state S5, the control state machine fills data into the transmit FIFO according to the file export data packet format and a specific order. If the data filling is completed, it jumps to state S6; otherwise, it returns to state S5. In state S6, under the control of the control state machine, the data in the transmit FIFO is output to the MAC module, which then sends it to the Ethernet daughter card and finally transmits it to the host computer. Then, the control state machine compares the value of read_count (the number of times memory has been read) with the value of read_num (the number of times memory needs to be read). If they are equal, it jumps to state S7; otherwise, it jumps back to state S5. In state S7, the control state machine sets the enable signal output by the clock control module to 0, sets the working mode of the DFI interface conversion module to normal mode, and jumps to state S0.
[0045] Optionally, the unit to be verified includes a clock module, a CPU core, and a memory access module. The input terminal of the clock module is connected to the output terminal of the clock control module in the verification function unit. The output terminal of the clock module is connected to the clock signal output terminals of the CPU core and the memory access module, respectively. The CPU core and the memory access module are interconnected, and the memory access module is connected to the DFI interface conversion module in the verification function unit.
[0046] Compared with existing technologies, the present invention has the following main advantages: The method of the present invention includes downloading the design under test to an FPGA prototyping system; using a device tree file to boot the operating system of the host computer, wherein the memory nodes in the device tree contain child nodes defined as reserved memory, and the child nodes are used to reserve a contiguous memory space not used by the operating system for storing the data file to be exported; moving the data file to be exported to the reserved memory space in the operating system of the host computer; and sending a file export command to the FPGA prototyping system to obtain the data file to be exported. The present invention enables the FPGA prototyping system to conveniently and quickly export files stored in memory to a host computer or server without external I / O devices or I / O interfaces, shortening the file export time and improving the efficiency of functional and performance verification of the design code to be verified. Attached Figure Description
[0047] Figure 1 This is a schematic diagram of the basic process of the method in an embodiment of the present invention.
[0048] Figure 2 This is a schematic diagram of the execution flow of the data transfer program in an embodiment of the present invention.
[0049] Figure 3 This is a schematic diagram of the execution flow of the data transfer program in an embodiment of the present invention.
[0050] Figure 4 This is a schematic diagram of the file export command format in an embodiment of the present invention.
[0051] Figure 5 This is a schematic diagram of the data file format in an embodiment of the present invention.
[0052] Figure 6 This is a schematic diagram of the FPGA prototype verification system in an embodiment of the present invention.
[0053] Figure 7 This is a schematic diagram of the state switching of the control state machine in an embodiment of the present invention. Detailed Implementation
[0054] To make the technical problems solved, the technical solutions, and the beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0055] like Figure 1 As shown, the file export method for the FPGA prototype verification system in this embodiment includes:
[0056] Step S1: Download the design under test to the FPGA prototype verification system;
[0057] Step S2: Use the device tree file to boot the host computer's operating system. This device tree file is a specially modified device tree file. The special modification means that the memory nodes in the device tree corresponding to the device tree file contain child nodes defined as reserved memory (defined with the keyword reserve-memory). The child nodes are used to reserve a contiguous memory space that is not used by the operating system to store the data file to be output. Undoubtedly, the size of the reserved memory space must be larger than the size of the data file to be output.
[0058] Step S3: In the host computer's operating system, move the data files to be exported to the reserved memory space;
[0059] Step S4: Send a file export command to the FPGA prototype verification system to obtain the data file to be exported.
[0060] In step S4 of this embodiment, sending the file export command to the FPGA prototype verification system is implemented through file export control software running on the host computer. The file export control software is used to send the file export command to the FPGA prototype verification system and receive the file data output by the FPGA prototype verification system. The file export control software includes a network communication program library, which mainly includes software drivers and hardware abstraction layer interfaces for Ethernet communication initialization, reading and sending Ethernet data, and can realize Ethernet communication between the host computer and the FPGA prototype verification system. By using the file export control software to send the file export command to the FPGA prototype verification system, the data file to be exported is obtained.
[0061] like Figure 2 As shown, the execution steps of the file export control software include:
[0062] Step S4.1: Program initialization, complete the initialization configuration of network communication parameters and protocols, so that the file export control software and the FPGA prototype verification system can communicate via Ethernet;
[0063] Step S4.2: Receive the user input of information about the data file to be exported, including: the name of the data file file_name, the starting address of the data file in the memory of the FPGA prototype verification system file_addr, and the file size of the data file in bytes file_size;
[0064] Step S4.3: Create a file file_name_PC and its corresponding file counter pointer pointer_file_name_PC based on the data file name file_name, and create an integer variable receive_count initialized to 0 to record the number of file data bytes received from the FPGA prototype verification system;
[0065] Step S4.4: Based on the required file command format for the data file to be exported, create an export file command and send it to the FPGA prototype verification system via the Ethernet daughter card;
[0066] Step S4.5: Wait for the FPGA prototype verification system to return the file export data packet, and extract the file data of the specified size n bytes according to the start and end characters of the file export data packet;
[0067] Step S4.6: Determine whether the difference between the file size file_size and the integer variable receive_count is greater than or equal to n bytes. If it is true, proceed to step S4.7; otherwise, proceed to step S4.8.
[0068] Step S4.7: Write all n bytes of received file data to file file_name_PC using the file count pointer pointer_file_name_PC, increment the integer variable receive_count by n, and then jump to step S4.5.
[0069] Step S4.8: Write the first file_size - receive_count bytes of the received file data into the file file_name_PC using the file counter pointer pointer_file_name_PC, and then jump to step S4.9; where file_size - receive_count is the difference between the file size file_size and the integer variable receive_count;
[0070] Step S4.9: Close the file counter pointer pointer_file_name_PC, and display a message to the user on the host computer terminal indicating that the data file export is complete and terminate the program execution.
[0071] In step 4.5, the size n bytes of file data can be specified as needed. For example, as an optional implementation, in this embodiment, the size n bytes of file data specified in step 4.5 refers to 54 bytes of file data.
[0072] In step S3 of this embodiment, moving the data file to be exported to the reserved memory space in the operating system is achieved by a data moving program running in the host computer's operating system. The data moving program continuously writes the file to be exported into the reserved physical memory. In this embodiment, the data moving program is a C language program. The input parameters of the data moving program include the name of the file to be exported (file_name) and the starting address of the reserved physical memory (file_addr). The file to be exported is moved to the reserved memory space using the data moving program in the operating system. Figure 3 As shown, the execution steps of the data migration procedure include:
[0073] Step S3.1: Create a file pointer pointer_file_name pointing to the data file file_name to be exported; create an integer variable write_count and initialize it to 0;
[0074] Step S3.2: Read 1 byte of data from the data file file_name using the file pointer pointer_file_name and store it in the character variable write_data;
[0075] Step S3.3: Write the data of the character variable write_data into the reserved memory space;
[0076] Step S3.4: Increment the integer variable write_count by 1;
[0077] Step S3.5: Determine whether the data file file_name has been read completely by checking the file pointer pointer_file_name. If it has been read completely, proceed to step S3.6; otherwise, proceed to step S3.2.
[0078] Step S3.6: Close the file pointer pointer_file_name, print the integer variable write_count to the operating system terminal, and end the program execution. The integer variable write_count is the file size file_size of the data file file_name.
[0079] In this embodiment, step S3.3 includes: calling the devmem function provided by the operating system to write the data of the character variable write_data into the reserved memory space. The devmem function contains two parameters. The first parameter is the data to be written to memory, and the second parameter is the address of the data to be written. The value of the first parameter is set to the character variable write_data, and the value of the second parameter is the sum of the starting address of the data file file_name in the memory of the FPGA prototype verification system, file_addr, and the integer variable write_count.
[0080] See Figure 4 In this embodiment, the file export command is a frame of data with a specific format, containing 5 data fields. From the highest bit to the lowest bit, they are the file export command start character, the file's starting address in memory (file_addr), the file size in bytes (file_size), zero padding, and the file export command end character. The file export command start character is 4 bytes, the file's starting address in memory (file_addr) is 8 bytes, the file size (file_size) is 8 bytes, the zero padding is 40 bytes, and the file export command end character is 4 bytes.
[0081] See Figure 5 In this embodiment, the format of the file export data packet is as follows: from the highest bit to the lowest bit, they are the file export data packet start character, the file data, and the file export data packet end character. The file export data packet start character is 4 bytes, the file data is 56 bytes, and the file export data packet end character is 4 bytes.
[0082] In summary, the file export method for the FPGA prototype verification system described in this embodiment processes the file content to be exported, outputs the file content in hexadecimal ASCII format to a new content file, and the new file's content format is the write address, the number of bits to be written, and the content to be written. The content of the new content file is read line by line and written to the corresponding memory address using Devmem. Finally, the data successfully read from memory is processed, transcoded again, and output to a new file, restoring the file to be exported from the prototype system. This enables file export from the FPGA prototype verification system, meeting the requirement for rapid file output in the FPGA prototype verification system.
[0083] Furthermore, the present invention also provides a file export system for an FPGA prototyping system, comprising a microprocessor and a memory interconnected thereto, the microprocessor being programmed or configured to perform the steps of the file export method for the FPGA prototyping system.
[0084] Furthermore, the present invention also provides a computer-readable storage medium storing a computer program that is programmed or configured by a microprocessor to perform the steps of the file export method for the FPGA prototyping system.
[0085] like Figure 6 As shown, the present invention also provides an FPGA prototype verification system for use in applications, including a file export method for an FPGA prototype verification system, comprising a host computer, an Ethernet daughter card, and an FPGA chip (on an FPGA prototype verification board). The host computer is connected to the FPGA chip via the Ethernet daughter card. The FPGA chip includes a verification function unit and a unit to be verified (the design to be verified). The verification function unit includes:
[0086] The Media Access Control (MAC) module is used to implement the data link layer for Ethernet communication.
[0087] Receive FIFO to buffer input file export commands;
[0088] Send a FIFO to buffer the output data file;
[0089] The control state machine is used to analyze and verify the received file export command, and after the file export command has been analyzed and verified, it controls the DFI interface conversion module and memory controller to realize the data file output;
[0090] FPGA DDR PHY module, used to connect to the memory daughter card;
[0091] The DFI interface conversion module is used to implement interface conversion between the FPGA DDR PHY module, the verified unit, the memory controller, and the control state machine.
[0092] The memory controller is used to send read requests from the control state machine to the verified unit through the DFI interface conversion module, and to send file data read from memory by the verified unit back to the control state machine via the DFI interface conversion module. The memory controller has an AXI interface and a DFI interface. The AXI interface is connected to the control state machine, and the DFI interface is connected to the uplink DFI interface of the DFI interface conversion module.
[0093] The division calculation module is used to perform division calculations for the control state machine to determine the number of memory reads (read_num).
[0094] The clock control module is used to provide clock signals to the unit being verified.
[0095] The media access control module is connected to the receive FIFO and the transmit FIFO respectively. The output of the receive FIFO is connected to the input of the control state machine. The control state machine is connected to the division calculation module, the memory controller, and the DFI interface conversion module respectively. The control state machine is also connected to the control terminal of the clock control module. The DFI interface conversion module is also connected to the verified unit, the FPGA DDR PHY module, and the memory controller respectively. The memory controller is connected to the transmit FIFO.
[0096] See Figure 6 As an optional implementation, in this embodiment, the host computer and the Ethernet daughter card are connected via an RJ45 network cable. Alternatively, fiber optic cables can be used as needed. See also Figure 6 In this embodiment, the MAC module and the Ethernet daughter card are connected via the MII interface.
[0097] In this embodiment, the host computer is a server or other computer device with an RJ45 interface connector, used to run file export control software. Under the action of the file export control software, the host computer sends file export commands to the FPGA prototype verification system through the RJ45 network cable and Ethernet daughter card, and receives and saves the file data returned by the FPGA prototype verification system.
[0098] The Ethernet daughter card is used for processing and transmitting physical layer signals of the Ethernet protocol. In this embodiment, the Ethernet daughter card consists of an Ethernet PHY chip, an FMC (FPGA Mezzanine Card) interface connector, an RJ45 interface connector, and an Ethernet transformer. The Ethernet daughter card connects to the FMC interface connector of the FPGA prototyping system via its FMC interface connector, and the Ethernet daughter card connects to the host computer via an RJ45 interface connector and an RJ45 cable. The Ethernet PHY chip is used to implement the physical layer of Ethernet communication. The MII interface (Medium Independent Interface) of the Ethernet PHY chip... The Independent Interface (IMI) pin is connected to the FMC interface on the Ethernet daughter card, which in turn connects to the MAC logic module inside the FPGA chip. The Ethernet electrical signal transceiver interface of the Ethernet PHY chip is connected to the RJ45 connector via an Ethernet transformer. The Ethernet PHY chip performs parallel-to-serial conversion, encoding, and digital-to-analog conversion on the parallel data received from the MAC module, and then sends it to the host computer via the Ethernet transformer, RJ45 interface connector, and RJ45 cable. Conversely, when the Ethernet PHY chip receives the serial signal sent by the host computer via the RJ45 cable, RJ45 interface connector, and Ethernet transformer, it performs analog-to-digital conversion, encoding, and serial-to-parallel conversion on the received serial signal, and then sends it to the MAC module via the MII interface.
[0099] The Media Access Control (MAC) module is used to implement the data link layer of Ethernet communication. In this embodiment, the MAC module has an MII interface, a data sending interface, and a data receiving interface. The MII interface of the MAC module is connected to the pin of the FPGA chip, and then connected to the FMC interface connector of the FPGA prototype verification system through the PCB wiring of the FPGA prototype verification system, so as to realize the connection with the MII interface of the PHY chip in the Ethernet daughter card.
[0100] The receive FIFO is a hardware functional module within the FPGA chip on the FPGA prototype verification board. The input port of this module is connected to the MAC module (e.g., ...). Figure 6 As shown by label 1 in the diagram, the output port of this module is connected to the control state machine (e.g., ...). Figure 6 As shown in reference numeral 3, it also has a counter that counts the number of bytes of input data; the input ports of the receiving FIFO include the rx_fifo_data_in signal port and the rx_fifo_data_in_valid signal port; the output ports of the receiving FIFO include the rx_fifo_data_out signal port and the rx_fifo_data_out_valid signal port; when the MAC module sets rx_fifo_data_in_valid to 1, the MAC module buffers the received file export command into the receiving FIFO through the rx_fifo_data_in signal port, and the counter counts the number of bytes of data input by the MAC module; when the counter value reaches 64 bytes, the receiving FIFO outputs the buffered data file export command to the control state machine through the rx_fifo_data_out signal port, sets the rx_fifo_data_out_valid signal to 1 to notify the control state machine to receive the data, and clears the counter value to zero.
[0101] The transmit FIFO is a hardware functional module within the FPGA chip on the FPGA prototype verification board. The output port of this module is connected to the MAC module (e.g., ...). Figure 6 (Ref. 2) The input port of this module is connected to the control state machine (e.g., ...). Figure 6(Ref. 4) The input ports of the transmitting FIFO include the tx_fifo_data_in signal port; the output ports of the transmitting FIFO include the tx_fifo_data_out signal port and the tx_fifo_data_out_valid signal port; the control state machine buffers the file export data packets into the transmitting FIFO through the tx_fifo_data_in signal port; when the control state machine sets the tx_fifo_data_out_valid signal to 1, the transmitting FIFO outputs its buffered file export data packets to the MAC module through the tx_fifo_data_out signal port.
[0102] The control state machine is a hardware functional module within the FPGA chip on the FPGA prototype verification board. It analyzes and verifies received file export commands, and after successful analysis and verification, controls the DFI interface conversion module and memory controller to output the data file. Analysis and verification involve the control state machine checking whether the corresponding byte bits of the received data contain the correct start and end characters of the file export command. If not, the verification is considered faulty; if the corresponding byte bits contain the correct start and end characters, the verification is considered successful, and the file's starting memory address (file_addr) and file size (file_size) are extracted according to the file export command format.
[0103] In this embodiment, the DFI interface conversion module is a hardware functional module operating within the FPGA chip on the FPGA prototype verification board. This DFI interface conversion module has three DFI interfaces: uplink DFI interface A, uplink DFI interface B, and downlink DFI interface. Uplink DFI interface A connects to the memory controller (e.g., ...). Figure 6 (5) The uplink DFI interface B connects to the memory access system in the design to be verified (e.g., ...). Figure 6 (Ref. 9 in the text) The downlink DFI interface connects to the FPGA DDR PHY module (e.g., ...). Figure 6 (Ref. 10); This DFI interface conversion module also has a query interface for receiving memory access completion status query signals from the design under test (e.g., ... Figure 6 (Ref. 6 in the text); This DFI interface conversion module also has an acknowledgment interface for outputting a listening acknowledgment signal (such as...). Figure 6(Ref. 7). The DFI interface conversion module has two working modes: normal and debug. In normal mode, the uplink DFI interface A is connected to the downlink DFI interface, thereby connecting the memory controller to the FPGA DDR PHY module. In debug mode, the uplink DFI interface B is connected to the downlink DFI interface, thereby connecting the memory access system in the design to be verified to the FPGA DDR PHY module (FPGA physical memory adapter module).
[0104] The memory controller is a hardware functional module within the FPGA chip on the FPGA prototype verification board. The memory controller has an AXI interface and a DFI interface. The AXI interface is connected to the control state machine (e.g., ...). Figure 6 (Ref. 13) The DFI interface is connected to the uplink DFI interface A of the DFI conversion module (e.g., ...). Figure 6 (5) The memory controller receives the AXI read request sent by the state machine through the AXI interface, converts the AXI read request into a DFI interface signal, and sends it to the uplink DFI interface A of the DFI interface conversion module through the DFI interface. When the DFI interface conversion module returns the file data read from memory through the uplink DFI interface A, the memory controller sends the read file data to the control state machine through the AXI interface.
[0105] like Figure 7 As shown, the control state machine includes eight states, S0 to S7, where:
[0106] State S0 is the initial state of the control state machine. When reset, the control state machine is in state S0. When the control state machine receives a file export command from the FIFO, the control state machine jumps from state S0 to state S1. Otherwise, it continues to remain in state S0.
[0107] State S1 refers to the state machine analyzing and verifying the received file export command according to the format of the file export command. If the verification passes, it jumps from state S1 to state S2; if the verification fails, it jumps to state S0.
[0108] State S2 is the state machine's calculation of the number of memory reads required (read_num), and then transitions to state S3. In this embodiment, the number of memory reads required (read_num) is stored in a register within the control state machine, and its reset value is 0. The method for calculating read_num is to use the file size (file_size) as the dividend and mc_data_width as the divisor, and call the division calculation unit to obtain the quotient and remainder (e.g., ...). Figure 6In the section labeled 11), if the remainder is zero, the number of memory reads required, read_num, is equal to the quotient; if the remainder is not zero, read_num is equal to quotient plus 1. Here, mc_data_width is the width of the memory controller's data line, calculated in bytes.
[0109] State S3 is where the control state machine listens for any incomplete memory access requests from the unit under test. If the unit under test has no incomplete memory access requests, the control state machine transitions to state S4; otherwise, it remains in state S3. Listening for incomplete memory access requests from the unit under test means that the control state machine sends a memory access completion status query signal to the DFI interface conversion module (e.g., ...). Figure 6 (6) The DFI interface conversion module queries whether the design under test has completed memory access and feeds back the query result to the control state machine (e.g., 6) by listening for the response signal. Figure 6 (Ref. 7); When the DFI interface conversion module is in debug mode, after the module sends the memory access request of the design under test to the FPGA DDR PHY module through the downlink DFI interface (e.g., ... Figure 6 (Referring to label 10) Set the access_memory_state register of the design under test (DUT) in this module to 0; When the FPGA DDR PHY module returns the memory access result to the DFI interface conversion module through the downlink DFI interface, set the access_memory_state register of the DUT to 1; When the DFI interface conversion module receives the DUT memory access completion status query signal, if the value of the access_memory_state register of the DUT is 0, the value of the feedback listening response signal is 1, indicating that there is a memory access failure request in the DUT; otherwise, the value of the feedback listening response signal is 0, indicating that there is no memory access failure request in the DUT.
[0110] State S4 is the control state machine setting the enable signal output by the clock control module to 1 and setting the operating mode of the DFI interface conversion module to debug mode; the clock control module is controlled by the control state machine shown (e.g., Figure 6 (Ref. 12 in the text) The enable signal output by the clock control module is output to the clock module of the design under test (e.g., ...). Figure 6 The number 8 in the diagram is used to control the clock signal output by this module to the CPU core and memory access system; when the enable signal is 1, the clock module can output the clock signal normally, and when the enable signal is 0, the clock module does not output a valid clock signal.
[0111] In state S5, the control state machine fills the data into the sending FIFO according to the file export data packet format and a specific order. If the data filling is complete, it jumps to state S6; otherwise, it returns to state S5.
[0112] The control state machine fills the transmit FIFO with data including the file data packet start symbol, file data, and file export data packet end symbol (e.g., ...). Figure 6 In section 4), the file export data packet start symbol and file export data packet end symbol are fixed values. The file data is data read from a specified address in memory by the control state machine through the memory controller. The control state machine fills data into the send FIFO in a specific order. This means that the state machine first fills the send FIFO with the file export data packet start symbol, then fills the send FIFO with the file data read from memory, and when the length of the data filled into the send FIFO reaches 56 bytes, the file export data packet end symbol is filled into the send FIFO, thus reaching the state where the data filling is complete. The control state machine includes a send data length register send_count, the reset value of send_count is 0, and the control state machine fills 1 byte of data into the send FIFO each time. After sending_count is incremented by 1, and once the data filling is complete, the control state machine sets the value of send_count to 0; file data is the data read by the control state machine from a specified address in memory through the memory controller. This means that the control state machine sends a memory read request to the memory controller. The memory address to be read is calculated by multiplying read_count and mc_data_width and then adding file_addr. read_count is a register in the control state machine. The reset value of read_count is 0. read_count is the cumulative number of times the state machine reads memory data through the memory controller. The read_count register is incremented by 1 after each memory read request is sent.
[0113] In state S6, under the control of the control state machine, the data in the FIFO is output to the MAC module, which then sends it to the Ethernet daughter card and finally transmits it to the host computer. Then, the control state machine compares the value of read_count (the number of times memory has been read) with the value of read_num (the number of times memory needs to be read). If they are equal, it jumps to state S7; otherwise, it jumps back to state S5.
[0114] State S7 controls the state machine to set the enable signal output by the clock control module to 0 (e.g., ...). Figure 6 (8) and set the working mode of the DFI interface conversion module to normal mode, and jump to the S0 state.
[0115] like Figure 7As shown, the unit to be verified (the design to be verified) in this embodiment includes a clock module, a CPU core, and a memory access module. The input terminal of the clock module is connected to the output terminal of the clock control module in the verification function unit. The output terminal of the clock module is connected to the clock signal output terminals of the CPU core and the memory access module respectively. The CPU core and the memory access module are interconnected, and the memory access module is connected to the DFI interface conversion module in the verification function unit.
[0116] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0117] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A file export method for an FPGA prototype verification system, characterized in that: include: Step S1: Download the design to be tested to the FPGA prototype verification system; Step S2: using the device tree file to guide the operating system of the host computer to start, the memory node in the device tree corresponding to the device tree file contains a sub-node defined as a reserved memory, and the sub-node is used to reserve a section of continuous memory space not used by the operating system for storing the data file to be output; Step S3: Moving the data files to be exported to the reserved memory space in the operating system of the host computer; Step S4: Send a file export command to the FPGA prototype verification system to obtain the data file to be exported; Sending the file export command to the FPGA prototype verification system in step S4 is implemented by the file export control software running in the host computer, and the execution steps of the file export control software include: Step S4.1: program initialization, completing the initialization configuration of network communication parameters and protocols, so that the file export control software and the FPGA prototype verification system can communicate via Ethernet; Step S4.2: receiving the information of the data file to be exported input by the user, including: the name of the data file file_name, the starting address file_addr of the data file in the memory of the FPGA prototype verification system, and the file size file_size of the data file in bytes; Step S4.3: Create a file file_name_PC and its corresponding file counting pointer pointer_file_name_PC according to the name file_name of the data file, and create an integer variable receive_count initialized to 0 to record the number of file data bytes received from the FPGA prototype verification system; Step S4.4: creating an export file command according to the file command format of the data file to be exported and sending it to the FPGA prototype verification system through the Ethernet daughter card; Step S4.5: Wait for the file export data packet returned by the FPGA prototype verification system, and extract the file data of the specified size n bytes according to the start character and end character of the file export data packet; Step S4.6: Determine whether the difference between the file size file_size and the integer variable receive_count is greater than or equal to n bytes. If so, jump to step S4.7; otherwise, jump to step S4.8; Step S4.7: Write all the received n-byte file data into the file file_name_PC through the file counting pointer pointer_file_name_PC, add n to the integer variable receive_count and jump to the step S4.5; Step S4.8: Write the first file_size-receive_count bytes of the received file data into the file file_name_PC through the file counting pointer pointer_file_name_PC, and jump to step S4.9; wherein file_size-receive_count is the difference between the file size file_size and the integer variable receive_count; Step S4.9: Close the file counting pointer pointer_file_name_PC, prompt the user through the host computer display terminal that the data file export is complete and end the program execution.
2. The file export method for FPGA prototype verification system according to claim 1, characterized in that: The file data of size n bytes specified in step 4.5 refers to 54 bytes of file data.
3. The file export method for FPGA prototype verification system according to claim 1, characterized in that: In step S3, the data files to be exported are moved to the reserved memory space in the operating system by a data moving program running in the operating system of the host computer. The execution steps of the data moving program include: Step S3.1: Create a file pointer pointer_file_name pointing to the data file file_name to be exported; create an integer variable write_count and initialize it to 0; Step S3.2: read 1 byte of data from the data file file_name through the file pointer pointer_file_name and store it in the character variable write_data; Step S3.3: Write the data of the character variable write_data into the reserved memory space; Step S3.4: increment the integer variable write_count by 1; Step S3.5: judging whether the data file file_name has been read through the file pointer pointer_file_name, if it has been read, jumping to step S3.6, otherwise jumping to step S3.2; Step S3.6: close the file pointer pointer_file_name, print the integer variable write_count on the operating system display terminal and end the program execution, wherein the integer variable write_count is the file size file_size of the data file file_name.
4. The file export method for FPGA prototype verification system according to claim 3, characterized in that: Step S3.3 includes: calling the devmem function provided by the operating system to write the data of the character variable write_data into the reserved memory space, the devmem function contains two parameters, the first parameter is the data to be written into the memory, and the second parameter is the address of the write data. The value of the first parameter is set to the character variable write_data, and the second parameter is set to the sum of the starting address file_addr of the data file file_name in the FPGA prototype verification system memory and the integer variable write_count.
5. A file export system for an FPGA prototype verification system, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the steps of the file export method for an FPGA prototype verification system as described in any one of claims 1 to 4.
6. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, characterized in that: The computer program is used to be programmed or configured by a microprocessor to execute the steps of the file export method for an FPGA prototype verification system as described in any one of claims 1 to 4.
7. An FPGA prototype verification system for applying the file export method for an FPGA prototype verification system as claimed in any one of claims 1 to 4, characterized in that: It includes a host computer, an Ethernet daughter card and an FPGA chip, wherein the host computer is connected to the FPGA chip via the Ethernet daughter card, and the FPGA chip includes a verification function unit and a verified unit, wherein the verification function unit includes: A media access control module, used to implement the data link layer of Ethernet communication; Receive FIFO, used to cache input file export commands; Send FIFO, used to cache output data files; A control state machine is used to analyze and verify the received file export command, and control the DFI interface conversion module and the memory controller to realize data file output after the file export command passes the analysis and verification; FPGA DDR PHY module, used to connect to the memory daughter card; DFI interface conversion module, used to realize interface conversion between FPGA DDR PHY module, verified unit, memory controller and control state machine; The memory controller is used to send the read request of the control state machine to the verified unit through the DFI interface conversion module, and send the file data read from the memory returned by the DFI interface conversion module from the verified unit to the control state machine; the memory controller has an AXI interface and a DFI interface, the AXI interface is connected to the control state machine, and the DFI interface is connected to the uplink DFI interface of the DFI interface conversion module; A division calculation module, used for performing division calculation for the control state machine to determine the number of times read_num of memory to be read; A clock control module, used for providing a clock signal to the unit to be verified; The media access control module is respectively connected to the receiving FIFO and the transmitting FIFO, the output end of the receiving FIFO is connected to the input end of the control state machine, the control state machine is respectively connected to the division calculation module, the memory controller, and the DFI interface conversion module, and the control state machine is connected to the control end of the clock control module, the DFI interface conversion module is also respectively connected to the verified unit, the FPGA DDR PHY module and the memory controller, and the memory controller is connected to the transmitting FIFO.
8. The FPGA prototype verification system according to claim 7, characterized in that: The control state machine includes eight states from state S0 to state S7, wherein: state S0 is the initial state of the control state machine, and the control state machine is in state S0 when reset. When the control state machine receives a file export command output by the receiving FIFO, the control state machine jumps from state S0 to state S1, otherwise it continues to remain in state S0; state S1 means that the control state machine analyzes and verifies the received file export command according to the format of the file export command, and if the verification passes, it jumps from state S1 to state S2, and if the verification fails, it jumps to state S0; state S2 is that the control state machine calculates the number of times read_num of memory to be read, and jumps to state S3; state S3 is that the control state machine monitors whether there is an unfinished memory access request of the verified unit, and if there is no unfinished memory access request of the verified unit, the control state machine jumps to state S4, otherwise it remains in state S3; state S4 is that the control state machine controls the clock control module The value of the enable signal output by the block is set to 1, and the working mode of the DFI interface conversion module is set to the debug mode; the state S5 state is the control state machine filling data into the sending FIFO according to the file export data packet format and a specific order, if the data is filled in, it jumps to state S6, otherwise it returns to state S5; state S6 is under the control of the control state machine, the data in the sending FIFO is output to the MAC module, and then the MAC module sends it to the Ethernet daughter card and finally transmits it to the host computer, and then the control state machine compares the number of times the memory has been read read_count and the number of times the memory needs to be read read_num. If they are equal, it jumps to state S7, otherwise it jumps back to state S5; state S7 is the control state machine setting the value of the enable signal output by the clock control module to 0, and setting the working mode of the DFI interface conversion module to norm mode, and jumping to the said S0 state.
9. The FPGA prototype verification system according to claim 8, characterized in that: The verified unit includes a clock module, a CPU core and a memory access module. The input end of the clock module is connected to the output end of the clock control module in the verification function unit, and the output end of the clock module is respectively connected to the clock signal output ends of the CPU core and the memory access module. The CPU core and the memory access module are connected to each other, and the memory access module is connected to the DFI interface conversion module in the verification function unit.
