Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
65 views

Lab Session 2: Introduction To The DSP56800E Assembly

Uploaded by

Bryan Davis
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Lab Session 2: Introduction To The DSP56800E Assembly

Uploaded by

Bryan Davis
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Lab Session 2

Introduction to the DSP56800E


Assembly

Ira Fulton School of Engineering


Electrical Department
EEE404/591 – Real Time DSP
Objective
▪ Getting familiar with the Freescale
DSP56858E Assembly instructions.
➢ Assembler syntax and directives.
➢ Data types and addressing modes.
➢ Arithmetic operations.
➢ Branch & looping instructions.

* Checklists marked “Prereq” in the verification sheet has to be


completed in simulator mode before lab starts.
Reference : DSP56800E 16-bit DSP Core Reference Manual Rev2.16
Ira Fulton School of Engineering
Electrical Department
EEE404/591 – Real Time DSP
Assembler Syntax
Start MPY X0,Y0,A ; Multiply the two registers X0 & Y0
; and store result in accumulator A

Comments begin with a semicolon

The contents and number of operand fields are dependent on the


mnemonic used. The operand may be a register or memory location, or
an expression such as built in functions (ie: LOG(100)). Note that
operands are separated by comma.

A mnemonic is an abbreviation that represents the


actual binary or hex value of the opcode. For syntax of every
instruction refer
A label (which is optional) is translated into to Appendix A in
the physical address of the memory location DSP56800E 16-bit DSP
where the instruction is stored.
Core Reference Manual
Mnemonic + Operand = Instruction Rev2.16, 2005
Ira Fulton School of Engineering
Electrical Department
EEE404/591 – Real Time DSP
Assembler Instruction Coding

FFF represents 3 bits that encode the destination register (See Table A-7, p.A-315 in
Ref Manual)

JJJJJ are 5 bits encoding the 2 sources registers (See Table A-8, p.A-317 in Ref
Manual)
Ira Fulton School of Engineering
Electrical Department
EEE404/591 – Real Time DSP
Assembler Directives
▪ Directives are not executed on the DSP chip
and therefore are not translated to opcode.
▪ Directives are instructions to assembler.
These are used for example to:
➢ Reserve memory for data variables, arrays and
structures (i.e: X DS 4 ).
➢ Determine the entry address of the program (i.e:
ORG P:).
➢ Initialize variable values (i.e: X DC 1,2 ).
▪ For more information refer to:
➢ CodeWarrior™ Development Studio Motorola
DSP56800x Embedded Systems Assembler
Manual.
Ira Fulton School of Engineering
Electrical Department
EEE404/591 – Real Time DSP
Create a New Project
▪ Follow the steps below for creating a
project:
▪ Start Code Warrior R8.2.
▪ Create a new project named “Intro_ASM”
(follow the steps described in lab 2 for
creating assembly project).
▪ Double click and open “main.asm”.

Ira Fulton School of Engineering


Electrical Department
EEE404/591 – Real Time DSP
„Main.asm‟ Description

Ira Fulton School of Engineering


Electrical Department
EEE404/591 – Real Time DSP
Addressing Modes
▪ Addressing modes specify where operands are
located: either in an immediate value, in a register, or
in memory.
➢ Immediate addressing mode: when the value to be loaded in
the accumulator or any other internal register is provided in
the instruction‟s operand (the value following immediately
after the symbol # is the constant to be loaded).
➢ Absolute addressing: when the address of the value to be
loaded in the accumulator or any other internal register is
provided in the instruction‟s operand.
➢ Indirect addressing mode: when the address of the value to
be loaded in the accumulator or any other internal register is
provided in the AGU register (i.e R2).
▪ Check Examples 5 to 7.

Ira Fulton School of Engineering


Electrical Department
EEE404/591 – Real Time DSP
MOVE Instructions
▪The DSP56800E architecture supports byte (8-bit),
word (16-bit) and long word (32 bit) integer data types.
▪It also supports word, long-word and accumulator
fractional data types.
▪MOVE.W: moves a 16-bit word.
▪MOVE.L: moves a 32 bit long word.
▪MOVE.B: moves a byte.
▪MOVE.BP moves a byte.

So what is the difference between MOVE.B and


MOVE.BP?

Ira Fulton School of Engineering


Electrical Department
EEE404/591 – Real Time DSP
MOVE.B: Word Pointer

The lower bit of the offset


will determine whether
the lower or upper byte
is used

The upper bit of the


offset will be added
to the word pointer to
calculate the word
address

Ira Fulton School of Engineering


Electrical Department
EEE404/591 – Real Time DSP
MOVE.BP: Byte Pointer

- The register R0 contains a byte


pointer.
-To convert to word pointer we divide
by 2 or we shift to the right by 2.
- The lower bit of the byte pointer will
determine the byte to be selected,
either lower or upper.

Do we need MOVE.BP ??
Check Example 8

Use built-in assembler functions to


convert from word to byte pointer

Ira Fulton School of Engineering


Electrical Department
EEE404/591 – Real Time DSP
Integer Vs Fractional Representation
▪ Multiplication can be performed using integer
as well as fractional representation:
➢ 16-bit integer multiplication: use IMPY.W
➢ 16-bit fractional multiplication: use MPY.W
• Rounding can be performed automatically when using
MPYR.
▪ Fractional representation avoids multiplication
overflow but NOT addition overflow.
▪ Be aware of underflow in fractional
multiplication.
▪ Check Examples 9 to 12.
Ira Fulton School of Engineering
Electrical Department
EEE404/591 – Real Time DSP
MAC Instruction
▪ There are several DSP algorithms such as
finite impulse filters (FIRs) that require a large
number of sum of products terms.
▪ This is achieved by carrying out a series of
multiplications and adding the products
together.
▪ This can be performed in DSP processors
efficiently using MAC (multiply and
Accumulate) instruction.
▪ Check Example 13.
Ira Fulton School of Engineering
Electrical Department
EEE404/591 – Real Time DSP
Software Vs Hardware Looping
▪ Software looping:
➢ Performed using conditional branch instruction (Bcc
instruction). Table 10 summarizes the available
conditional branch instructions.
➢ Looping performed using instructions.
➢ Check Example 17.
▪ Hardware Looping:
➢ Performed using hardware modules.
➢ More Efficient.
➢ Used by calling REP, DO, or DOSLC.
➢ Limited number of nested loops (two).
➢ Check Examples 18, and 19.

Ira Fulton School of Engineering


Electrical Department
EEE404/591 – Real Time DSP

You might also like