Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please show work on how you got answer 2. For the following code, variables are stored starting at location Ox1000. ng 16 bits wide and
please show work on how you got answer
2. For the following code, variables are stored starting at location Ox1000. ng 16 bits wide and show the memory locations that are assigned to each array element and variable as is done in Figures 6.1 and 6.8. Give the contents of these memory locations after all of the code is executed. Assume that any uninitialized variables are initialized to before this code fragment is executed. int32 tt pi32x; int16 t* pi16y; int16 t 116.b; int32-t i32-a; uint8.t au8_cl4: uint8 t pu8_w; bei // Note: value given in decinal ; 132 a i16b p132-x : &132-a ; p132-x p132-x 2; + Assume the initial memory and register contents of Table 6.1 at the beginning of each problem through 20. Give the new register and memory contents after the instruction is executed. 3 Effective Address and Operation Notes Syntax Word EA (Wn) Mode R1 with pre- RI with pre- R1 with post- RI with post- RI ncrement decrement | | I [++Wn] [--IYn] [1Yn++] (Bn-1 Byte | (Wn += I); EA = (JYn) | (Wii- | (Win +-2); EA = (Wh) (W) IM); ( Wn += 2); | Increment before | Decrement before | Increment after Win | Decrement after Wn unmodified Wn used as EA Wn used as EA used as EA I ); EA (W) | (JYn-2); EA EA-(W | EA-(Wr); (IYn--2); EA-(JYn); (IYn += i); increment | EA-(11'n); (Hn-I): decrement RI with register offset Wn used as EA Wn, Wb unmodified Figure 6.1 Register indirect (RI) addressing modes W15 is the stack pointer (SP), (a) push Operation: datad (SP), SP- SP+2 datad is specified by the source addressing mode. Stack grows towards incrcasing memory locations After push of data Location Contents 0x1200data 0x1202 2??? SP 0x1204 ???? W15 0x1202 modified Before push of data Location Contents 0x1200 ??? SP 0x1202 ??22 0x1204 2?? W15 dataA modified 0x1200 (b) pop Operaon: SP SP-2, ((SP) destination as specified by destination addressing mode After pop operation Before pop operation Location Contents 0x1200 dataA Ox 1202 ???SP 0x1204 ???? W15 0x 1202 Location Contents 0x1200 dataASP 0x1202???? 0x1204 ???? W15 0x1200 modified Figure 6.8 Memory stack push, pop operations 2. For the following code, variables are stored starting at location Ox1000. ng 16 bits wide and show the memory locations that are assigned to each array element and variable as is done in Figures 6.1 and 6.8. Give the contents of these memory locations after all of the code is executed. Assume that any uninitialized variables are initialized to before this code fragment is executed. int32 tt pi32x; int16 t* pi16y; int16 t 116.b; int32-t i32-a; uint8.t au8_cl4: uint8 t pu8_w; bei // Note: value given in decinal ; 132 a i16b p132-x : &132-a ; p132-x p132-x 2; + Assume the initial memory and register contents of Table 6.1 at the beginning of each problem through 20. Give the new register and memory contents after the instruction is executed. 3 Effective Address and Operation Notes Syntax Word EA (Wn) Mode R1 with pre- RI with pre- R1 with post- RI with post- RI ncrement decrement | | I [++Wn] [--IYn] [1Yn++] (Bn-1 Byte | (Wn += I); EA = (JYn) | (Wii- | (Win +-2); EA = (Wh) (W) IM); ( Wn += 2); | Increment before | Decrement before | Increment after Win | Decrement after Wn unmodified Wn used as EA Wn used as EA used as EA I ); EA (W) | (JYn-2); EA EA-(W | EA-(Wr); (IYn--2); EA-(JYn); (IYn += i); increment | EA-(11'n); (Hn-I): decrement RI with register offset Wn used as EA Wn, Wb unmodified Figure 6.1 Register indirect (RI) addressing modes W15 is the stack pointer (SP), (a) push Operation: datad (SP), SP- SP+2 datad is specified by the source addressing mode. Stack grows towards incrcasing memory locations After push of data Location Contents 0x1200data 0x1202 2??? SP 0x1204 ???? W15 0x1202 modified Before push of data Location Contents 0x1200 ??? SP 0x1202 ??22 0x1204 2?? W15 dataA modified 0x1200 (b) pop Operaon: SP SP-2, ((SP) destination as specified by destination addressing mode After pop operation Before pop operation Location Contents 0x1200 dataA Ox 1202 ???SP 0x1204 ???? W15 0x 1202 Location Contents 0x1200 dataASP 0x1202???? 0x1204 ???? W15 0x1200 modified Figure 6.8 Memory stack push, pop operationsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started