Blackfin Array Handling Part 2 Moving an array between locations int * MoveASM( int foo[ ], int fee[ ], int N);

Slides:



Advertisements
Similar presentations
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Advertisements

Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
MIPS assembly. Review  Lat lecture, we learnt  addi,  and, andi, or, ori, xor, xori, nor,  beq, j, bne  An array is stored sequentially in the memory.
Lecture 20: 11/12/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Code Composer Department of Electrical and Computer Engineering
ECE 232 L6.Assemb.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 6 MIPS Assembly.
10/6: Lecture Topics Procedure call Calling conventions The stack
Lecture 6: MIPS Instruction Set Today’s topic –Control instructions –Procedure call/return 1.
Computer Architecture CSCE 350
Procedures II (1) Fall 2005 Lecture 07: Procedure Calls (Part 2)
The University of Adelaide, School of Computer Science
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
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.
1 Pointers A pointer variable holds an address We may add or subtract an integer to get a different address. Adding an integer k to a pointer p with base.
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
Software and Hardware Circular Buffer Operations First presented in ENCM There are 3 earlier lectures that are useful for midterm review. M. R.
Intro to Computer Architecture
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.
Just enough information to program a Blackfin Familiarization assignment for the Analog Devices’ VisualDSP++ Integrated Development Environment.
Friday’s lecture again. Using E-TDD environment Build the tests you want to pass Build the code Test the code.
Blackfin BF533 EZ-KIT Control The O in I/O
Lecture 7: MIPS Instruction Set Today’s topic –Procedure call/return –Large constants Reminders –Homework #2 posted, due 9/17/
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.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 9/19/2015 Review of 50% OF ENCM369 in 50 minutes1.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Programming Language Principles Lecture 24 Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Subroutines.
Understanding the TigerSHARC ALU pipeline Determining the speed of one stage of IIR filter – Part 3 Understanding the memory pipeline issues.
Averaging Filter Comparing performance of C++ and ‘our’ ASM Example of program development on SHARC using C++ and assembly Planned for Tuesday 7 rd October.
M. Smith University of Calgary.  Many people like to sing in the shower.  However, its rather boring as there is no accompaniment.  The McVASH device.
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);
Computer Architecture CSE 3322 Lecture 4 crystal.uta.edu/~jpatters/cse3322 Assignments due 9/15: 3.7, 3.9, 3.11.
CE-2810 Dr. Mark L. Hornick 1 Mixing C and assembly Safety goggles on!
Computer Architecture CSE 3322 Lecture 4 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/10/09
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.
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 2/26/2016 Review of 50% OF ENCM369 in 50 minutes1.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 3/3/2016 Review of 50% OF ENCM369 in 50 minutes1.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.
“Lab. 5” – Updating Lab. 3 to use DMA Test we understand DMA by using some simple memory to memory DMA Make life more interesting, since hardware is involved,
Generating a software loop with memory accesses TigerSHARC assembly syntax.
CSC 253 Lecture 8.
General Optimization Issues
Generating the “Rectify” code (C++ and assembly code)
Generating “Rectify( )”
A Play Core Timer Interrupts
CSC 253 Lecture 8.
Generating a software loop with memory accesses
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Assembly Language Review
Using Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Assembly Language Review
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.
Getting serious about “going fast” on the TigerSHARC
General Optimization Issues
Concept of TDD Test Driven Development
Explaining issues with DCremoval( )
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
An Embedded Software Primer
Blackfin BF533 EZ-KIT Control The O in I/O
A first attempt at learning about optimizing the TigerSHARC code
Blackfin Syntax Stores, Jumps, Calls and Conditional Jumps
Presentation transcript:

Blackfin Array Handling Part 2 Moving an array between locations int * MoveASM( int foo[ ], int fee[ ], int N);

Array handling -- part 1 -- M. Smith 2 of 30 To be tackled – Array handling Move arrays – Max array (Exercise) Recap Setting up the tests Writing “enough” assembly code so you can “call the code, and return without crashing” Move one value between arrays Moving through an array – Hard coding and auto-increment addressing modes – Software loops – Hardware loops will be covered in a later lecture

Array handling -- part 1 -- M. Smith 3 of 30 Build the project (F7)

Array handling -- part 1 -- M. Smith 4 of 30 Add new tests BUT WHY THE ERROR MESSAGE

Array handling -- part 1 -- M. Smith 5 of 30 “Just enough code” to safely return after call to assembly code.section program.global start_address label with : end_address label with : HOWEVER LINKER SAYS “CAN”T FIND THIS FUNCTION” RECOGNIZE THIS ERROR SO YOU KNOW HOW TO FIX IN THE ASSIGNMENTS AND LABS

