Blackfin Syntax Stores, Jumps, Calls and Conditional Jumps

Slides:



Advertisements
Similar presentations
Machine cycle.
Advertisements

Tutorial Essentially all the Blackfin instruction you need for all of ENCM511. The instructions are easy. Its knowing when to use them that is the difficult.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 4 Assembly Language Programming 2.
Functions Functions and Parameters. History A function call needs to save the registers in use The called function will use the registers The registers.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 3 – New instruction recap Tutorial.
Assignment Overview Thermal oscillator One of the ENCM415 Laboratory 2 items Oscillator out GND +5V.
6/2/2015 Labs in ENCM415. Laboratory 2 PF control, Copyright M. Smith, ECE, University of Calgary, Canada 1 Temperature Sensor Laboratory 2 Part 2 – Developing.
Building a simple loop using Blackfin assembly code M. Smith, Electrical and Computer Engineering, University of Calgary, Canada.
Developing a bicycle speed-o-meter Part 2 A comparison between the Analog Devices ADSP-BF533 (Blackfin) and Motorola MC68332.
Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn.
Developing a bicycle speed-o-meter A comparison between the Analog Devices ADSP-BF533 (Blackfin) and Motorola MC68332.
Timers and Timing Signals Tutorial. 6/18/2015 Timer Control Copyright M. Smith, ECE, University of Calgary, Canada 2 / 31 Temperature Sensor -- Lab 3.
Understanding the Blackfin ADSP-BF5XX Assembly Code Format
Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
Tutorial Essentially all the Blackfin instruction you need for all of ENCM511. The instructions are easy. Its knowing when to use them that is the difficult.
Developing a bicycle speed-o-meter Midterm Review.
Blackfin Array Handling Part 2 Moving an array between locations int * MoveASM( int foo[ ], int fee[ ], int N);
Lesson 13 CDT301 – Compiler Theory, Spring 2011 Teacher: Linus Källberg.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM511.
Generating “Rectify( )” Test driven development approach to TigerSHARC assembly code production Assembly code examples Part 1 of 3.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
DOCUMENTATION SECTION GLOBAL DECLARATION SECTION
CE-2810 Dr. Mark L. Hornick 1 Mixing C and assembly Safety goggles on!
A first attempt at learning about optimizing the TigerSHARC code TigerSHARC assembly syntax.
Building a simple loop using Blackfin assembly code If you can handle the while-loop correctly in assembly code on any processor, then most of the other.
Assignment 4 / Lab. 3 Convert C++ ISR to ASM AND GET IT TO WORK Doing Assignment 4 / Lab. 3 the Test Driven Development way.
Lecture 3 Translation.
Assembly language.
Chapter 5- Assembling , Linking, and Executing Programs
Tutorial Essentially all the Blackfin instruction you need for all of ENCM511. The instructions are easy. Its knowing when to use them that is the difficult.
Developing a bicycle speed-o-meter
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
and Executing Programs
Lab. 2 Overview.
Generating the “Rectify” code (C++ and assembly code)
Generating “Rectify( )”
A Play Core Timer Interrupts
The planned and expected
Generating a software loop with memory accesses
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
* M. R. Smith, University of Calgary, Alberta,
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Thermal arm-wrestling
Using Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
A Play Lab. 2 Task 8 Core Timer Interrupts
Assembly Language Review
Hints for Post-Lab Quiz 1
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Tutorial Essentially all the Blackfin instruction you need for all of ENCM511. The instructions are easy. Its knowing when to use them that is the difficult.
Explaining issues with DCremoval( )
Lab. 4 – Part 2 Demonstrating and understanding multi-processor boot
Independent timers build into the processor Basis for Lab. 2
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Developing a bicycle speed-o-meter
Blackfin Timers Independent timers build into the processor
Independent timers build into the processor
Developing a bicycle speed-o-meter
Blackfin BF533 EZ-KIT Control The O in I/O
Developing a bicycle speed-o-meter
Thermal arm-wrestling
Building a simple loop using Blackfin assembly code
Developing a bicycle speed-o-meter Part 2
Understanding the TigerSHARC ALU pipeline
A first attempt at learning about optimizing the TigerSHARC code
Blackfin Syntax Moves and Adds
Presentation transcript:

Blackfin Syntax Stores, Jumps, Calls and Conditional Jumps What we already know and have to remember to apply What we need to learn

Assembly code “stub” Each function written in assembly code has the same general look The necessary #include files and Section name Declaration of the function as “global” combined with labels for start and end of function Setting size of link operation and using LINK instruction to save the return address Unlink used with JUMP(P0) instruction to cause the function to return “to calling program” R0 used for return parameter Required code with Documentation of code 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Example 1 -- stub code 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Example 2 – Stub code 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Store/Write code 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Store/write error messages 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Load/read 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Jump 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

If CC jump If !CC jump 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Jump predicted taken (bp) IF CC JUMP WHILE [--SP] = (R7:0); // Save to stack WHILE: R0 = R1; R2 = R3; CC = R1 < R4; IF CC JUMP WHILE; R6 = R7; R5 = R4; IF CC JUMP WHILE [--SP] = (R7:0); // Save to stack WHILE: R0 = R1; R2 = R3; CC = R1 < R4; IF CC JUMP WHILE (BP); R6 = R7; R5 = R4; 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Processor fetches instructionS before execution 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

UP to 10 instructions being executed in paraller Processor fetches 9 new instructions before execution of 1st instruction is complete UP to 10 instructions being executed in paraller 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Jump predicted taken (bp) IF CC JUMP WHILE [--SP] = (R7:0); // Save to stack WHILE: R0 = R1; R2 = R3; CC = R1 < R4; IF CC JUMP WHILE; R6 = R7; R5 = R4; IF CC JUMP WHILE [--SP] = (R7:0); // Save to stack WHILE: R0 = R1; R2 = R3; CC = R1 < R4; IF CC JUMP WHILE (bp); R6 = R7; R5 = R4; 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Jump example code 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Call instruction 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

void ExampleASM(void) { C++ code void ExampleASM(void) { ConvertTempASM(100,200,1); // declared as extern “C” } Assembly code 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

void Example2ASM(void) { C++ code void Example2ASM(void) { CalculateTemperature(100,200,1); // C++ function } Assembly code 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Move Register 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Conditional move register 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Practice Exercise Translate in Blackfin Assembly Code extern “C” unsigned long int WaitTillLow(void); extern “C” unsigned long int WaitTillHigh(void); unsigned short int MeasureTimeHigh_ASM(void) { unsigned long int value; WaitTillLow( ); WaitTillHigh( ); value = WaitTillLow( ); return value; } 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Practice Exercise 2 Translate in Blackfin Assembly Code extern “C” unsigned long int WaitTillLow(void); extern “C” unsigned long int WaitTillHigh(void); unsigned long int MeasureTimeHigh_ASM(void) { unsigned long int value1, value2; WaitTillLow( ); WaitTillHigh( ); value1 = WaitTillLow( ); value2 = WaitTillLow( ); return (value1 + value2); } 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada

Practice Exercise 3 Translate in Blackfin Assembly Code extern “C” unsigned long int WaitTillLow(void); extern “C” unsigned long int WaitTillHigh(void); extern unsigned long int value1; extern unsigned long int value2; unsigned long int MeasureTimeHigh_ASM(void) { WaitTillLow( ); WaitTillHigh( ); value1 = WaitTillLow( ); value2 = WaitTillLow( ); return (value1 + value2); } 8/5/2019 Timer Control -- Lab.3, Copyright M. Smith, ECE, University of Calgary, Canada