[go: up one dir, main page]

CN113505063B - FPGA logic test method and device - Google Patents

FPGA logic test method and device Download PDF

Info

Publication number
CN113505063B
CN113505063B CN202110756274.3A CN202110756274A CN113505063B CN 113505063 B CN113505063 B CN 113505063B CN 202110756274 A CN202110756274 A CN 202110756274A CN 113505063 B CN113505063 B CN 113505063B
Authority
CN
China
Prior art keywords
fpga
data
chip
memory
storage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110756274.3A
Other languages
Chinese (zh)
Other versions
CN113505063A (en
Inventor
贺莹
田莉蓉
王闯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Avic Airborne System General Technology Co ltd
Original Assignee
Avic Airborne System General Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Avic Airborne System General Technology Co ltd filed Critical Avic Airborne System General Technology Co ltd
Priority to CN202110756274.3A priority Critical patent/CN113505063B/en
Publication of CN113505063A publication Critical patent/CN113505063A/en
Application granted granted Critical
Publication of CN113505063B publication Critical patent/CN113505063B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R31/00Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
    • G01R31/28Testing of electronic circuits, e.g. by signal tracer
    • G01R31/317Testing of digital circuits
    • G01R31/3177Testing of logic operation, e.g. by logic analysers
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3698Environments for analysis, debugging or testing of software
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Tests Of Electronic Circuits (AREA)

Abstract

本发明属于集成电路技术领域,具体提供了一种FPGA逻辑测试方法及装置。其中,方法包括:基于待测试逻辑源代码的待测试信号带宽和采样深度,确定测试待测试逻辑源代码所需的需求资源存储量;若需求资源存储量小于FPGA片内存储器的剩余存储量,则确定存储方式为片内存储,否则确定存储方式为片外存储;其中,片内存储对应的存储器为FPGA片内存储器,片外存储对应的存储器为外部存储器;基于嵌入式逻辑分析仪内核对待测试逻辑源代码进行测试,并根据确定的存储方式将测试产生的采样数据存储到对应的存储器中。本申请可以避免FPGA测试时因内部存储空间导致的采样深度低的问题,从而有效提高测试时的采样深度。

Figure 202110756274

The invention belongs to the technical field of integrated circuits, and specifically provides an FPGA logic testing method and device. The method includes: determining the required resource storage amount required for testing the logic source code to be tested based on the bandwidth of the signal to be tested and the sampling depth of the logic source code to be tested; if the required resource storage amount is less than the remaining storage amount of the FPGA on-chip memory, Then determine the storage mode as on-chip storage, otherwise determine the storage mode as off-chip storage; among them, the memory corresponding to the on-chip storage is the FPGA on-chip memory, and the memory corresponding to the off-chip storage is the external memory; The test logic source code is tested, and the sampled data generated by the test is stored in the corresponding memory according to the determined storage mode. The present application can avoid the problem of low sampling depth caused by internal storage space during FPGA testing, thereby effectively improving the sampling depth during testing.

Figure 202110756274

Description

一种FPGA逻辑测试方法及装置FPGA logic testing method and device

技术领域technical field

本发明涉及集成电路技术领域,具体涉及一种FPGA逻辑测试方法及装置。The present invention relates to the technical field of integrated circuits, in particular to a method and device for FPGA logic testing.

背景技术Background technique

FPGA(Field Pragrammable Gate Array,现场可编程门阵列)是一种通用器件,包含大量重复的可编程逻辑块(CLB)、输入输出单元(IOB)、可编程互连线(PI)等基本单元。特别适合集成电路的新品开发和小批量ASIC电路的生产,随着其发展迅速已经广泛应用于许多领域。随着FPGA的广泛应用,对其的准确性的要求也越来越高,所以都需要经过测试对FPGA进行合理验证。FPGA (Field Pragrammable Gate Array, Field Programmable Gate Array) is a general-purpose device that contains a large number of repetitive programmable logic blocks (CLB), input and output units (IOB), programmable interconnect lines (PI) and other basic units. It is especially suitable for the development of new products of integrated circuits and the production of small batches of ASIC circuits. With its rapid development, it has been widely used in many fields. With the wide application of FPGA, the requirements for its accuracy are getting higher and higher, so it is necessary to verify the FPGA reasonably through testing.

目前,对于FPGA逻辑测试通常有两种方法:一种是使用外部示波器或逻辑分析仪的方法,另一种是使用嵌入式逻辑分析仪的方法。使用外部示波器或逻辑分析仪的方法,需将待测试的内部信号路由到FPGA没有使用的管脚上,然后连接到外部示波器或逻辑分析仪上进行观测,这种方法能够提供较深的内存,但必须增加专用于调试的部分针脚数量,占用额外的I/O管脚。Currently, there are usually two methods for FPGA logic testing: one is a method using an external oscilloscope or logic analyzer, and the other is a method using an embedded logic analyzer. The method of using an external oscilloscope or logic analyzer requires routing the internal signal to be tested to the unused pins of the FPGA, and then connecting it to an external oscilloscope or logic analyzer for observation. This method can provide deeper memory, However, the number of pins dedicated to debugging must be increased, occupying additional I/O pins.

使用嵌入式逻辑分析仪的方法基于FPGA厂商的嵌入式逻辑分析仪内核,获取FPGA内部资源实现信号采样和存储,并通过JTAG接口把捕获的数据传送到PC上进行显示。该方法受到FPGA内部存储资源的限制,导致信号的采样深度(采样数据存储量)受限,无法满足对于测试样本数量要求高的测试场景要求。The method of using the embedded logic analyzer is based on the embedded logic analyzer core of the FPGA manufacturer, obtains the internal resources of the FPGA to realize signal sampling and storage, and transmits the captured data to the PC for display through the JTAG interface. This method is limited by the internal storage resources of the FPGA, which results in the limited sampling depth (sampling data storage) of the signal, and cannot meet the requirements of the test scenarios that require a high number of test samples.

发明内容SUMMARY OF THE INVENTION

针对现有技术中的缺陷,本发明提供一种FPGA逻辑测试方法及装置、电子设备及介质,以解决使用嵌入式逻辑分析仪进行FPGA逻辑测试时信号采样深度受限的问题。In view of the defects in the prior art, the present invention provides an FPGA logic testing method and device, electronic equipment and medium to solve the problem of limited signal sampling depth when using an embedded logic analyzer for FPGA logic testing.

第一方面,本发明提供的一种FPGA逻辑测试方法,包括:A first aspect, a kind of FPGA logic testing method provided by the present invention, comprises:

基于待测试逻辑源代码的待测试信号带宽和采样深度,确定测试所述待测试逻辑源代码所需的需求资源存储量;Determine the required resource storage amount required for testing the logic source code to be tested based on the bandwidth of the signal to be tested and the sampling depth of the logic source code to be tested;

若所述需求资源存储量小于FPGA片内存储器的剩余存储量,则确定存储方式为片内存储,否则确定存储方式为片外存储;其中,片内存储对应的存储器为FPGA片内存储器,片外存储对应的存储器为外部存储器;If the required resource storage amount is less than the remaining storage amount of the FPGA on-chip memory, the storage method is determined to be on-chip storage, otherwise, the storage method is determined to be off-chip storage; wherein, the memory corresponding to the on-chip storage is the FPGA on-chip memory, and the on-chip storage The memory corresponding to the external storage is the external memory;

基于嵌入式逻辑分析仪内核对所述待测试逻辑源代码进行测试,并根据确定的存储方式将测试产生的采样数据存储到对应的存储器中。The logic source code to be tested is tested based on the embedded logic analyzer core, and the sampled data generated by the test is stored in the corresponding memory according to the determined storage mode.

由上述技术方案可知,本发明提供的FPGA逻辑测试方法,针对于需求资源存储量与片内剩余存储量的关系,确定存储方式,在需求资源存储量大于片内剩余存储量的情况下,将数据选择合适的存储方式存储,可有效提高采样深度,充分利用现有资源,不带来额外设计开销。It can be seen from the above technical solutions that the FPGA logic testing method provided by the present invention determines the storage mode according to the relationship between the required resource storage and the remaining on-chip storage. When the required resource storage is greater than the remaining on-chip storage, the Selecting an appropriate storage method for data storage can effectively increase the sampling depth and make full use of existing resources without additional design overhead.

可选地,当存储方式为片外存储时,所述根据确定的存储方式将测试产生的采样数据存储到对应的存储器中,包括:Optionally, when the storage mode is off-chip storage, the sampling data generated by the test is stored in the corresponding memory according to the determined storage mode, including:

将测试产生的采样数据写入所述FPGA片内存储器;Write the sampled data generated by the test into the FPGA on-chip memory;

当写入所述FPGA片内存储器内的采样数据的数据量满足预设条件时,将所述FPGA片内存储器内的采样数据存入所述外部存储器。When the data amount of the sampled data written into the FPGA on-chip memory satisfies a preset condition, the sampled data in the FPGA on-chip memory is stored in the external memory.

可选地,所述方法还包括:Optionally, the method further includes:

记录向所述FPGA片内存储器内写入采样数据的写入次数;Record the number of times of writing sampling data into the FPGA on-chip memory;

若所述写入次数不小于数据转移阈值,则确定写入所述FPGA片内存储器内的采样数据的数据量满足预设条件,并将所述写入次数清零,其中,数据转移阈值是基于所述需求资源存储量和待测试信号带宽确定的。If the number of writes is not less than the data transfer threshold, it is determined that the data amount of the sampled data written in the FPGA on-chip memory meets a preset condition, and the number of writes is cleared, wherein the data transfer threshold is It is determined based on the required resource storage amount and the bandwidth of the signal to be tested.

可选地,所述数据转移阈值为

Figure BDA0003147639070000021
其中,Y为所述FPGA片内存储器的剩余存储量,K为待测试信号带宽,n为大于1的数值。Optionally, the data transfer threshold is
Figure BDA0003147639070000021
Wherein, Y is the remaining storage capacity of the on-chip memory of the FPGA, K is the bandwidth of the signal to be tested, and n is a value greater than 1.

可选地,当外部存储器的数据宽度C和FPGA片内存储器的数据宽度R不等时,所述将所述FPGA片内存储器内的采样数据存入所述外部存储器,包括:Optionally, when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the storing of the sampled data in the FPGA on-chip memory into the external memory includes:

将所述FPGA片内存储器内待存入所述外部存储器的采样数据依次存入数据写缓冲区,将数据写缓冲区中的采样数据的数据宽度修改为C,将数据写缓冲区中数据宽度为C的采样数据存入所述外部存储器。The sampled data to be stored in the external memory in the FPGA on-chip memory is sequentially stored in the data write buffer, the data width of the sampled data in the data write buffer is modified to C, and the data width in the data write buffer Store the sampled data for C into the external memory.

可选地,所述方法还包括:Optionally, the method further includes:

根据所述需求资源存储量,在所述外部存储器中选取部分空间,将所述部分空间分隔为N个数据块,其中,

Figure BDA0003147639070000022
X为所述需求资源存储量,R为所述FPGA片内存储器的数据宽度,L为所述FPGA片内存储器剩余的数据深度;According to the required resource storage amount, a part of the space is selected in the external memory, and the part of the space is divided into N data blocks, wherein,
Figure BDA0003147639070000022
X is the required resource storage amount, R is the data width of the FPGA on-chip memory, and L is the remaining data depth of the FPGA on-chip memory;

所述将所述FPGA片内存储器内的采样数据存入所述外部存储器,包括:The storing of the sampled data in the FPGA on-chip memory into the external memory includes:

将所述FPGA片内存储器内的采样数据依次存入所述外部存储器的数据块中。The sampling data in the on-chip memory of the FPGA is sequentially stored in the data blocks of the external memory.

可选地,在所述嵌入式逻辑分析仪测试完成后,还包括:Optionally, after the embedded logic analyzer is tested, the method further includes:

将所述外部存储器内存储采样数据的数据块按序写入所述FPGA片内存储器;The data blocks storing the sampled data in the external memory are sequentially written into the FPGA on-chip memory;

当每完成一个数据块的读出后,将下一个数据块写入片内存储器实现片内存储器的刷新,直到数据块读出完成。After each data block is read out, the next data block is written into the on-chip memory to refresh the on-chip memory until the data block is read out.

可选地,当外部存储器的数据宽度C和FPGA片内存储器的数据宽度R不等时,所述将存储于所述外部存储器内的数据块按序写入所述FPGA片内存储器,包括:Optionally, when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the sequential writing of the data blocks stored in the external memory to the FPGA on-chip memory includes:

将所述外部存储器内的数据块依次存入数据读缓冲区,将数据读缓冲区中的数据块的数据宽度修改为C,将数据读缓冲区中数据宽度为C的数据块存入所述FPGA片内存储器。The data blocks in the external memory are stored in the data read buffer in turn, the data width of the data blocks in the data read buffer is modified to C, and the data blocks with a data width of C in the data read buffer are stored in the data read buffer. FPGA on-chip memory.

可选地,所述外部存储器为FPGA配置芯片,其中,FPGA配置芯片为FPGA掉电时用于存储FPGA程序的芯片,当FPGA上电后,FPGA配置芯片将存储的FPGA程序发送至FPGA内,此时FPGA配置芯片为空闲状态。Optionally, the external memory is an FPGA configuration chip, wherein the FPGA configuration chip is a chip used to store the FPGA program when the FPGA is powered off, and when the FPGA is powered on, the FPGA configuration chip sends the stored FPGA program to the FPGA, At this time, the FPGA configuration chip is in an idle state.

第二方面,本发明提供的一种FPGA逻辑测试装置,包括:In the second aspect, a FPGA logic test device provided by the present invention includes:

存储量确定模块,用于基于待测试逻辑源代码的待测试信号带宽和采样深度,确定测试所述待测试逻辑源代码所需的需求资源存储量;a storage capacity determination module, configured to determine the required resource storage capacity required for testing the logic source code to be tested based on the bandwidth of the signal to be tested and the sampling depth of the logic source code to be tested;

存储方式确定模块,用于若所述需求资源存储量小于FPGA片内存储器的剩余存储量,则确定存储方式为片内存储,否则确定存储方式为片外存储;其中,片内存储对应的存储器为FPGA片内存储器,片外存储对应的存储器为外部存储器;The storage mode determination module is used to determine that the storage mode is on-chip storage if the required resource storage amount is less than the remaining storage capacity of the FPGA on-chip memory, otherwise, the storage mode is determined to be off-chip storage; wherein, the memory corresponding to the on-chip storage It is the on-chip memory of the FPGA, and the memory corresponding to the off-chip memory is the external memory;

测试存储模块,用于基于嵌入式逻辑分析仪内核对所述待测试逻辑源代码进行测试,并根据确定的存储方式将测试产生的采样数据存储到对应的存储器中。The test storage module is used to test the logic source code to be tested based on the embedded logic analyzer core, and store the sampled data generated by the test into the corresponding memory according to the determined storage mode.

可选地,当存储方式为片外存储时,所述测试存储模块具体用于:Optionally, when the storage mode is off-chip storage, the test storage module is specifically used for:

将测试产生的采样数据写入所述FPGA片内存储器;Write the sampled data generated by the test into the FPGA on-chip memory;

当写入所述FPGA片内存储器内的采样数据的数据量满足预设条件时,将所述FPGA片内存储器内的采样数据存入所述外部存储器。When the data amount of the sampled data written into the FPGA on-chip memory satisfies a preset condition, the sampled data in the FPGA on-chip memory is stored in the external memory.

可选地,所述装置还包括计数模块:Optionally, the device also includes a counting module:

记录向所述FPGA片内存储器内写入采样数据的写入次数;Record the number of times of writing sampling data into the FPGA on-chip memory;

若所述写入次数不小于数据转移阈值,则确定写入所述FPGA片内存储器内的采样数据的数据量满足预设条件,并将所述写入次数清零,其中,数据转移阈值是基于所述需求资源存储量和待测试信号带宽确定的。If the number of writes is not less than the data transfer threshold, it is determined that the data amount of the sampled data written in the FPGA on-chip memory meets a preset condition, and the number of writes is cleared, wherein the data transfer threshold is It is determined based on the required resource storage amount and the bandwidth of the signal to be tested.

可选地,所述计数模块中,所述数据转移阈值为

Figure BDA0003147639070000031
其中,Y为所述FPGA片内存储器的剩余存储量,K为待测试信号带宽,n为大于1的数值。Optionally, in the counting module, the data transfer threshold is
Figure BDA0003147639070000031
Wherein, Y is the remaining storage capacity of the on-chip memory of the FPGA, K is the bandwidth of the signal to be tested, and n is a value greater than 1.

可选地,当外部存储器的数据宽度C和FPGA片内存储器的数据宽度R不等时,所述测试存储模块,具体用于:Optionally, when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the test storage module is specifically used for:

将所述FPGA片内存储器内待存入所述外部存储器的采样数据依次存入数据写缓冲区,将数据写缓冲区中的采样数据的数据宽度修改为C,将数据写缓冲区中数据宽度为C的采样数据存入所述外部存储器。The sampled data to be stored in the external memory in the FPGA on-chip memory is sequentially stored in the data write buffer, the data width of the sampled data in the data write buffer is modified to C, and the data width in the data write buffer Store the sampled data for C into the external memory.

可选地,所述装置还包括空间选取模块,具体用于:Optionally, the device further includes a space selection module, which is specifically used for:

根据所述需求资源存储量,在所述外部存储器中选取部分空间,将所述部分空间分隔为N个数据块,其中,

Figure BDA0003147639070000041
X为所述需求资源存储量,R为所述FPGA片内存储器的数据宽度,L为所述FPGA片内存储器剩余的数据深度;According to the required resource storage amount, a part of the space is selected in the external memory, and the part of the space is divided into N data blocks, wherein,
Figure BDA0003147639070000041
X is the required resource storage amount, R is the data width of the FPGA on-chip memory, and L is the remaining data depth of the FPGA on-chip memory;

所述测试存储模块具体还用于:The test storage module is also specifically used for:

将所述FPGA片内存储器内的采样数据依次存入所述外部存储器的数据块中。The sampling data in the on-chip memory of the FPGA is sequentially stored in the data blocks of the external memory.

可选地,所述装置还包括数据迁移模块,具体用于:Optionally, the device further includes a data migration module, which is specifically used for:

在所述嵌入式逻辑分析仪测试完成后,将所述外部存储器内存储采样数据的数据块按序写入所述FPGA片内存储器;After the embedded logic analyzer test is completed, the data blocks storing the sampled data in the external memory are sequentially written into the FPGA on-chip memory;

当每完成一个数据块的读出后,将下一个数据块写入片内存储器实现片内存储器的刷新,直到数据块读出完成。After each data block is read out, the next data block is written into the on-chip memory to refresh the on-chip memory until the data block is read out.

可选地,当外部存储器的数据宽度C和FPGA片内存储器的数据宽度R不等时,所述测试存储模块还用于:Optionally, when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the test memory module is also used for:

将所述外部存储器内的数据块依次存入数据读缓冲区,将数据读缓冲区中的数据块的数据宽度修改为C,将数据读缓冲区中数据宽度为C的数据块存入所述FPGA片内存储器。The data blocks in the external memory are stored in the data read buffer in turn, the data width of the data blocks in the data read buffer is modified to C, and the data blocks with a data width of C in the data read buffer are stored in the data read buffer. FPGA on-chip memory.

可选地,所述测试模块具体用于的所述外部存储器为FPGA配置芯片,其中,FPGA配置芯片为FPGA掉电时用于存储FPGA程序的芯片,当FPGA上电后,FPGA配置芯片将存储的FPGA程序发送至FPGA内,此时FPGA配置芯片为空闲状态。Optionally, the external memory specifically used by the test module is an FPGA configuration chip, wherein the FPGA configuration chip is a chip used to store the FPGA program when the FPGA is powered off, and when the FPGA is powered on, the FPGA configuration chip will store the FPGA program. The FPGA program is sent to the FPGA, and the FPGA configuration chip is in an idle state at this time.

第三方面,本发明一实施例提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,处理器执行计算机程序时实现上述任一种方法的步骤。In a third aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements any of the above when executing the computer program steps of the method.

第四方面,本发明一实施例提供了一种计算机可读存储介质,其上存储有计算机程序指令,该计算机程序指令被处理器执行时实现上述任一种方法的步骤。In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the steps of any one of the above methods are implemented.

采用上述技术方案,具有如下有益效果:Adopt the above-mentioned technical scheme, have the following beneficial effects:

1)本申请提出了一种FPGA逻辑测试方法,通过将采样信号由内部RAM存储转换为外部存储器存储,在解决由于FPGA内部存储资源有限而带来的采样深度不足的问题同时,不增加额外存储空间,提高了测试的采样深度。同时本申请采用嵌入式逻辑分析仪,不同于外接示波器或是分析仪的方式,无需将所有待测试信号引出至FPGA管脚,因而不受FPGA空余IO管脚数量的限制。1) This application proposes an FPGA logic testing method. By converting the sampling signal from internal RAM storage to external memory storage, it solves the problem of insufficient sampling depth due to limited internal storage resources in the FPGA without adding additional storage. space, increasing the sampling depth of the test. At the same time, the present application adopts an embedded logic analyzer, which is different from an external oscilloscope or analyzer, and does not need to lead out all the signals to be tested to the FPGA pins, so it is not limited by the number of spare IO pins of the FPGA.

