Here you can ask questions and find or give answers to organizational, academic and other questions about studying computer science.

1.1k questions

1.3k answers

1.7k comments

557 users

0 votes
Hello,

I am currently trying to figure out how to handle jump instructions and nops. Are nops necessary after a jump instruction and how many of them?

In the Pipelining chapter, we have the "Summary on General Number of Stalls in Case of Conflicts" (Slide 88), which indicates that nops are required after ALU, load, and branch instructions.

However, older exams from Computer Systems 2 sometimes contain tasks where inserting nops after a jump was necessary (e.g., 28.03.2018 Task 1a, no Forwarding).

In the exam from 27.08.2015, we were given the hint: "Jump instructions do not require NOP instructions here."

Thanks in advance
in # Mandatory Modules Bachelor by (290 points)

1 Answer

0 votes
 
Best answer
Well, it depends. If you look at the pipeline implementation, jump instructions are certainly fetched, and decoded as all other instructions. What needs to be done for a jump instruction is to add the direct operand that comes with the jump instruction to the program counter. So, all that we need is an adder.

Now, you can implement the jump instruction in such a way that the required addition is done in the execution stage, and that the assignment to the program counter is done in the write back stage. If it would be done like this, we need nops after jump instructions in the same way as for branch instructions. The implementation of Abacus on slide 53 does this.

If we use forwarding, we want to use values as soon as they are available. For jump instruction, we still would have to wait for the addition in the execution phase. However, adders are not expensive, and therefore most processors spend another adder in the ID stage to perform the addition required for jump instructions. Slide 85 shows that implementation of the jump instructions which then requires no stalling anymore (provided register bypassing is used as well).

TLTR: It depends on the pipeline implementation, and with forwarding you may assume no further Nops, without you better ask how the jump instructions are implemented.
by (170k points)
selected by
Imprint | Privacy Policy
...