EE357Unit1_FixedPoint

EE357Unit1_FixedPoint - Mark Redekopp, All rights reserved...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Mark Redekopp, All rights reserved EE 357 Unit 1 Fixed Point Systems and Arithmetic Mark Redekopp, All rights reserved Learning Objectives Understand the size and systems used by the underlying HW when a variable is declared in a SW program Understand and be able to find the decimal value of numbers represented in various systems in either binary or hex Perform the various arithmetic and logic operations that the HW needs to perform Be able to determine when overflow has occurred in an arithmetic operation Mark Redekopp, All rights reserved Connecting C & EE 101 This slide package is meant to review the basic data representation and operations that we learned in EE 101 but now in the context of a programming language like C We will show how the code you write in C directs the compiler to control the HW in specific ways Mark Redekopp, All rights reserved SIGNED AND UNSIGNED SYSTEMS Unsigned 2s Complement Sign and Zero Extension Hexadecimal Representation Mark Redekopp, All rights reserved Binary Representation Systems Integer Systems Unsigned Unsigned (Normal) binary Signed Signed Magnitude 2s complement Excess-N* 1s complement* Floating Point For very large and small (fractional) numbers Codes Text ASCII / Unicode Decimal Codes BCD (Binary Coded Decimal) / (8421 Code) * = Not fully covered in this class Mark Redekopp, All rights reserved Data Representation In C/C++ variables can be of different types and sizes Integer Types (signed by defaultunsigned with leading keyword) Floating Point Types C Type Bytes Bits Coldfire Name MIPS Name [unsigned] char 1 8 byte byte [unsigned] short [int] 2 16 word half-word [unsigned] long [int] 4 32 longword word [unsigned] long long [int] 8 64- double word C Type Bytes Bits Coldfire/MIPS Name float 4 32 single double 8 64 double Mark Redekopp, All rights reserved C examples int x = -2; Allocates a 4-byte (32-bit) chunk of memory Any operation involving x will use signed operations, if necessary char c = 0xfa; Allocates a 1-byte (8-bit) chunk of memory unsigned char d = 10; Allocates a 1-byte chunk of memory Any operation involving d will use unsigned operations, if necessary float f = 3.1; Allocates a 4-byte (32-bit) chunk of memory Any operation involving f will use floating point HW double g = -1.5; Allocates an 8-byte (64-bit) chunk of memory unsigned long long y; Allocates an 8-byte (64-bit) chunk of memory short z = -1; Allocates a 2-byte (16-bit) chunk of memory Mark Redekopp, All rights reserved Unsigned and Signed Variables Unsigned variables use unsigned binary (normal power-of-2 place values) to represent numbers Signed variables use the 2s complement system (Neg. MSB weight) to represent numbers 128 64 32 16 8 4 2 1 1 1 1 1 = +147-128 64 32 16 8 4 2 1 1 1 1 1 = -109 Mark Redekopp, All rights reserved 2s Complement System MSB has negative weight MSB determines sign of the number...
View Full Document

This note was uploaded on 04/04/2010 for the course EE 357 taught by Professor Mayeda during the Spring '08 term at USC.

Page1 / 35

EE357Unit1_FixedPoint - Mark Redekopp, All rights reserved...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online