This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.

Slides:



Advertisements
Similar presentations
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
Advertisements

This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Process for changing “C-based” design to SHARC assembler ADDITIONAL EXAMPLE M. R. Smith, Electrical and Computer Engineering University of Calgary, Canada.
This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.
6/3/20151 ENCM515 Comparison of Integer and Floating Point DSP Processors M. Smith, Electrical and Computer Engineering, University of Calgary, Canada.
Booth’s Algorithm.

8 November Forms and JavaScript. Types of Inputs Radio Buttons (select one of a list) Checkbox (select as many as wanted) Text inputs (user types text)
Binary Arithmetic Math For Computers.
Binary Representation and Computer Arithmetic
Simple Data Type Representation and conversion of numbers
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
Fixed-Point Arithmetics: Part II
IT253: Computer Organization
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
Floating-Point Representation We can store integers and characters easily in binary, but what about fractions? ¼ =.25 = 2.5 * *
Computer Arithmetic See Stallings Chapter 9 Sep 10, 2009
1 Information Representation in Computer Lecture Nine.
Floating Point Numbers Representation, Operations, and Accuracy CS223 Digital Design.
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
Systematic development of programs with parallel instructions SHARC ADSP21XXX processor M. Smith, Electrical and Computer Engineering, University of Calgary,
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Floating Point Arithmetic – Part I
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Compsci 210 Tutorial Two CompSci Semester Two 2016.
Dr. Clincy Professor of CS
Lecture No. 4 Number Systems
Dr. Clincy Professor of CS
Data Representation Binary Numbers Binary Addition
Floating Point Number system corresponding to the decimal notation
CS/COE0447 Computer Organization & Assembly Language
A Level Computing Component 2
William Stallings Computer Organization and Architecture 7th Edition
واشوقاه إلى رمضان مرحباً رمضان
Overview of SHARC processor ADSP and ADSP-21065L
DMA example Video image manipulation
Overview of SHARC processor ADSP Program Flow and other stuff
ENCM K Interrupts Theory and Practice
ECEG-3202 Computer Architecture and Organization
* M. R. Smith, University of Calgary, Alberta,
Comparing 68k (CISC) with 21k (Superscalar RISC DSP)
* 07/16/96 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items.
Overview of TigerSHARC processor ADSP-TS101 Compute Operations
* L. E. Turner and M. R. Smith, University of Calgary, Alberta, Canada
-- Tutorial A tool to assist in developing parallel ADSP2106X code
* 07/16/96 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items.
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.
* 2000/08/1307/16/96 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these.
March 27 Test 2 Review Read Sections 5.1 through 5.3.
* L. E. Turner and M. R. Smith, University of Calgary, Alberta, Canada
Explaining issues with DCremoval( )
DMA example Video image manipulation
Overview of SHARC processor ADSP-2106X Compute Operations
Overview of SHARC processor ADSP-2106X Compute Operations
* L. E. Turner and M. R. Smith, University of Calgary, Alberta, Canada
Overview of SHARC processor ADSP-2106X Memory Operations
This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during.
Cosc 2P12 Week 2.
* M. R. Smith 07/16/96 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint.
Presentation transcript:

This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during your presentation In Slide Show, click on the right mouse button Select “Meeting Minder” Select the “Action Items” tab Type in action items as they come up Click OK to dismiss this box This will automatically create an Action Item slide at the end of your presentation with your points entered. SHARC Processor Characteristics Number Representations When 1 + 1 = 2 BUT 2 *2 != 4 M. R. Smith, Electrical and Computer Engineering University of Calgary, Alberta, Canada smithmr @ ucalgary.ca

