Floating point arithmetic unit testing method and device, centralized control equipment and storage medium

文档序号:7394 发布日期:2021-09-17 浏览:22次 中文

1. A method for testing a floating-point arithmetic unit is used for a centralized control device, the centralized control device is connected with the floating-point arithmetic unit to be tested, and the method comprises the following steps:

receiving a first target configuration parameter and a target test case quantity sent by a user;

generating a target test case by using a preset test packet set based on the first target configuration parameter and the number of the target test cases;

sending the target test case to the floating point operation unit to be tested so that the floating point operation unit to be tested utilizes the target test case to perform testing to obtain a test result;

and receiving the test result returned by the floating point operation unit to be tested.

2. The method of claim 1, wherein the centralized control device has a control area, the control area having a mode button; before the step of receiving the first target configuration parameter and the target test case quantity sent by the user, the method further includes:

receiving a first selection operation of a test mode selection frame of the mode button by a user;

entering a test mode based on the first selection operation;

the step of receiving the first target configuration parameters and the number of target test cases sent by the user comprises the following steps:

and when the centralized control equipment is in the test mode, receiving a first target configuration parameter and a target test case quantity sent by a user.

3. The method of claim 2, wherein the centralized control device has a display area; after the step of receiving the test result returned by the floating-point arithmetic unit to be tested, the method further comprises:

receiving a second selection operation of the calculation mode selection frame of the mode button by the user;

entering a computing mode based on the second selection operation;

receiving a second target configuration parameter and a target floating point number sent by a user;

calculating the target floating point number by using a preset test packet set based on the second target configuration parameter to obtain result data;

and outputting the result data and the target floating point number in the display area.

4. The method of claim 3, wherein the control area further has a generate button, the first target configuration parameter including a target operation precision, a target operation type, a target rounding mode, and a target minuscule mode; the step of generating the target test case by using a preset test packet set based on the first target configuration parameter and the target test case quantity comprises the following steps:

and when a first determination operation of a user for the generation button is received, generating the target test case by using operation precision configuration software, operation type configuration software, rounding mode configuration software, minimum mode configuration software, test case quantity configuration software and test case generation software in the preset test packet set based on the first determination operation, the target operation precision, the target operation type, the target rounding mode, the target minimum mode and the target test case quantity.

5. The method of claim 4, wherein the control area further has an operation precision button, an operation type button, a rounding mode button, a minimal mode button, and a randomly generated number button; the step of receiving the first target configuration parameters and the number of target test cases sent by the user comprises the following steps:

receiving a third selection operation of a user for the operation precision button, and obtaining the first target operation precision based on the third selection operation;

receiving a fourth selection operation of a user for the operation type button, and obtaining the first target operation type based on the fourth selection operation;

receiving a fifth selection operation of the user for the rounding mode button, and obtaining the first target rounding mode based on the fifth selection operation;

receiving a sixth selection operation of a user for the minimal mode button, and obtaining the first target minimal mode based on the sixth selection operation;

and receiving a seventh selection operation of the user for the randomly generated number buttons, and obtaining the target test case number based on the seventh selection operation.

6. The method of claim 5, wherein the result data includes a result floating point number, a first sign segment corresponding to the result floating point number, a first mantissa segment corresponding to the result floating point number, a first exponent segment corresponding to the result floating point number, and a exception segment corresponding to the result floating point number; before the step of outputting the result data and the target floating point number in the display area of the centralized control device, the method further includes:

based on the target floating point number, obtaining a second sign segment corresponding to the target floating point number, a second mantissa segment corresponding to the target floating point number and a second exponent segment corresponding to the target floating point number;

determining a first area and a second area in the display area based on the number of the target floating point numbers;

the step of outputting the result data and the target floating point number in the display area of the centralized control device includes:

outputting the result floating point number, the first symbol segment, the first mantissa segment, the first exponent segment, and the exception segment in the first region;

outputting the target floating point number, the second symbol segment, the second mantissa segment, and the second exponent segment in the second region.

7. The method of claim 6, wherein the control area further has a start button; the step of sending the target test case to the floating point operation unit to be tested so that the floating point operation unit to be tested performs testing by using the target test case to obtain a test result includes:

and when a second determination operation of the user for the start button is received, sending the target test case to the floating point operation unit to be tested, so that the floating point operation unit to be tested utilizes the target test case to perform testing to obtain a test result.