2)针对本申请提出的FPGA逻辑测试方法,片内存储器与外部存储器之间能够实现数据的交换,使逻辑测试时不受片内存储器资源的限制,提高了FPGA逻辑测试时的采样深度。2) For the FPGA logic testing method proposed in the present application, data can be exchanged between the on-chip memory and the external memory, so that the logic testing is not limited by on-chip memory resources, and the sampling depth during FPGA logic testing is improved.

3)本申请利用外部存储器存储待测试逻辑代码,其中外部存储器可为配置芯片,在提高采样深度的同时不额外增加外部存储器,降低了成本。3) The present application utilizes an external memory to store the logic code to be tested, wherein the external memory can be a configuration chip, and the sampling depth is improved without additional external memory, thereby reducing the cost.

附图说明Description of drawings

为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍。在所有附图中,类似的元件或部分一般由类似的附图标记标识。附图中,各元件或部分并不一定按照实际的比例绘制。In order to illustrate the specific embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that are required to be used in the description of the specific embodiments or the prior art. Similar elements or parts are generally identified by similar reference numerals throughout the drawings. In the drawings, each element or section is not necessarily drawn to actual scale.

图1示出了本发明实施例所提供的FPGA逻辑测试方法的应用场景示意图;1 shows a schematic diagram of an application scenario of the FPGA logic testing method provided by an embodiment of the present invention;

