Interface testing method and device, electronic equipment and storage medium

By adjusting and testing the clock and delay parameters of the chip's I2C interface, the problem of simple timing control of the I2C interface in the existing technology is solved, and a more comprehensive and accurate interface test is achieved.

CN118550775APending Publication Date: 2024-08-27KTMICRO ELECTRONICS
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410640562.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

When testing the I2C interface of a chip, the existing technology has simple timing control and cannot comprehensively, accurately and flexibly test whether all I2C timing parameter ranges are met.

Method used

Through the preset clock adjustment rules and/or delay adjustment rules, the timing parameters of the integrated circuit bus of the chip to be adjusted are adjusted, the adjusted timing parameters are generated, and the interface test is performed based on these parameters, including using fixed or random Clock parameters and delay parameters.

Benefits of technology

It improves the completeness and accuracy of the interface test, ensures that the chip I2C interface meets all I2C timing parameter ranges, and enhances the flexibility and accuracy of the test.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550775A
    Figure CN118550775A
Patent Text Reader

Abstract

The embodiment of the invention provides an interface testing method and device, electronic equipment and a storage medium. The method comprises the steps that a to-be-adjusted chip is acquired; according to a preset clock adjusting rule and / or a time delay adjusting rule, adjusting a time sequence parameter of an integrated circuit bus of the to-be-adjusted chip to obtain an adjusted time sequence parameter of the integrated circuit bus; and testing the interface of the chip to be adjusted according to the adjusted time sequence parameter of the integrated circuit bus, so that the interface of the chip to be adjusted can be comprehensively tested, whether the I2C interface of the chip to be adjusted meets all I2C time sequence parameter ranges or not is tested, and the completeness and accuracy of interface testing are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to an interface testing method, device, electronic device and storage medium. Background Art

[0002] In the prior art, for a chip to perform data transmission, I 2 C communication protocol for data transmission, but for this chip, usually only fixed timing parameters are set for data transmission, and the timing parameters at least include clock frequency and duty cycle. Although this solution can verify I 2 C read and write communication functions, but the timing control is simple and cannot fully, accurately and flexibly test the chip's I 2 Does the C interface meet all I 2 C timing parameter range. Summary of the invention

[0003] The purpose of some embodiments of the present application is to provide an interface testing method, device, electronic device and storage medium. Through the technical solutions of the embodiments of the present application, a chip to be adjusted is obtained; the timing parameters of the integrated circuit bus of the chip to be adjusted are adjusted according to a preset clock adjustment rule and / or delay adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus; according to the adjusted timing parameters of the integrated circuit bus, the interface of the chip to be adjusted is tested, so that the interface of the chip to be adjusted can be fully tested, and the I 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0004] In a first aspect, some embodiments of the present application provide an interface testing method, including:

[0005] Get the chip to be adjusted;

[0006] According to a preset clock adjustment rule and / or delay adjustment rule, the timing parameters of the integrated circuit bus of the chip to be adjusted are adjusted to obtain the adjusted timing parameters of the integrated circuit bus;

[0007] The interface of the chip to be adjusted is tested according to the adjusted timing parameters of the integrated circuit bus.

[0008] In some embodiments of the present application, the timing parameters of the integrated circuit bus of the chip to be adjusted are adjusted according to the preset clock adjustment rules and / or delay adjustment rules, and the interface of the chip to be adjusted is tested according to the adjusted timing parameters of the integrated circuit bus. In this way, the interface of the chip to be adjusted can be fully tested, and the IC bus of the chip to be adjusted can be tested. 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0009] Optionally, adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset clock adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus includes:

[0010] A preset input parameter function is used to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, wherein the clock parameters at least include a clock frequency and a duty cycle.

[0011] Some embodiments of the present application use a preset input parameter function to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, that is, use fixed clock parameters to perform interface testing on the chip to be adjusted.

[0012] Optionally, adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset clock adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus includes:

[0013] A preset random function is used to generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted.

[0014] Some embodiments of the present application generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted by preset random functions, that is, use the randomly generated clock parameters to perform interface testing on the chip to be adjusted, and test the IC bus of the chip to be adjusted. 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0015] Optionally, adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset delay adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus includes:

[0016] According to a preset delay adjustment mode, a delay parameter corresponding to the integrated circuit bus of the chip to be adjusted is determined, wherein the delay adjustment mode includes at least a first delay mode, a second delay mode and a third delay mode, the first delay mode is used to set a fixed first delay time for a transmission parameter, and determine the first delay time as a timing parameter of the integrated circuit bus after adjustment, the second delay mode is used to randomly generate a second delay time for the transmission parameter when a clock level changes, and determine the second delay time as a timing parameter of the integrated circuit bus after adjustment, and the third delay mode is used to generate a third delay time for the transmission parameter each time the level changes, and determine the third delay time as the timing parameter of the integrated circuit bus after adjustment.

[0017] In some embodiments of the present application, each call to I 2 Before reading and writing programs in C, various delay parameters are generated as needed, so that 2 When reading and writing programs in C, the specific timing of SCL and SDA is constructed according to the delay parameters generated this time, so as to realize I 2 Flexible control of C timing.

[0018] Optionally, the transmission parameters include at least a setup time for a repeated start, a hold time for a start / repeat start, a data setup time, a data hold time, a setup time for a stop condition, and a bus idle time between stop and start.

[0019] In some embodiments of the present application, delay processing can be performed on multiple transmission parameters under different conditions to achieve I 2 Flexible control of C timing.

[0020] In a second aspect, some embodiments of the present application provide an interface testing device, including:

[0021] An acquisition module, used for acquiring a chip to be adjusted;

[0022] An adjustment module, used to adjust the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset clock adjustment rule and / or delay adjustment rule, to obtain the adjusted timing parameters of the integrated circuit bus;

[0023] The transmission module is used to test the interface of the chip to be adjusted according to the adjusted timing parameters of the integrated circuit bus.

[0024] In some embodiments of the present application, the timing parameters of the integrated circuit bus of the chip to be adjusted are adjusted according to the preset clock adjustment rules and / or delay adjustment rules, and the interface of the chip to be adjusted is tested according to the adjusted timing parameters of the integrated circuit bus. In this way, the interface of the chip to be adjusted can be fully tested, and the IC bus of the chip to be adjusted can be tested. 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0025] Optionally, the adjustment module is used to:

[0026] A preset input parameter function is used to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, wherein the clock parameters at least include a clock frequency and a duty cycle.

[0027] Some embodiments of the present application use a preset input parameter function to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, that is, use fixed clock parameters to perform interface testing on the chip to be adjusted.

[0028] Optionally, the adjustment module is used to:

[0029] A preset random function is used to generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted.

[0030] Some embodiments of the present application generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted by preset random functions, that is, use the randomly generated clock parameters to perform interface testing on the chip to be adjusted, and test the IC bus of the chip to be adjusted. 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0031] Optionally, the adjustment module is used to:

[0032] According to a preset delay adjustment mode, a delay parameter corresponding to the integrated circuit bus of the chip to be adjusted is determined, wherein the delay adjustment mode includes at least a first delay mode, a second delay mode and a third delay mode, the first delay mode is used to set a fixed first delay time for a transmission parameter, and determine the first delay time as a timing parameter of the integrated circuit bus after adjustment, the second delay mode is used to randomly generate a second delay time for the transmission parameter when a clock level changes, and determine the second delay time as a timing parameter of the integrated circuit bus after adjustment, and the third delay mode is used to generate a third delay time for the transmission parameter each time the level changes, and determine the third delay time as the timing parameter of the integrated circuit bus after adjustment.

[0033] In some embodiments of the present application, each call to I 2 Before reading and writing programs in C, various delay parameters are generated as needed, so that 2 When reading and writing programs in C, the specific timing of SCL and SDA is constructed according to the delay parameters generated this time, so as to realize I 2 Flexible control of C timing.

[0034] Optionally, the transmission parameters include at least a setup time for a repeated start, a hold time for a start / repeat start, a data setup time, a data hold time, a setup time for a stop condition, and a bus idle time between stop and start.

[0035] In some embodiments of the present application, delay processing can be performed on multiple transmission parameters under different conditions to achieve I 2 Flexible control of C timing.

[0036] In a third aspect, some embodiments of the present application provide an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the interface testing method as described in any embodiment of the first aspect can be implemented.

[0037] In a fourth aspect, some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the interface testing method as described in any embodiment of the first aspect.

