Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.

Slides:



Advertisements
Similar presentations
A look at interrupts What are interrupts and why are they needed.
Advertisements

Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Boot Issues Processor comparison TigerSHARC multi-processor system Blackfin single-core.
Daddy! -- Where do instructions come from? Program Sequencer controls program flow and provides the next instruction to be executed Straight line code,
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.
Thermal arm-wrestling Design of a video game using two programmable flags (PF) interrupts Tutorial on handling 2 Hardware interrupts from an external device.
Building a simple loop using Blackfin assembly code M. Smith, Electrical and Computer Engineering, University of Calgary, Canada.
Specialized Video (8-bit) and Vector (16-bit) Instructions on the Blackfin There is always a “MAKE-UP-YOUR-QUESTION-AND-ANSWER-IT” Question on a Dr. Smith.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Core Timer Code Development How you could have done the Take- Home Quiz using a test driven development (TDD) approach.
Specialized Video (8-bit) and Vector (16-bit) Instructions on the Blackfin Expand on these ideas for Q9 question and answer on the final.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Understanding the Blackfin ADSP-BF5XX Assembly Code Format
A look at interrupts What are interrupts and why are they needed.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller.
Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment.
Getting the O in I/O to work on a typical microcontroller Activating a FLASH memory “output line” Part 1 Main part of Laboratory 1 Also needed for “voice.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Developing a bicycle speed-o-meter Midterm Review.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Handling multiple input signals Version #2 – co-operative scheduler Version #3 – pre-emptive scheduler.
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. 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,
Microprocessor Systems Design I
Computer Architecture
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
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.
Software and Hardware Circular Buffer Operations
Generating the “Rectify” code (C++ and assembly code)
A Play Core Timer Interrupts
SPI Compatible Devices
Thermal arm-wrestling
DMA example Video image manipulation
The planned and expected
Trying to avoid pipeline delays
Generating a software loop with memory accesses
ENCM K Interrupts Theory and Practice
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Lab. 2 – More details – Later tasks
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Understanding the TigerSHARC ALU pipeline
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.
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
HD44780 LCD programming From the Hardware Side
HD44780 LCD programming From the Hardware Side
Expand on these ideas for Q9 question and answer on the final
Getting serious about “going fast” on the TigerSHARC
Thermal arm-wrestling
Concept of TDD Test Driven Development
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.
DMA example Video image manipulation
Developing a bicycle speed-o-meter
Independent timers build into the processor
Developing a bicycle speed-o-meter
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
Developing a reliable communication between Blackfin and Slave device
A first attempt at learning about optimizing the TigerSHARC code
Post Lab Quiz 3 Review Assignment 2 Help
Presentation transcript:

Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Tackled today Demonstrating memory to memory DMA Coding DMA DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

When DMA might be useful -- Double Buffering Program Wait for picture 2 memory to fill – video-in Picture 3 comes into memory – background DMA Process picture 2 – place into picture 0 location Picture 4 comes into memory – background DMA Process picture 3 – place into picture 1 location Transmit picture 0 – background DMA Picture 0 comes into memory – background DMA Process picture 4 – place into picture 2 location Transmit picture 1– background DMA Picture 1 comes into memory – background DMA Process picture 0 – place into picture 3 location Transmit picture 2 – background DMA Picture 2 comes into memory – background DMA Process picture 1 – place into picture 4 location Transmit picture 3– background DMA DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

We are only going to look at a simple DMA task Normal code P0  address of start_array[0]; P1  address of final_array[0]; R0  max-value needed to transfer R1  How many values already transferred R1 = 0; LOOP: CC = R0 <= R1 IF CC JUMP DONE: R2 = [P0++]; VERY BIG PIPELINE [P1++] = R2; LATENCY ISSUES JUMP LOOP; MANY INTERNAL PROCESSOR STALLS DONE: WHILE WAIT FOR R2 TO BE Do something else READ, STORED and then TRANSMITTED DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

