TMS320C6713 Assembly Language (cont’d). Module 1 Exam (solution) 1. Functional Units a. How many can perform an ADD? Name them. a. How many can perform.

Slides:



Advertisements
Similar presentations
Chapter 7 Linear Assembly
Advertisements

Chapter 11 Interfacing C and Assembly Code
OPTIMIZING C CODE FOR THE ARM PROCESSOR Optimizing code takes time and reduces source code readability Usually done for functions that are critical for.
FIR Filter. C-Implementation (FIR filter) #include #include #include "coeff_ccs_16int.h" int in_buffer[300]; int out_buffer[300]; #define TRUE 1 /*Function.
Details.L and.S units TMS320C6000 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004.
TMS320C6000 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Architectural Overview.
Lecture 6 Programming the TMS320C6x Family of DSPs.
Superscalar and VLIW Architectures Miodrag Bolic CEG3151.
Assembly and Linear Assembly Evgeny Kirshin, 05/10/2011
TMS320 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Overview A.A
TMS320C6000 Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2004 Architectural Overview.
DSP Module 1 Open Exam. Module 1 Exam You have 20 minutes to complete the exam. Exam is open mind, open book, open eyes. Sharing answers, cheating, asking.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
Computer Architecture Lecture 7 Compiler Considerations and Optimizations.
Chapter 2 — Instructions: Language of the Computer — 1 Branching Far Away If branch target is too far to encode with 16-bit offset, assembler rewrites.
ECE 232 L6.Assemb.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 6 MIPS Assembly.
1 Lecture 4: Procedure Calls Today’s topics:  Procedure calls  Large constants  The compilation process Reminder: Assignment 1 is due on Thursday.
TMS320C6000 Architectural and Programming Overview.
Slider param_definition( minVal, maxVal, increment, pageIncrement, paramName ) { statements } param_definitionParameter description that is printed on.
SPIM and MIPS programming
1 Today’s lecture  Last lecture we started talking about control flow in MIPS (branches)  Finish up control-flow (branches) in MIPS —if/then —loops —case/switch.
The University of Adelaide, School of Computer Science
TMS320C6000 Architectural Overview.  Describe C6000 CPU architecture.  Introduce some basic instructions.  Describe the C6000 memory map.  Provide.
Lecture 8: MIPS Instruction Set
ECSE DSP architecture Review of basic computer architecture concepts C6000 architecture: VLIW Principle and Scheduling Addressing Assembly and linear.
COMP3221: Microprocessors and Embedded Systems--Lecture 7 1 COMP3221: Microprocessors and Embedded Systems Lecture 7: Arithmetic and logic Instructions.
Chapter 11 Interfacing C and Assembly Code. Dr. Naim Dahnoun, Bristol University, (c) Texas Instruments 2002 Chapter 11, Slide 2 Learning Objectives 
9/20/6Lecture 21 -PIC Architecture1 PIC Architecture Programmers Model and Instruction Set.
Assembly Language Programming for the MC68HC11. Assembly language programming  Recall the 4 design levels for software development: – Application – High.
TECHNICAL SEMINAR BINAY KUMAR MISHRA 1 TMS320C6211 AND MICRO-50 EB DIGITAL SIGNAL PROCESSORS PRESENTED BY BINAY KUMAR MISHRA ROLL # EI
Chapter 4 The Processor. Chapter 4 — The Processor — 2 Introduction We will examine two MIPS implementations A simplified version A more realistic pipelined.
ajay patil 1 TMS320C6000 Assembly Language and its Rules Assignment One of the simplest operations in C is to assign a constant to a variable: One.
MICROPROCESSORS Dr. Hugh Blanton ENTC TMS320C6x INSTRUCTION SET.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
Lecture Set 4 Programming the 8051.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
EECS 370 Discussion 1 xkcd.com. EECS 370 Discussion Topics Today: – ARM Addressing Endianness, Loading, and Storing Data – Data Layout Struct Packing.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
ECSE436 Tutorial Assembly and Linear Assembly Laurier Boulianne.
Unit 1 Instruction set M.Brindha AP/EIE
Addressing Modes in Microprocessors
Chapter 7 Linear Assembly
CS2100 Computer Organisation
Gunjeet Kaur Dronacharya Group of institutions
Assembly Language Programming of 8085
TMS320C6713 Assembly Language
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
Lecture on Microcomputer
Chapter 4 Addressing modes
Microcomputer Programming
Details .L and .S units TMS320C6000.
11/10/2018.
SCHOOL OF ELECTRONICS ENGINEERING Electronics and Communication
Computer Organization and ASSEMBLY LANGUAGE
Introduction to Micro Controllers & Embedded System Design Addressing Mode Department of Electrical & Computer Engineering Missouri University of Science.
Chapter 11 Interfacing C and Assembly Code
Computer Architecture
The University of Adelaide, School of Computer Science
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
Data Hazard Example (stall).
Chapter 12 Software Optimisation
Example 1: (expression evaluation)
CS501 Advanced Computer Architecture
Instruction execution and ALU
An Introduction to the ARM CORTEX M0+ Instructions
Presentation transcript:

TMS320C6713 Assembly Language (cont’d)