[0038] In a fifth aspect, some embodiments of the present application provide a computer program product, comprising a computer program, wherein the computer program, when executed by a processor, can implement the interface testing method as described in any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of some embodiments of the present application, the drawings required for use in some embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A flowchart of an interface testing method provided in an embodiment of the present application;

[0041] Figure 2 The I2C bus connection diagram provided in the embodiment of the present application is intended;

[0042] Figure 3 A schematic diagram of an I2C write operation provided in an embodiment of the present application;

[0043] Figure 4 A schematic diagram of an I2C read operation provided in an embodiment of the present application;

[0044] Figure 5 A schematic diagram of an I2C interface timing chart provided in an embodiment of the present application;

[0045] Figure 6 The i2c_master and i2c_slave connection diagram provided for the embodiment of the present application;

[0046] Figure 7 A schematic diagram of a clock duty cycle provided in an embodiment of the present application;

[0047] Figure 8 A schematic diagram of the structure of an interface testing device provided in an embodiment of the present application;

[0048] Fig. 9 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The technical solutions in some embodiments of the present application will be described below in conjunction with the drawings in some embodiments of the present application.

[0050] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0051] In the prior art, for a chip to perform data transmission, I 2C communication protocol for data transmission, but for this chip, usually only fixed timing parameters are set for data transmission, and the timing parameters at least include clock frequency and duty cycle. Although this solution can verify I 2 C read and write communication functions, but the timing control is simple and cannot fully, accurately and flexibly test the chip's I 2 Does the C interface meet all I 2 In view of this, some embodiments of the present application provide an interface testing method, which includes obtaining a chip to be adjusted; adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset clock adjustment rule and / or delay adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus; testing the interface of the chip to be adjusted according to the adjusted timing parameters of the integrated circuit bus, so that the interface of the chip to be adjusted can be fully tested, and the I 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0052] like Figure 1 As shown, an embodiment of the present application provides an interface testing method, the method comprising:

[0053] S101, obtaining a chip to be adjusted;

[0054] Specifically, the chip to be adjusted is connected to the terminal device, and the terminal device obtains the chip to be adjusted.

[0055] S102, adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset clock adjustment rule and / or delay adjustment rule to obtain adjusted timing parameters of the integrated circuit bus;

[0056] Specifically, the terminal device pre-stores clock adjustment rules and delay adjustment rules. During the process of testing the interface of the chip to be adjusted, only the pre-set clock adjustment rules can be used to adjust the timing parameters of the integrated circuit bus of the chip to be adjusted to obtain the adjusted timing parameters of the integrated circuit bus.

[0057] Alternatively, a preset delay adjustment rule may be used to adjust the timing parameters of the integrated circuit bus of the chip to be adjusted to obtain the adjusted timing parameters of the integrated circuit bus;

[0058] Alternatively, the preset clock adjustment rule and delay adjustment rule may be used simultaneously to adjust the timing parameters of the integrated circuit bus of the chip to be adjusted to obtain the adjusted timing parameters of the integrated circuit bus.

[0059] S103: testing the interface of the chip to be adjusted according to the adjusted timing parameters of the integrated circuit bus.

[0060] Specifically, after obtaining the adjusted timing parameters of the integrated circuit bus, the terminal device tests the interface of the chip to be adjusted according to the adjusted timing parameters of the integrated circuit bus. 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0061] In some embodiments of the present application, the timing parameters of the integrated circuit bus of the chip to be adjusted are adjusted according to the preset clock adjustment rules and / or delay adjustment rules, and the interface of the chip to be adjusted is tested according to the adjusted timing parameters of the integrated circuit bus. In this way, the interface of the chip to be adjusted can be fully tested, and the IC bus of the chip to be adjusted can be tested. 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0062] Another embodiment of the present application further supplements the interface testing method provided in the above embodiment.

[0063] Figure 2 The schematic diagram of the I2C bus connection provided in the embodiment of the present application, I2C (also known as IIC) (Inter-Integrated Circuit) is the abbreviation of I2C Bus, which is called integrated circuit bus in Chinese. It is a serial communication bus that uses a multi-master-slave architecture. It is a serial, half-duplex bus launched by Philips in the 1980s, mainly used for communication between short-distance, low-speed chips; the I2C bus has two bidirectional signal lines, a data line SDA for sending and receiving data, and a clock line SCL for synchronizing the clocks of both communicating parties; the I2C bus has a simple hardware structure, simplifies PCB wiring, reduces system costs, and improves system reliability, so it has been widely used in various fields.

