Lesson activities for



Download 363.63 Kb.
Page5/5
Date28.01.2017
Size363.63 Kb.
#9623
1   2   3   4   5





R0

R1

R2




4

2

2

MUL R0, R1, R2










MUL R1, R0, R2










MUL R0, R1, R2
















R0

R1

R2




0

7

5

SUB R0, R1, #3










ADD R2, R2, #1










SUB R0, R1, R2













Write an assembly language program to compute 3x + 6x. Assume that the value of x is stored in register R5. Add comments to your code to make it easier to understand.

Hint: the MUL command can only have registers as operands so you will need to store the immediate values 3 and 6 in registers.





Activity 23.3 (homework)

Summarise what you have learnt so far.



List five different types of computer devices that use an ARM processor.











ARM processors are designed to keep energy consumption to a minimum.

Explain why this is desirable.






Explain why every processor type has its own instruction set.




Explain how machine code differs from assembly language.




What is a mnemonic?




List three assembly language mnemonics and state what they do.







Each assembly language instruction consists of an opcode and one or more operands.

Operands can be one of two sorts. What are they?









The ARM11 has a 32-bit address bus.

Describe the function of the address bus.






How many unique memory locations does a 32 bit address bus provide?




Explain what this command does.

MUL R1, R0, R3






What do these mnemonics stand for?


  • CMP

  • MOV

  • LDR

  • B

  • SUB

  • MUL

The ARM11 instruction set has three groups of instructions: ‘data manipulation’, ‘load and store’ and ‘branch’.

Put these instructions into the correct group:



  • ADD

  • LDR

  • B

  • SUB

  • MUL

  • CMP

  • STR

  • BL

  • MOV

Data manipulation











Load and store





Branch





Which component of the processor carries out data manipulation instructions?




Load and store instructions are used to access memory. How is data transferred between memory and the registers?




Lesson 24 activities

Activity 24.1

Write comments for these two lines of code.

ADD R0, R1, R2




ADDEQ R0, R1, R2







Explain what this piece of code does.

CMP R0, R1

MOVGT R2, R0









Write comments for each line of this program.

MOV R0, #5




MOV R2, #6




CMP R0, R2




MOVEQ R3, R0




MOVNE R3, R2







What will be the outcome of executing this piece of code if register R0 holds the value 9 and register R1 holds the value 15?

CMP R0, R1

SUBGT R0, R0, R1

SUBLT R1, R1, R0








What will be the outcome of executing this piece of code if register R0 held the value 3 and register R1 held the value 3?

CMP R0, R1

ADDGT R0, R0, R1

ADDLT R1, R1, R0








Write an assembly language program to swap the contents of register R1 and register R2 if the value in R1 is greater than the value in R2. Add comments to your code to make it easier to understand.







Write an assembly language program to set the contents of register R1 to #1 if the contents of register R5 is less than or equal to 100. Add comments to your code to make it easier to understand.






Activity 24.2


ARM processors have a load-store architecture. Explain what this means.







Explain what this piece of code does.

LDA R0, [R2]

LDA R1, [R3]

ADD R0, R0, R1

STR R0 [R2]








Activity 24.3 (homework)


Draw a flowchart to illustrate what this piece of code does.

start MOV R0, #0

MOV R1, #10

loop ADD R0, R0, R1

SUB R1, Rl, #1

CMP R1, #0

BNE loop

STR R0, [R3]

stop B stop




Draw a flowchart to illustrate what this piece of code does.

start LDA R0, [R3]

LDA R1, [R4]

loop


CMP R0, R1

SUBGT R0, R0, R1

SUBLT R1, R1, R0

BNE loop


stop B stop




Write an assembly language program to implement this algorithm.















Download 363.63 Kb.

Share with your friends:
1   2   3   4   5




The database is protected by copyright ©ininet.org 2024
send message

    Main page