문제

So I'm turning in a project for class, and both parts of the program work.

However I noticed:

If I load the program (load "p5a.mal"), then execute it with run, it works.

If I type run a second time, type the same input, it shows behavior that indicates the variables declared in .text are retaining their values from the previous run.

An example of a variable being declared can be seen here:

#Used to store the word count in the given string (initialized to 0)
    wordcount:  .word       0

For example, if wordcount was 10 in the previous run, it outputs 20 in the second run.

Is this standard behavior of SPIM? Or am I not correctly zeroing out my variables?

I am aware SPIM has the "reinitialize" command, but should the second run just work anyway (without typing "reinitialize")?

도움이 되었습니까?

해결책

My TA responded to my email, and SPIM does need to be reinitialized (with the reinitialize command) in order for registers and memory locations to be reset.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top