图2示出了本发明实施例所提供的FPGA逻辑测试方法的流程图;2 shows a flowchart of an FPGA logic testing method provided by an embodiment of the present invention;

图3示出了本发明实施例所提供的片内存储器和外部存储器的空间映射图;3 shows a space mapping diagram of an on-chip memory and an external memory provided by an embodiment of the present invention;

图4示出了本发明实施例所提供的FPGA逻辑测试装置的结构示意图;4 shows a schematic structural diagram of an FPGA logic testing device provided by an embodiment of the present invention;

图5示出了本发明实施例所提供的电子设备的结构示意图。FIG. 5 shows a schematic structural diagram of an electronic device provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合附图对本发明技术方案的实施例进行详细的描述。以下实施例仅用于更加清楚地说明本发明的技术方案,因此只是作为示例,而不能以此来限制本发明的保护范围。Embodiments of the technical solutions of the present invention will be described in detail below with reference to the accompanying drawings. The following examples are only used to illustrate the technical solutions of the present invention more clearly, and are therefore only used as examples, and cannot be used to limit the protection scope of the present invention.

需要注意的是,除非另有说明,本申请使用的技术术语或者科学术语应当为本发明所属领域技术人员所理解的通常意义。It should be noted that, unless otherwise specified, the technical or scientific terms used in this application should have the usual meanings understood by those skilled in the art to which the present invention belongs.

在使用嵌入式逻辑分析仪对FPGA进行逻辑测试时,经常会出现由于待测试逻辑源代码的数据量大于内部存储空间不匹配,造成的采样深度不高。遇到这种问题,往往采用增加外部存储器,用于存储待测试逻辑源代码。这样会给测试过程带来额外的外部存储器成本,同时会延长逻辑测试的时间,降低测试效率。When using an embedded logic analyzer to test FPGA logic, it often occurs that the data volume of the logic source code to be tested is larger than the internal storage space and the sampling depth is not high. When this problem is encountered, an external memory is often used to store the logic source code to be tested. This will bring additional external memory cost to the test process, and will prolong the logic test time and reduce the test efficiency.

参见图1,图1为本发明实施例提供的一种FPGA逻辑测试方法的应用场景示意图,通过设置嵌入式逻辑分析仪内核,将待测试信号设置为采样信号,对待测试逻辑代码进行采样。同时,采样信号会被写入内部RAM进行存储,逻辑分析仪会通过JTAG接口将信号发送至显示器显示。当内部RAM不满足采样信号的深度需求时,内部RAM可以连接外部存储器,通过外部存储器存储采样信号,这种方法在需求存储需求量很大时有很好的效果,但是当需求存储量很小时,直接通过外部存储器进行存储会使测试时间延长,造成测试效率不高的问题。基于此,本申请提出了一种逻辑测试方法,根据采样信号的需求量进行判断,当FPGA片内存储器不足以存储采样信号时,通过FPGA逻辑测试装置来实现FPGA片内存储器到外部存储器的数据迁移,之后再将数据分块处理,逐个迁移至FPGA片内存储器,实现测试信号的显示。Referring to FIG. 1, FIG. 1 is a schematic diagram of an application scenario of an FPGA logic testing method provided by an embodiment of the present invention. By setting an embedded logic analyzer core, a signal to be tested is set as a sampling signal, and the logic code to be tested is sampled. At the same time, the sampled signal will be written to the internal RAM for storage, and the logic analyzer will send the signal to the display through the JTAG interface. When the internal RAM does not meet the depth requirements of the sampling signal, the internal RAM can be connected to an external memory, and the sampling signal can be stored through the external memory. This method has a good effect when the demand for storage is large, but when the demand for storage is very small. , direct storage through the external memory will prolong the test time and cause the problem of low test efficiency. Based on this, the present application proposes a logic testing method, which is determined according to the demand of the sampling signal. When the FPGA on-chip memory is not enough to store the sampling signal, the FPGA logic testing device is used to realize the data from the FPGA on-chip memory to the external memory. After migration, the data is processed in blocks and migrated to the FPGA on-chip memory one by one to realize the display of test signals.

基于上述技术问题,下面对本申请实施例中具体涉及的一种FPGA逻辑测试方法进行说明,参见图2,包括:Based on the above technical problems, an FPGA logic testing method specifically involved in the embodiments of the present application will be described below, referring to FIG. 2 , including:

S101、基于待测试逻辑源代码的待测试信号带宽和采样深度,确定测试待测试逻辑源代码所需的需求资源存储量。S101. Determine the required resource storage amount required for testing the logic source code to be tested based on the bandwidth and sampling depth of the signal to be tested of the logic source code to be tested.

具体地,待测试逻辑源代码主要用于对FPGA进行逻辑测试,为了安排存储空间,首先确定待测试逻辑源代码的需求资源存储量,需求资源存储量通过源代码的待测试信号带宽和采样深度确定,具体计算方法如下:Specifically, the logic source code to be tested is mainly used for logic testing of the FPGA. In order to arrange the storage space, the required resource storage amount of the logic source code to be tested is first determined. The required resource storage amount is determined by the bandwidth of the signal to be tested and the sampling depth of the source code. OK, the specific calculation method is as follows:

X=K×S,X=K×S,

其中,X为需求资源存储量,K为待测试逻辑源代码的待测试信号带宽,S为采样深度也就是样本数量。根据上述计算方法,可以获取到待测试逻辑源代码的需求资源存储量。Among them, X is the required resource storage amount, K is the signal bandwidth to be tested of the logic source code to be tested, and S is the sampling depth, that is, the number of samples. According to the above calculation method, the required resource storage amount of the logic source code to be tested can be obtained.