[0064] I2C requires at least two wires, similar to an asynchronous serial port, but can support multiple slave devices. Theoretically, an I2C can mount up to 127 devices, but excluding reserved addresses, a maximum of 112 devices can be mounted. I2C can support a multi-master system, allowing multiple masters and each master can communicate with all slaves (masters cannot communicate through I2C, and each master can only use the I2C bus in turn).

[0065] The I2C bus transmission rate can reach 100Kbit / s in standard mode, 400Kbit / s in fast mode, and 3.4Mbit / s in high-speed mode.

[0066] Figure 3 The schematic diagram of the I2C write operation provided in the embodiment of the present application takes the KTA1009 chip as an example to explain the I2C protocol. KTA1009 has a 2-wire, I2C-compatible serial interface, which is connected to the I2C bus as a slave device. Timing diagram of a typical I2C write sequence. KTA1009 supports standard mode (100kHz) and fast mode (400kHz), and does not support 10-bit addressing and broadcast call addressing. It has a 7-bit slave address, and its six high bits are set to 001000. The lowest bit (LSB) is set by the state of the A0 address pin, which determines the state of the A0 bit. By changing the logic level of the A0 pin before a read or write operation, users can integrate multiple KTA1009 devices on one bus.

[0067] The operation of the two-wire I2C serial bus protocol is as follows: When a high-to-low transition occurs on the SDA line while SCL is high, the master initiates data transmission by establishing a start condition. The next byte is the slave address byte, which consists of a 7-bit slave address. The slave address corresponding to the transmitted address responds by pulling SDA low during the ninth clock pulse (i.e., the acknowledge bit). During this period, all other devices on the bus remain idle while the selected device waits for data to be written to or read from its shift register.

[0068] Data is transferred on the serial bus in a sequence of nine clock pulses (eight data bits followed by an acknowledge bit). Transitions on the SDA line must occur during the low period of SCL and remain stable during the high period of SCL. When all data bits have been read or written, the stop condition is established.

[0069] In write mode, the host pulls the SDA line high during the 10th clock pulse to establish a stop condition. In read mode, the host issues a negative acknowledgement to the ninth clock pulse (i.e., the SDA line remains high). The host pulls the SDA line low before the 10th clock pulse and then pulls it high during the 10th clock pulse to establish a stop condition. When writing to the KTA1009, the user must begin with a start command, followed by an address byte R / W=0, and then confirm that it is ready to receive data by pulling SDA low. The KTA1009 requires three bytes of data: The first byte is the pointer byte, which contains information that defines the type of operation required by the KTA1009, such as configuring I / O pins and writing to the DAC. The pointer byte is followed by the most significant byte (MSB) of data and the least significant byte (LSB) of data. After the KTA1009 acknowledges these data bytes, it sends a stop condition.

[0070] Figure 4 Schematic diagram of I2C read operation provided by the embodiment of the present application. When reading back data from KTA1009, the user starts with a start command, followed by an address byte (R / W=0), after which KTA1009 confirms that it is ready to send data by pulling down SDA; then writes a pointer byte to select the content to be read back; then the start can be repeated to perform a new I2C transmission to read two bytes of data from KTA1009. Both bytes are confirmed by the host.

[0071] Figure 5 The schematic diagram of the I2C interface timing chart provided in the embodiment of the present application shows that for each chip containing an I2C slave interface, the SCL clock line and the SDA data line have a series of more specific timing parameter ranges in actual operation. Normal communication can only occur when the SCL and SDA signal jumps sent by the external master meet these timing parameters and comply with the above-mentioned read and write timings. Otherwise, communication will be abnormal.

[0072] Figure 6 The i2c_master and i2c_slave connection diagram provided for the embodiment of the present application shows that in a digital chip including an I2C interface, there will be an i2c_slave (I2C slave) module to receive I2C communication instructions on the SCL / SDA line. In order to issue a complete I2C interface communication instruction and read and write chip registers, it is necessary for the verification personnel to develop an i2c_master (I2C host). The I2c_master not only needs to support all the read and write operations of the above-mentioned I2C, but also must be able to support the range control of I2C timing parameters.

