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.