S102、若需求资源存储量小于FPGA片内存储器的剩余存储量,则确定存储方式为片内存储,否则确定存储方式为片外存储;其中,片内存储对应的存储器为FPGA片内存储器,片外存储对应的存储器为外部存储器。S102. If the required resource storage amount is less than the remaining storage amount of the FPGA on-chip memory, determine the storage mode as on-chip storage, otherwise determine the storage mode as off-chip storage; wherein, the memory corresponding to the on-chip storage is the FPGA on-chip memory, and the on-chip storage The memory corresponding to the external storage is the external memory.

本步骤中,由于需求资源存储量与片内剩余存储量之间存在大小不一致的情况,在不同的情况下确定待测试逻辑源代码的存储方式,根据确定的存储方式存储待测试逻辑源代码。片内存储是指将测试过程中产生的采样数据存储到FPGA片内存储器中,片外存储是指将测试过程中产生的采样数据存储到FPGA片内存储器中。In this step, since there is a size inconsistency between the required resource storage and the remaining on-chip storage, the storage mode of the logic source code to be tested is determined under different circumstances, and the logic source code to be tested is stored according to the determined storage mode. On-chip storage refers to storing the sampled data generated in the testing process into the FPGA on-chip memory, and off-chip storage refers to storing the sampled data generated during the testing process in the FPGA on-chip memory.

S103、基于嵌入式逻辑分析仪内核对待测试逻辑源代码进行测试,并根据确定的存储方式将测试产生的采样数据存储到对应的存储器中。S103 , test the logic source code to be tested based on the embedded logic analyzer core, and store the sampled data generated by the test in the corresponding memory according to the determined storage mode.

在进行测试前,首先要对嵌入式逻辑分析内核进行设置,具体设置方法如下:Before testing, the embedded logic analysis core should be set first. The specific setting method is as follows:

令触发宽度等于待测试逻辑源代码的带宽K;数据深度的设置包括两种情况,具体如下:Let the trigger width be equal to the bandwidth K of the logic source code to be tested; the settings of the data depth include two cases, as follows:

Figure BDA0003147639070000061
Figure BDA0003147639070000061

其中,D为数据深度,S为采样深度,Y为片内剩余资源存储量,X为需求资源存储量,K为待测试逻辑源代码的带宽,

Figure BDA0003147639070000071
表示
Figure BDA0003147639070000072
向下取整为2的倍数,其余内核保持不变。Among them, D is the data depth, S is the sampling depth, Y is the remaining resource storage on-chip, X is the required resource storage, K is the bandwidth of the logic source code to be tested,
Figure BDA0003147639070000071
express
Figure BDA0003147639070000072
Round down to a multiple of 2, leaving the rest of the kernel unchanged.

通过设置嵌入式逻辑分析仪内核,将待测试逻辑代码信号设置为内核采样信号,可对待测试信号进行测试。由于需求资源存储量与片内剩余存储量之间存在大小不一致的情况,在不同的情况下确定待测试逻辑源代码的存储方式,根据确定的存储方式存储待测试逻辑源代码。By setting the embedded logic analyzer core and setting the logic code signal to be tested as the core sampling signal, the signal to be tested can be tested. Due to the inconsistency between the required resource storage and the remaining on-chip storage, the storage mode of the logic source code to be tested is determined under different circumstances, and the logic source code to be tested is stored according to the determined storage mode.

通过上述的FPGA逻辑测试方法,实现了基于需求资源存储量和片内剩余存储量的情况自动选择合适存储方式的功能,当待测试逻辑源代码不满足片内存储器可存储量的情况下,调用外部存储器进行存储,充分利用外部存储器的闲散资源,从而提高了FPGA逻辑测试的可存储数据量,可有效提高采样深度;当待测试逻辑源代码可以满足片内存储器可存储量的情况下,选择FPGA片内存储器存储采样数据,保证数据存储和读取效率。通过根据需求存储数据量对存储方式进行判断,在需求存储数据量小于FPGA片内剩余存储量的情况,直接通过FPGA片内存储器进行存储而无需转移至外部存储器存储,进而缩短了测试时间。Through the above-mentioned FPGA logic testing method, the function of automatically selecting the appropriate storage mode based on the required resource storage and remaining on-chip storage is realized. When the logic source code to be tested does not meet the storage capacity of the on-chip memory, the call The external memory is used for storage, and the idle resources of the external memory are fully utilized, thereby increasing the amount of storable data for FPGA logic testing and effectively increasing the sampling depth; when the source code of the logic to be tested can meet the storage capacity of the on-chip memory, select The FPGA on-chip memory stores sampled data to ensure data storage and reading efficiency. By judging the storage method according to the required amount of data to be stored, when the required amount of data to be stored is less than the remaining storage capacity of the FPGA chip, the storage method is directly stored in the FPGA on-chip memory without transferring to an external memory for storage, thereby shortening the test time.

具体地,针对待测试逻辑源代码可以被FPGA片内存储器存储的情况,直接将待测试逻辑源代码存储于片内存储器,即选择的存储方式为片内存储。即上述的响应需求资源存储量小于片内剩余存储量,将测试逻辑源代码通过FPGA片内存储器进行存储。Specifically, for the case that the logic source code to be tested can be stored in the FPGA on-chip memory, the logic source code to be tested is directly stored in the on-chip memory, that is, the selected storage mode is on-chip storage. That is, the above-mentioned storage amount of the resource in response to the demand is less than the remaining storage amount on the chip, and the test logic source code is stored in the FPGA on-chip memory.

当FPGA片内存储器不满足存储需求,选择的存储方式为片外存储,此时步骤S103中的根据确定的存储方式将测试产生的采样数据存储到对应的存储器,包括:将测试产生的采样数据写入FPGA片内存储器;当写入FPGA片内存储器内的采样数据的数据量满足预设条件时,将FPGA片内存储器内的采样数据存入外部存储器。When the on-chip memory of the FPGA does not meet the storage requirements, the selected storage mode is off-chip storage. At this time, in step S103, the sampled data generated by the test is stored in the corresponding memory according to the determined storage mode, including: storing the sampled data generated by the test. Write into the FPGA on-chip memory; when the data amount of the sampled data written into the FPGA on-chip memory satisfies the preset condition, store the sampled data in the FPGA on-chip memory into the external memory.

其中,预设条件可以是写入FPGA片内存储器内的采样数据的数据量达到预设值,该预设值可根据步骤S102中获取的FPGA片内存储器的剩余存储量确定,预设值不超过FPGA片内存储器的剩余存储量。即测试产生的采样数据先存储到FPGA片内存储器内,当FPGA片内存储器内的采样数据的数据量达到预设值时,开始将FPGA片内存储器内的采样数据依次转存到外部存储器中,直至完成测试。The preset condition may be that the amount of sampled data written into the FPGA on-chip memory reaches a preset value, and the preset value may be determined according to the remaining storage capacity of the FPGA on-chip memory obtained in step S102, and the preset value is not Exceeds the remaining storage capacity of the FPGA on-chip memory. That is, the sampled data generated by the test is first stored in the FPGA on-chip memory. When the data volume of the sampled data in the FPGA on-chip memory reaches the preset value, the sampled data in the FPGA on-chip memory will be sequentially transferred to the external memory. , until the test is completed.

由于FPGA片内存储器的读写过程快且数据转移路径短,将FPGA片内存储器当作采样数据的缓存区,在片内存储器足够存储待测试逻辑源代码的情况下,先将采样数据缓存到FPGA片内存储器中,充分利用FPGA内部存储空间,再将FPGA片内存储器内的采样数据依次转存到外部存储器中,相比直接存储到外部存储器的方式可提高数据存储效率。在当测试数据的需求存储数据量小于FPGA片内存储器剩余存储量时,通过采用片内存储的存储方式可有效缩短存储时间,简化了数据处理流程。Because the reading and writing process of the FPGA on-chip memory is fast and the data transfer path is short, the FPGA on-chip memory is used as a buffer area for sampled data. In the on-chip memory of the FPGA, the internal storage space of the FPGA is fully utilized, and then the sampled data in the on-chip memory of the FPGA is sequentially transferred to the external memory, which can improve the data storage efficiency compared with the method of directly storing it in the external memory. When the required storage data amount of the test data is less than the remaining storage amount of the FPGA on-chip memory, the storage time of the on-chip storage can be effectively shortened and the data processing process can be simplified.

在一种可能的实施方式中,可通过如下方法统计写入FPGA片内存储器内的采样数据的数据量:记录向FPGA片内存储器内写入采样数据的写入次数;若写入次数不小于数据转移阈值,则确定写入FPGA片内存储器内的采样数据的数据量满足预设条件,并将写入次数清零,其中,数据转移阈值是基于需求资源存储量和待测试信号带宽确定的。In a possible implementation manner, the data amount of the sampled data written into the FPGA on-chip memory can be counted by the following method: record the number of times of writing the sampled data into the FPGA on-chip memory; if the number of writes is not less than The data transfer threshold is to determine that the amount of sampled data written into the FPGA on-chip memory meets the preset conditions, and the number of writes is cleared to zero, where the data transfer threshold is determined based on the required resource storage and the bandwidth of the signal to be tested. .

具体实施时,在进行数据采样前,先根据需求资源存储量和待测试信号带宽设置合适的数据转移阈值,确定数据转移入外部存储器的条件,保证FPGA片内存储器足够缓存采样数据;并设计写计数器,写计数器根据触发时钟进行计数,记录当前写入RAM的数量,读取写计数器的数值就可以获得写入次数。开始进行数据采样后,向FPGA片内存储器内写入一个采样数据,写计数器的数值就增加1,当写计数器的计数值≥数据转移阈值时,置外部写信号WR_ex有效,将片内存储器内的采样数据写入外部存储器,并将写计数器的数值清零,重复以上操作直到采样结束。During specific implementation, before data sampling, set an appropriate data transfer threshold according to the required resource storage and the bandwidth of the signal to be tested, determine the conditions for data transfer into the external memory, and ensure that the FPGA on-chip memory is sufficient to cache the sampled data; and design and write Counter, the write counter counts according to the trigger clock, records the current number of writes to the RAM, and reads the value of the write counter to obtain the number of writes. After starting data sampling, write a sampled data into the FPGA on-chip memory, and the value of the write counter will increase by 1. When the count value of the write counter is greater than or equal to the data transfer threshold, the external write signal WR_ex will be valid, and the on-chip memory will be changed to The sampled data is written into the external memory, and the value of the write counter is cleared, and the above operations are repeated until the sampling ends.

在一种可能的实施方式中,数据转移阈值为

Figure BDA0003147639070000081
其中,Y为FPGA片内存储器的剩余存储量,K为待测试信号带宽,n为大于1的数值。In a possible implementation, the data transfer threshold is
Figure BDA0003147639070000081
Among them, Y is the remaining storage capacity of the FPGA on-chip memory, K is the bandwidth of the signal to be tested, and n is a value greater than 1.

本申请中数据转移阈值为从FPGA片内存储器向外部存储器转移数据的条件,以n=2为例,当片内数据存储量达到

Figure BDA0003147639070000082
开始向外部存储器转移FPGA片内存储器内存储的数据。其中,
Figure BDA0003147639070000083
为本申请可实现的一个数据转移阈值示例,不作为本申请的具体限制。The data transfer threshold in this application is the condition for transferring data from the FPGA on-chip memory to the external memory. Taking n=2 as an example, when the on-chip data storage amount reaches
Figure BDA0003147639070000082
Start transferring data stored in FPGA on-chip memory to external memory. in,
Figure BDA0003147639070000083
This is an example of a data transfer threshold that can be implemented by this application, and is not a specific limitation of this application.

可选地,参见图3,当外部存储器的数据宽度C和FPGA片内存储器的数据宽度R不等时,将FPGA片内存储器内的采样数据存入外部存储器,具体包括如下步骤:将FPGA片内存储器内待存入外部存储器的采样数据依次存入数据写缓冲区,为了匹配数据宽度,将数据写缓冲区中的采样数据的数据宽度修改为C,将数据写缓冲区中数据宽度为C的采样数据存入外部存储器。Optionally, referring to FIG. 3, when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the sampling data in the FPGA on-chip memory is stored in the external memory, which specifically includes the following steps: The sampled data in the internal memory to be stored in the external memory are sequentially stored in the data write buffer. In order to match the data width, the data width of the sampled data in the data write buffer is modified to C, and the data width in the data write buffer is C The sampled data is stored in external memory.

本步骤中,在FPGA片内存储器内的采样数据存入到外部存储器的过程中,针对于FPGA片内存储器的数据宽度和外部存储器的数据宽度不一致的情况,为了匹配FPGA片内存储器和外部存储器的数据宽度,本申请提供了一种FPGA逻辑测试装置,FPGA逻辑测试装置可用于外部存储器与FPGA片内存储器之间控制数据的交换,FPGA逻辑测试装置中的测试存储模块可用于数据缓冲时数据宽度的重新组织。其中,测试存储模块包括数据写缓冲区和数据读缓冲区,当将FPGA片内存储器的数据存入外部存储器时,FPGA片内存储器和外部存储器的数据宽度不一致,将数据存入测试存储模块的数据写缓冲区重新组织数据,使数据宽度满足待存入FPGA片内存储器或外部存储器的数据宽度。当数据宽度相同,直接将FPGA片内存储器内的数据按序迁移至外部存储器的存储空间,不需要进行数据缓冲;当数据宽度不一致时,在数据写缓存区进行数据缓冲,重新组织数据,将数据的数据宽度组织为外部存储器的数据宽度,实现数据的迁移。数据写缓存区可以是FPGA片内存储器用作数据缓存的存储空间。In this step, in the process of storing the sampled data in the FPGA on-chip memory into the external memory, in order to match the data width of the FPGA on-chip memory and the data width of the external memory, in order to match the data width of the FPGA on-chip memory and the external memory The application provides a FPGA logic test device, the FPGA logic test device can be used for the exchange of control data between external memory and FPGA on-chip memory, and the test storage module in the FPGA logic test device can be used for data buffering. Width reorganization. Among them, the test memory module includes a data write buffer and a data read buffer. When the data of the FPGA on-chip memory is stored in the external memory, the data width of the FPGA on-chip memory and the external memory are inconsistent, and the data is stored in the test memory module. The data write buffer reorganizes the data so that the data width meets the data width to be stored in the FPGA on-chip memory or external memory. When the data width is the same, the data in the on-chip memory of the FPGA is directly migrated to the storage space of the external memory in sequence without data buffering; when the data width is inconsistent, data buffering is performed in the data write buffer area to reorganize the data, The data width of the data is organized as the data width of the external memory to realize data migration. The data write buffer area can be the storage space used by the on-chip memory of the FPGA as a data buffer.

数据写缓冲区和数据读缓冲区为FPGA片内存储器和外部存储器之间提供数据缓冲,无论数据是被从FPGA片内存储器写入外部存储器中还是外部存储器写入FPGA片内存储器中,当两者之间数据宽度不一致时,都需要进行数据缓冲,重新组织数据,将信号的数据宽度变更为目标存储器的数据宽度。The data write buffer and data read buffer provide data buffering between the FPGA on-chip memory and the external memory, no matter whether the data is written from the FPGA on-chip memory to the external memory or the external memory is written to the FPGA on-chip memory, when the two When the data width is inconsistent between them, it is necessary to buffer the data, reorganize the data, and change the data width of the signal to the data width of the target memory.

使FPGA片内存储器内的数据可以被存入外部存储器中,提高了逻辑测试时的采样深度。The data in the FPGA on-chip memory can be stored in the external memory, which improves the sampling depth during logic testing.

可选地,在确定存储方式为片外存储后,还可以对外部存储器的存储空间进行划分,方便数据存储,具体包括如下步骤:Optionally, after it is determined that the storage mode is off-chip storage, the storage space of the external memory can also be divided to facilitate data storage, which specifically includes the following steps:

根据需求资源存储量,在外部存储器中选取部分空间,将部分空间分隔为N个数据块,其中,

Figure BDA0003147639070000091
X为需求资源存储量,R为FPGA片内存储器的数据宽度,L为FPGA片内存储器剩余的数据深度,R×L等于FPGA片内存储器剩余存储量Y;数据块的数量取决于FPGA片内存储器的存储量。当数据块的数量确定以后,将采样数据分块处理,为此,将FPGA片内存储器内的采样数据存入外部存储器的具体步骤包括:将FPGA片内存储器内的采样数据依次存入外部存储器的数据块中。According to the required resource storage amount, select a part of the space in the external memory, and divide the part of the space into N data blocks, among which,
Figure BDA0003147639070000091
X is the required resource storage amount, R is the data width of the FPGA on-chip memory, L is the remaining data depth of the FPGA on-chip memory, R×L is equal to the remaining storage amount Y of the FPGA on-chip memory; the number of data blocks depends on the FPGA on-chip memory The amount of storage in the memory. After the number of data blocks is determined, the sampled data is processed in blocks. To this end, the specific steps of storing the sampled data in the FPGA on-chip memory into the external memory include: sequentially storing the sampled data in the FPGA on-chip memory into the external memory in the data block.

在具体实施时,根据需求资源存储量,在外部存储器中选取部分空间,将部分空间分隔为若干个数据块,其中,数据块的总存储量等于FPGA片内存储器的存储量,将FPGA片内存储器数据按序迁移至数据块中。并且,需求资源存储量与数据块中存储的总数据量相等。In the specific implementation, according to the required resource storage, a part of the space is selected in the external memory, and the part of the space is divided into several data blocks, wherein the total storage capacity of the data blocks is equal to the storage capacity of the FPGA on-chip memory. Memory data is migrated sequentially into data blocks. And, the required resource storage amount is equal to the total data amount stored in the data block.

通过采用外部存储器对待测试逻辑信号进行存储,充分利用了外部存储器的闲散空间,提高了测试信号的存储量,从而使采样信号的深度提高,加快了逻辑测试时的效率。By using the external memory to store the logic signal to be tested, the idle space of the external memory is fully utilized, the storage capacity of the test signal is increased, the depth of the sampled signal is increased, and the efficiency of the logic test is accelerated.

可选地,在嵌入式逻辑分析仪测试完成后,本申请实施例的FPGA逻辑测试方法还包括如下步骤:Optionally, after the embedded logic analyzer is tested, the FPGA logic testing method of the embodiment of the present application further includes the following steps:

数据按块存储于外部存储器,当测试完成后,为了将数据转移通过外接的显示器进行显示,首先要将外部存储器内存储采样数据的数据块按序写入FPGA片内存储器;具体可按先进先出或是先进后出等顺序从外部存储器写入FPGA片内存储器,当第一个数据块被存入FPGA片内存储器,第二个数据块会接着被写入FPGA片内存储器实现刷新FPGA片内存储器内的数据,第一个数据块即为从FPGA片内存储器的数据缓冲器存入外部存储器的第一个数据块。当第二个数据块被写入FPGA片内存储器后,FPGA片内存储器内存储的数据会被刷新为第二个数据块的数据,数据块被逐个存入FPGA片内存储器,当每完成一个数据块的读出后,将下一个数据块写入FPGA片内存储器实现FPGA片内存储器的刷新,直到数据块读出完成,即当最后一个数据块被写入FPGA片内存储器。The data is stored in the external memory in blocks. After the test is completed, in order to transfer the data for display through the external display, first write the data blocks of the sampled data stored in the external memory into the FPGA on-chip memory in sequence; The sequence of out or FIFO is written into the FPGA on-chip memory from the external memory. When the first data block is stored in the FPGA on-chip memory, the second data block will then be written into the FPGA on-chip memory to refresh the FPGA chip. For the data in the internal memory, the first data block is the first data block stored in the external memory from the data buffer of the FPGA on-chip memory. After the second data block is written into the FPGA on-chip memory, the data stored in the FPGA on-chip memory will be refreshed to the data of the second data block, and the data blocks will be stored into the FPGA on-chip memory one by one. After the data block is read, the next data block is written into the FPGA on-chip memory to refresh the FPGA on-chip memory until the data block is read out, that is, when the last data block is written into the FPGA on-chip memory.

具体地,当FPGA片内存储器的存储空间不满足测试要求,利用外部存储器进行存储后,为了对采样信号进行显示观察,还需要将采样数据写入FPGA片内存储器,通过JTAG接口连接到显示器进行显示,所以还需要将外部存储器写入FPGA片内存储器。Specifically, when the storage space of the FPGA on-chip memory does not meet the test requirements, after using the external memory for storage, in order to display and observe the sampled signal, it is necessary to write the sampled data into the FPGA on-chip memory, and connect it to the display through the JTAG interface. display, so the external memory also needs to be written to the FPGA on-chip memory.

此时,外部存储器的数据按从FPGA片内存储器写入数据时划分的数据块依次被写入FPGA片内存储器,当第一个数据块被完全写入FPGA片内存储器,第二个数据块会接着写入FPGA片内存储器刷新FPGA片内存储器的数据。At this time, the data of the external memory is written into the FPGA on-chip memory in sequence according to the data blocks divided when writing data from the FPGA on-chip memory. When the first data block is completely written into the FPGA on-chip memory, the second data block It will then write to the FPGA on-chip memory to refresh the data in the FPGA on-chip memory.

当采样信号通过外部存储器存储时,为了对采样信号进行显示,当采样信号被存入外部存储器后,采样信号依旧会被按写入外部存储器时的数据块格式按序写入FPGA片内存储器,但由于FPGA片内存储器的可存储量的大小,当

Figure BDA0003147639070000101
时,由于需求资源存储量与片内存储量一致的情况,片内存储器只存储R×L大小的数据量,为一个数据块。同时,数据块会被依次一个个的写入FPGA片内存储器,采用这种方法,使采样信号不局限于FPGA片内存储器和外部存储器的数据宽度的要求,扩大了适用的外部存储器的范围。When the sampled signal is stored in the external memory, in order to display the sampled signal, after the sampled signal is stored in the external memory, the sampled signal will still be written to the FPGA on-chip memory in sequence according to the data block format when writing to the external memory. However, due to the size of the storable amount of FPGA on-chip memory, when
Figure BDA0003147639070000101
When the required resource storage amount is consistent with the on-chip storage amount, the on-chip memory only stores the data amount of R×L size, which is one data block. At the same time, the data blocks will be written into the FPGA on-chip memory one by one. Using this method, the sampling signal is not limited to the data width requirements of the FPGA on-chip memory and the external memory, and the scope of the applicable external memory is expanded.

可选地,当外部存储器的数据宽度C和FPGA片内存储器的数据宽度R不等时,在外部存储器中存储的数据仍需被写入FPGA片内存储器进行存储,此时,将存储于外部存储器内的数据块按序写入FPGA片内存储器的具体步骤包括:将外部存储器内的数据块依次存入数据读缓冲区,将数据读缓冲区中的数据块的数据宽度修改为R,将数据读缓冲区中数据宽度为R的数据块存入FPGA片内存储器。Optionally, when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the data stored in the external memory still needs to be written into the FPGA on-chip memory for storage. The specific steps of sequentially writing the data blocks in the memory into the FPGA on-chip memory include: sequentially storing the data blocks in the external memory into the data read buffer, modifying the data width of the data blocks in the data read buffer to R, The data block whose data width is R in the data read buffer is stored in the FPGA on-chip memory.

具体地,当外部存储器等于FPGA片内存储器的数据宽度时,不需要进行外部存储器到FPGA片内存储器的数据宽度修正,直接将外部存储器写入FPGA片内存储器中。但当数据宽度不一致时,在FPGA逻辑测试装置中的数据缓存单元的数据读缓冲区进行数据缓冲,重新组织数据,将数据的数据宽度转换为FPGA片内存储器的数据宽度,再将外部存储器数据块按序写入FPGA片内存储器。Specifically, when the external memory is equal to the data width of the FPGA on-chip memory, there is no need to correct the data width from the external memory to the FPGA on-chip memory, and the external memory is directly written into the FPGA on-chip memory. However, when the data width is inconsistent, the data read buffer of the data cache unit in the FPGA logic test device performs data buffering, reorganizes the data, converts the data width of the data to the data width of the FPGA on-chip memory, and then converts the external memory data to the data width. Blocks are written to the FPGA on-chip memory sequentially.

当外部存储器存储采样信号时,外部存储器的存储数据还需要被写入FPGA片内存储器,才得以发送至显示器进行显示。具体信号显示过程中,首先外部存储器的存储数据被按块写入片内存储器,第一个数据块被写入片内存储器后,通过JTAG连接的外部显示器进行信号示波;同时,随着第一个数据块的数据被逐渐读出,第二个数据块逐渐写入FPGA片内存储器,实现FPGA片内存储器数据的刷新,重复数据被写入片内存储器再由外部显示器进行显示的步骤,直到数据都由外部显示器进行了显示。通过在测试存储模块进行缓冲,使数据宽度通过重新组织得到适配,避免了数据宽度不一致的情况,扩大了测试方法的适用场景。When the external memory stores the sampled signal, the stored data in the external memory also needs to be written into the FPGA on-chip memory before it can be sent to the display for display. In the specific signal display process, first the stored data of the external memory is written into the on-chip memory in blocks, and after the first data block is written into the on-chip memory, the signal oscilloscope is performed through the external display connected by JTAG; The data of one data block is gradually read out, and the second data block is gradually written into the FPGA on-chip memory to refresh the data in the FPGA on-chip memory. Until the data is displayed by the external display. By buffering in the test storage module, the data width can be adapted through reorganization, which avoids the inconsistent data width and expands the applicable scenarios of the test method.

在一种可能的实施方式中,外部存储器为FPGA配置芯片,其中,FPGA配置芯片为FPGA掉电时用于存储FPGA程序的芯片,当FPGA上电后,FPGA配置芯片将存储的FPGA程序发送至FPGA内,此时FPGA配置芯片为空闲状态。In a possible implementation, the external memory is an FPGA configuration chip, where the FPGA configuration chip is a chip used to store the FPGA program when the FPGA is powered off, and when the FPGA is powered on, the FPGA configuration chip sends the stored FPGA program to In the FPGA, the FPGA configuration chip is in an idle state at this time.

具体地,外部存储器可以为FPGA配置芯片,FPGA配置芯片为在FPGA掉电时用于存储FPGA程序的芯片。当FPGA掉电后,上电时的程序不会进行存储,FPGA配置芯片用于存储FPGA掉电后会丢失的程序。当FPGA重新上电,FPGA配置芯片会在短时间内重新配置到FPGA硬件中去,配置完成后,片外配置芯片为空闲状态,当利用嵌入式逻辑分析仪对待测试逻辑源代码进行测试时,可用于存储片内存储资源无法存储的待测试信号。Specifically, the external memory may be an FPGA configuration chip, and the FPGA configuration chip is a chip used to store the FPGA program when the FPGA is powered off. When the FPGA is powered off, the program when powered on will not be stored, and the FPGA configuration chip is used to store the program that will be lost when the FPGA is powered off. When the FPGA is powered on again, the FPGA configuration chip will be reconfigured to the FPGA hardware in a short time. After the configuration is completed, the off-chip configuration chip will be in an idle state. When the embedded logic analyzer is used to test the logic source code to be tested, It can be used to store signals to be tested that cannot be stored by on-chip memory resources.

由于FPGA片内存储器易失,FPGA配置芯片会在FPGA掉电后用于存储FPGA片内存储器的程序,当上电后,在使用嵌入式逻辑分析仪进行存储时,利用空闲的FPGA配置芯片存储待测试信号,从而可有效提高测试的采样深度,充分利用FPGA内的闲散资源而无需增设外部存储器,降低了设备成本。Since the FPGA on-chip memory is volatile, the FPGA configuration chip will be used to store the program in the FPGA on-chip memory after the FPGA is powered off. Therefore, the sampling depth of the test can be effectively improved, and the idle resources in the FPGA can be fully utilized without adding external memory, which reduces the equipment cost.

本发明提供的一种FPGA逻辑测试装置30,参见图4,包括:An FPGA logic testing device 30 provided by the present invention, referring to FIG. 4 , includes:

