Question: tips below: Question 1 This question is about the Status Register (SREG) and branch instructions of the AVR architecture. (1) Find a case in byte

 tips below: Question 1 This question is about the Status Register

(SREG) and branch instructions of the AVR architecture. (1) Find a case

tips below:

in byte addition that set flags Z, C and V in SREG

Question 1 This question is about the Status Register (SREG) and branch instructions of the AVR architecture. (1) Find a case in byte addition that set flags Z, C and V in SREG at the same time. 4 (2) Use the flags in SREG, form the conditions for two hypothetical branch in- structions "BRHI" (branch if higher for unsigned values) and "BRLE" (branch if less or equal for signed values). 5 (3) Suppose we extend the SREG with three more flags NZ, NC, NS. They are used to store the previous values of flags Z, C and S, respectively. In this way, we can actually use two compare instructions together to support more sophis- ticated branch instructions. For example, we can test if a value (e.g., in R16) is in range [2,5) by: cpi R16, 2 cpi R16, 5 If R16-3, we know that Z=0, C=1. S=1 (since R16 5) and NZ = 0, NC=0, NS-0 (since R162 2). Please use the flags in this extended SREG to form the conditions for two hypothetical branch instructions "BRRU" (branch if in range for unsigned value) and "BRRS (branch if in range for signed value)? [6] For (1): Think the condition to make Z-1 and C-1. Since the addition result is 0 (for Z-1), to have an overflow (V-1), we need to add two negative values together. For (2) and (3): A combination of flag expression is needed. Remind, C flag is checked fro unsigned branch, S flag for signed branch. Question 1 This question is about the Status Register (SREG) and branch instructions of the AVR architecture. (1) Find a case in byte addition that set flags Z, C and V in SREG at the same time. 4 (2) Use the flags in SREG, form the conditions for two hypothetical branch in- structions "BRHI" (branch if higher for unsigned values) and "BRLE" (branch if less or equal for signed values). 5 (3) Suppose we extend the SREG with three more flags NZ, NC, NS. They are used to store the previous values of flags Z, C and S, respectively. In this way, we can actually use two compare instructions together to support more sophis- ticated branch instructions. For example, we can test if a value (e.g., in R16) is in range [2,5) by: cpi R16, 2 cpi R16, 5 If R16-3, we know that Z=0, C=1. S=1 (since R16 5) and NZ = 0, NC=0, NS-0 (since R162 2). Please use the flags in this extended SREG to form the conditions for two hypothetical branch instructions "BRRU" (branch if in range for unsigned value) and "BRRS (branch if in range for signed value)? [6] For (1): Think the condition to make Z-1 and C-1. Since the addition result is 0 (for Z-1), to have an overflow (V-1), we need to add two negative values together. For (2) and (3): A combination of flag expression is needed. Remind, C flag is checked fro unsigned branch, S flag for signed branch

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!