# US 2018/0024833 A1 · Processor testing

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2018/0024833 A1
- Document ID: US20180024833A1
- Status: Published application
- Kind: A1
- Application number: 15/722,938
- Filed: 2017-10-02
- Published: 2018-01-25
- Earliest claimed: 2010-10-20
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Abhishek Bansal; Nitin P. Gupta; Brad L. Herold; Jayakumar N. Sankarannair
- Web page: https://patentgrep.com/patent/US20180024833A1

## CPC

- G06F 11/2236: {to test CPU or processors}
- G06F 9/3005: {to perform operations for flow control}
- G06F 9/30058: {Conditional branch instructions}
- G06F 9/3804: {for branches, e.g. hedging, branch folding}
- G06F 11/28: by checking the correct order of processing (G06F11/08 - G06F11/26 take precedence; monitoring patterns of pulse trains H03K5/19)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A process for processor testing includes generating a set of test instructions having a first portion and a second portion. A first branch instruction is randomly generated for the first portion where the first branch instruction branches to a respective instruction in a second portion by a branching location offset. A second branch instruction is randomly generated for the second portion where the second branch instruction branches to a respective instruction in the first portion by the branching location offset. If additional instructions are to be added to the set of test instructions, a value of the branching location offset is incrementing by a predetermined amount.

## Claims

### Claim 1

A method comprising:
generating a set of test instructions having a first portion and a second portion;
randomly generating a first branch instruction for the first portion, the first branch instruction branching to a respective instruction in a second portion by a branching location offset;
randomly generating a second branch instruction for the second portion, the second branch instruction branching to a respective instruction in the first portion by the branching location offset;
determining whether to add another instruction to the set of test instructions;
responsive to determining to add an other instruction to the set of test instructions, incrementing a value of the branching location offset by a predetermined amount; and
writing the instructions to a computer readable storage medium.

### Claim 2 (depends on 1)

The method of claim 1, wherein randomly generating the first and second branch instructions comprises randomly selecting whether the branch instruction is a conditional branch.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
generating a first instruction that increments a counter, the first counter instruction to be placed at a first location in the instruction set;
placing the first branch instruction at an instruction set location subsequent the first counter instruction and branching to an instruction set location preceding the first counter instruction by the branching location offset;
generating a second instruction that increments the counter, the second counter instruction to be placed at the location preceding the first counter instruction; and
placing the second branch instruction at an instruction set location subsequent the second counter instruction and branching to an instruction set location subsequent the first branch instruction.

### Claim 4 (depends on 3)

The method of claim 3, further comprising:
generating a third instruction that increments the counter, the third counter instruction to be placed at the location subsequent the first branch instruction;
randomly generating a third branch instruction, the third branch instruction to be placed at an instruction set location subsequent the third counter instruction and branching to an instruction set location preceding the first counter instruction by the incremented value of the branching location offset;
generating a fourth instruction that increments the counter, the fourth counter instruction to be placed at the location preceding the first counter instruction by the second amount; and
randomly generating a fourth branch instruction, the fourth branch instruction to be placed at an instruction set location subsequent the fourth counter instruction and branching to a location subsequent the third branch instruction.

### Claim 5 (depends on 1)

The method of claim 1, further comprising writing processor performance analysis instructions in the instruction set, the analysis instructions determining whether the appropriate number of branches is encountered during execution of the instruction set.

### Claim 6 (depends on 1)

The method of claim 1, further comprising
determining an amount of instruction set locations available for storing the branch instructions and increment instructions; and
generating the branch and increment instructions to at least substantially fill the instruction set locations.

### Claim 7 (depends on 6)

The method of claim 6, further comprising:
determining an approximate mid-point of the amount of instruction locations; and
placing a first counter instruction at the approximate mid-point.

### Claim 8 (depends on 6)

The method of claim 6, further comprising
determining an amount of instruction set locations needed for storing processor performance analysis instructions; and
reducing the amount of instruction locations available for storing the branch and increment instructions by the amount of instruction set locations needed for the analysis instructions.

### Claim 9 (depends on 1)

The method of claim 1, wherein the first portion is contiguous with the second portion.

### Claim 10 (depends on 1)

The method of claim 1, further comprising:
operating a processor according to the instruction set a plurality of times;
determining the number of branches encountered by the processor during each run of the instruction set; and
evaluating the number of branches encountered by the processor during each run of the instruction set to determine whether an error occurred in the processor.

### Claim 11

A system comprising:
a computer readable storage medium storing instructions for processor testing; and
a processor, according to the instructions, configured to:
generate a set of test instructions having a first portion and a second portion;
randomly generate a first branch instruction for the first portion, the first branch instruction branching to a respective instruction in a second portion by a branching location offset;
randomly generate a second branch instruction for the second portion, the second branch instruction branching to a respective instruction in the first portion by the branching location offset;
determine whether to add another instruction to the set of test instructions;
responsive to determining to add an other instruction to the set of test instructions, increment a value of the branching location offset by a predetermined amount; and
write the instructions to the computer readable storage medium.

### Claim 12 (depends on 11)

The system of claim 11, wherein the processor randomly selects whether the branch instructions are a conditional branch.

### Claim 13 (depends on 11)

The system of claim 11, wherein the processor is further configured to:
generate a first instruction that increments a counter, the first counter instruction to be placed at a first location in the instruction set;
place the first branch instruction at an instruction set location subsequent the first counter instruction and branching to an instruction set location preceding the first counter instruction by the branching location offset;
generate a second instruction that increments the counter, the second counter instruction to be placed at the location preceding the first counter instruction; and
place the second branch instruction at an instruction set location subsequent the second counter instruction and branching to an instruction set location subsequent the first branch instruction.

### Claim 14 (depends on 11)

The system of claim 11, wherein the processor also writes processor performance analysis instructions in the instruction set, the analysis instructions determining whether the appropriate number of branches is encountered during execution of the instruction set.

### Claim 15 (depends on 11)

The system of claim 11, wherein the first portion is contiguous with the second portion.

### Claim 16 (depends on 11)

The system of claim 11, the processor also randomizes branch hint bits for a branch instruction based on the branch instruction being conditional.

### Claim 17

A computer program product for generating test instructions for a processor, the computer program product comprising:
a computer readable storage medium having computer readable program code embodied therewith, the computer readable program code comprising computer readable program code configured to:
generate a set of test instructions having a first portion and a second portion;
randomly generate a first branch instruction for the first portion, the first branch instruction branching to a respective instruction in a second portion by a branching location offset;
randomly generate a second branch instruction for the second portion, the second branch instruction branching to a respective instruction in the first portion by the branching location offset;
determine whether to add another instruction to the set of test instructions; and
responsive to determining to add an other instruction to the set of test instructions, increment a value of the branching location offset by a predetermined amount.

### Claim 18 (depends on 17)

The computer program product of claim 17, wherein the computer readable program code is configured to randomly select whether the branch instructions are a conditional branch.

### Claim 19 (depends on 17)

The computer program product of claim 17, wherein the computer readable program code is configured to:
generate a first instruction that increments a counter, the first counter instruction to be placed at a first location in the instruction set;
place the first branch instruction at an instruction set location subsequent the first counter instruction and branching to an instruction set location preceding the first counter instruction by a the branching location offset;
generate a second instruction that increments the counter, the second counter instruction to be placed at the location preceding the first counter instruction; and
place the second branch instruction at an instruction set location subsequent the second counter instruction and branching to an instruction set location subsequent the first branch instruction.

### Claim 20 (depends on 17)

The computer program product of claim 17, wherein the first portion is contiguous with the second portion.