Module 1 Exam (solution) 1. Functional Units a. How many can perform an ADD? Name them. a. How many can perform an ADD? Name them. b. Which support memory loads/stores? b. Which support memory loads/stores?.M.S.D.L six;.L1,.L2,.D1,.D2,.S1,.S2

2. Conditional Code a.Which registers can be used as cond’l registers? b.Which instructions can be conditional? A1, A2, B0, B1, B2 All of them

3. Coding Problems a. Move contents of A0-->A1 a. Move contents of A0-->A1 MV.L1A0, A1 orADD.S1A0, 0, A1 orMPY.M1A0, 1, A1 (what’s the problem with this?)

3. Coding Problems a. Move contents of A0-->A1 a. Move contents of A0-->A1 b. Move contents of CSR-->A1 b. Move contents of CSR-->A1 c. Clear register A5 MV.L1A0, A1 orADD.S1A0, 0, A1 orMPY.M1A0, 1, A1 ZERO.S1A5 orSUB.L1A5, A5, A5 orMPY.M1A5, 0, A5 orCLR.S1A5, 0, 31, A5 orMVK.S10, A5 orXOR.L1A5,A5,A5 (A0 can only be a (A0 can only be a 16-bit value) MVCCSR, A1

3. Coding Problems (cont’d) d. A2 = A0 2 + A1 d. A2 = A0 2 + A1 e. If (B1  0) then B2 = B5 * B6 e. If (B1  0) then B2 = B5 * B6 f. A2 = A0 * A g. Load an unsigned constant (19ABCh) into register A6. MPY.M1A0, A0, A2 ADD.L1A2, A1, A2 [B1] MPY.M2B5, B6, B2 mvkl.s10x00019abc,a6 mvkh.s10x00019abc,a6 value.equ0x00019abc mvkl.s1value,a6 mvkh.s1value,a6 MPYA0, A1, A2 ADD10, A2, A2

3. Coding Problems (cont’d) h.Load A7 with contents of mem1 and post- increment the selected pointer. h.Load A7 with contents of mem1 and post- increment the selected pointer. x16 mem mem1 10h A7 load_mem1:MVKL.S1mem1,A6 load_mem1:MVKL.S1mem1,A6 MVKH.S1mem1,A6 LDH.D1*A6++,A7

Pipeline & NOP Pipeline stages Multiply: One NOP (NOP) Load: four NOPs (NOP 4) Branch: five NOPs (NOP 5)

Pipeline & NOP MVK.S140, A2; A2 = 40, loop count loop:LDH.D1*A5++, A0; A0 = a(n) LDH.D1*A6++, A1; A1 = x(n) NOP 4 NOP 4 MPY.M1A0, A1, A3; A3 = a(n) * x(n) NOP NOP ADD.L1A3, A4, A4; Y = Y + A3 SUB.L1A2, 1, A2; decrement loop count [A2]B.S1loop; if A2  0, branch [A2]B.S1loop; if A2  0, branch NOP 5 NOP 5 STH.D1A4, *A7; *A7 = Y

Interface C and Assembly  As a general rule the code written in C is used for initialization and for non-critical (in terms of speed or size) code.  Critical code (in terms of speed/size) can be written in assembly.  There are three different ways to interface C and assembly code: (1)C code call to the assembly function. (2)An interrupt can call an assembly function. (3)Call an assembly instruction using intrinsics.

Calling Assembly from C  The C and assembly functions share the same resources (e.g. registers).  The C and assembly functions may exchange data.  Therefore code interfacing requires a means of handing-off data and control info and some rules of handling shared registers. main () { y = asmFunction (a, b); } _asmFunction bb3

Calling Assembly from C  Use “_” underscore in assembly for all variables or functions declared in C.  Labels also need to be global. main_c.c int asm_Function (short, short); short x = 0x4000, y = 0x2000; int z; void main (void) { z = asm_Function (x, y); } asm_Function.c int asm_Function (short a, short b) { int y; y = (a * b) << 1; return y; }asm_Function.asm.global _asm_Function

Passing Arguments between C and Assembly  The following registers are used to pass and return variables when calling an assembly routine from C. AB arg1/r_val arg3 arg5 arg7 arg9 ret addr arg2 arg4 arg6 arg8 arg

Passing Arguments between C and Assembly  Before assembly call. 0x40000x AB 0x80000x  After return from assembly call.

Passing Arguments between C and Assembly Problem:  The C code will use some or all of the registers.  The assembly code may also require the use of some or all registers.  If nothing is done then on return to the C code some of the values may have been destroyed by the assembly code.

Passing Arguments between C and Assembly Solution:  Both the C code and assembly code are responsible for saving some registers if they need to use them AB C code automatically saves these registers Assembly code must save these registers - responsibility of the programmer

An example of ASM function.global_sum _sum: ZERO.L1A9 MV.L1B4,A2 loop: LDH.D1*A4++, A7 NOP4 ADD.L1A7,A9,A9 [A2] SUB.L1A2,1,A2 [A2] SUB.L1A2,1,A2 [A2]B.S1loop [A2]B.S1loop NOP5 MV.L1A9,A4 B.S2B3 NOP5