This problem is about tracing actions in a typical CPU when

This problem is about tracing actions in a typical CPU when executing an instruction. In this case, we are considering the following Arduino program fragment: int myVar; myVar = EEP ROM. read (100) + 1; Describe in detail the correct sequence of actions that occur as the Arduino program executes the actions required for the second instruction listed. Your description must include these architectural elements: data bus, address bus, ALU, Program memory, SRAM, EEPROM, general registers, etc. I have included a general schematic of the Arduino system to help with your description.

Solution

This is a typical code in a arduino system where a read from EEPROM is performed at address 100 and we are adding 1 to the result and putting it in myvar.

This will result into a assembly code on arduino and will then be run on the board. int myVar will initialize a space in the stack for the program,

We will do a load operation in assembly for the EEPROM .read function for address 100. We will then use the add instruction in the assembly to add one to the result and then we will use the store instruction to store the result at the final destination of myVar.

Assembly will be

mv r2,0xfff ; to store the location of myvar

mv r0,0x100 ;to store the address for load

LD r1,[r0] ; to load the value at address 0x100

ADD r1,r1,0x1 ;to add on to the r1 value and then again storing it in r1.

ST r1,[r2] ; to move the final value to r2.

The address bus will contain value of myVar and address 0x100. Data bus will contains the final result.

 This problem is about tracing actions in a typical CPU when executing an instruction. In this case, we are considering the following Arduino program fragment:

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site