We are only going to look at a simple DMA task DMA_source_address_register  address of start_array[0]; DMA_destination_address_register  address of final_array[0]; DMA_max_count_register  max-value needed to transfer DMA_count_register  How many values already transferred R1 = 0; LOOP: CC = R0 <= R1 IF CC JUMP DONE: DMA_enable = true R2 = [P0++]; [P1++] = R2; Miminized pipeline issues JUMP LOOP; DONE: Do something else Do something else DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

Write some tests so we know how to proceed -- Test 2 External memory test – arrays in external SDRAM SDRAM -- MANY MEGS AVAILABLE Addresses hard-coded DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

Write some tests so we know how to proceed -- Test 3 Most probable way to use DMA – Store in SLOW external memory Move to process in FAST internal memory, put back into external SDRAM Addresses hard-coded DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

Some results Code details later Debug Mode Release Mode L1  L1 8748 625 L1  L1 DMA 6579 6477 SDRAM  SDRAM 39132 28200 SDRAM  SDRAM DMA 12175 12090 SDRAM  L1 DMA 5265 4836 SDRAM  L1 DMA L1  SDRAM DMA 9792 9276 DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

Memory to memory move Release Mode DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Pipeline viewer -- L1  L1 DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

Pipeline viewer SDRAM  SDRAM DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Key DMA Elements idle( ); // idle; ASM DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Idle We have the ability to “poll” a flag to determine whether the DMA has finished Instead – we demonstrate the ability to go into “idle” (infinite do-nothing loop) until the “background DMA” causes an interrupt and “wakes up” the system. Once the interrupt occurs, the program automatically moves past the “idle” instruction onto the next instruction! DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

Source DMA – read Destination DMA – write DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada DMA Interrupt ISR Essentially the same as the PF (Lab. 4) or SPI (Lab. 5) interrupts Clear an interrupt status bit so that the interrupt does not keep happening Details needed -- Why D0 and not S0 as well? Set a flag so that main program can continue Was not used in this example code – used idle( ) DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA register detail -- status RO W1C bits Why only Destination DMA status considered? DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Set up DMA interrupts Similar to set up of PF and SPI Details needed ISR address into event table Set the IMASK Set the peripheral mask to allow this sort of interrupt DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada SIC_IAR2 register We have the ability to change the priority level of the DMA Use AND to keep other levels unchanged, and then put in required level. Why is it a good idea to set to level 6, even if system reset value was 6?? DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada How to configure DMA Certain functionality obvious DMA Source channel S0 – starts at address of &start[0]; number to mover size change address by 4 each time – 4 bytes = 1 32-bit word Questions – Why X_MODIFY and not just MODIFY? Why do you need two channels and not just one? DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

Source DMA Configuration register – answers 2 questions S0 – read, 32-bits Stop when done, No interrupt when done Leave disabled Inner (X) and outer (Y) interrupts possible 1D or 2D transfers DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

Destination DMA Configuration register – answers 1 question D0 – read, 32-bits Stop when done, Interrupt when done Inner (X) and outer (Y) interrupts possible 1D or 2D transfers DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Review Exercises - I Write the overloaded C++ functions void ConfigMDMA(unsigned int* start, unsigned int* finish, int size); void ConfigMDMA(float* start, float* finish, int size) DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Review Exercises -- II Write the overloaded C++ functions void ConfigMDMA(short int* start, short* finish, int size); void ConfigMDMA(char *start, start* finish, int size) DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Remaining questions How does DMA work, and why is it better than the normal R0= [P0++]; [P1++] = R0? Why do we need 2 DMA channels? DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Two different busses in use Working DMA model Source channel Source  FIFO Destination channel FIFO  Destination DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Tackled today Demonstrating memory to memory DMA Coding DMA DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019

DMA , Copyright M. Smith, ECE, University of Calgary, Canada Information taken from Analog Devices On-line Manuals with permission http://www.analog.com/processors/resources/technicalLibrary/manuals/ Information furnished by Analog Devices is believed to be accurate and reliable. However, Analog Devices assumes no responsibility for its use or for any infringement of any patent other rights of any third party which may result from its use. No license is granted by implication or otherwise under any patent or patent right of Analog Devices. Copyright  Analog Devices, Inc. All rights reserved. DMA , Copyright M. Smith, ECE, University of Calgary, Canada 1/18/2019