CN117634370A - Function verification method and platform for Verilog code - Google Patents
Function verification method and platform for Verilog code Download PDFInfo
- Publication number
- CN117634370A CN117634370A CN202311740984.2A CN202311740984A CN117634370A CN 117634370 A CN117634370 A CN 117634370A CN 202311740984 A CN202311740984 A CN 202311740984A CN 117634370 A CN117634370 A CN 117634370A
- Authority
- CN
- China
- Prior art keywords
- simulation
- verification
- eda
- module
- verilog code
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/30—Circuit design
- G06F30/32—Circuit design at the digital level
- G06F30/33—Design verification, e.g. functional simulation or model checking
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/30—Circuit design
- G06F30/32—Circuit design at the digital level
- G06F30/337—Design optimisation
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Description
技术领域Technical field
本发明涉及数字集成电路验证技术领域,尤其涉及一种Verilog代码的功能验证方法及平台。The invention relates to the technical field of digital integrated circuit verification, and in particular to a Verilog code function verification method and platform.
背景技术Background technique
当前对于Verilog代码的功能验证,主要思路是通过使用电子设计自动化(Electronic design automation,EDA)仿真工具编写Testbench,用以生成验证激励,并将待验证Verilog代码的输出与预期结果进行对比,从而达到功能验证的目的。前述方法不仅每次验证都需开发人员在EDA仿真工具的图形用户界面(Graphical User Interface,GUI)进行交互与操作,还依赖人工编写Testbench生成验证激励,并手动对比待验证Verilog代码的输出与预期结果。导致验证自动化水平低、可视性差,以及验证用例覆盖率低、移植性差等问题。 Currently, the main idea for functional verification of Verilog code is to write Testbench using Electronic Design Automation (EDA) simulation tools to generate verification incentives, and compare the output of the Verilog code to be verified with the expected results, so as to achieve Functional verification purposes. The aforementioned method not only requires developers to interact and operate in the Graphical User Interface (GUI) of the EDA simulation tool for each verification, but also relies on manually writing Testbench to generate verification incentives and manually comparing the output of the Verilog code to be verified with expectations. result. This leads to problems such as low verification automation level, poor visibility, low verification use case coverage, and poor portability.
发明内容Contents of the invention
有鉴于此,本发明提供了一种Verilog代码的功能验证方法及平台,以解决传统Verilog代码验证方法中存在的验证用例覆盖率低、移植性差,及验证自动化水平低、可视性差等问题。In view of this, the present invention provides a Verilog code function verification method and platform to solve the problems existing in the traditional Verilog code verification method such as low verification use case coverage, poor portability, low verification automation level, and poor visibility.
为实现上述目的,本发明第一方面公开一种Verilog代码的功能验证方法,其特征包括以下步骤:In order to achieve the above object, the first aspect of the present invention discloses a functional verification method of Verilog code, which features include the following steps:
步骤1:验证激励生成。验证激励为仿真的外部输入,需根据验证的目的与场景需求生成对应的验证激励。Step 1: Verify incentive generation. Verification incentives are external inputs to the simulation, and corresponding verification incentives need to be generated based on the verification purpose and scenario requirements.
步骤2:Matlab仿真脚本编写。利用软件Matlab编写仿真脚本,用以实现对Verilog代码预期功能的仿真,获取预期仿真结果并作为基准。Step 2: Matlab simulation script writing. Use the software Matlab to write simulation scripts to simulate the expected functions of the Verilog code, and obtain the expected simulation results as a benchmark.
步骤3:EDA仿真脚本编写。利用Python语言编写EDA仿真脚本,通过调用工具命令语言(Tool Command Language,TCL)在后台运行EDA仿真工具,以生成仿真文件,并通过Python的文件函数库,完成对仿真文件的修改与运行。 Step 3: EDA simulation script writing. Use the Python language to write EDA simulation scripts, call the Tool Command Language (TCL) to run the EDA simulation tool in the background to generate simulation files, and complete the modification and operation of the simulation files through the Python file function library.
步骤4:Testbench编写。在EDA仿真工具中编写Testbench,并置于待验证工程顶部。Testbench用以对待验证Verilog代码模块的接口及控制信号进行配置,并完成验证激励的输入与行为仿真结果的输出。Step 4: Testbench writing. Write Testbench in the EDA simulation tool and place it on top of the project to be verified. Testbench is used to configure the interface and control signals of the Verilog code module to be verified, and complete the input of verification stimuli and the output of behavioral simulation results.
步骤5:Matlab仿真脚本、EDA仿真脚本运行。分别运行Matlab仿真脚本与EDA仿真脚本,并得到预期仿真结果及行为仿真结果。Step 5: Run the Matlab simulation script and EDA simulation script. Run the Matlab simulation script and the EDA simulation script respectively, and obtain the expected simulation results and behavioral simulation results.
步骤6:功能正确性验证。对比预期仿真结果与行为仿真结果,验证Verilog代码的功能正确性。Step 6: Verification of functional correctness. Compare the expected simulation results with the behavioral simulation results to verify the functional correctness of the Verilog code.
进一步地,所述步骤1,根据仿真目的与需求,对验证激励的名称、数量、长度、随机性及限值等控制项进行人为设置,以生成符合仿真目的与需求的激励。Further, step 1 is to manually set control items such as the name, quantity, length, randomness, and limit of the verification incentives according to the purpose and needs of the simulation to generate incentives that meet the purpose and needs of the simulation.
进一步地,所述步骤2,Matlab仿真脚本共包含三部分内容,分别为验证激励的读取,待验证Verilog代码预期功能的实现及预期仿真结果的文件写入。Furthermore, in step 2, the Matlab simulation script contains three parts, namely reading of verification incentives, implementation of the expected functions of the Verilog code to be verified, and file writing of expected simulation results.
进一步地,所述Verilog代码的预期功能为开发人员为满足开发需求,对Verilog代码模块的作用与输出做出的定义。Further, the expected function of the Verilog code is the developer's definition of the role and output of the Verilog code module in order to meet development needs.
进一步地,所述步骤3,EDA仿真脚本包含三部分内容,分别为仿真文件的生成、修改及执行。Further, in step 3, the EDA simulation script includes three parts, which are the generation, modification and execution of the simulation file.
进一步地,所述仿真文件为EDA仿真工具执行仿真时自动生成的批处理及执行文件,用于对待仿真工程的名称、路径,仿真库及仿真设置进行说明,通过修改仿真文件内容,可修改被仿真对象,还可控制EDA仿真工具的界面显示、仿真时长、波形信号等设置。Further, the simulation file is a batch process and execution file automatically generated when the EDA simulation tool executes the simulation. It is used to describe the name, path, simulation library and simulation settings of the simulation project to be simulated. By modifying the content of the simulation file, the to-be-simulated project can be modified. The simulation object can also control the interface display, simulation duration, waveform signal and other settings of the EDA simulation tool.
优选地,所述EDA仿真脚本,通过Python调用TCL命令可在不运行仿真且不打开EDA仿真工具GUI的情况下,直接生成仿真所需的所有仿真文件。通过Python的文件编辑函数完成对仿真文件内容的修改,若仿真时有人值守,则将仿真文件内容修改为非命令行连续执行且执行完毕不退出仿真,可实现仿真时显示仿真界面且仿真结束后不退出;若仿真时无人值守,将仿真文件内容修改为命令行连续执行且执行完毕退出仿真,可实现仿真时不显示仿真界面且结束后退出仿真。通过Python的命令行函数执行仿真文件,以实现仿真的自动运行。Preferably, the EDA simulation script calls the TCL command through Python to directly generate all simulation files required for simulation without running the simulation and without opening the EDA simulation tool GUI. Modify the content of the simulation file through Python's file editing function. If someone is on duty during the simulation, modify the content of the simulation file to a non-command line for continuous execution and do not exit the simulation after the execution is completed. The simulation interface can be displayed during the simulation and after the simulation is completed. Do not exit; if the simulation is unattended, modify the content of the simulation file to continuously execute the command line and exit the simulation after execution, so that the simulation interface will not be displayed during the simulation and the simulation will exit after completion. Execute the simulation file through Python's command line function to realize automatic running of the simulation.
进一步地,所述步骤4,Testbench为EDA仿真工具中的虚拟测试平台,Testbench共包含三部分内容,分别为验证激励的读取、待验证Verilog代码模块接口与控制信号的配置及行为仿真结果的文件写入。Further, in step 4, Testbench is a virtual test platform in the EDA simulation tool. Testbench contains three parts, namely the reading of verification incentives, the configuration of the Verilog code module interface and control signals to be verified, and the behavioral simulation results. File writing.
进一步地,所述步骤5,首先运行Matlab仿真脚本,脚本自行生成预期仿真结果并写入txt文件;其次运行EDA仿真脚本,脚本自行生成行为仿真结果并写入txt文件。Further, in step 5, first run the Matlab simulation script, and the script will automatically generate the expected simulation results and write them into a txt file; secondly, run the EDA simulation script, and the script will automatically generate the behavioral simulation results and write them into the txt file.
进一步地,所述步骤6,从txt文件中分别读取预期仿真结果与行为仿真结果,并以预期仿真结果作为基准,验证行为仿真结果的正确性。Further, in step 6, the expected simulation results and behavioral simulation results are respectively read from the txt file, and the expected simulation results are used as a benchmark to verify the correctness of the behavioral simulation results.
本发明第二方面公开一种Verilog代码的功能验证平台,基于所述一种Verilog代码的功能验证方法实现。一种Verilog代码的功能验证平台包括前端层、服务层及数据层。A second aspect of the present invention discloses a Verilog code function verification platform, which is implemented based on the Verilog code function verification method. A functional verification platform for Verilog code includes a front-end layer, a service layer and a data layer.
进一步地,所述前端层,包括参数配置模块、验证模式选择模块、验证激励配置模块及验证结果显示模块。用于为开发人员提供显示、交互功能。前端层将开发人员所输入的参数、模式及激励配置等输入信息进行数据处理及逻辑分析,得到参数配置信号、验证模式控制信号及验证激励,并下发至服务层。同时接收数据层所上传的验证结果,并进行前端显示。Further, the front-end layer includes a parameter configuration module, a verification mode selection module, a verification incentive configuration module and a verification result display module. Used to provide developers with display and interactive functions. The front-end layer performs data processing and logical analysis on input information such as parameters, modes, and incentive configurations input by developers, and obtains parameter configuration signals, verification mode control signals, and verification incentives, and sends them to the service layer. At the same time, the verification results uploaded by the data layer are received and displayed on the front end.
进一步地,所述服务层,包括Matlab仿真模块与EDA仿真模块。用以接收前端层所下发的参数配置信号、验证模式控制信号及验证激励等控制信号,并依据所接收控制信号完成Matlab与EDA仿真,得到预期仿真结果与行为仿真结果,最后将控制信号、预期仿真结果及行为仿真结果一同下发至数据层。Further, the service layer includes a Matlab simulation module and an EDA simulation module. It is used to receive control signals such as parameter configuration signals, verification mode control signals, and verification excitations issued by the front-end layer, and complete Matlab and EDA simulations based on the received control signals to obtain expected simulation results and behavioral simulation results. Finally, the control signals, The expected simulation results and behavioral simulation results are sent to the data layer together.
进一步地,所述数据层,包括验证模块、日志打印模块及存储模块。用以接收服务层所下发的控制信号、预期仿真结果及行为仿真结果,依据预期仿真结果与行为仿真结果进行功能验证。若功能将验正确,则将验证结果上传至前端层;若功能验证错误,则将验证结果上传至前端层的同时,基于控制信号进行日志打印及数据存储。Further, the data layer includes a verification module, a log printing module and a storage module. It is used to receive the control signals, expected simulation results and behavioral simulation results issued by the service layer, and perform functional verification based on the expected simulation results and behavioral simulation results. If the function verification is correct, the verification result will be uploaded to the front-end layer; if the function verification is incorrect, the verification result will be uploaded to the front-end layer and at the same time, log printing and data storage will be performed based on the control signal.
进一步地,所述参数配置模块,用以接收参数配置信息,并将实数与路径等不同类型的参数统一转换成字符型的参数配置信号,最后将参数配置信号发送至EDA仿真模块与日志打印模块。Further, the parameter configuration module is used to receive parameter configuration information, uniformly convert different types of parameters such as real numbers and paths into character-type parameter configuration signals, and finally send the parameter configuration signals to the EDA simulation module and log printing module. .
进一步地,所述参数配置信息为开发人员对Testbench文件名称、待验证Verilog代码文件路径及文件存储路径等参数的配置信息。Further, the parameter configuration information is the developer's configuration information for parameters such as Testbench file name, Verilog code file path to be verified, and file storage path.
进一步地,所述验证模式选择模块,用以接收验证模式配置信息并进行逻辑分析,输出验证模式控制信号至Matlab仿真模块、EDA仿真模块及日志打印模块。Further, the verification mode selection module is used to receive the verification mode configuration information and perform logical analysis, and output the verification mode control signal to the Matlab simulation module, EDA simulation module and log printing module.
进一步地,所述验证模式配置信息为开发人员基于仿真目的与需求,对验证模式及验证次数的配置信息。其中,验证模式包含自动验证、代码调试及仿真文件生成等三种验证模式。三种验证模式的区别在于:1.自动验证模式为无人值守验证模式,开发人员不对验证结果进行实时检查,仅在所有验证完成后检查历史验证记录,此模式下的验证全部通过命令行运行,不显示EDA仿真工具界面;2.代码调试模式为有人值守验证模式,开发人员需对每次验证结果进行实时检查,以检查当前Verilog代码的功能正确性,此模式下的验证在EDA仿真工具中进行,实时显示每次验证的EDA仿真工具界面;3.仿真文件生成模式为仅生成仿真文件,不进行仿真文件的修改与执行操作,用于待验证的工程或Verilog代码发生变化后,生成针对新工程或代码的仿真文件。Further, the verification mode configuration information is the developer's configuration information of the verification mode and number of verifications based on simulation purposes and needs. Among them, the verification mode includes three verification modes: automatic verification, code debugging and simulation file generation. The difference between the three verification modes is: 1. The automatic verification mode is an unattended verification mode. The developer does not check the verification results in real time, but only checks the historical verification records after all verifications are completed. All verifications in this mode are run through the command line. , the EDA simulation tool interface is not displayed; 2. The code debugging mode is the attended verification mode. Developers need to check the results of each verification in real time to check the functional correctness of the current Verilog code. The verification in this mode is in the EDA simulation tool During the process, the EDA simulation tool interface for each verification is displayed in real time; 3. The simulation file generation mode is to only generate simulation files without modifying and executing the simulation files. It is used to generate after the project to be verified or the Verilog code changes. Simulation files for new projects or code.
进一步地,所述逻辑分析为设置模式控制字,并与验证模式进行1:1映射,映射关系为:自动验证-0,代码调试-1,仿真文件生成-2。将模式控制字与验证次数统称为验证模式控制信号。Further, the logic analysis is to set the mode control word and perform a 1:1 mapping with the verification mode. The mapping relationship is: automatic verification-0, code debugging-1, and simulation file generation-2. The mode control word and the number of verifications are collectively referred to as verification mode control signals.
进一步地,所述验证激励配置模块,用以接收激励配置信息,生成验证激励并输出至Matlab仿真模块、EDA仿真模块及存储模块。Further, the verification incentive configuration module is used to receive incentive configuration information, generate verification incentives and output them to the Matlab simulation module, EDA simulation module and storage module.
进一步地,所述激励配置信息为开发人员基于仿真目的与需求,对验证激励的名称、数量、长度、随机性及限值等参数的配置信息。Further, the incentive configuration information is the configuration information of the developers to verify the name, quantity, length, randomness, limit and other parameters of the incentives based on the purpose and needs of the simulation.
进一步地,所述验证结果显示模块,用以接收验证结果并进行前端显示。验证结果显示模块接收验证模块所输出的验证结果,在前端GUI中对当前验证次数、累计错误次数及本次验证结果进行显示。Further, the verification result display module is used to receive the verification results and perform front-end display. The verification result display module receives the verification results output by the verification module, and displays the current number of verifications, the cumulative number of errors, and the results of this verification in the front-end GUI.
进一步地,所述Matlab仿真模块,用以接收验证模式控制信号与验证激励,分析仿真控制字,执行Matlab仿真脚本以生成预期仿真结果,并将预期仿真结果输出至验证模块与日志打印模块。Further, the Matlab simulation module is used to receive the verification mode control signal and verification excitation, analyze the simulation control word, execute the Matlab simulation script to generate expected simulation results, and output the expected simulation results to the verification module and log printing module.
优选地,Matlab仿真模块内嵌步骤2所述的Matlab仿真脚本,对输入的验证模式控制信号中的模式控制字进行分析,若模式控制字为0或1,则执行脚本内容,并输出预期仿真结果;若模式控制字为2,则跳过本次Matlab仿真。Preferably, the Matlab simulation module embeds the Matlab simulation script described in step 2 to analyze the mode control word in the input verification mode control signal. If the mode control word is 0 or 1, execute the script content and output the expected simulation. Result: If the mode control word is 2, this Matlab simulation will be skipped.
进一步地,所述EDA仿真模块,用以接收参数配置信号、验证模式控制信号及验证激励,分析仿真控制字,执行EDA仿真脚本以生成行为仿真结果,并将行为仿真结果输出至验证模块与日志打印模块。Further, the EDA simulation module is used to receive parameter configuration signals, verification mode control signals and verification incentives, analyze the simulation control words, execute the EDA simulation script to generate behavioral simulation results, and output the behavioral simulation results to the verification module and log. Print module.
优选地,EDA仿真模块内嵌步骤3所述的EDA仿真脚本,对输入的验证模式控制信号中的模式控制字进行分析,若模式控制字为0或1,且当前为第一次验证,则完整执行脚本内容,并输出行为仿真结果;若模式控制字为0或1,但非第一次验证,则仅执行脚本的仿真文件的修改与运行部分,并输出行为仿真结果,略过仿真文件生成,以提高验证速度;若模式控制字为2,则仅执行脚本的仿真文件生成部分。Preferably, the EDA simulation module embeds the EDA simulation script described in step 3 to analyze the mode control word in the input verification mode control signal. If the mode control word is 0 or 1 and the current verification is the first time, then Completely execute the script content and output the behavioral simulation results; if the mode control word is 0 or 1, but it is not the first verification, only the modification and running part of the simulation file of the script will be executed, and the behavioral simulation results will be output, and the simulation file will be skipped. Generate to improve verification speed; if the mode control word is 2, only the simulation file generation part of the script will be executed.
进一步地,所述验证模块,用以接收预期仿真结果与行为仿真结果。以预期仿真结果作为基准,验证行为仿真结果的正确性,并输出验证结果至验证结果显示模块、存储模块。验证模块将行为仿真结果与基准进行对比分析,若两者一致,则验证标志信号置1,当前验证次数加1,累计错误次数不变;若两者不一致,则验证标志信号置0,当前验证次数加1,累计错误次数加1。验证标志信号、当前验证次数、累计错误次数三者一同作为验证结果输出。Further, the verification module is used to receive expected simulation results and behavioral simulation results. Use the expected simulation results as the benchmark to verify the correctness of the behavioral simulation results, and output the verification results to the verification result display module and storage module. The verification module compares and analyzes the behavioral simulation results with the benchmark. If the two are consistent, the verification flag signal is set to 1, the current number of verifications is increased by 1, and the cumulative number of errors remains unchanged; if the two are inconsistent, the verification flag signal is set to 0, and the current number of verifications remains unchanged. The number of times increases by 1, and the accumulated number of errors increases by 1. The verification flag signal, the current number of verifications, and the cumulative number of errors are output together as the verification results.
进一步地,所述日志打印模块,用以接收参数配置信号、验证模式控制信号、预期仿真结果及行为仿真结果,并完成日志打印。日志打印模块将每次验证的输入信息打印至txt文件,并存储至预设路径下。Further, the log printing module is used to receive parameter configuration signals, verification mode control signals, expected simulation results and behavioral simulation results, and complete log printing. The log printing module prints the input information for each verification to a txt file and stores it in a preset path.
进一步地,所述存储模块,用以接收验证激励及验证结果,并基于验证结果存储验证激励。存储模块对每次的验证结果进行分析,若验证结果正确,则不对验证激励做任何处理;若验证结果错误,则将验证激励存储至txt文件,以便开发人员对问题进行复现。Further, the storage module is used to receive verification incentives and verification results, and store verification incentives based on the verification results. The storage module analyzes each verification result. If the verification result is correct, the verification incentive will not be processed in any way; if the verification result is incorrect, the verification incentive will be stored in a txt file so that developers can reproduce the problem.
本发明的有益技术效果:一方面,本发明利用Matlab与Python等软件与语言编写仿真脚本,通过直接对仿真文件进行生成、修改及运行等操作,可实现激励生成、仿真执行及结果验证等验证流程的自动执行,避免了开发人员与EDA仿真工具GUI间重复性的交互与操作,极大提升了验证效率;另一方面,本发明基于前端层、服务层及数据层构建了验证平台,平台提供前端GUI界面,可实现参数与激励信息的灵活配置及验证结果的实时显示,极大提升了验证的可视性及激励控制的便捷性与灵活性。平台还提供三种不同的验证模式,可动态调整仿真文件的生成与内容修改,以控制EDA仿真工具的参数设置,从而满足有人场景下的单次验证或无人场景下的连续验证等不同验证需求,平台还可自动判断验证结果,并存储日志与异常数据激励,以便开发人员对异常数据进行复现并排查问题。进一步提升了验证的自动化水平。Beneficial technical effects of the present invention: On the one hand, the present invention uses software and languages such as Matlab and Python to write simulation scripts. By directly generating, modifying and running simulation files, it can achieve verification such as incentive generation, simulation execution and result verification. The automatic execution of the process avoids repetitive interactions and operations between developers and the EDA simulation tool GUI, greatly improving verification efficiency; on the other hand, the present invention builds a verification platform based on the front-end layer, service layer and data layer. Provides a front-end GUI interface that enables flexible configuration of parameters and incentive information and real-time display of verification results, greatly improving the visibility of verification and the convenience and flexibility of incentive control. The platform also provides three different verification modes, which can dynamically adjust the generation and content modification of simulation files to control the parameter settings of EDA simulation tools to meet different verifications such as single verification in manned scenarios or continuous verification in unmanned scenarios. If required, the platform can also automatically determine verification results and store logs and abnormal data incentives so that developers can reproduce abnormal data and troubleshoot problems. The automation level of verification is further improved.
附图说明Description of drawings
图1为一种Verilog代码的功能验证方法的流程图。Figure 1 is a flow chart of a functional verification method of Verilog code.
图2为一种Verilog代码的功能验证平台的结构框图。Figure 2 is a structural block diagram of a functional verification platform for Verilog code.
实施方式Implementation
为使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不限定本发明。In order to make the purpose, technical solutions and advantages of the present invention more clear, the present 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 here are only used to explain the present invention and do not limit the present invention.
本发明实施例提供了一种Verilog代码的功能验证方法,如附图1所示,包括:The embodiment of the present invention provides a method for functional verification of Verilog code, as shown in Figure 1, including:
步骤1:验证激励生成。对验证激励的名称、数量、长度、随机性及限值等参数进行合理设置,以生成符合验证目的与场景需求的验证激励。Step 1: Verify incentive generation. Reasonably set parameters such as the name, quantity, length, randomness, and limit of the verification incentives to generate verification incentives that meet the verification purpose and scenario requirements.
步骤2:Matlab仿真脚本编写。通过软件Matlab编写Matlab仿真脚本,以实现读取验证激励,生成与Verilog代码预期功能相符的预期仿真结果,以及将预期仿真结果写入txt文件。Step 2: Matlab simulation script writing. Write a Matlab simulation script through the software Matlab to achieve reading verification incentives, generate expected simulation results that are consistent with the expected functions of the Verilog code, and write the expected simulation results into a txt file.
步骤3:EDA仿真脚本编写。借助Python语言丰富的文件处理函数库及TCL命令,使用Python语言编写EDA仿真脚本。以实现如下功能:1.不运行仿真且不打开EDA仿真工具GUI界面的情况下,直接生成仿真所需的所有仿真文件;2.修改仿真文件内容,以控制待验证工程的名称、路径,及EDA仿真工具的界面显示、仿真时长、波形信号等参数;3.执行仿真文件,实现仿真的自动执行。Step 3: EDA simulation script writing. Use Python language to write EDA simulation scripts with the help of Python language's rich file processing function library and TCL commands. To achieve the following functions: 1. Directly generate all simulation files required for simulation without running simulation and without opening the EDA simulation tool GUI interface; 2. Modify the content of the simulation file to control the name and path of the project to be verified, and The interface display, simulation duration, waveform signal and other parameters of the EDA simulation tool; 3. Execute the simulation file to realize automatic execution of the simulation.
步骤4:Testbench编写。在EDA仿真工具中编写Testbench,并将Testbench置于待验证工程顶部。以实现为待验证Verilog代码模块配置接口与控制信号,提供验证激励,以及输出Verilog代码的行为仿真结果。Step 4: Testbench writing. Write Testbench in the EDA simulation tool and place Testbench on top of the project to be verified. The implementation configures interfaces and control signals for the Verilog code module to be verified, provides verification incentives, and outputs behavioral simulation results of the Verilog code.
步骤5:Matlab、EDA仿真脚本运行。分别运行Matlab仿真脚本、EDA仿真脚本,脚本自行将预期仿真结果与行为仿真结果分别写入txt文件。Step 5: Run Matlab and EDA simulation scripts. Run the Matlab simulation script and EDA simulation script respectively, and the script will write the expected simulation results and behavioral simulation results into txt files respectively.
步骤6:功能正确性验证。从txt文件中分别读取预期仿真结果与行为仿真结果,并以预期仿真结果作为基准,对比二者差异,若行为仿真结果与基准一致,则Verilog代码功能正常;若行为仿真结果与基准不一致,则Verilog代码功能异常。Step 6: Verification of functional correctness. Read the expected simulation results and behavioral simulation results from the txt file respectively, and use the expected simulation results as the benchmark to compare the differences between the two. If the behavioral simulation results are consistent with the benchmark, the Verilog code functions normally; if the behavioral simulation results are inconsistent with the benchmark, Then the Verilog code functions abnormally.
本实施例还提供一种Verilog代码的功能验证平台,基于上述的一种Verilog代码的功能验证方法实现,如附图2所示,包括:前端层、服务层及数据层。This embodiment also provides a Verilog code function verification platform, which is implemented based on the above-mentioned Verilog code function verification method. As shown in Figure 2, it includes: a front-end layer, a service layer and a data layer.
所述前端层,包括参数配置模块、验证模式选择模块、验证激励配置模块及验证结果显示模块。为开发人员提供显示、交互功能,将开发人员输入的参数、模式及激励配置等信息进行数据处理及逻辑分析,得到参数配置信号、验证模式控制信号及验证激励,并下发至服务层。同时接收数据层所上传的验证结果,并进行前端显示。The front-end layer includes a parameter configuration module, a verification mode selection module, a verification incentive configuration module and a verification result display module. Provide display and interactive functions for developers, perform data processing and logical analysis on parameters, modes, incentive configuration and other information input by developers, obtain parameter configuration signals, verification mode control signals and verification incentives, and send them to the service layer. At the same time, the verification results uploaded by the data layer are received and displayed on the front end.
所述服务层,包括Matlab仿真模块与EDA仿真模块。用以接收前端层所下发的参数配置信号、验证模式控制信号及验证激励等控制信号,并依据所接收控制信号完成Matlab与EDA仿真,得到预期结果与仿真结果,最后将控制信号、预期结果及仿真结果一同下发至数据层。The service layer includes a Matlab simulation module and an EDA simulation module. It is used to receive control signals such as parameter configuration signals, verification mode control signals, and verification excitations issued by the front-end layer, and complete Matlab and EDA simulations based on the received control signals to obtain expected results and simulation results. Finally, the control signals and expected results are and simulation results are sent to the data layer together.
所述数据层,包括验证模块、日志打印模块及存储模块。用以接收服务层所下发的控制信号、预期仿真结果及行为仿真结果,依据预期仿真结果及行为仿真结果进行功能验证。若功能将验正确,则将验证结果上传至前端层;若功能验证错误,则将验证结果上传至前端层的同时,根据控制信号进行日志打印及数据存储。The data layer includes a verification module, a log printing module and a storage module. It is used to receive the control signals, expected simulation results and behavioral simulation results issued by the service layer, and perform functional verification based on the expected simulation results and behavioral simulation results. If the function verification is correct, the verification result will be uploaded to the front-end layer; if the function verification is incorrect, the verification result will be uploaded to the front-end layer, and log printing and data storage will be performed according to the control signal.
进一步地,所述参数配置模块,用以接收开发人员输入的Testbench文件名称、待验证Verilog代码文件路径及文件存储路径等配置信息,并转换为字符型的参数配置信号。Further, the parameter configuration module is used to receive configuration information such as Testbench file name, Verilog code file path to be verified, and file storage path input by the developer, and convert it into a character-type parameter configuration signal.
进一步地,所述验证模式选择模块,用以接收开发人员输入的验证模式与验证次数,并设置模式控制字与验证模式进行1:1映射,映射关系为:自动验证-0,代码调试-1,仿真文件生成-2。Further, the verification mode selection module is used to receive the verification mode and verification times input by the developer, and set the mode control word and the verification mode for 1:1 mapping. The mapping relationship is: automatic verification-0, code debugging-1 , Simulation file generation-2.
进一步地,所述验证激励配置模块,用以接收开发人员输入的验证激励名称、数量、长度、随机性及限值等配置信息,并生成对应的验证激励。Further, the verification incentive configuration module is used to receive the verification incentive name, quantity, length, randomness, limit and other configuration information input by the developer, and generate the corresponding verification incentive.
进一步地,所述验证结果显示模块,用以接收验证结果并进行前端显示。Further, the verification result display module is used to receive the verification results and perform front-end display.
进一步地,所述Matlab仿真模块,内嵌步骤2所述Matlab仿真脚本,用以接收验证模式控制信号与验证激励,若模式控制字为0或1,则执行脚本内容;若模式控制字为2,则跳过本次Matlab仿真。Further, the Matlab simulation module is embedded with the Matlab simulation script described in step 2 to receive the verification mode control signal and verification stimulus. If the mode control word is 0 or 1, the script content is executed; if the mode control word is 2 , then skip this Matlab simulation.
进一步地,所述EDA仿真模块,内嵌步骤3所述的EDA仿真脚本,用以接收参数配置信号、验证模式控制信号及验证激励,若模式控制字为0或1,且当前为第一次验证,则完整执行脚本内容;若模式控制字为0或1,但非第一次验证,则仅执行脚本的仿真文件的修改与运行部分,略过仿真文件生成;若模式控制字为2,则仅执行脚本的仿真文件生成部分。Further, the EDA simulation module is embedded with the EDA simulation script described in step 3 to receive parameter configuration signals, verification mode control signals and verification excitations. If the mode control word is 0 or 1, and it is currently the first time Verify, then execute the script content completely; if the mode control word is 0 or 1, but it is not the first verification, only the modification and running part of the simulation file of the script will be executed, and the simulation file generation will be skipped; if the mode control word is 2, Then only the simulation file generation part of the script is executed.
进一步地,所述验证模块,用以接收预期仿真结果与行为仿真结果,并以预期仿真结果为基准,若行为仿真结果与基准一致,则验证标志信号置1,当前验证次数加1,累计错误次数不变;若行为仿真结果与基准不一致,则验证标志信号置0,当前验证次数加1,累计错误次数加1。Further, the verification module is used to receive expected simulation results and behavioral simulation results, and use the expected simulation results as a benchmark. If the behavioral simulation results are consistent with the benchmark, the verification flag signal is set to 1, the current number of verifications is increased by 1, and the accumulated errors The number of times remains unchanged; if the behavioral simulation results are inconsistent with the benchmark, the verification flag signal is set to 0, the current number of verifications is increased by 1, and the cumulative number of errors is increased by 1.
进一步地,所述日志打印模块,用以接收参数配置信号、验证模式控制信号、预期结果及仿真结果,将每次验证的输入信息写入txt文件并存储至预设路径下。Further, the log printing module is used to receive parameter configuration signals, verification mode control signals, expected results and simulation results, write the input information of each verification into a txt file and store it in a preset path.
进一步地,所述存储模块,用以接收验证激励及验证结果,若验证结果正确,则不对验证激励做任何处理;若验证结果错误,则将验证激励写入txt文件并存储至预设路径下。Further, the storage module is used to receive verification incentives and verification results. If the verification results are correct, no processing will be done to the verification incentives; if the verification results are incorrect, the verification incentives will be written into a txt file and stored in a preset path. .
上述实施例是对本发明的具体实施方式的说明,而非对本发明的限制,有关技术领域的技术人员在不脱离本发明的精神和范围的情况下,还可做出各种变换和变化以得到相对应的等同的技术方案,因此所有等同的技术方案均应归入本发明的专利保护范围。The above embodiments are illustrative of specific implementations of the present invention, rather than limitations of the present invention. Those skilled in the relevant technical fields can also make various transformations and changes without departing from the spirit and scope of the present invention. Corresponding equivalent technical solutions, therefore all equivalent technical solutions should be included in the patent protection scope of the present invention.
Claims (7)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311740984.2A CN117634370A (en) | 2023-12-18 | 2023-12-18 | Function verification method and platform for Verilog code |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311740984.2A CN117634370A (en) | 2023-12-18 | 2023-12-18 | Function verification method and platform for Verilog code |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN117634370A true CN117634370A (en) | 2024-03-01 |
Family
ID=90032179
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202311740984.2A Pending CN117634370A (en) | 2023-12-18 | 2023-12-18 | Function verification method and platform for Verilog code |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN117634370A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118657098A (en) * | 2024-08-21 | 2024-09-17 | 珠海电科星拓科技有限公司 | A chip verification system and method based on Verilog |
-
2023
- 2023-12-18 CN CN202311740984.2A patent/CN117634370A/en active Pending
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118657098A (en) * | 2024-08-21 | 2024-09-17 | 珠海电科星拓科技有限公司 | A chip verification system and method based on Verilog |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN101046767B (en) | Method and system for automated testing of a graphic-based programming tool | |
| CN112270149A (en) | Verification platform automation integration method and system, electronic equipment and storage medium | |
| US6408403B1 (en) | Method for integrating automated software testing with software development | |
| US9594543B2 (en) | Activity diagram model-based system behavior simulation method | |
| CN115828839A (en) | System-level verification system and method for SOC (System on chip) | |
| US20150294038A1 (en) | Graphical Design Verification Environment Generator | |
| CN112732579B (en) | Automatic test method and system for WebUI | |
| CN103164328A (en) | Method and device and system for regression testing of service function | |
| US5907698A (en) | Method and apparatus for characterizing static and dynamic operation of an architectural system | |
| CN106649103A (en) | Android application program automatically black box testing method and system | |
| CN111611008A (en) | A software code packaging and deployment method, device, device and storage medium | |
| US7895575B2 (en) | Apparatus and method for generating test driver | |
| US8140315B2 (en) | Test bench, method, and computer program product for performing a test case on an integrated circuit | |
| CN117634370A (en) | Function verification method and platform for Verilog code | |
| US20050049841A1 (en) | Simulation management system | |
| CN116643977A (en) | Automatic performance model testing method, device, equipment and storage medium | |
| CN118245268B (en) | Error reporting and positioning method and device based on hardware accelerator platform test program | |
| CN114548027A (en) | Method for tracking signal in verification system, electronic device and storage medium | |
| CN101183400B (en) | Method and system for debugging and verification in graphics hardware design | |
| CN118550784A (en) | Automated test case integration method and device, case test method and device | |
| CN118468771A (en) | Chip problem locating method, device and related equipment | |
| CN113946519B (en) | A method for UI automation testing | |
| US7340661B2 (en) | Computer program product for performing testing of a simulated storage device within a testing simulation environment | |
| CN117850305A (en) | Methods for editing variables in automated processes and methods for controlling automated processes | |
| CN118672925A (en) | Unit test code generation method and device, electronic 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 | ||
| CB02 | Change of applicant information |
Country or region after: China Address after: No. 858, Huaguan Road, Chengyang District, Qingdao, Shandong 266000 Applicant after: QINGDAO TOPSCOMM COMMUNICATION Co.,Ltd. Applicant after: Qingdao Zhidian New Energy Technology Co.,Ltd. Applicant after: Qingdao Dingxin Communication Power Engineering Co.,Ltd. Address before: No. 858, Huaguan Road, Chengyang District, Qingdao, Shandong 266000 Applicant before: QINGDAO TOPSCOMM COMMUNICATION Co.,Ltd. Country or region before: China Applicant before: Qingdao Dingxin Communication Power Engineering Co.,Ltd. |
|
| CB02 | Change of applicant information |