[0073] The embodiment of the present application provides a verification implementation method for adding flexible timing control in i2c_master, which is implemented by programming with system verilog syntax. It can comprehensively, efficiently and conveniently discover I2C communication function and performance bugs in the chip development stage, and effectively ensure the development quality and efficiency of chips containing i2c_slave interfaces.

[0074] Optionally, adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset clock adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus includes:

[0075] A preset input parameter function is used to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, wherein the clock parameters at least include a clock frequency and a duty cycle.

[0076] Some embodiments of the present application use a preset input parameter function to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, that is, use fixed clock parameters to perform interface testing on the chip to be adjusted.

[0077] Optionally, adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset clock adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus includes:

[0078] A preset random function is used to generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted.

[0079] Specifically, the clock frequency, that is, the number of times the clock recurs within a unit of time (1 second), corresponds to the clock period. If the clock frequency is fixed, then the clock period is fixed, and the clock period T = 1 / f (clock frequency).

[0080] The so-called clock duty cycle, such as Figure 7 As shown in the figure, when the clock frequency / cycle is fixed, when the high and low level widths of the clock are not equal, the clock waveform will appear in various forms, so it is necessary to introduce the concept of clock duty cycle, which is defined as the ratio of the high pulse width to the clock cycle, that is, t / T in the figure. Ideally, when the duty cycle is 50%, the high level width is equal to the low level width.

[0081] like Figure 5 As shown, the minimum SCL clock period is 2500ns, that is, the maximum frequency is 400KHz, and there is no limit on the minimum frequency. Take the minimum 1KHz (clock period 1000000ns) as an example. The duty cycle is set between 30% and 70%.

[0082] As shown in the following code, the Verilog parameter function $value$plusargs can be used to directly specify the desired clock frequency and clock phase. When not specified, the Verilog random function $urandom_range is used to randomly generate a reasonable clock frequency and clock phase. The basic syntax is as follows:

[0083]

[0084]

[0085] The above code implements a flexible clock generation scheme with controllable / random frequency and duty cycle. When you need to generate an SCL clock with a specified clock frequency and duty cycle, add +scl_frq=X+clk_ratio=Y in the makefile to generate an SCL clock with a clock frequency of X KHz and a duty cycle of Y / 100; otherwise, the SCL clock frequency and duty cycle are randomly generated within a reasonable range.

[0086] In addition, if Figure 5 As shown in the figure, because the SCL of I2C timing keeps high level and there is no clock jump when the bus is idle, the scl signal finally output by i2c_master can be defined according to the following logic, that is, it is assigned high impedance Z when I2C is idle, and comes from scl_r generated in the above code when working. In this way, pullup this signal at the top level can ensure that the SCL signal is high level when I2C is idle.

[0087] Some embodiments of the present application generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted by presetting a random function, that is, using the randomly generated clock parameters to perform interface testing on the chip to be adjusted to test whether the I2C interface of the chip to be adjusted meets all I2C timing parameter ranges, thereby improving the completeness and accuracy of the interface test.

[0088] Optionally, adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset delay adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus includes:

[0089] According to a preset delay adjustment mode, a delay parameter corresponding to the integrated circuit bus of the chip to be adjusted is determined, wherein the delay adjustment mode includes at least a first delay mode, a second delay mode and a third delay mode, the first delay mode is used to set a fixed first delay time for the transmission parameter, and determine the first delay time as the timing parameter of the integrated circuit bus after adjustment, the second delay mode is used to randomly generate a second delay time for the transmission parameter when the clock level changes, and determine the second delay time as the timing parameter of the integrated circuit bus after adjustment, and the third delay mode is used to generate a third delay time for the transmission parameter each time the level changes, and determine the third delay time as the timing parameter of the integrated circuit bus after adjustment.

[0090] Specifically, Figure 5 As shown in the figure, in order to fully cover all parameter ranges in the chart, it is necessary to be able to flexibly control these delays in the I2C read and write program. The main idea is to generate various delay parameters as needed before calling the I2C read and write program each time, so that when executing the I2C read and write program, the specific timing of SCL and SDA can be constructed according to the delay information generated this time, thereby realizing flexible control of the I2C timing. The basic syntax is as follows:

[0091]

