Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

pleaseconvert Listings 4.2 thru 4.6 code to 1, as a program using in -line assem

ID: 3754485 • Letter: P

Question

pleaseconvert Listings 4.2 thru 4.6 code to 1, as a program using in -line assembly. 2, as a C-only program. isting 4.2 Usage of Data Processing and Memory Access Instructions text align 2 MemAddr . field 0x20000040; Memory address BitBandAddr field 0x22000810: Bit-band address global main main Data moving instructions MOV R0, #09h; R0-0x09 MOV R1, #11d; R1 . 0x0B MOV R2 , #00001010b; R1 . 0x0A Memory access instructions LDR R3, MemAddr STR R2, R3 STR R1, [R3, #41; LDR RO, R31 PUSH (R3) POP (R4) Bit-band operation LDR RS, BitBandAddri LDR R6, (RS) MOV R6, 1 STR R6, [RS) Porever 1loop end

Explanation / Answer

We can modify the datapath from Lecture 02-03 of the 3-instruction processor to add an instruction that performs an ALU operation on any two memory locations and stores the result in a register file location. (We would need to add 2 multiplexers – ALU_Mux1 and ALU_Mux2 – to the inputs to the ALU to select between an input from the register file and an input from data memory.) Note that if we wanted to perform the operation d(4) = d(5) + d(6) + d(7) with the old datapath (i.e. before the enhancement) we would need a total of 6 instructions. However, with the new datapath, we would only need 4 instructions: Un-enhanced Solution: Enhanced Solution: MOV R1, d(5) Add R1, d(5), d(6) MOV R2, d(6) MOV R2, d(7) MOV R3, d(7) Add R3, R1, R2 Add R4, R1, R2 MOV d(4), R3 Add R5, R4, R3 MOV d(4), R5