Numerical Concepts Copyright Copyright ? ? 2009 Texas Instruments. All rights reserved. 2009 Texas Instruments. All rights reserved. Technical anization T TTO TO Module 8 TMS320C28x ? MCU Workshop Learning Objectives ? Integers and Fractions ? IEEE-754 Floating-Point ? IQmath ? Format Conversion of ADC Results Integer Basics ? Unsigned Binary Integers 0100b = (0 *2 3 )+(1 *2 2 )+(0 *2 2 )+(0 *2 0 ) = 4 1101b = (1 *2 3 )+(1 *2 2 )+(0 *2 1 )+(1 *2 0 ) = 13 ? Signed Binary Integers (2 ’ plement) 0100b = (0 * -2 3 )+(1 *2 2 )+(0 *2 2 )+(0 *2 0 ) = 4 1101b = (1 * -2 3 )+(1 *2 2 )+(0 *2 1 )+(1 *2 0 ) = -3 2 32 2 3 3 ±2 n-1 ±2 2 n-1 n-12 22 2 2 22 12 2 1 12 02 2 0 0 What is Sign Extension? ? When moving a value from a narrowed width location to a wider width location, the sign bit is extended to fill the width of the destination ? Sign extension applies to signed numbers only ? It keeps negative numbers negative! ? Sign extension controlled by SXM bit in ST0 register; When SXM = 1, sign extension happens automatically 4 bit Example: Load a memory value into the ACC 4 bit Example: Load a memory value into the ACC 1101 1101 memory memory = -2 = -2 3 3 + 2 + 2 2 2 + 2 + 2 0 0 = -3 = -3 ACC ACC = -2 = -2 7 7 + 2 + 2 6 6 + 2 + 2 5 5 + 2 + 2 4 4 + 2 + 2 3 3 + 2 + 2 2 2 + 2 + 2 0 0 = -128 + 64 + 32 + 16 + 8 + 4 + 1 = -128 + 64 + 32 + 16 + 8 + 4 + 1 = -3 = -3 Load and sign extend Load and sign extend 1111 1111 1101 1101 Integer Multiplication (signed) 0100 0100 x 1101 x 1101 0000 0000 0100 0100 000 000 0000 0000 00 00 0100 0100 1 1 1100 1100 1 1 1110100 1110100 Accumulator Accumulator Data Memory Data Memory 11110100 11110100 11110100 4 x -3 4 4 x -3 x -3 -12 -12 ? ? Fraction Basics -2 0 -2 -2 0 02 -12 2 -1 -12 -22 2 -2 -22 -32 2 -3 -3?? 1101b 1101b = (1 = (1 * * -2 -2 0 0 )+(1 )+(1 * *2 2 -1 -1 )+(0 )+(0 * *2
DSP 教程 来自淘豆网www.taodocs.com转载请标明出处.