review of blackfin syntax moves and adds 1) what we already know and have to remember to apply 2)...

16
Review of Blackfin Review of Blackfin Syntax Syntax Moves and Adds Moves and Adds 1) 1) What we already know What we already know and have to remember to and have to remember to apply apply 2) 2) What we need to learn What we need to learn

Post on 19-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

Review of Blackfin Review of Blackfin SyntaxSyntaxMoves and AddsMoves and Adds

1)1) What we already know and What we already know and have to remember to applyhave to remember to apply

2)2) What we need to learn What we need to learn

Page 2: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

22

Assembly code “stub”Assembly code “stub”

Each function written in assembly code has Each function written in assembly code has the same general lookthe same general look

1.1. The necessary #include files and Section nameThe necessary #include files and Section name2.2. Declaration of the function as “global” combined Declaration of the function as “global” combined

with labels for start and end of functionwith labels for start and end of function3.3. Setting size of link operation and using LINK Setting size of link operation and using LINK

instruction to save the return addressinstruction to save the return address4.4. Unlink used with JUMP(P0) instruction to cause Unlink used with JUMP(P0) instruction to cause

the function to return “to calling program”the function to return “to calling program”5.5. R0 used for return parameterR0 used for return parameter6.6. Required code with Documentation of codeRequired code with Documentation of code

Page 3: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

33

Example 1 -- stub code Example 1 -- stub code

Page 4: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

44

Store/Write codeStore/Write code

Page 5: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

55

LoadLoad/read/read

Page 6: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

66

Move Move RegisterRegister

Page 7: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

77

Conditional move Conditional move registerregister

Page 8: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

88

Half register movesHalf register moves

Zero extendedZero extended

Sign extendedSign extended

Page 9: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

99

What does zero What does zero extendedextendedand sign extended and sign extended mean?mean? 1 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1

0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1

1 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1

0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1

0 In all bits

0 In all bits

“sign bit” In all bits

1 In all bits

0 In all bits

Page 10: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

1010

32 bit adds32 bit adds

Page 11: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

1111

16 bit adds16 bit adds

VIDEOtwo

16-bitAdds

At same time

Page 12: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

1212

Some assign Some assign statementstatementLoad immediateLoad immediate

Page 13: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

1313

Some assign Some assign statementstatementLoad immediateLoad immediate

Page 14: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

1414

Page 15: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

1515

Page 16: Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn

04/18/2304/18/23 Timer Control -- Lab.3, Timer Control -- Lab.3, Copyright M. Smith, ECE, Unive Copyright M. Smith, ECE, University of Calgary, Canadarsity of Calgary, Canada

1616

Safe way of doing Safe way of doing immediate loadsimmediate loads