2

so glad i've found this place, hoping to learn here from other and help if i can.

my question is about understanding a single cycle MIPS: how can i know the values of 3,5 and 12? if you can, please explain it slowly so i could learn fast.

additional info: beq $t1,$t2,go_home is placed in memory in 0X3000. the label go_home is placed in 0x30AC, and the values of t2 and t1 are 0x2000. from what i understand, beq, branch if equal, and since t1 equals t2, then it should jump to the given label, go_home.

hardware diagram

this topic is quite difficult for me and i'm self learning it, so would really appreciate an explanation.

thank you very much!

Jester
  • 56,577
  • 4
  • 81
  • 125
  • 1
    i've tried several times to make the picture be shown but with no success. i am new to this platform so i don't know how to set it. would appreciate an explanation how to do so - so i could do it myself next time – javablemountain Aug 25 '18 at 17:50
  • 1
    `3` depends on how your ALU encodes operations, can't tell from this diagram. `5` is just bits 15:11 from the instruction (the destination register) `12` is the result to be written into the destination. For `beq` operation the diagram is missing parts, for example the `PCSrc` for the top right mux which should be controlled by the comparison result and of course no other register update occurs so the `12` path should be blocked. – Jester Aug 25 '18 at 18:01
  • MIPS instruction encodings are chosen so that parts of the instruction word can be used as internal control signals. But if `instruction[5:0]` is passed through to the ALU, then that just means the real decoding into add vs. sub vs. xor (no-carry add) vs. shifts vs. etc. is done inside the ALU. – Peter Cordes Aug 25 '18 at 18:53
  • thank you very much for your explanations @jester. i am wondering, what would happen if we say for instance that the line to ALUOp is stuck on 10(binary)? – javablemountain Aug 25 '18 at 19:17
  • That would force a particular operation corresponding to the stuck value to be executed instead of the one encoded in the instruction. – Jester Aug 25 '18 at 22:22
  • which operation would be forced? i am trying to understand that and wondering what would happen if the control line of ALUSrc will be stuck on the value 1(i assume that since it selects the second operand for ALU, then if it's stuck at 1, it means it's equals and the command should be computed regularly. is it true?) – javablemountain Aug 26 '18 at 10:30
  • `ALUSrc` controls whether the operand comes from a register or an immediate embedded in the instruction. It does not control what operation is performed. Not sure what you mean by "means it's equals". If it's stuck at `1` it would use part of the instruction as an immediate and if your instruction was not of that form then it would do something crazy. Your diagram does not have enough information about the `ALU Control` block we don't know how the ALU operations are encoded. – Jester Aug 26 '18 at 11:55

0 Answers0