Questions about adding jal instruction to mips single cycle datapath

6.6k views Asked by At

I am trying to add jal instruction i understand how it works however i am having difficulty implementing it in the hardware?

I have this schematic and it shows that 31 connects to the mux before the register but not sure what to connect. I see that R[31] is equal to pc+8 or to the jump address however those are 32 bits while the entry to the mux is just 5 bits.

enter image description here

1

There are 1 answers

0
gusbro On

It means that the constant 31 be fed to the mux.

That 5-bit constant is the register number for $ra which is the register you want to hold the value of $PC + 8 if the MIPS has delayed branching and $PC + 4 if it does not have delayed branching.