MIPS assembly statement - solution unclear -


reviewing practice exam questions class , 1 of questions ask write assembly statements task...

set 0 bit in flag register

solution - add r1, r0, r0 ( there many ways of doing )

i'm not clear on why apply 0 bit in flag register?

real mips processors (normally) not have "flags".

however universitary mips variants (i found in google) add flags educational purposes.

unlike mips cpus other cpu types not have conditional jump instructions can jump dependent on register value (like "bltz"). instead have conditional jump instructions jump dependent on result of previous arithmethic operation.

therefore these cpus must have special "register" saving information last result (like "result negative"). register contains special bits - so-called "flags". 1 of these bits "zero flag" indicates result zero.

note:

  • the sparc cpus have instruction set similar mips use flag register instead of "bltz"-style relative jumps. using such cpu original question make sense without adding non-standard registers.
  • i use "add r0, r0, r0" because not modify r1 register.

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -