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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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