Lynn
Lynn

Reputation: 121

Adding a new instruction to a MIPS

heyy, I study software so i'm absolutely new when it comes to drawing electrical circuits and I need to add a new instruction to This MIPS machine here

enter image description here

The new instruction i have to add jt - jump table - is an instruction which makes it possible to go to the address indicated by a value in memory at the address indicated by two registers:

jt rs, rt # PC := mem[ R[rs] + R[rt] * 8 ]

Its encoding is as follows: • Instruction [31-26]: Operation code for jt

• Instruction [25-21]: rs registry number

• Instruction [20-16]: rt registry number

• Instruction [15-11]: 0

• Instruction [10-6]: 0

• Instruction [5-0]: 0x20

Can someone explain to a complete beginner (me) the process to add an instruction like this one on the diagram? Thanks for your time.

Upvotes: 1

Views: 1029

Answers (1)

ajit
ajit

Reputation: 418

As per your instruction description you need to store a new value to PC using registers in R as input. Existing architecture does not allow moving an address calculated using register rs and rt value as input to PC register. But, allow for moving value of R[rs] and R[rt] to the output port V1 and V2. You just need to set E(enable) to 1. For further implementation an add and shift is required. A simple approach could be add a barrel shifter block to shift the second input or V2. V1 and V2*8 goes as input to the UAL. Enable Add arithmetic operation in UAL. Output of adder get into Adr input of MD. MD should be enabled. Output of MD should get into PC. Since there are now more than two inputs to PC a 2:1 Multiplexer before it is required. Controller should generate five control bits. One to enable R (register file), one to enable 3 bit shift, another to enable Adder, another to enable MD, another to set control of Mux before PC and last one to enable LD(Load) control of PC.

Upvotes: 2

Related Questions