A data processor, comprising:
- a memory for storing instructions;
- an instruction fetch unit for fetching the instructions from said memory;
- an instruction decoding unit for decoding the instructions fetched by said instruction fetch unit;
- an instruction execution unit for executing the instructions decoded by the instruction decoding unit;
- and
- pre-branch means including a branch target address generating unit having means for generating a branch target address and transferring means for transferring said branch target address to said instruction fetch unit, and means for processing a conditional branch instruction to fetch an instruction of a branch target by transferring the branch target address generated in said branch target address generating unit to said instruction fetch unit via said transferring means before determining the branch condition in said instruction execution unit;
- wherein
- said instruction fetch unit includes first and second instruction pre-fetch queues for temporarily holding instructions fetched from said memory, output means for selectively outputting instructions held in said first and second instruction pre-fetch queues to said instruction decoding unit, first and second address registers respectively holding the instruction address fetched in said first and second pre-fetch queues, and a branch target address saving latch for temporarily saving the branch target address,
- whereby, when the instruction in said first instruction pre-fetch queue is outputted to said instruction decoding unit by said output means and the first conditional branch instruction is included in instructions to be fetched in said first instruction pre-fetch queue:
- at processing said first conditional branch instruction, a first branch target address is generated by said branch target address generating unit, said pre-branch means transfers said first branch target address generated in said branch target address generating unit to said instruction fetch unit via said transferring means and instructs fetching an instruction of said first branch target address, and said instruction fetch unit stores said first branch target address in said second address register and fetches an instruction of the branch target into said second instruction pre-fetch queue, and said output means outputs the instruction fetched in either of said first or second pre-fetch queues to said instruction decoding unit, and
- whereby, when there is a second conditional branch instruction in an instruction train to be outputted to said instruction decoding unit, before determining the branch condition of said first conditional branch instruction:
- at processing said second conditional branch instruction, said pre-branch means transfers a second branch target address generated in said branch target address generating unit to said instruction fetch unit via said transferring means and instructs fetching the instruction of said second branch target address and said instruction fetch unit temporarily saves said second branch target address in said branch target address saving latch, and
- whereby, when a branch condition related to said first branch instruction is determined, said first branch instruction branches and said second conditional branch instruction is the instruction succeeding the instruction of said first branch target address,
- said first instruction pre-fetch queue is voided, said second branch target address saved in said branch target address saving latch is transferred to said first address register, and an instruction of said second branch target address is fetched in said first instruction pre-fetch queue, and
- whereby, when said first branch instruction does not branch and said second conditional branch instruction is the instruction succeeding to said first conditional branch instruction:
- said second instruction pre-fetch queue is voided, said second branch target address saved in said branch target address saving latch is transferred to said second address register, and an instruction of said second branch target address is fetched in said second instruction pre-fetch queue.