To tackled Number Representations are varied Make sure you understand them Can solve many coding errors by recognizing improper use of number representations SHARC default number representation for integers is not what is expected. Understanding Number Representations allows for extra speed in that 1 in 1000 situation 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Number Representations Number representations are important. This is a talk about the number representations on the Analog Devices ADSP-21061 SHARC Processor has “C-like” syntax for assembly code Both single cycle integer and float operations 32-bit registers (integer and float) For more information see the article Smith, M. R., "Quirks and SHARCs -- Issues in programming the Analog Devices SHARC processor. When 1 + 1 = 2 but 2 + 2 != 4", Circuit Cellar, March 2001. 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Recap -- Bit patterns in memory Bit values stored in memory Can represent what you like hash table, ascii characters, signed and unsigned integer numbers (various precisions), floating point numbers etc. Certain number representations more easily supported by the processor for various operations than others. On SHARC -- 32 bit integers and FP, also 40-bit FP (extended FP). 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Example -- Eight Bit Values Unsigned 8-bit integers Range 0 -- 255, resolution 1 e.g. 0x00 = 0, 0x10 = 16, 0x7F = 127 0x80 = 128, 0x81 = 129, 0x90 = ????, 0xC0 = ???? 0xF0 = ????, 0xFE = 254, 0xFF = 255 Signed 8-bit integers -- 2’s complement Range -128 to + 127, resolution 1 e.g. 0x00 = 0, 0x10 = +16, 0x7F = +127 0x80 = -128, 0x81 = -128 + 1 = -127, 0x90 = ??? 0xF0 = ????, 0xFE = -2, 0xFF = -1 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Floating Point in Binary Representation 20 (decimal) = 0x14 hex = %0001 0100 (binary) = %0001 0100. 0000 0000 0000 Normalize binary -- express as %1.frac * 2N %0001 0100. 0000 0000 0000 = %1.0100 0000 0000 * 24 6 = %0110. 0000 0000 = %1.1000 0000 0000 * 22 Sign = 0 Fraction part = 0.1000 0000 0000 Biased Exponent 2 + 127 = 129 = %1000 0001 Stored as FP Number 1000 0001 1000 0000 0000 etc 0x40C0 0000 = 0100 0000 1100 0000 0000 000 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Display Program Code -- Float 32-bit registers 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Code displayed in Mixed Mode No such instruction as F4 = Only R4 = WARNING --- F4 = 2 is the same as R4 = 2 and is DIFFERENT F4 = 2.0 Note how FP looks like VERY LARGE integer 32 bit registers 40 bit display Ultra High precision FP 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Need to learn to recognize What do “integers” look like when they are displayed as “floats” What do “floats” look like when displayed as “integers” Happens when you pass a pointer to the start of an array and then treat the array incorrectly I consider the following a BUG IN ASSEMBLER F4 = 6 is actually the same as F4 = 3 * 10-45 FN = value does not exist -- only RN = value Make sure that you add the decimal point!!!! var array_of_FLOATS[] = { 2.8, 3, 3.2, 3.4}; NOT INTENDED AS A VERY SMALL VALUE 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Display Program Code -- Integer 32 BIT registers Top 32 bits means something Note how integers look like VERY SMALL floats -- note also wrong values 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Unexpected default integer representation 68k processor Default operations Signed and unsigned integer representation 21k processor Signed and unsigned integer representation of “fractional” values Signed and unsigned integer “need to be switched on” See difference in multiplication 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Code displayed in Mixed Mode 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Proper Integer Coding sequence 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Bit meaning in 8-bit signed fractional number ^ ACTS AS IF “BINARY POINT” HERE Binary Pattern %1001 0011 = -1 * 2-0 + 0*2-1 + 0*2-2 + 1* 2-3 + 0* 2-4 + 0* 2-5 + 1* 2-6 + 1* 2-7 Decimal Calculation = ( 0x93 / 128) = ( 0x80 + 0x13 ) / 128 = ( -128 + 19 ) / 128 = -1 + 19 / 128 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Signed fractional Integer interpreted with a binary point just after the sign bit Using 32-bit values Smallest value -1.0 Largest almost = + 1.0 = 1.0 - 2^-31 Steps (accuracy) 2^-31 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

68k equivalence -- 8-bit example Standard number format Range -128 to + 127, resolution 1 0x0A+ 0x01 = 0x0B %00001010 + %00000001 = %00001011 In any given DSP algorithm it could be useful to scale input values so that we have an alternative number format where binary point is effectively placed between bit #3 and #4 Range -8 to 7 7/8, resolution 1/8 0xA0 + 0x10 = 0xB0 (Means 0xA.0, 0x1.0, 0xB.0) %1010.0000 + %0001.0000 = %1011.0000 Addition supported in both number formats 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

68k equivalence -- 8-bit example Standard number format Range -128 to + 127, resolution 1 0x0A * 0x01 = 0x0A %00001010 * %00000001 = %00001010 Alternative number format where binary point is placed between bit #3 and #4 Range -8 to 7 7/8, resolution 1/8 0xA.0 * 0x1.0 = 0x?? %10100000 * %00010000 = %101000000000 Must now adjust by >> 8 to get correct answer. When SHARC in SSF format, the scaling occurs automatically 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Equivalent decimal calculation As done in grade 6 -0.75 * 0.125 Perform 75 * 125 then adjust for 5 decimal places. -9375 then adjust to give -0.09375 68k multiplication was 0xA.0 * 0x1.0 Perform 0xA0 * 0x10 then adjust for hex places 0xA00 then adjust to give 0xA.00 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Displayed as “signed fractional” 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

SHARC DIVISION APPEARS WEIRD TOO 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Actual SHARC division operations Note the parallel instructions 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Division is slow Integer division on 68K -- 70 cycles 60000 / 3 takes 70 cycles 60000 / 2 takes 70 cycles Integer shift takes much less 60000 / 2 = 60000 >> 1 ASR #1, D0 (with D0 = 60000) takes 4 cycles 21061 -- ASHIFT D0 BY -1 takes 1 cycle Can we find an equivalent operation for floating point scaling (by 2, 4, 8, 16 etc.)? 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Signed Fractional -- ASHIFT of integer Works here but that’s cheating since SF format is an floating point interpretation of an integer format 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Binary Pattern of TRUE floats SIGN BIT EXPONENT BITS FRACTIONAL BITS Floating point division is often SLOW DIVIDE BY 2, 4, 8, 16 fast with integers CAN ALSO MAKE FAST WITH FLOATS If you understand number representations 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Fast scaling -- Floats as Integers Differ in value by 4.0 Differ in BEXP by 2 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Complete Fast Scaling 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Nothing but a party trick! F8 = 0.0625; F0 = 4.0; F1 = F0 * F8; F2 = 2.0; F3 = F3 * F8; F4 = 0.0; F5 = F4 * F8; Since this processor has single cycle multiply operation R8 = -4; F0 = 4.0; F1 = SCALEB F0 BY R8; F2 = 2.0; F3 = SCALEB F2 BY R8; F4 = 0.0; F5 = SCALEB F4 BY R8; Works just like our code Advantage – this is a COMPUTE operation and NOT a MAC operation 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca

Learnt today Number Representations are varied Make sure you understand them Can solve many coding errors by recognizing improper use of number representations -- Limitation in SHARC assembler for F4 = Signed Fractional is default SHARC integer representation Understanding Number Representations allows for that 1 in 1000 situation when somebody at a party likes to play with DSP processors. 12/5/2018 Number Representations -- SHARC ADSP21061 Copyright M. Smith -- smithmr@ucalgary,ca