Real Time DSP and the Motorola 56300 DSP

  • Slides: 25
Download presentation
Real Time DSP and the Motorola 56300 DSP Chip R. C. Maher ECEN 4002/5002

Real Time DSP and the Motorola 56300 DSP Chip R. C. Maher ECEN 4002/5002 DSP Laboratory Spring 2002

Introduction: DSP Review • Sampled signal is represented as a sequence of numbers: x[n]

Introduction: DSP Review • Sampled signal is represented as a sequence of numbers: x[n] • Unit sample [n] : … 0, 0, 0, 1, 0, 0, 0, … • Can write: “Sifting” property ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 2

Linearity, Time Invariance • Linear systems: additivity and scaling • Time-Invariant systems: delay (shift)

Linearity, Time Invariance • Linear systems: additivity and scaling • Time-Invariant systems: delay (shift) of input sequence simply causes the same delay (shift) of output sequence ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 3

Unit Sample Response • The response of an LTI system to a unit sample

Unit Sample Response • The response of an LTI system to a unit sample is very useful. Note that: Sifting Linearity Convolution ECEN 4002 Spring 2002 Time Invariance Real Time DSP R. C. Maher 4

Unit Sample Response (cont. ) • NOTE: we can find the response of an

Unit Sample Response (cont. ) • NOTE: we can find the response of an LTI system to any input if we know h[n] • What if input is a complex exponential? ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 5

Frequency Response • Frequency response is the discrete-time Fourier transform of the unit sample

Frequency Response • Frequency response is the discrete-time Fourier transform of the unit sample response: – This is a periodic function with period 2 – 2 corresponds to the sample rate, fs , of the sampled-data system ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 6

Sampling Effects: Frequency Domain Xc(j ) - N S > 2 N Fourier Transform

Sampling Effects: Frequency Domain Xc(j ) - N S > 2 N Fourier Transform of continuous function N Fourier Transform of sampled function XS(j ) -2 S - N S < 2 N (aliasing) S 2 S XS(j ) -2 S - S ECEN 4002 Spring 2002 N Real Time DSP S 2 S R. C. Maher 7

The Motorola 5630 x Programming model Introduction to instruction set Assembler directives ECEN 4002

The Motorola 5630 x Programming model Introduction to instruction set Assembler directives ECEN 4002 Spring 2002 Real Time DSP R. C. Maher

ALU 5630 x ALU ECEN 4002 Spring 2002 Real Time DSP R. C. Maher

ALU 5630 x ALU ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 9

ALU Registers X 0 Y 0 X 1 Y 1 A 2 A 1

ALU Registers X 0 Y 0 X 1 Y 1 A 2 A 1 A 0 B 2 B 1 B 0 ECEN 4002 Spring 2002 Real Time DSP General-Purpose: • 24 bits • Move to/from other registers • Move to/from memory • ALU/Mult operands Accumulators: • 56 bits [ 8 : 24 ] • Move to/from other registers • Move to/from memory • ALU/Mult results R. C. Maher 10

5630 x Addressing Unit ECEN 4002 Spring 2002 Real Time DSP R. C. Maher

5630 x Addressing Unit ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 11

AGU Registers Index Registers Modulo Registers Offset Registers R 0 M 0 N 0

AGU Registers Index Registers Modulo Registers Offset Registers R 0 M 0 N 0 R 1 M 1 N 1 R 2 M 2 N 2 R 3 M 3 N 3 R 4 M 4 N 4 R 5 M 5 N 5 R 6 M 6 N 6 R 7 M 7 N 7 ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 12

Addressing Examples move x: (R 4), X 0 move x: (R 0)+, X 1

Addressing Examples move x: (R 4), X 0 move x: (R 0)+, X 1 move x: (R 4)-, X 1 move x: -(R 0), X 1 move x: (R 4)+N 4, X 0 move x: (R 0)-N 0, X 1 move x: (R 4+N 4), X 0 ECEN 4002 Spring 2002 ; Register Indirect ; w/ postincrement by 1 ; w/ postdecrement by 1 ; w/ predecrement by 1 ; w/ postincrement by N ; w/ postdecrement by N ; w/ indexed offset by N (no update) Real Time DSP R. C. Maher 13