Array handling -- part 1 -- M. Smith 6 of 30 Use C++ keywords ‘extern “C” ‘ so compiler knows ASM follows C calling convention and not C++ calling convention Expected test failures

Array handling -- part 1 -- M. Smith 7 of 30 Same memory addressing error as before INCREMENT IN 4’s with accessing int arrays TYPOS inpar1 twice

Array handling -- part 1 -- M. Smith 8 of 30 FIXED TYPO R2 is INPAR 3 #define N_inpar3_R2 R2

Array handling -- part 1 -- M. Smith 9 of 30 How do we pass back a parameter from “ASM” to “C++”

Array handling -- part 1 -- M. Smith 10 of 30 Parameter passing convention Pass first parameter “into” function using R0 (same for data or addresses) Pass second parameter using R1 Pass third parameter using R2 Pass 4 th parameter on “stack” (like MIPS) Return the “result of a function” using R0 as the return register

Array handling -- part 1 -- M. Smith 11 of 30 The starting address of “final[ ]” is still (unchanged) in R2 – copy it to “return_register” NOTE R2 typos to be fixed N_inpar3_R2 R2 #define N_inpar3_R2 R2

Array handling -- part 1 -- M. Smith 12 of 30 Tests now all pass

Array handling -- part 1 -- M. Smith 13 of 30 This code format using “index” addition can’t be looped Stop using [P0 + 4] [P0 + 8] etc Go to auto increment mode [P0++]; #define N_inpar3_R2 R2

Array handling -- part 1 -- M. Smith 14 of 30 Add new tests for numpoints = 10 TEST FAILS AT THIS TIME

Array handling -- part 1 -- M. Smith 15 of 30 Your exercise – convert to software loop format Stop using [P0 + 4] [P0 + 8] etc Go to auto increment mode [P0++]; #define N_inpar3_R2 R2

Array handling -- part 1 -- M. Smith 16 of 30 Problem to solve R0 – used for source in-parameter R1 – used for final in-parameter R2 – used for “N points” in-paramater R3 – used for “temp” when reading and writing memory YOU CAN’T USE R4, R5, R6, R7 without saving them to the stack. Do we have to learn about the correct way of saving things to the stack or is there another way

Array handling -- part 1 -- M. Smith 17 of 30 Let’s rewrite the code R0 is used to pass in the address of the beginning of the “start” array R0 is transferred to P0 so we can access memory The value in R0 is not needed again in this function Rather than learning to save things to the stack – lets re-use R0

Array handling -- part 1 -- M. Smith 18 of 30 Value in R0 not needed REUSE R0 #define N_inpar3_R2 R2 N_inpar3_R2

Array handling -- part 1 -- M. Smith 19 of 30 Exercise 1 Stop using [P0 + 4] [P0 + 8] etc Go to auto increment mode [P0++]; #define N_inpar3_R2 R2

Array handling -- part 1 -- M. Smith 20 of 30 Exercise 2 – Write the assembly code to determine the location of the maximum of an array Some example tests

Array handling -- part 1 -- M. Smith 21 of 30 Problems to solve R0 used to pass in array address P0  R0 – therefore R0 is dead can be reused R0 reused to store temporary value when reading from memory R1 used in pass in number of points R2 used to store loop counter value R3 used to store maximum value R? used to store maximum location If use R4, R5, R6 and R7 then must learn to use “the stack” Solution 1 – use R2 as loop counter and decrement to 0 Solution 2 – store maximum location in another register (P1) and then transfer to R0 before we leave the routine Solution 3 – use hardware loop

Array handling -- part 1 -- M. Smith 22 of 30 Hints Write the tests for the code running in “C” ArrayMaxLocationCPP( ) Write the code first in “C++”ArrayMaxLocationCPP( ) Use the C++ code as comments in the assembly code

Array handling -- part 1 -- M. Smith 23 of 30 Always do a code review to make sure “code” does what you expect

Array handling -- part 1 -- M. Smith 24 of 30 Showing only the tests that fail ActivateTestsmain.cpp Change 1 line to show only the tests that fail | SHOW_SUCCESS; To ; // | SHOW_SUCCESSES

Array handling -- part 1 -- M. Smith 25 of 30 To be tackled – Array handling Move arrays – Max array (Exercise) Recap Setting up the tests Writing “enough” assembly code so you can “call the code, and return without crashing” Move one value between arrays Moving through an array – Hard coding and auto-increment addressing modes – Software loops – Hardware loops will be covered in a later lecture