[0092] dly_mode

[0093] $display("makefile input dly_mode=%0d",dly_mode);

[0094] end

[0095] else dly_mode=$urandom_range(0,3); / / No dly_mode parameter is passed, dly_mode is randomly between 0 and 3

[0096] $display(“dly_mode=%0d”,dly_mode);

[0097] end

[0098] / / Generate each delay information according to dly_mode

[0099] function void gen_i2c_dly();

[0100] if(dly_mode == 0) begin / / All delays use the minimum / maximum values ​​specified in the specification

[0101] dly_susta = T_SUSTA; / / Repeat start establishment time

[0102] dly_hdsta = T_HDSTA; / / Start / restart hold time

[0103] dly_sudat = T_SUDAT; / / data establishment time

[0104] dly_hddat = T_HDDAT; / / data hold time

[0105] dly_susto = T_SUSTO; / / Stop condition establishment time

[0106] dly_buf = T_BUF; / / bus idle time between stop and start

[0107] end

[0108] else begin / / All delays are randomly generated once or every time

[0109] if((dly_mode>=2)||((dly_mode==1)&&(rand_flag==0)))begin

[0110] dly_susta = $urandom_range(T_SUSTA, period_clk / 2); / / Repeat start setup time

[0111] dly_hdsta=$urandom_range(T_HDSTA,low_clk_time / 2); / / Start / restart hold time

[0112] dly_sudat=$urandom_range(T_SUDAT,(low_clk_time-T_HDDAT)); / / Data setup time

[0113] dly_hddat=$urandom_range(0,T_HDDAT); / / Data retention time

[0114]

[0115] The above code implements a flexible generation scheme of controllable / random I2C timing:

[0116] When you need to verify the maximum and minimum values ​​of the delays specified in the specifications, add +dly_mode=0 in the makefile;

[0117] When the delay information in this simulation is fixed (reasonably random once), add +dly_mode=1 in the makefile;

[0118] When the delay information is always random in this simulation, add +dly_mode=2 or 3 in the makefile;

[0119] Otherwise if dly_mode is not specified in the makefile, then dly_mode is random among the above 3 modes.

[0120] In the actual chip application process, the I2C timing is most likely to run according to dly_mode = 1, that is, each delay information is always fixed at a reasonable value when the chip is working and will not change all the time. However, because the chip is to be applied to different products, the delay information between different products is very different. Therefore, in order to more quickly, accurately, comprehensively and strictly ensure that the chip can fully cover the delay information specified in the specification, the dly_mode = 0 mode and the dly_mode = 2 / 3 mode are added, so that the design problems of i2c_slave (slave) in the chip development stage can be discovered more quickly. Especially in the post-simulation stage of IC verification, it is recommended to specify dly_mode = 2, so that a variety of timing combinations can be covered in limited test cases, which is convenient for faster and more effective discovery of timing errors (many bugs have indeed been found in actual applications). Because there are fewer test cases for post-simulation, if fixed timing is always used, it is difficult to encounter some special timing combination errors in a short time, and bugs may be missed.

[0121] In summary, the above content is the basic principle and implementation scheme of adding flexible timing control to the I2C master. The clock frequency, clock duty cycle and timing parameters can be flexibly controlled or randomly generated. This method has been successfully applied to the actual verification of many chips containing i2c_slave interface modules, and effectively discovered multiple bugs. It has strong practicality, versatility and reusability, greatly improving the verification quality and efficiency and shortening the verification cycle.

[0122] In some embodiments of the present application, various delay parameters are generated as needed before calling the I2C read / write program each time, so that the specific timing of SCL and SDA can be constructed according to the delay parameters generated this time when the I2C read / write program is executed, thereby realizing flexible control of the I2C timing.

[0123] Optionally, the transmission parameters include at least a setup time for a repeated start, a hold time for a start / repeat start, a data setup time, a data hold time, a setup time for a stop condition, and a bus idle time between stop and start, as shown in Table 1.

[0124]

[0125] Some embodiments of the present application can perform delay processing on multiple transmission parameters under different circumstances to achieve flexible control of I2C timing.

[0126] The embodiments of the present application can flexibly control the clock frequency, clock duty cycle and timing parameters, and are concise, intuitive, flexible and efficient. They have strong practicality, versatility and reusability, can be used as a reference in the design of all communication interface masters, can greatly improve the verification quality and efficiency, and shorten the verification cycle.

[0127] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any combination without conflict, and this application is not limited thereto.

[0128] Another embodiment of the present application provides an interface testing device for executing the interface testing method provided in the above embodiment.

[0129] like Figure 8 FIG. 8 is a schematic diagram of the structure of an interface testing device provided in an embodiment of the present application. The interface testing device includes an acquisition module 801, an adjustment module 802 and a transmission module 803, wherein:

[0130] The acquisition module 801 is used to acquire the chip to be adjusted;

[0131] The adjustment module 802 is used to adjust the timing parameters of the integrated circuit bus of the chip to be adjusted according to the preset clock adjustment rules and / or delay adjustment rules to obtain the adjusted timing parameters of the integrated circuit bus;

[0132] The transmission module 803 is used to test the interface of the chip to be adjusted according to the adjusted timing parameters of the integrated circuit bus.

[0133] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0134] Some embodiments of the present application adjust the timing parameters of the integrated circuit bus of the chip to be adjusted according to pre-set clock adjustment rules and / or delay adjustment rules, and test the interface of the chip to be adjusted according to the adjusted timing parameters of the integrated circuit bus. In this way, the interface of the chip to be adjusted can be comprehensively tested to test whether the I2C interface of the chip to be adjusted meets all I2C timing parameter ranges, thereby improving the completeness and accuracy of the interface test.

[0135] Another embodiment of the present application further supplements the interface testing device provided in the above embodiment.

[0136] Optionally, the regulating module is used to:

[0137] A preset input parameter function is used to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, wherein the clock parameters at least include a clock frequency and a duty cycle.

[0138] Some embodiments of the present application use a preset input parameter function to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, that is, use fixed clock parameters to perform interface testing on the chip to be adjusted.

[0139] Optionally, the regulating module is used to:

[0140] A preset random function is used to generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted.

[0141] Some embodiments of the present application generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted by presetting a random function, that is, using the randomly generated clock parameters to perform interface testing on the chip to be adjusted, and testing the IC bus of the chip to be adjusted. 2 Does the C interface meet all I 2 C timing parameter range, improving the completeness and accuracy of interface testing.

[0142] Optionally, the regulating module is used to:

[0143] According to a preset delay adjustment mode, a delay parameter corresponding to the integrated circuit bus of the chip to be adjusted is determined, wherein the delay adjustment mode includes at least a first delay mode, a second delay mode and a third delay mode, the first delay mode is used to set a fixed first delay time for the transmission parameter, and determine the first delay time as the timing parameter of the integrated circuit bus after adjustment, the second delay mode is used to randomly generate a second delay time for the transmission parameter when the clock level changes, and determine the second delay time as the timing parameter of the integrated circuit bus after adjustment, and the third delay mode is used to generate a third delay time for the transmission parameter each time the level changes, and determine the third delay time as the timing parameter of the integrated circuit bus after adjustment.

[0144] In some embodiments of the present application, each call to I 2 Before reading and writing programs in C, various delay parameters are generated as needed, so that 2 When reading and writing programs in C, the specific timing of SCL and SDA is constructed according to the delay parameters generated this time, so as to realize I 2 Flexible control of C timing.

[0145] Optionally, the transmission parameters include at least a setup time for a repeated start, a hold time for a start / repeated start, a data setup time, a data hold time, a setup time for a stop condition, and a bus idle time between stop and start.

[0146] In some embodiments of the present application, delay processing can be performed on multiple transmission parameters under different conditions to achieve I 2 Flexible control of C timing.

[0147] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0148] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any combination without conflict, and this application is not limited thereto.

[0149] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the operation of the method corresponding to any embodiment of the interface testing method provided in the above embodiments can be implemented.

[0150] An embodiment of the present application also provides a computer program product, which includes a computer program, wherein when the computer program is executed by a processor, it can implement the operations of the method corresponding to any embodiment of the interface testing method provided in the above embodiments.

[0151] like Fig. 9 As shown, some embodiments of the present application provide an electronic device 900, which includes: a memory 910, a processor 920, and a computer program stored in the memory 910 and executable on the processor 920, wherein the processor 920 can implement a method of any embodiment included in the above-mentioned interface testing method when reading the program from the memory 910 through a bus 930 and executing the program.

