4 Replies - 175 Views - Last Post: 12 February 2019 - 10:32 PM

#1 TonyRymond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 09-February 19

Value of register

Posted 09 February 2019 - 02:29 PM

Hello !
I would like to ask two questions:
1) is the value of the register saved whenever I didn't smash it(update it) ? I mean lets assume I have like this situation:
leaf: 
    1. *instruction*
    2.*instruction*
    3.jal roof
    4.*instruction*

roof:
    1. addi $v0 $zero 5
    2.jr $ra


my question is, will the value of $v0 saved after updating it in label roof can use it immediately in the body of label leaf? I mean in other words like global variable, I can use it in the whole code .. ?

2) if I have closed the stack and already updated value of a specific register when the stack was opened....so after closing it will I still get access to the value of the specific register?! for instance $v0 updated to 5 when the stack was open, after closing the stack .. will I still having the value 5 in the register $v0 ?


thanks very much.

Is This A Good Question/Topic? 0
  • +

Replies To: Value of register

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14867
  • View blog
  • Posts: 59,319
  • Joined: 12-June 08

Re: Value of register

Posted 09 February 2019 - 02:34 PM

2hat happens when you try it?
Was This Post Helpful? 0
  • +
  • -

#3 TonyRymond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 09-February 19

Re: Value of register

Posted 09 February 2019 - 05:24 PM

I don't have the compiler of MIPS ; Currently studying the basic !
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14867
  • View blog
  • Posts: 59,319
  • Joined: 12-June 08

Re: Value of register

Posted 09 February 2019 - 05:25 PM

Perhaps you should get one and try it out. It's amazing what you can find out by trying it out.
Was This Post Helpful? 2
  • +
  • -

#5 turboscrew   User is offline

  • D.I.C Lover
  • member icon

Reputation: 171
  • View blog
  • Posts: 1,107
  • Joined: 03-April 12

Re: Value of register

Posted 12 February 2019 - 10:32 PM

In a typical assembly, there are no locals unless you use stack "manually" for that.
I don't understand what you mean by "opening" or "closing" the stack.

And for trying out stuff, there are simulators, like SPIM or MARS.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1