存储量确定模块301,用于基于待测试逻辑源代码的待测试信号带宽和采样深度,确定测试所述待测试逻辑源代码所需的需求资源存储量;A storage amount determination module 301, configured to determine the required resource storage amount required for testing the logic source code to be tested based on the bandwidth of the signal to be tested and the sampling depth of the logic source code to be tested;

存储方式确定模块302,用于若所述需求资源存储量小于FPGA片内存储器的剩余存储量,则确定存储方式为片内存储,否则确定存储方式为片外存储;其中,片内存储对应的存储器为FPGA片内存储器,片外存储对应的存储器为外部存储器;The storage mode determination module 302 is configured to determine that the storage mode is on-chip storage if the required resource storage amount is less than the remaining storage capacity of the FPGA on-chip memory, otherwise, determine that the storage mode is off-chip storage; wherein, the corresponding on-chip storage The memory is the FPGA on-chip memory, and the memory corresponding to the off-chip memory is the external memory;

测试存储模块303,用于基于嵌入式逻辑分析仪内核对所述待测试逻辑源代码进行测试,并根据确定的存储方式将测试产生的采样数据存储到对应的存储器中。The test storage module 303 is configured to test the logic source code to be tested based on the embedded logic analyzer core, and store the sampled data generated by the test in the corresponding memory according to the determined storage mode.

可选地,当存储方式为片外存储时,所述测试存储模块303具体用于:Optionally, when the storage mode is off-chip storage, the test storage module 303 is specifically used for:

将测试产生的采样数据写入所述FPGA片内存储器;Write the sampled data generated by the test into the FPGA on-chip memory;

当写入所述FPGA片内存储器内的采样数据的数据量满足预设条件时,将所述FPGA片内存储器内的采样数据存入所述外部存储器。When the data amount of the sampled data written into the FPGA on-chip memory satisfies a preset condition, the sampled data in the FPGA on-chip memory is stored in the external memory.

可选地,所述装置还包括计数模块:Optionally, the device also includes a counting module:

记录向所述FPGA片内存储器内写入采样数据的写入次数;Record the number of times of writing sampling data into the FPGA on-chip memory;

若所述写入次数不小于数据转移阈值,则确定写入所述FPGA片内存储器内的采样数据的数据量满足预设条件,并将所述写入次数清零,其中,数据转移阈值是基于所述需求资源存储量和待测试信号带宽确定的。If the number of writes is not less than the data transfer threshold, it is determined that the data amount of the sampled data written in the FPGA on-chip memory meets a preset condition, and the number of writes is cleared, wherein the data transfer threshold is It is determined based on the required resource storage amount and the bandwidth of the signal to be tested.

可选地,所述计数模块中,所述数据转移阈值为

Figure BDA0003147639070000121
其中,Y为所述FPGA片内存储器的剩余存储量,K为待测试信号带宽,n为大于1的数值。Optionally, in the counting module, the data transfer threshold is
Figure BDA0003147639070000121
Wherein, Y is the remaining storage capacity of the on-chip memory of the FPGA, K is the bandwidth of the signal to be tested, and n is a value greater than 1.

可选地,当外部存储器的数据宽度C和FPGA片内存储器的数据宽度R不等时,所述测试存储模块303,具体用于:Optionally, when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the test storage module 303 is specifically used for:

将所述FPGA片内存储器内待存入所述外部存储器的采样数据依次存入数据写缓冲区,将数据写缓冲区中的采样数据的数据宽度修改为R,将数据写缓冲区中数据宽度为R的采样数据存入所述外部存储器。The sampled data to be stored in the external memory in the FPGA on-chip memory is sequentially stored in the data write buffer, the data width of the sampled data in the data write buffer is modified to R, and the data width in the data write buffer Store the sampled data for R into the external memory.

可选地,所述装置还包括空间选取模块,具体用于:Optionally, the device further includes a space selection module, which is specifically used for:

根据所述需求资源存储量,在所述外部存储器中选取部分空间,将所述部分空间分隔为N个数据块,其中,

Figure BDA0003147639070000122
X为所述需求资源存储量,R为所述FPGA片内存储器的数据宽度,L为所述FPGA片内存储器剩余的数据深度;According to the required resource storage amount, a part of the space is selected in the external memory, and the part of the space is divided into N data blocks, wherein,
Figure BDA0003147639070000122
X is the required resource storage amount, R is the data width of the FPGA on-chip memory, and L is the remaining data depth of the FPGA on-chip memory;

所述测试存储模块303具体还用于:The test storage module 303 is also specifically used for:

将所述FPGA片内存储器内的采样数据依次存入所述外部存储器的数据块中。The sampling data in the on-chip memory of the FPGA is sequentially stored in the data blocks of the external memory.

可选地,在所述嵌入式逻辑分析仪测试完成后,所述装置还包括数据迁移模块,具体用于:Optionally, after the embedded logic analyzer is tested, the device further includes a data migration module, which is specifically used for:

将所述外部存储器内存储采样数据的数据块按序写入所述FPGA片内存储器;The data blocks storing the sampled data in the external memory are sequentially written into the FPGA on-chip memory;

当每完成一个数据块的读出后,将下一个数据块写入片内存储器实现片内存储器的刷新,直到数据块读出完成。After each data block is read out, the next data block is written into the on-chip memory to refresh the on-chip memory until the data block is read out.

可选地,当外部存储器的数据宽度C和FPGA片内存储器的数据宽度R不等时,所述测试存储模块303还用于:Optionally, when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the test storage module 303 is also used for:

将所述外部存储器内的数据块依次存入数据读缓冲区,将数据读缓冲区中的数据块的数据宽度修改为C,将数据读缓冲区中数据宽度为C的数据块存入所述FPGA片内存储器。The data blocks in the external memory are stored in the data read buffer in turn, the data width of the data blocks in the data read buffer is modified to C, and the data blocks with a data width of C in the data read buffer are stored in the data read buffer. FPGA on-chip memory.

可选地,所述测试模块303具体用于的所述外部存储器为FPGA配置芯片,其中,FPGA配置芯片为FPGA掉电时用于存储FPGA程序的芯片,当FPGA上电后,FPGA配置芯片将存储的FPGA程序发送至FPGA内,此时FPGA配置芯片为空闲状态。Optionally, the external memory specifically used by the test module 303 is an FPGA configuration chip, wherein the FPGA configuration chip is a chip used to store the FPGA program when the FPGA is powered off. When the FPGA is powered on, the FPGA configuration chip will store the FPGA program. The stored FPGA program is sent to the FPGA, and the FPGA configures the chip to be in an idle state at this time.

本申请实施例提供的FPGA逻辑测试装置30与上述FPGA逻辑测试方法采用了相同的发明构思,能够取得相同的有益效果,在此不再赘述。The FPGA logic testing apparatus 30 provided in the embodiment of the present application adopts the same inventive concept as the above-mentioned FPGA logic testing method, and can achieve the same beneficial effects, which will not be repeated here.

基于与上述FPGA逻辑测试方法相同的发明构思,本申请实施例还提供了一种电子设备40,如图5所示,该电子设备40可以包括处理器401和存储器402。Based on the same inventive concept as the above-mentioned FPGA logic testing method, an embodiment of the present application further provides an electronic device 40 , as shown in FIG. 5 , the electronic device 40 may include a processor 401 and a memory 402 .

处理器401可以是通用处理器,例如中央处理器(CPU)、数字信号处理器(DigitalSignal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。The processor 401 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array) , FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components, which can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the methods disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

存储器402作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random Access Memory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申请实施例中的存储器402还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。As a non-volatile computer-readable storage medium, the memory 402 can be used to store non-volatile software programs, non-volatile computer-executable programs and modules. The memory may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Magnetic Memory, Disk, CD and so on. Memory is, but is not limited to, any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 402 in this embodiment of the present application may also be a circuit or any other device capable of implementing a storage function, for storing program instructions and/or data.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;上述计算机存储介质可以是计算机能够存取的任何可用介质或数据存储设备,包括但不限于:移动存储设备、随机存取存储器(RAM,Random Access Memory)、磁性存储器(例如软盘、硬盘、磁带、磁光盘(MO)等)、光学存储器(例如CD、DVD、BD、HVD等)、以及半导体存储器(例如ROM、EPROM、EEPROM、非易失性存储器(NAND FLASH)、固态硬盘(SSD))等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by program instructions related to hardware, the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, execute Including the steps of the above-mentioned method embodiments; the above-mentioned computer storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to: mobile storage device, random access memory (RAM, Random Access Memory), magnetic memory (eg floppy disk, hard disk, magnetic tape, magneto-optical disk (MO), etc.), optical memory (eg CD, DVD, BD, HVD, etc.), and semiconductor memory (eg ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH) , Solid State Drive (SSD)) and other media that can store program codes.

或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、随机存取存储器(RAM,Random Access Memory)、磁性存储器(例如软盘、硬盘、磁带、磁光盘(MO)等)、光学存储器(例如CD、DVD、BD、HVD等)、以及半导体存储器(例如ROM、EPROM、EEPROM、非易失性存储器(NAND FLASH)、固态硬盘(SSD))等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated units of the present application are implemented in the form of software function modules and sold or used as independent products, they may also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence or in the parts that make contributions to the prior art. The computer software products are stored in a storage medium and include several instructions for A computer device (which may be a personal computer, a server, or a network device, etc.) is caused to execute all or part of the methods described in the various embodiments of the present application. The aforementioned storage media include: removable storage devices, random access memory (RAM, Random Access Memory), magnetic storage (such as floppy disk, hard disk, magnetic tape, magneto-optical disk (MO), etc.), optical storage (such as CD, DVD, BD, etc.) , HVD, etc.), and semiconductor memories (eg, ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state disk (SSD), etc.) various media that can store program codes.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围,其均应涵盖在本发明的权利要求和说明书的范围当中。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features thereof can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention. The scope of the invention should be included in the scope of the claims and description of the present invention.