[0152] Processor 920 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 920 can be a microprocessor.

[0153] The memory 910 may be used to store instructions executed by the processor 920 or data related to the execution of instructions. These instructions and / or data may include codes for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 920 of the disclosed embodiment may be used to execute instructions in the memory 910 to implement the method shown above. The memory 910 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memory known to those skilled in the art.

[0154] The above are only embodiments of the present application and are not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0155] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0156] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. An interface testing method, characterized in that: The method comprises: Get the chip to be adjusted; According to a preset clock adjustment rule and / or delay adjustment rule, the timing parameters of the integrated circuit bus of the chip to be adjusted are adjusted to obtain the adjusted timing parameters of the integrated circuit bus; The interface of the chip to be adjusted is tested according to the adjusted timing parameters of the integrated circuit bus.

2. The interface testing method according to claim 1, characterized in that: The step of adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to the preset clock adjustment rules to obtain the adjusted timing parameters of the integrated circuit bus includes: A preset input parameter function is used to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, wherein the clock parameters at least include a clock frequency and a duty cycle.

3. The interface testing method according to claim 1, characterized in that: The step of adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to the preset clock adjustment rules to obtain the adjusted timing parameters of the integrated circuit bus includes: A preset random function is used to generate random clock parameters corresponding to the integrated circuit bus of the chip to be adjusted.

4. The interface testing method according to claim 1, characterized in that: The step of adjusting the timing parameters of the integrated circuit bus of the chip to be adjusted according to the preset delay adjustment rule to obtain the adjusted timing parameters of the integrated circuit bus includes: According to a preset delay adjustment mode, a delay parameter corresponding to the integrated circuit bus of the chip to be adjusted is determined, wherein the delay adjustment mode includes at least a first delay mode, a second delay mode and a third delay mode, the first delay mode is used to set a fixed first delay time for a transmission parameter, and determine the first delay time as a timing parameter of the integrated circuit bus after adjustment, the second delay mode is used to randomly generate a second delay time for the transmission parameter when a clock level changes, and determine the second delay time as a timing parameter of the integrated circuit bus after adjustment, and the third delay mode is used to generate a third delay time for the transmission parameter each time the level changes, and determine the third delay time as the timing parameter of the integrated circuit bus after adjustment.

5. The interface testing method according to claim 4, characterized in that: The transmission parameters include at least a setup time for a repeated start, a hold time for a start / repeated start, a data setup time, a data hold time, a setup time for a stop condition, and a bus idle time between a stop and a start.

6. An interface testing device, characterized in that: The device comprises: An acquisition module, used for acquiring a chip to be adjusted; An adjustment module, used to adjust the timing parameters of the integrated circuit bus of the chip to be adjusted according to a preset clock adjustment rule and / or delay adjustment rule, to obtain the adjusted timing parameters of the integrated circuit bus; The transmission module is used to test the interface of the chip to be adjusted according to the adjusted timing parameters of the integrated circuit bus.

7. The interface testing device according to claim 6, characterized in that: The regulating module is used for: A preset input parameter function is used to set fixed clock parameters corresponding to the integrated circuit bus of the chip to be adjusted, wherein the clock parameters at least include a clock frequency and a duty cycle.

8. The interface testing device according to claim 6, characterized in that: The regulating module is used for: According to a preset delay adjustment mode, a delay parameter corresponding to the integrated circuit bus of the chip to be adjusted is determined, wherein the delay adjustment mode includes at least a first delay mode, a second delay mode and a third delay mode, the first delay mode is used to set a fixed first delay time for a transmission parameter, and determine the first delay time as a timing parameter of the integrated circuit bus after adjustment, the second delay mode is used to randomly generate a second delay time for the transmission parameter when a clock level changes, and determine the second delay time as a timing parameter of the integrated circuit bus after adjustment, and the third delay mode is used to generate a third delay time for the transmission parameter each time the level changes, and determine the third delay time as the timing parameter of the integrated circuit bus after adjustment.

9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor can implement the interface testing method described in any one of claims 1 to 5 when executing the program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the program, when executed by a processor, can implement the interface testing method described in any one of claims 1 to 5.

Citation Information

Cited By

  • I2C bus communication optimization method and device, equipment and storage medium

    CN120892381A