Question
Flow of Program Execution (10pts) 1. In the class, we explored how a program is executed by using a register file. a. Explain the reason
Flow of Program Execution (10pts) 1. In the class, we explored how a program is executed by using a register file. a. Explain the reason why CPUs use registers (what is the benefit of using registers). b. In ARM Cortex-M3 processor, how many registers are provided? And what is the size of each register (number of bits)? Data Representation & ARM Instructions (30pts + 20pts + 40pts) 2. Translate the following numbers into the specified different number systems. Do not use a calculator for this problem because it is important to understand the rule of number conversion so the calculator will not be allowed in the exam. a. Assume that all numbers are unsigned values. Binary number and hexadecimal number is presented with the prefixes that we discussed in the class. Decimal number doesnt have any prefix. 1) 64 = 0b( ) = 0x( ) 2) 0xBF2 = 0b( ) = ( ) 3) 0b1010111 = ( ) = 0x( ) b. Now assume that the numbers are signed 2s complement values. And, we are using 16bit system, which means that all numbers should be represented with 16 bits. If you cant find total of 16 bits in the given value presentation, assume that 0s are padded before the values. (i.e. 0xAB is actually 0x00AB) Likely, all answers should be presented with 16 bits except for the decimal answers. 1) 64 = 0b( ) = 0x( ) 2) 0xFBF2 = 0b( ) = ( ) 3) 0b1010111 = ( ) = 0x( ) 3. Show the result of the following operations. Translate hexadecimal numbers into binaries and do the binary level addition and subtraction. And then reconvert the result to a hexadecimal number. Assume that all numbers are 32-bit 2s complement signed numbers. Again, do not use a calculator for this problem because it is important to understand the rule of binary computation so the calculator will not be allowed in the exam. a. 0x7FFFFFFF + 0x00000123 b. 0xB0000000 0x20000000 4. Consider the computations of problem 3.a and 3.b above. For each computation, is overflow occurred? a. Answer based on the overflow rule that is explored in the lecture.
b. Now, lets verify your answer with ARM Keil debugger. Create an overflow_test.s like below: Define three word-size variables a, b and c in DATA area. Use myData as DATA areas name. Assign values used in 3.a and 3.b to variables a and b. Assign 0 to c. Define a function __main in CODE area. Use myCode as CODE areas name. In __main function, load values from a and b that are defined in 1) to registers r0 and r1. Check add and sub instructions in ARM Keil Assembler User Guide (http://www.keil.com/support/man/docs/armasm/armasm_dom1361289850039. htm) and find the proper formats of instructions to compute addition and subtraction with condition flags setting. Use the instructions to compute the operations of 3.a and 3.b. Store the computation result to r2. Store the value of r2 to the variable c. Run Debug Session (as directed in the installation guide) and answer the following two questions. 1) Answer if overflow is occurred for each of 3.a and 3.b by explaining how you observed the overflow from the debugger. You can either explaining which bit of what register youve checked or attaching a captured image of the register below. 2) Submit your code either by copying the code below or by submitting the overflow_test.s file separately.
Step 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