8. The method of claim 7, wherein the control area further has a verification button; after the step of receiving the test result returned by the floating-point arithmetic unit to be tested, the method further comprises:

outputting the test result in the display area;

when a third determination operation of a user for the verification button is received, verifying the test result of the output state to obtain a verification result;

and outputting the verification result in the display area.

9. The method of claim 8, wherein the control area further has a save button; after the step of outputting the verification result in the display area, the method further comprises:

and when a fourth determination operation of the user for the saving button is received, storing the verification result and the test result.

10. The method of claim 9,

the operation precision button is provided with a half-precision selection frame, a single-precision selection frame, a double-precision selection frame, an expanded double-precision selection frame and a four-precision selection frame;

the operation type button is provided with an addition selection frame, a subtraction selection frame, a multiplication selection frame, a division selection frame, a square selection frame, a multiplication and addition selection frame, a remainder selection frame, a type conversion selection frame, an equal selection frame, a less selection frame and a greater selection frame; the type conversion selection frame is also provided with a floating point to floating point sub selection frame, a floating point to integer sub selection frame and an integer to floating point sub selection frame;

the rounding mode button has a round-nearest checkbox, a round-zero checkbox, a round-minus-infinity checkbox, a round-plus-infinity checkbox, and a round-nearest checkbox;

the mini mode button has a pre-round selection box and a post-round selection box.

11. A floating point arithmetic unit testing device is used for a centralized control device, the centralized control device is connected with a floating point arithmetic unit to be tested, the device comprises:

the first receiving module is used for receiving first target configuration parameters and the number of target test cases sent by a user;

the generating module is used for generating a target test case by utilizing a preset test packet set based on the first target configuration parameter and the number of the target test cases;

the sending module is used for sending the target test case to the floating point arithmetic unit to be tested so that the floating point arithmetic unit to be tested can test by using the target test case to obtain a test result;

and the second receiving module is used for receiving the test result returned by the floating point operation unit to be tested.

12. A centralized control apparatus, characterized in that the centralized control apparatus comprises: memory, a processor and a floating point unit test program stored on the memory and running on the processor, the floating point unit test program when executed by the processor implementing the steps of the floating point unit test method as claimed in any one of claims 1 to 10.

13. A computer readable storage medium having stored thereon a floating point unit test program which when executed by a processor implements the steps of the floating point unit test method of any of claims 1 to 10.

Background

Modern hardware designs such as a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Field Programmable Gate Array (FPGA), and the like generally include a Floating Point Unit (FPU). The FPU provides floating-point arithmetic functions such as floating-point addition, subtraction, multiplication, or division. After the FPU hardware design is complete, the FPU is typically tested.

In the related art, a test method is disclosed, in which a software toolkit is used to test an FPU in a command line manner based on the standard of the floating point arithmetic IEEE (institute of electrical and electronics engineers) to obtain a test result of the FPU.

However, when the existing testing method is adopted to test the FPU, the testing operation is complex, so that the testing efficiency is low.

Disclosure of Invention

The invention mainly aims to provide a floating point operation unit testing method, a floating point operation unit testing device, centralized control equipment and a computer readable storage medium, and aims to solve the technical problems that when an existing testing method is adopted in the prior art to test an FPU, testing operation is complex, and testing efficiency is low.

In order to achieve the above object, the present invention provides a method for testing a floating point arithmetic unit, which is used for a centralized control device, wherein the centralized control device is connected with the floating point arithmetic unit to be tested, and the method comprises the following steps:

receiving a first target configuration parameter and a target test case quantity sent by a user;

generating a target test case by using a preset test packet set based on the first target configuration parameter and the number of the target test cases;

sending the target test case to the floating point operation unit to be tested so that the floating point operation unit to be tested utilizes the target test case to perform testing to obtain a test result;

and receiving the test result returned by the floating point operation unit to be tested.

Optionally, the centralized control device has a control area, and the control area has a mode button; before the step of receiving the first target configuration parameter and the target test case quantity sent by the user, the method further includes:

receiving a first selection operation of a test mode selection frame of the mode button by a user;

entering a test mode based on the first selection operation;

the step of receiving the first target configuration parameters and the number of target test cases sent by the user comprises the following steps:

and when the centralized control equipment is in the test mode, receiving a first target configuration parameter and a target test case quantity sent by a user.

Optionally, the centralized control device has a display area; after the step of receiving the test result returned by the floating-point arithmetic unit to be tested, the method further comprises:

receiving a second selection operation of the calculation mode selection frame of the mode button by the user;

entering a computing mode based on the second selection operation;

receiving a second target configuration parameter and a target floating point number sent by a user;

calculating the target floating point number by using a preset test packet set based on the second target configuration parameter to obtain result data;

and outputting the result data and the target floating point number in the display area.

Optionally, the control area further has a generation button, and the first target configuration parameter includes a target operation precision, a target operation type, a target rounding mode, and a target minimum mode; the step of generating the target test case by using a preset test packet set based on the first target configuration parameter and the target test case quantity comprises the following steps:

and when a first determination operation of a user for the generation button is received, generating the target test case by using operation precision configuration software, operation type configuration software, rounding mode configuration software, minimum mode configuration software, test case quantity configuration software and test case generation software in the preset test packet set based on the first determination operation, the target operation precision, the target operation type, the target rounding mode, the target minimum mode and the target test case quantity.

Optionally, the control area further has an operation precision button, an operation type button, a rounding mode button, a minimum mode button, and a randomly generated number button; the step of receiving the first target configuration parameters and the number of target test cases sent by the user comprises the following steps:

receiving a third selection operation of a user for the operation precision button, and obtaining the first target operation precision based on the third selection operation;

receiving a fourth selection operation of a user for the operation type button, and obtaining the first target operation type based on the fourth selection operation;

receiving a fifth selection operation of the user for the rounding mode button, and obtaining the first target rounding mode based on the fifth selection operation;

receiving a sixth selection operation of a user for the minimal mode button, and obtaining the first target minimal mode based on the sixth selection operation;

and receiving a seventh selection operation of the user for the randomly generated number buttons, and obtaining the target test case number based on the seventh selection operation.

Optionally, the result data includes a result floating point number, a first sign segment corresponding to the result floating point number, a first mantissa segment corresponding to the result floating point number, a first exponent segment corresponding to the result floating point number, and an exception segment corresponding to the result floating point number; before the step of outputting the result data and the target floating point number in the display area of the centralized control device, the method further includes:

based on the target floating point number, obtaining a second sign segment corresponding to the target floating point number, a second mantissa segment corresponding to the target floating point number and a second exponent segment corresponding to the target floating point number;

determining a first area and a second area in the display area based on the number of the target floating point numbers;

the step of outputting the result data and the target floating point number in the display area of the centralized control device includes:

outputting the result floating point number, the first symbol segment, the first mantissa segment, the first exponent segment, and the exception segment in the first region;

outputting the target floating point number, the second symbol segment, the second mantissa segment, and the second exponent segment in the second region.

Optionally, the control area further has a start button; the step of sending the target test case to the floating point operation unit to be tested so that the floating point operation unit to be tested performs testing by using the target test case to obtain a test result includes:

and when a second determination operation of the user for the start button is received, sending the target test case to the floating point operation unit to be tested, so that the floating point operation unit to be tested utilizes the target test case to perform testing to obtain a test result.

Optionally, the control area further has a verification button; after the step of receiving the test result returned by the floating-point arithmetic unit to be tested, the method further comprises:

outputting the test result in the display area;

when a third determination operation of a user for the verification button is received, verifying the test result of the output state to obtain a verification result;

and outputting the verification result in the display area.

Optionally, the control area further has a save button; after the step of outputting the verification result in the display area, the method further comprises:

and when a fourth determination operation of the user for the saving button is received, storing the verification result and the test result.

Alternatively to this, the first and second parts may,

the operation precision button is provided with a half-precision selection frame, a single-precision selection frame, a double-precision selection frame, an expanded double-precision selection frame and a four-precision selection frame;

the operation type button is provided with an addition selection frame, a subtraction selection frame, a multiplication selection frame, a division selection frame, a square selection frame, a multiplication and addition selection frame, a remainder selection frame, a type conversion selection frame, an equal selection frame, a less selection frame and a greater selection frame; the type conversion selection frame is also provided with a floating point to floating point sub selection frame, a floating point to integer sub selection frame and an integer to floating point sub selection frame;

the rounding mode button has a round to nearest selection box, a round to 0 selection box, a round to minus infinity selection box, a round to plus infinity selection box, and a round to nearest selection box;

the mini mode button has a pre-round selection box and a post-round selection box.

In addition, in order to achieve the above object, the present invention further provides a floating point arithmetic unit testing apparatus, for a centralized control device, where the centralized control device is connected to a floating point arithmetic unit to be tested, and the apparatus includes:

the first receiving module is used for receiving first target configuration parameters and the number of target test cases sent by a user;

the generating module is used for generating a target test case by utilizing a preset test packet set based on the first target configuration parameter and the number of the target test cases;

the sending module is used for sending the target test case to the floating point arithmetic unit to be tested so that the floating point arithmetic unit to be tested can test by using the target test case to obtain a test result;

and the second receiving module is used for receiving the test result returned by the floating point operation unit to be tested.

In addition, in order to achieve the above object, the present invention further provides a centralized control device, including: the test method comprises the steps of a memory, a processor and a floating point arithmetic unit test program which is stored on the memory and runs on the processor, wherein when the floating point arithmetic unit test program is executed by the processor, the steps of the test method of the floating point arithmetic unit are realized.

In addition, to achieve the above object, the present invention further provides a computer readable storage medium, on which a floating point unit test program is stored, and the floating point unit test program, when executed by a processor, implements the steps of the floating point unit test method according to any one of the above items.

The technical scheme of the invention provides a floating point arithmetic unit testing method, which is used for centralized control equipment, wherein the centralized control equipment is connected with a floating point arithmetic unit to be tested and receives a first target configuration parameter and a target test case quantity sent by a user; generating a target test case by using a preset test packet set based on the first target configuration parameter and the number of the target test cases; sending the target test case to the floating point operation unit to be tested so that the floating point operation unit to be tested utilizes the target test case to perform testing to obtain a test result; and receiving the test result returned by the floating point operation unit to be tested.

In the existing method, the floating point arithmetic unit to be tested is tested in a command line mode, a user needs to spend larger time and energy to manually configure a large number of command lines, the test operation is complex, and the test efficiency is low. In the application, based on the first target configuration parameter and the number of the target test cases, a preset test packet set is directly utilized to generate the target test cases, so that the floating point operation unit to be tested is tested by utilizing the target test cases to obtain a test result, and a user does not need to manually configure a large number of command lines, so that the test operation is simple and rapid, and the test efficiency is improved. Therefore, the method of the invention improves the testing efficiency of the floating point arithmetic unit to be tested.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.

Fig. 1 is a schematic structural diagram of a centralized control device of a hardware operating environment according to an embodiment of the present invention;

FIG. 2 is a flowchart illustrating a method for testing a floating-point unit according to a first embodiment of the present invention;

FIG. 3 is a functional block diagram of the centralized control apparatus of the present invention;

FIG. 4 is a schematic view of a display area of the centralized control apparatus in a computing mode according to the present invention;

FIG. 5 is a block diagram illustrating a first embodiment of a floating-point unit testing apparatus according to the present invention.

The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Referring to fig. 1, fig. 1 is a schematic structural diagram of a centralized control device in a hardware operating environment according to an embodiment of the present invention.

The centralized control device may be a User Equipment (UE) such as a Mobile phone, a smart phone, a laptop, a digital broadcast receiver, a Personal Digital Assistant (PDA), a tablet computer (PAD), a handheld device, a vehicle-mounted device, a wearable device, a computing device or other processing device connected to a wireless modem, a Mobile Station (MS), etc. The centralized control device may be referred to as a user terminal, a portable terminal, a desktop terminal, etc.

Generally, the centralized control device comprises: at least one processor 301, a memory 302, and a floating point unit test program stored on the memory and executable on the processor, the floating point unit test program being configured to implement the steps of the floating point unit test method as described previously.

The processor 301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 301 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 301 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. The processor 301 may further include an AI (Artificial Intelligence) processor for processing operations related to the floating point unit test method, so that the floating point unit test method model may be trained and learned autonomously, improving efficiency and accuracy.

Memory 302 may include one or more computer-readable storage media, which may be non-transitory. Memory 302 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in the memory 302 is used to store at least one instruction for execution by the processor 301 to implement the floating point unit testing method provided by the method embodiments herein.

In some embodiments, the terminal may further include: a communication interface 303 and at least one peripheral device. The processor 301, the memory 302 and the communication interface 303 may be connected by a bus or signal lines. Various peripheral devices may be connected to communication interface 303 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 304, a display screen 305, and a power source 306.

The communication interface 303 may be used to connect at least one peripheral device related to I/O (Input/Output) to the processor 301 and the memory 302. In some embodiments, processor 301, memory 302, and communication interface 303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 301, the memory 302 and the communication interface 303 may be implemented on a single chip or circuit board, which is not limited in this embodiment.

