12. (7) Instructions can read, test and modify variables. A variable can correspond to a data item in memory or in a reg
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
12. (7) Instructions can read, test and modify variables. A variable can correspond to a data item in memory or in a reg
statement: If (X>65536) Y = X/128; else Y = X % 128; This statement sets Y equal to X divided by 128, if X is greater than 65536; otherwise it sets Y equal to (absolute value of X) modulo 128. Let the integer variable X correspond to the register $5 and the integer variable Y correspond to the register $6. Does the following sequence of MIPS instructions correctly produce the same result in Y (i.e., $6) as this high-level statement? Explain your answer. lui slt bne abs andi beq nop else: sra skip: nop $1,1 $1, $1, $5 $1, $0, else $1, $5 $6, $1, 0x7F $0,$0,skip $6, $5,7
12. (7) Instructions can read, test and modify variables. A variable can correspond to a data item in memory or in a register. Consider the high-level language