0% found this document useful (0 votes)
19 views

Control Lab

The document discusses C code that is equivalent to assembly code. It loads values from registers into other registers, shifts the values, compares them, and sets other register values based on the comparisons. It also lists the final values of the registers after the code is run.

Uploaded by

moses
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Control Lab

The document discusses C code that is equivalent to assembly code. It loads values from registers into other registers, shifts the values, compares them, and sets other register values based on the comparisons. It also lists the final values of the registers after the code is run.

Uploaded by

moses
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

USING C LANGUAGE

a.

The assembly code above is equivalent to the following C code:

int r3 = r1;

int r10 = r3 >> 0x1e8;

int r4 = (r10 == 0x5);

int r3 = `LdPfpPrgmStrmSelect(r0);

int r2 = r3 >> 0x3c;

r3 = r1;

The code above loads the value in register r1 into register r3, then shifts the value in register r3 right by
0x1e8 bits. It stores the result in register r10, and compares the value in register r10 to 0x5. If they are
equal, it sets the value in register r4 to 1. Otherwise, it sets the value in register r4 to 0.

Next, the code loads the value in register `LdPfpPrgmStrmSelect(r0) into register r3, then shifts the value
in register r3 right by 0x3c bits. It stores the result in register r2. Finally, it loads the value in register r1
into register r3.

b.

The final values of the registers will be as follows:

r2 = 0

The value in register r2 will be 0 because the value in register `LdPfpPrgmStrmSelect(r0) is 1, and when
this value is shifted right by 0x3c bits, the result is 0.

r3 = 0x0fe00504

The value in register r3 will be 0x0fe00504 because this is the value that was loaded into the register
from the FIFO.

r4 = 0

The value in register r4 will be 0 because the value in register r10 (0x00000500) is not equal to 0x5.

r10 = 0x00000500

The value in register r10 will be 0x00000500 because this is the value that was loaded into the register
from the FIFO.

You might also like