The Radio Frequency circuit 304 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 304 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 304 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 304 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 304 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 304 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.

The display screen 305 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 305 is a touch display screen, the display screen 305 also has the ability to capture touch signals on or over the surface of the display screen 305. The touch signal may be input to the processor 301 as a control signal for processing. At this point, the display screen 305 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 305 may be one, the front panel of the electronic device; in other embodiments, the display screens 305 may be at least two, respectively disposed on different surfaces of the electronic device or in a folded design; in still other embodiments, the display screen 305 may be a flexible display screen disposed on a curved surface or a folded surface of the electronic device. Even further, the display screen 305 may be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display screen 305 may be made of LCD (liquid crystal Display), OLED (Organic Light-Emitting Diode), and the like.

The power supply 306 is used to power various components in the electronic device. The power source 306 may be alternating current, direct current, disposable or rechargeable. When the power source 306 includes a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology. Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the centralized control facility, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.

In addition, an embodiment of the present invention further provides a computer-readable storage medium, where a floating point unit test program is stored, and when the floating point unit test program is executed by a processor, the steps of the floating point unit test method described above are implemented. Therefore, a detailed description thereof will be omitted. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in embodiments of the computer-readable storage medium referred to in the present application, reference is made to the description of embodiments of the method of the present application. Determining by way of example, the program instructions may be deployed to be executed on one centralized device, or on multiple centralized devices located at one site, or on multiple centralized devices distributed across multiple sites and interconnected by a communication network.

It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The computer-readable storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.

Based on the hardware structure, the embodiment of the floating point arithmetic unit testing method is provided.

Referring to fig. 2, fig. 2 is a schematic flowchart of a first embodiment of a method for testing a floating-point unit according to the present invention, the method being used for a centralized control device, the method including the following steps:

step S11: and receiving the first target configuration parameters and the target test case quantity sent by the user.

It should be noted that the execution main body of the present invention is a centralized control device, the centralized control device is installed with a floating point arithmetic unit test program, the structure of the centralized control device refers to the above description, and when the centralized control device executes the floating point arithmetic unit test program, the steps of the floating point arithmetic unit test method of the present invention are implemented.

Specifically, the first target configuration parameter includes a target operation precision, a target operation type, a target rounding mode and a target minimum mode, where the target operation precision is one of a half precision (16bit), a single precision (32bit), a double precision (64bit), an extended double precision (80bit) or a four precision (64bit), and under different precisions, the parameters of a symbol segment, a mantissa segment and an exponent segment of a corresponding calculation mode (the application relates to a test mode and a calculation mode, which are described in detail below) refer to table 1, where table 1 is as follows:

TABLE 1

Symbol segment Mantissa section Exponential section
Semi-precision (16bit) 1bit 10bit 5bit
Single precision (32bit) 1bit 23bit 8bit
Double precision (64bit) 1bit 52bit 11bit
Extended double precision (80bit) 1bit 64bit 15bit
Four precision (128bit) 1bit 112bit 15bit

The target operation type is addition, subtraction, multiplication, division, square, multiplication and addition, complementation and type conversion, and is equal to, less than or greater than; the type conversion also comprises floating point to floating point conversion, floating point to integer conversion or integer to floating point conversion, wherein the floating points are of 5 types, namely 16 bits, 32 bits, 64 bits, 80 bits and 128 bits, the integers are of 4 types, namely unsigned 32 bits, unsigned 64 bits, signed 32 bits and signed 64 bits, the type conversion relates to the combination of all types, such as floating point (16 bits) to floating point (32 bits), floating point (128 bits) to integer (signed 32 bits), and the invention is not shown in a list.

The target rounding mode is one of nearest rounding (even-first), rounding to 0, rounding to minus infinity, rounding to plus infinity select look, or rounding to nearest rounding (max-first).

The target mini-mode is one of before rounding and after rounding, i.e., the order in which the rounding configuration and the mini-configuration are processed.

The target test case number refers to the number of test cases which need to be generated, and the test cases are used for testing the floating point arithmetic unit.

In a specific application, the first target configuration parameter and the target test case number may be manually input by a user, and may be input through a keyboard input module or a voice input module of the centralized control device, which is not limited in the present invention.

Further, the centralized control device has a control area, and the control area has a mode button; before the step of receiving the first target configuration parameter and the target test case quantity sent by the user, the method further includes: receiving a first selection operation of a test mode selection frame of the mode button by a user; entering a test mode based on the first selection operation; the step of receiving the first target configuration parameters and the number of target test cases sent by the user comprises the following steps: and when the centralized control equipment is in the test mode, receiving a first target configuration parameter and a target test case quantity sent by a user.

Referring to fig. 3, fig. 3 is a functional block diagram of the centralized control device according to the present invention, the centralized control device is connected to a hardware FPU (floating point unit) through a hardware adapter, and the centralized control device can call a preset test packet set through an API interface, where the preset test packet set may be pre-stored by the centralized control device. The hardware adapter is responsible for testing the interworking of the centralized control device and the hardware design (the FPU to be tested, i.e., the hardware FPU in fig. 4). After the centralized control equipment generates a target test case, the adapter is responsible for sending the target test case to the hardware design interface; and after the hardware design calculation is finished, the adapter is responsible for returning the test result to the centralized control equipment. Different hardware design logic requires different adapters.

In fig. 3, the control area includes a mode button, an operation precision button, an operation type button, a rounding mode button, a minimum mode button, a random generation number button, a generation button, a check button, and a save button. The mode button comprises a calculation mode selection frame and a test mode selection frame, a user can send a first selection operation to the test mode selection frame, namely, the test mode is selected, so that the centralized control equipment enters the test mode, and when the centralized control equipment is in the test mode, the user can send first target configuration parameters and the number of target test cases. It can be understood that the control area may be a partial area of the display screen of the centralized control device, and at this time, the buttons are all virtual buttons; the control area may also be a part of the non-display area of the centralized control device, and in this case, the buttons may be physical buttons.

Specifically, referring to fig. 3, the control area further has an operation precision button, an operation type button, a rounding mode button, a minimum mode button, and a randomly generated number button; receiving a third selection operation of a user for the operation precision button, and obtaining the first target operation precision based on the third selection operation; receiving a fourth selection operation of a user for the operation type button, and obtaining the first target operation type based on the fourth selection operation; receiving a fifth selection operation of the user for the rounding mode button, and obtaining the first target rounding mode based on the fifth selection operation; receiving a sixth selection operation of a user for the minimal mode button, and obtaining the first target minimal mode based on the sixth selection operation; and receiving a seventh selection operation of the user for the randomly generated number buttons, and obtaining the target test case number based on the seventh selection operation.

The operation precision button is provided with a half-precision selection frame, a single-precision selection frame, a double-precision selection frame, an expanded double-precision selection frame and a four-precision selection frame; the operation type button is provided with an addition selection frame, a subtraction selection frame, a multiplication selection frame, a division selection frame, a square selection frame, a multiplication and addition selection frame, a remainder selection frame, a type conversion selection frame, an equal selection frame, a less selection frame and a greater selection frame; the type conversion selection frame further has a floating point to floating point sub selection frame, a floating point to integer sub selection on selection frame, and an integer to floating point sub selection frame, and each selection frame in the type conversion further includes all combination results of different floating point types and integer types, for example, the floating point to floating point sub selection frame relates to combinations of all floating point types, all floating point types refer to the above description, including 5, and at the same time, all integer types include 4; the rounding mode button has a round to nearest selection box, a round to 0 selection box, a round to minus infinity selection box, a round to plus infinity selection box, and a round to nearest selection box; the mini mode button has a pre-round selection box and a post-round selection box.

It is to be understood that the third selection operation is a selection operation on any one of all the selection frames related to the operation precision button, for example, the third selection operation is a selection frame with a half-precision of the operation precision, and the target operation precision is half-precision at this time; similarly, the fourth selection operation, the fifth selection operation and the sixth selection operation are all to select one of the options in the plurality of related selection frames. For the seventh selection operation of the randomly generated number button, that is, clicking the randomly generated number button, the opportunity obtains a random number, that is, the target test case number, such as 500 or 10 ten thousand, and the like.

It is understood that all the buttons and selection boxes referred to above may be physical buttons, or virtual buttons output by the display screen of the centralized control device, and the virtual buttons are displayed in the control area of the display screen of the display device. That is, in the present invention, the control area may be an operation area corresponding to the physical button, and the control area may also be an operation area corresponding to the virtual button in the display screen of the centralized control device. The display area is a partial area (the control area is a partial area of the display screen corresponding to the virtual button) or a whole area (the control area is an area corresponding to the physical button) of the display screen of the centralized control equipment.

