EE357Unit1_FixedPoint

EE357Unit1_FixedPoint - Learning Objectives EE 357 Unit 1...

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

View Full Document Right Arrow Icon
1 © Mark Redekopp, Al rights reserved EE 357 Unit 1 Fixed Point Systems and Arithmetic © Mark Redekopp, Al 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, Al 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, Al rights reserved SIGNED AND UNSIGNED SYSTEMS Unsigned 2’s Complement Sign and Zero Extension Hexadecimal Representation
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 © Mark Redekopp, Al rights reserved Binary Representation Systems Integer Systems – Unsigned • Unsigned (Normal) binary – Signed • Signed Magnitude • 2’s complement Excess-N* 1’s 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, Al rights reserved Data Representation • In C/C++ variables can be of different types and sizes – Integer Types (signed by default…unsigned 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, Al 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, Al rights reserved Unsigned and Signed Variables • Unsigned variables use unsigned binary (normal power-of-2 place values) to represent numbers • Signed variables use the 2’s complement system (Neg. MSB weight) to represent numbers 128 64 32 16 8 4 2 1 1 0 0 1 0 0 1 1 = +147 -128 64 32 16 8 4 2 1 1 0 0 1 0 0 1 1 = -109
Background image of page 2
3 © Mark Redekopp, Al rights reserved 2’s Complement System • MSB has negative weight
Background image of page 3

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

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

Page1 / 9

EE357Unit1_FixedPoint - Learning Objectives EE 357 Unit 1...

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

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