The present application relates to central processing unit (CPU) simulation, and more specifically to address solving methods for instruction sequence generation.
Functional verification of a CPU design attempts to verify that the logic design of the CPU conforms to its specification. Such functional verification is complex because a large number of test cases are needed to increase assurance that the design conforms to its specification. For CPU design verification, such test cases include streams of instructions to be executed by a simulated CPU design in a design simulation system.
A first aspect relates to a method for generating a memory access instruction by a network device. The method includes obtaining constraints on a memory access instruction, the constraints comprising a target address range and a specification of valid address locations; obtaining simulation state information relating to a current state of a central processing unit (CPU) design simulation; and generating the memory access instruction based on the target address range, the specification of valid address locations, and the simulation state information.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that generating the memory access instruction includes storing a value in a previously unused memory location of the CPU design simulation; and generating the memory access instruction further based on an address of the previously unused memory location.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that generating the memory access instruction includes obtaining previous instruction information relating to a history of instructions previously simulated by the CPU design simulation; and generating the memory access instruction further based on the previous instruction information.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that generating the memory access instruction includes generating a plurality of possible target addresses; and randomly selecting one of the possible target addresses for the memory access instruction.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that generating the plurality of possible memory access instructions includes determining an instruction addressing mode of the memory access instruction; determining whether the instruction addressing mode permits combinations of fixed-value operands; determining whether the instruction addressing mode permits combinations of flexible-value operands; and for each combination of permitted fixed-value operands and/or flexible-value operands, combining the specification of valid address locations, the target address range, and the combination of permitted fixed-value operands and/or flexible-value operands to generate one possible memory access instruction of the plurality of possible memory access instructions.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that the method further includes removing one or more memory access instructions from the plurality of memory access instructions based on a filter criterion prior to randomly selecting one memory access instruction of the plurality of memory access instructions.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that the filter criterion is based on the previous instruction information.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that the filter criterion is based on the simulation state information.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that the network device is configured as an instruction stream generator (ISG), the method performed by the ISG.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that the method further includes sending to the CPU design simulation environment, an executable test case including the memory access instruction.
A second aspect relates to a network device that includes a memory configured to store instructions; and a processor coupled to the memory and configured to execute the instructions stored in the memory. When executed by the processor, the instructions cause the network device to obtain constraints on a memory access instruction, the constraints comprising a target address range and a specification of valid address locations; obtain simulation state information relating to a current state of a central processing unit (CPU) design simulation; and generate the memory access instruction based on the target address range, the specification of valid address locations, and the simulation state information.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that executing the instructions further causes the network device to store a value in a previously unused memory location of the CPU design simulation; and generate the memory access instruction further based on an address of the previously unused memory location.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that executing the instructions further causes the network device to obtain previous instruction information relating to a history of instructions previously simulated by the CPU design simulation; and generate the memory access instruction further based on the previous instruction information.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that executing the instructions further causes the network device to generate a plurality of possible target addresses; and randomly select one of the possible target addresses for the memory access instruction.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that executing the instructions further causes the network device to determine an instruction addressing mode of the memory access instruction; determine whether the instruction addressing mode permits combinations of fixed-value operands; determine whether the instruction addressing mode permits combinations of flexible-value operands; and for each combination of permitted fixed-value operands and/or flexible-value operands, combine the specification of valid address locations, the target address range, and the combination of permitted fixed-value operands and/or flexible-value operands to generate one possible memory access instruction of the plurality of possible memory access instructions.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that executing the instructions further causes the network device to remove one or more memory access instructions from the plurality of memory access instructions based on a filter criterion prior to randomly selecting one memory access instruction of the plurality of memory access instructions.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that the filter criterion is based on the previous instruction information.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that the filter criterion is based on the simulation state information.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that the instructions comprise an instruction stream generator.
Optionally, in any of the preceding aspects, another implementation of the aspect provides that executing the instructions further causes the network device to send to the CPU design simulation environment, an executable test case including the memory access instruction.
For the purpose of clarity, any one of the foregoing embodiments may be combined with any one or more of the other foregoing embodiments to create a new embodiment within the scope of the present disclosure.
These and other features, and the advantages thereof, will be more clearly understood from the following detailed description taken in conjunction with the accompanying drawings and claims.
For a more complete understanding of this disclosure, reference is now made to the following brief description, taken in connection with the accompanying drawings and detailed description, wherein like reference numerals represent like parts.
It should be understood at the outset that, although illustrative implementations of one or more embodiments are provided below, the disclosed systems and/or methods may be implemented using any number of techniques, whether currently known or in existence. The disclosure should in no way be limited to the illustrative implementations, drawings, and techniques illustrated below, including the exemplary designs and implementations illustrated and described herein, but may be modified within the scope of the appended claims along with their full scope of equivalents.
A design simulation system according to the disclosure includes an instruction stream generator (ISG) that generates streams of instructions that test various functions of a CPU design being simulated by the design simulation system. One function of the ISG is to generate memory access instructions. An ISG may generate memory access patterns randomly or under limited constraints.
An ISG having an ASM according to the disclosure may create testing scenarios that deliberately stress the CPU design with memory access patterns that target page boundaries or cache lines, for example. An ASM according to the disclosure instead creates memory access patterns based on constraints that include a target address range, a specification of valid address locations, and simulation state information relating to a current state of the CPU design simulation environment. Such an ASM results in an ISG that provides improved testing quality of memory access instructions that can meet any of several goals:
At least the ISG 104, the ISS shared library 106, the DSE 110, and the ISS cosimulation library 112 are software comprising instructions stored in memory of a computing device and executed by a processor of the computing device. Typically, the CPU design simulation system 100 is implemented on multiple computing devices interconnected by a communication network using an Ethernet network and/or the Internet protocol. Such computing devices may be referred to as network devices. In some embodiments, the ISG 104 and the ISS shared library 106 may be implemented in software on a first network device. In such embodiments, the test templates 102 may be generated on the same network device, or may be received by that network device from another network device. In such embodiments, the DSE 110 and the ISS cosimulation library 112 may be implemented on one or more other network devices. In other embodiments, a smaller-scale CPU design simulation system 100 may be implemented on a single network device.
As will be explained in greater detail with reference to
In some such embodiments, the method 300 generates a plurality of target address solutions from the constraints and information obtained in steps 302 and 304 and, because of the randomness discussed above, the plurality of target address solutions may not be identical. In other embodiments, the ISG 104 applies the method 300 repeatedly, either with the same or different constraints and information, to generate a plurality of target address solutions.
In step 406, the ASM 210 determines, for each operand value-related constraint, whether the addressing mode permits combinations of flexible-value operands and, if permitted, adds to the operand value-related constraint one or more additional constraints based on the combinations of flexible-value operands. Examples of flexible-value operands include immediate operands and enumerated operands, which have a small set of valid encoding values (e.g., a binary flag). In step 408, the ASM 210 combines the operand value-related constraints with further constraints based on the target address range(s) 202 and the valid addresses 204. Step 408 may further constrain the operand value-related constraints based on a virtual memory model maintained within the ISG 104 that is used to determine valid memory address locations.
One or more possible target addresses for the memory access instruction of step 402 result from step 408 and are used in step 212 to generate one or more of the memory access instructions. As described with reference to
In step 504, the plurality of target address solutions 502 is reduced to a second plurality of target address solutions 506 by a dependency filter. One example of a dependency filter is a filter that removes any target address solution that does not include a register index that was used in a previous simulated instruction, as reflected in the previous instruction history information 208. Another example of a dependency filter is to retain target address solutions that include a register index that was written to in one of the previous simulated instructions within a window of previous instructions that is proportional to the pipeline depth. In the example of the method 500 shown in
In step 508, the second plurality of target address solutions 506 is reduced to a third plurality of target address solutions 510 by applying an alignment filter. One example of an alignment filter is a filter that removes any target address solution that includes a stack pointer that does not align with a current stack base, as reflected in the simulation state information 206.
The addressing mode for a memory access instruction may not be suitable for application of either or both of the dependency filters and alignment filters described above. Some addressing modes may be suitable for application of another type of either dependency filter or alignment filter. Still other addressing modes may be suitable for application of another type of filter than a dependency filter or alignment filter. Regardless, the method 500 provides for reducing the plurality of target address solutions 502 by removing target address solutions that satisfy the constraints and information used in the method 300 or the method 400, but not additional dependency, alignment, or other filters.
Where the value 0xA3B7 is confirmed as correctly read in LOAD instruction 610, the ISG 104 confirms that the memory at address 0xA3B7 is previously unused and stores therein the value 0xA3B1. The ISG 104 then generates LOAD instruction 612 with the address 0xA3B7 as its target memory address. When the LOAD instruction 612 is simulated, the value that is read from the memory 602 is compared to the stored value 0xA3B7. In a similar manner, LOAD instructions 614, 616, and 618 are generated with target memory addresses of previously unused memory locations 602 to which known values have been stored.
Such preloading of values into selected locations in memory may be performed in an executable test case 108 by the ISG 104 writing the memory values to the data section of the Executable Test Case. When the DSE 110 reads the executable test case 108, it loads these memory values into its memory model.
The network device 700 includes a memory 760 or data storing means configured to store the instructions and various data. The memory 760 can be any type of or combination of memory components capable of storing data and/or instructions. For example, the memory 760 can include volatile and/or non-volatile memory such as read-only memory (ROM), random access memory (RAM), ternary content-addressable memory (TCAM), and/or static random-access memory (SRAM). The memory 760 can also include one or more disks, tape drives, and solid-state drives. In some embodiments, the memory 760 can be used as an over-flow data storage device to store programs when such programs are selected for execution, and to store instructions and data that are read during program execution.
The network device 700 has one or more processor(s) 730 or other processing means (e.g., central processing unit (CPU)) to process instructions. The processor 730 may be implemented as one or more CPU chips, cores (e.g., as a multi-core processor), field-programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), and digital signal processors (DSPs). The processor 730 is communicatively coupled via a system bus with the ingress ports 710, RX 720, TX 740, egress ports 750, and memory 760. The processor 730 can be configured to execute instructions stored in the memory 760. Thus, the processor 730 provides a means for performing any computational, comparison, determination, initiation, configuration, or any other action corresponding to the claims when the appropriate instruction is executed by the processor. In some embodiments, the memory 760 can be memory that is integrated with the processor 730.
In one embodiment, the memory 760 stores an ISG 770. The ISG 770 includes data and executable instructions for implementing the disclosed embodiments. For instance, the ISG 770 can include instructions for implementing the methods described with reference to
The network device 700 includes data and executable instructions for implementing an ISG as described in any of
While several embodiments have been provided in the present disclosure, it may be understood that the disclosed systems and methods might be embodied in many other specific forms without departing from the spirit or scope of the present disclosure. The present examples are to be considered as illustrative and not restrictive, and the disclosure is not to be limited to the details given herein. For example, the various elements or components may be combined or integrated in another system or certain features may be omitted, or not implemented.
In addition, techniques, systems, subsystems, and methods described and illustrated in the various embodiments as discrete or separate may be combined or integrated with other systems, modules, techniques, or methods without departing from the scope of the present disclosure. Other items shown or discussed as coupled or directly coupled or communicating with each other may be indirectly coupled or communicating through some interface, device, or intermediate component whether electrically, mechanically, or otherwise. Other examples of changes, substitutions, and alterations are ascertainable by one skilled in the art and may be made without departing from the spirit and scope disclosed herein.
This application is a continuation of International Application No. PCT/US2021/016422 filed on Feb. 3, 2021, by Futurewei Technologies, Inc., and titled “Address Solving for Instruction Sequence Generation,” which claims priority to U.S. Provisional Pat. Application No. 63/034,781, filed Jun. 4, 2020, by Jingliang Wang, et al., and titled “Address Solving for Instruction Sequence Generation,” both of which are incorporated herein by reference.
| Number | Date | Country | |
|---|---|---|---|
| 63034781 | Jun 2020 | US |
| Number | Date | Country | |
|---|---|---|---|
| Parent | PCT/US2021/016422 | Feb 2021 | WO |
| Child | 18074140 | US |