Claims (5)

1. An FPGA logic test method is applied to an FPGA which does not additionally increase an external memory and only utilizes idle resources, and is characterized by comprising the following steps:
determining the required resource storage amount required by testing the logic source code to be tested based on the bandwidth and the sampling depth of the signal to be tested of the logic source code to be tested;
if the required resource storage amount is less than the residual storage amount of the FPGA on-chip memory, determining that the storage mode is on-chip storage, otherwise, determining that the storage mode is off-chip storage; the storage corresponding to the on-chip storage is an FPGA on-chip storage, and the storage corresponding to the off-chip storage is an external storage; the external memory is an FPGA configuration chip, wherein the FPGA configuration chip is a chip for storing an FPGA program when the FPGA is powered off, and after the FPGA is powered on, the FPGA configuration chip sends the stored FPGA program into the FPGA, and is in an idle state at the moment;
when the storage mode is off-chip storage, the step of storing the sampling data generated by the test into the corresponding memory according to the determined storage mode comprises the following steps:
writing sampling data generated by testing into the FPGA on-chip memory;
when the data volume of the sampling data written into the FPGA on-chip memory meets a preset condition, storing the sampling data in the FPGA on-chip memory into the external memory;
when the data width C of the external memory is not equal to the data width R of the FPGA on-chip memory, the step of storing the sampling data in the FPGA on-chip memory into the external memory comprises the following steps:
sequentially storing the sampling data to be stored into the external memory in the FPGA on-chip memory into a data writing buffer area, modifying the data width of the sampling data in the data writing buffer area to R, and storing the sampling data with the data width of R in the data writing buffer area into the external memory;
testing the logic source code to be tested based on the embedded logic analyzer kernel, and storing sampling data generated by testing into a corresponding memory according to a determined storage mode;
the method further comprises the following steps:
recording the writing times of writing sampling data into the FPGA on-chip memory;
if the writing times are not less than a data transfer threshold value, determining that the data volume of the sampling data written into the FPGA on-chip memory meets a preset condition, and clearing the writing times, wherein the data transfer threshold value is determined based on the required resource storage amount and the bandwidth of the signal to be tested; the data transferShift the threshold value to
Figure FDA0003688150580000011
Y is the residual memory space of the FPGA on-chip memory, K is the bandwidth of the signal to be tested, and n is a numerical value larger than 1.
2. The method of claim 1, further comprising:
selecting a partial space in the external memory according to the demand resource storage amount, and dividing the partial space into N data blocks,
Figure FDA0003688150580000021
x is the storage amount of the required resources, R is the data width of the FPGA on-chip memory, and L is the residual data depth of the FPGA on-chip memory;
the storing the sampling data in the FPGA on-chip memory into the external memory comprises:
and sequentially storing the sampling data in the FPGA on-chip memory into the data block of the external memory.
3. The method of claim 1, further comprising, after the embedded logic analyzer test is completed:
writing the data blocks storing the sampling data in the external memory into the FPGA on-chip memory in sequence;
and after the reading of each data block is finished, writing the next data block into the on-chip memory to realize the refreshing of the on-chip memory until the reading of the data block is finished.
4. The method according to claim 3, wherein when the data width C of the external memory and the data width R of the FPGA on-chip memory are not equal, the writing the data blocks stored in the external memory into the FPGA on-chip memory in sequence comprises:
and sequentially storing the data blocks in the external memory into a data reading buffer area, modifying the data width of the data blocks in the data reading buffer area into C, and storing the data blocks with the data width of C in the data reading buffer area into the FPGA chip memory.
5. An FPGA logic test device, comprising:
the memory space determining module is used for determining the required resource memory space required by testing the logic source code to be tested based on the bandwidth and the sampling depth of the signal to be tested of the logic source code to be tested;
the storage mode determining module is used for determining that the storage mode is on-chip storage if the storage capacity of the required resources is less than the residual storage capacity of the FPGA on-chip storage, or determining that the storage mode is off-chip storage; the storage corresponding to the on-chip storage is an FPGA on-chip storage, and the storage corresponding to the off-chip storage is an external storage; the external memory is an FPGA configuration chip, wherein the FPGA configuration chip is a chip for storing an FPGA program when the FPGA is powered off, and after the FPGA is powered on, the FPGA configuration chip sends the stored FPGA program to the FPGA, and the FPGA configuration chip is in an idle state;
when the storage mode is off-chip storage, the step of storing the sampling data generated by the test into the corresponding memory according to the determined storage mode comprises the following steps:
writing sampling data generated by testing into the FPGA on-chip memory;
when the data volume of the sampled data written into the FPGA on-chip memory meets a preset condition, storing the sampled data in the FPGA on-chip memory into the external memory;
when the data width C of the external memory is not equal to the data width R of the FPGA on-chip memory, the step of storing the sampling data in the FPGA on-chip memory into the external memory comprises the following steps:
sequentially storing the sampling data to be stored into the external memory in the FPGA on-chip memory into a data writing buffer area, modifying the data width of the sampling data in the data writing buffer area to R, and storing the sampling data with the data width of R in the data writing buffer area into the external memory;
the test storage module is used for testing the logic source code to be tested based on the embedded logic analyzer kernel and storing the sampling data generated by the test into the corresponding memory according to the determined storage mode;
the apparatus is further configured to:
recording the writing times of writing sampling data into the FPGA on-chip memory;
if the writing times are not less than a data transfer threshold value, determining that the data volume of the sampling data written into the FPGA on-chip memory meets a preset condition, and clearing the writing times, wherein the data transfer threshold value is determined based on the required resource storage amount and the bandwidth of the signal to be tested; the data transfer threshold is
Figure FDA0003688150580000031
And Y is the residual memory space of the FPGA on-chip memory, K is the bandwidth of a signal to be tested, and n is a numerical value larger than 1.
CN202110756274.3A 2021-07-05 2021-07-05 FPGA logic test method and device Active CN113505063B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110756274.3A CN113505063B (en) 2021-07-05 2021-07-05 FPGA logic test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110756274.3A CN113505063B (en) 2021-07-05 2021-07-05 FPGA logic test method and device

Publications (2)

Publication Number Publication Date
CN113505063A CN113505063A (en) 2021-10-15
CN113505063B true CN113505063B (en) 2022-09-30

Family

ID=78011645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110756274.3A Active CN113505063B (en) 2021-07-05 2021-07-05 FPGA logic test method and device

Country Status (1)

Country Link
CN (1) CN113505063B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115756962A (en) * 2022-11-21 2023-03-07 浪潮(北京)电子信息产业有限公司 Memory backup acceleration method, device, device, and computer-readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6986073B2 (en) * 2000-03-01 2006-01-10 Realtek Semiconductor Corp. System and method for a family of digital subscriber line (XDSL) signal processing circuit operating with an internal clock rate that is higher than all communications ports operating with a plurality of port sampling clock rates
CN106873916A (en) * 2017-02-23 2017-06-20 郑州云海信息技术有限公司 A kind of Debugging message access method and device based on the debugging of ultra-large chip
CN108319526B (en) * 2017-12-18 2021-09-21 北京时代民芯科技有限公司 Built-in self-testing method based on-chip embedded micro system and internal FPGA (field programmable Gate array) resource thereof

Also Published As

Publication number Publication date
CN113505063A (en) 2021-10-15

Similar Documents

Publication Publication Date Title
CN108133732B (en) Performance test method, device and equipment of flash memory chip and storage medium
CN105279115B (en) Flash memory control device, flash memory control system, and flash memory control method
CN111813591B (en) Data error correction method and device of Nand Flash, electronic equipment and storage medium
US11068169B2 (en) Data storage device and method for memory operation and iterative polling
WO2020135384A1 (en) Data compression method and apparatus
TW201711049A (en) Method for managing a memory apparatus, and associated memory apparatus thereof and associated controller thereof
CN113900903B (en) Log storage device, log capturing method and storage medium
CN112181710A (en) A kind of solid state disk data storage method and device based on bit flip
CN113505063B (en) FPGA logic test method and device
CN115206405A (en) Test method, test device and computer readable storage medium for solid state hard disk
CN119088631A (en) A chip register verification method, device, equipment and medium
CN109785891A (en) A method of obtaining the shallow erasing characteristic rule of NAND flash storage
US10970206B2 (en) Flash data compression decompression method and apparatus
CN110399645B (en) FPGA prototype verification acceleration system based on solid state disk and implementation method
CN113419688B (en) Error rate analysis method, system and device of MLC chip
CN115933995B (en) Data writing method, device, electronic equipment and readable medium in solid-state hard disk
CN112988037A (en) Static wear leveling method, terminal and computer-readable storage medium
CN115470052B (en) Bad block detection method and device for memory chip and memory medium
CN114550809B (en) Multi-storage card testing method, device, computer equipment and storage medium
CN116301631A (en) Method and device for improving read-write performance of hard disk, hard disk and storage medium
CN116149549A (en) Cold data identification method and flash memory device
CN115148271A (en) Method and system for testing memory chip and storage medium
CN113806149B (en) Memory read-write test method and device and storage medium
CN109522565A (en) A kind of verification method, device and computer readable storage medium
CN114116291B (en) Log detection method, log detection device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant