Use of tags to cancel a conditional branch delay slot instruction
AssigneeBroadcom Corporation
InventorDavid A. Kruckemyer
Life of this patent
Estimating the term…
Abstract
A first tag is assigned to a branch instruction. Dependent on the type of branch instruction, a second tag is assigned to an instruction in the branch delay slot of the branch instruction. The second tag may equal the first tag if the branch delay slot is unconditional for that branch, and may equal a different tag if the branch delay slot is conditional for the branch. If the branch is mispredicted, the first tag is broadcast to pipeline stages that may have speculative instructions, and the first tag is compared to tags in the pipeline stages. If the tag in a pipeline stage matches the first tag, the instruction is not cancelled. If the tag mismatches, the instruction is cancelled.
Claims18
A processor comprising,
- an issue queue configured to store a plurality of instructions and a plurality of tags, each of the plurality of tags corresponding to a respective one of the plurality of instructions, wherein a first instruction of the plurality of instructions is in a branch delay slot of a branch instruction, and wherein a first tag of the plurality of tags corresponding to the first instruction is equal to a second tag corresponding to the branch instruction if the branch delay slot is unconditional, and wherein the first tag is not equal to the second tag if the branch delay slot is conditional;
- an issue logic coupled to the issue queue, wherein the issue logic is configured to select the first instruction for issue responsive to predetermined issue criteria, and wherein the issue queue is configured to issue the first instruction and the first tag responsive to the issue logic selecting the first instruction for issue;
- and
- an execution unit coupled to receive the first instruction and the first tag issued from the issue queue, wherein the execution unit is configured to execute the first instruction in one or more pipeline stages, and wherein the execution unit is further coupled to receive the second tag responsive to a misprediction of the branch instruction, and wherein the execution unit is configured to compare the second tag to tags of instructions in the one or more pipeline stages, and wherein, if a mismatch is detected in the comparison, the execution unit is configured to cancel the corresponding instruction and wherein, if a match is detected in the comparison, the execution unit does not cancel the corresponding instruction, whereby the first instruction is canceled if the branch delay slot is conditional and the first instruction is not canceled if the branch delay slot is unconditional.
A method comprising:
- storing a plurality of instructions and a plurality of tags in an issue queue, each of the plurality of tags corresponding to a respective one of the plurality of instructions, wherein a first instruction of the plurality of instructions is in a branch delay slot of a branch instruction, and wherein a first tag of the plurality of tags corresponding to the first instruction is equal to a second tag corresponding to the branch instruction if the branch delay slot is unconditional, and wherein the first tag is not equal to the second tag if the branch delay slot is conditional;
- selecting the first instruction for issue responsive to predetermined issue criteria;
- issuing the first instruction and the first tag responsive to the selecting the first instruction for issue;
- executing the first instruction in one or more pipeline stages of an execution unit;
- receiving the second tag in the execution unit responsive to a misprediction of the branch instruction;
- comparing the second tag to tags of instructions in the one or more pipeline stages;
- if a mismatch is detected in the comparing, canceling the corresponding instruction;
- and
- if a match is detected in the comparing, not canceling the corresponding instruction, whereby the first instruction is canceled if the branch delay slot is conditional and the first instruction is not canceled if the branch delay slot is unconditional.
A computer-readable medium carrying a database used to fabricate a processor comprising:
- an issue queue configured to store a plurality of instructions and a plurality of tags, each of the plurality of tags corresponding to a respective one of the plurality of instructions, wherein a first instruction of the plurality of instructions is in a branch delay slot of a branch instruction, and wherein a first tag of the plurality of tags corresponding to the first instruction is equal to a second tag corresponding to the branch instruction if the branch delay slot is unconditional, and wherein the first tag is not equal to the second tag if the branch delay slot is conditional;
- an issue logic coupled to the issue queue, wherein the issue logic is configured to select the first instruction for issue responsive to predetermined issue criteria, and wherein the issue queue is configured to issue the first instruction and the first tag responsive to the issue logic selecting the first instruction for issue;
- and
- an execution unit coupled to receive the first instruction and the first tag issued from the issue queue, wherein the execution unit is configured to execute the first instruction in one or more pipeline stages, and wherein the execution unit is further coupled to receive the second tag responsive to a misprediction of the branch instruction, and wherein the execution unit is configured to compare the second tag to tags of instructions in the one or more pipeline stages, and wherein, if a mismatch is detected in the comparison, the execution unit is configured to cancel the corresponding instruction and wherein, if a match is detected in the comparison, the execution unit does not cancel the corresponding instruction, whereby the first instruction is canceled if the branch delay slot is conditional and the first instruction is not canceled if the branch delay slot is unconditional.
Dependencies are inferred from the claim text.