|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Branch |
|
|
|
|
|
|
|
Branch on equal |
|
|
|
beq $rs, $rt, offset |
|
|
|
Requirements |
|
|
|
|
|
|
Compare contents of 2
registers |
|
|
|
|
Shift 16-bit offset left
by 2 bits to get word address |
|
|
|
|
Add shifted offset value
to value of PC + 4 to get branch target address |
|
|
|
Update PC with branch
target if operands are equal (branch is taken) |
|
|
Two operations: compare
and add |
|
|
|
|
|
Also modify instruction
fetch datapath to allow PC to be updated with new value |
|
|
|
|
|
|
|
|
Jump requires different
address calculation |
|
|
|
|
Replace lower 28 bits of
PC with 26 bits from instruction, shifted left 2 bits |
|
|
To be added later |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|