Step S13: and generating a target test case by utilizing a preset test packet set based on the first target configuration parameter and the number of the target test cases.

And calling a pre-stored preset test packet set by the centralized control equipment through an API (application program interface) interface to generate target test cases by obtaining the first target configuration parameters and the number of the target test cases, wherein the number of the target test cases is the number of the target test cases.

Further, referring to fig. 3, the control area further has a generation button, and the step of generating the target test case by using a preset test packet set based on the first target configuration parameter and the target test case number includes: and when a first determination operation of a user for the generation button is received, generating the target test case by using operation precision configuration software, operation type configuration software, rounding mode configuration software, minimum mode configuration software, test case quantity configuration software and test case generation software in the preset test packet set based on the first determination operation, the target operation precision, the target operation type, the target rounding mode, the target minimum mode and the target test case quantity.

It is to be understood that the first determination operation is clicking the generation button. Meanwhile, in the preset test packet set, there are various kinds of software, which may include operation precision configuration software, operation type configuration software, rounding mode configuration software, minimum mode configuration software, test case quantity configuration software, test case generation software, and the like, and the software is configured to respectively configure the operation precision, the operation type, the rounding mode configuration, the minimum mode, and the test case quantity by using the target operation precision, the target operation type, the target rounding mode, the target minimum mode, and the target test case quantity, and after configuration is completed, generate a target test case by using the test case generation software based on each configured parameter.

Step S13: the target test case is sent to the floating point operation unit to be tested, so that the floating point operation unit to be tested utilizes the target test case to perform testing to obtain a test result;

step S14: and receiving the test result returned by the floating point operation unit to be tested.

It should be noted that after the target test case is generated, the target test case may be used to test the floating point unit to be tested, so as to obtain a test result.

Further, referring to fig. 3, the control area further has a start button; the step of sending the target test case to the floating point operation unit to be tested so that the floating point operation unit to be tested performs testing by using the target test case to obtain a test result includes:

and when a second determination operation of the user for the start button is received, sending the target test case to the floating point operation unit to be tested, so that the floating point operation unit to be tested utilizes the target test case to perform testing to obtain a test result.

Further, referring to fig. 3, the control area further has a verification button; after the step of receiving the test result returned by the floating-point arithmetic unit to be tested, the method further comprises: outputting the test result in the display area; when a third determination operation of a user for the verification button is received, verifying the test result of the output state to obtain a verification result; and outputting the verification result in the display area.

After the test result returned by the floating point operation unit to be tested is received, the test result is continuously checked by the centralized control equipment to obtain a check result, wherein the check result is whether the test result passes the check, the test result is valid if the check is passed, and the test result is invalid if the check is not passed.

Furthermore, when the verification result is successful, namely the test result is valid, the test result can be analyzed to obtain the hardware test information of the FPU and the like.

Referring to fig. 3, when the centralized control device is in the test mode, the start button may be clicked to start executing step S13, and after S13 is executed, when the test result fed back by the floating point arithmetic unit to be tested is received, the display screen displays the test result, and after the check button is continuously clicked, the test result is checked to obtain a check result.

Further, referring to fig. 3, the control area further has a save button; after the step of outputting the verification result in the display area, the method further comprises: and when a fourth determination operation of the user for the saving button is received, storing the verification result and the test result.

After the verification result is obtained, the storage button can be clicked to store the current test result and the verification result in the centralized control equipment.

In other embodiments, during the above steps in the test mode, the display area of the display screen of the central control device may scroll to dynamically display the interactive information. For example, after the target test case is successfully generated, "xx test cases have been successfully generated" is displayed, the specific data information of the generated target test case is displayed, and if the test case is failed to be generated, "caution! Failure to generate test case! "and the like.

Further, referring to fig. 3, the centralized control device has a display area; after the step of receiving the test result returned by the floating-point arithmetic unit to be tested, the method further comprises: receiving a second selection operation of the calculation mode selection frame of the mode button by the user; entering a computing mode based on the second selection operation; receiving a second target configuration parameter and a target floating point number sent by a user; calculating the target floating point number by using a preset test packet set based on the second target configuration parameter to obtain result data; and outputting the result data and the target floating point number in the display area.