Program Layout • Instruction format: lab 1 Label field mac Operation field x 0,

Program Layout • Instruction format: lab 1 Label field mac Operation field x 0, y 0, a Operand field x: (r 0)+, x 0 X move field y: (r 4)+, y 0 Y move field • Some assembler directives: ORG EQU INCLUDE DS DC ; (comment) ECEN 4002 Spring 2002 Real Time DSP R. C. Maher ; comment Comment field END 14

Memory Organization • 56303 – Program: – X Data: – Y Data: $0 -

Memory Organization • 56303 – Program: – X Data: – Y Data: $0 - $0 FFF (4 k words) $0 - $07 FF (2 k words) • 56307 – Program: – X Data: – Y Data: ECEN 4002 Spring 2002 $0 - $3 FFF (16 k words) $0 - $5 FFF (24 k words) Real Time DSP R. C. Maher 15

Real Time Signal Processing ECEN 4002 Spring 2002 Real Time DSP R. C. Maher

Real Time Signal Processing ECEN 4002 Spring 2002 Real Time DSP R. C. Maher

“Real Time” means: • Input/output streams are sustained – no gaps or dropped data

“Real Time” means: • Input/output streams are sustained – no gaps or dropped data • Processing must occur within the sample period 1/fs (at least on average) • Fixed delay through the system (the latency) usually must be minimized • Availability of data drives the system ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 17

DSP System DSP receives an interrupt as each sample arrives Clock A/D Converter Clock

DSP System DSP receives an interrupt as each sample arrives Clock A/D Converter Clock DSP Data Microprocessor Data High speed serial data ECEN 4002 Spring 2002 D/A Converter DSP receives an interrupt when D/A ready for sample Real Time DSP R. C. Maher 18

DSP Software Development • • Write software Assemble and link Download to EVM Run!

DSP Software Development • • Write software Assemble and link Download to EVM Run! …but how to determine if it works or not? ? …and what if program doesn’t work? ? ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 19

Testing and Debugging • Can be a complicated process because: – Write and assemble

Testing and Debugging • Can be a complicated process because: – Write and assemble code on PC, but then download and run on EVM: indirect observation is required. – Algorithm and implementation errors are often subtle and ellusive numerical details. – Real Time programs can’t be run in “slow motion, ” so identifying bugs requires creative methods. ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 20

Testing and Debugging (cont. ) • Suggestions: – Develop and test your code incrementally.

Testing and Debugging (cont. ) • Suggestions: – Develop and test your code incrementally. Make only small changes code changes before testing again. In other words, never be more than one change away from a working program. – Test code segments in isolation using the debugger or the software simulator. – Learn to use your eyes and ears to find bugs. ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 21

Edit | Assemble | Load | Test • Edit source code file – Use

Edit | Assemble | Load | Test • Edit source code file – Use simple text editor (DOS Edit, Notepad, etc. ) – Plain text, not case sensitive – USE LOTS OF COMMENTS!! – Use modular code design and organization • Assemble – Execute: asm 56300 –a –b –g –l file. asm – Check for errors, and re-edit as necessary ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 22

Edit | Assemble | Load | Test (cont. ) • Download. cld module to

Edit | Assemble | Load | Test (cont. ) • Download. cld module to the EVM – Run the Domain Technologies Debugger EVM 30 XW – “File | Load…” and browse to the. cld file • Test the module – Start the code (green button on Debugger) – Observe input/output signals – When in doubt, stop and download known good code (e. g, pass. cld) ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 23

The Pass. asm Program • Initializes codec (stereo) • Handles codec data interrupts •

The Pass. asm Program • Initializes codec (stereo) • Handles codec data interrupts • Main program loop polls for data ready, then puts left sample in A and right sample in B • Uses some X and Y memory • Note: r 6 is used as a stack pointer ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 24

Lab Assignment #1 • Due at START of class in one week • Topics:

Lab Assignment #1 • Due at START of class in one week • Topics: – Use EVM and software tools – Observe sampling and reconstruction – Program #1: gain multiplier – Program #2: word length and quantization – Program #3: aliasing ECEN 4002 Spring 2002 Real Time DSP R. C. Maher 25