Specifically, the result data includes a result floating point number, a first sign segment corresponding to the result floating point number, a first mantissa segment corresponding to the result floating point number, a first exponent segment corresponding to the result floating point number, and an exception segment corresponding to the result floating point number; before the step of outputting the result data and the target floating point number in the display area of the centralized control device, the method further includes: based on the target floating point number, obtaining a second sign segment corresponding to the target floating point number, a second mantissa segment corresponding to the target floating point number and a second exponent segment corresponding to the target floating point number; determining a first area and a second area in the display area based on the number of the target floating point numbers; the step of outputting the result data and the target floating point number in the display area of the centralized control device includes: outputting the result floating point number, the first symbol segment, the first mantissa segment, the first exponent segment, and the exception segment in the first region; outputting the target floating point number, the second symbol segment, the second mantissa segment, and the second exponent segment in the second region.

It should be noted that the second selection operation is a selection operation on the calculation mode selection frame, and is used for the centralized control device to enter the calculation mode. In addition, the target floating point number is a floating point number for performing a calculation operation, and may be a plurality of floating point numbers or one floating point number, and the target floating point number may be input in a display area of the display screen, that is, in the calculation mode, the display area first outputs an input box of the target floating point number for typing the target floating point number.

It is to be understood that, the step of operating the target floating point number by using a preset test packet set based on the second target configuration parameter to obtain result data includes: and when a fifth determination operation of a user for the start button is received, calculating the target floating point number by using a preset test packet set based on the fifth determination operation and the second target configuration parameter to obtain result data. Wherein the fifth determination operation is clicking the start button.

It can be understood that when the second target configuration parameter and the target floating point number are obtained, the corresponding result data can be obtained by clicking the generation start. The centralized control device calls each test packet (the above-mentioned multiple test packets) in the preset test packet set through the API interface by using the second target configuration parameter and the target floating point number, and performs operation on the target floating point number to obtain result data.

Referring to fig. 4, fig. 4 is a schematic view of a display area of the centralized control device in the computing mode according to the present invention. In fig. 4, the number of target floating point numbers is 3, and the second area is divided into three parts for displaying the correlation values of the 3 target floating point numbers. It is understood that the number of target floating point numbers is different, and the display condition of the display area is different, for example, the target floating point number is 1, and the first area and the second area may be two areas with the same height, and when the target floating point number is 2, the second area includes the related value of the two target floating point numbers, and the height of the second area may be 2 times that of the first area.

It should be understood that the display area, the first area and the second area in fig. 4 do not limit the present invention, and a user may set other display manners based on requirements as long as specific values displayed in the display area include the result floating point number, the first symbol segment, the first mantissa segment, the first exponent segment, the exception segment, the target floating point number, the second symbol segment, the second mantissa segment and the second exponent segment.

The technical scheme of the invention provides a floating point arithmetic unit testing method, which is used for centralized control equipment, wherein the centralized control equipment is connected with a floating point arithmetic unit to be tested and receives a first target configuration parameter and a target test case quantity sent by a user; generating a target test case by using a preset test packet set based on the first target configuration parameter and the number of the target test cases; sending the target test case to the floating point operation unit to be tested so that the floating point operation unit to be tested utilizes the target test case to perform testing to obtain a test result; and receiving the test result returned by the floating point operation unit to be tested.

In the existing method, the floating point arithmetic unit to be tested is tested in a command line mode, a user needs to spend larger time and energy to manually configure a large number of command lines, the test operation is complex, and the test efficiency is low. In the application, based on the first target configuration parameter and the number of the target test cases, a preset test packet set is directly utilized to generate the target test cases, so that the floating point operation unit to be tested is tested by utilizing the target test cases to obtain a test result, and a user does not need to manually configure a large number of command lines, so that the test operation is simple and rapid, and the test efficiency is improved. Therefore, the method of the invention improves the testing efficiency of the floating point arithmetic unit to be tested.

Referring to fig. 5, fig. 5 is a block diagram illustrating a first embodiment of a floating point unit testing apparatus according to the present invention, the apparatus being used for a centralized control device, the apparatus comprising:

a first receiving module 10, configured to receive a first target configuration parameter and a target test case number sent by a user;

a generating module 20, configured to generate a target test case by using a preset test packet set based on the first target configuration parameter and the number of the target test cases;

the sending module 30 is configured to send the target test case to the floating point arithmetic unit to be tested, so that the floating point arithmetic unit to be tested performs a test by using the target test case to obtain a test result;

and the second receiving module 40 is configured to receive the test result returned by the floating point arithmetic unit to be tested.

The above description is only an alternative embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:芯片验证方法、终端设备、验证平台以及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!