EE 357 Unit 1
Fixed Point Systems and
Arithmetic
© Mark Redekopp, All rights reserved
Learning Objectives
• Understand the size and systems used by
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
decimal value of numbers represented in
various systems in either binary or hex
P
f
th
i
ith
ti
d l
i
•
Perform the various arithmetic and logic
operations that the HW needs to perform
© Mark Redekopp, All rights reserved
•
Be able to determine when overflow has
occurred in an arithmetic operation
Connecting C & EE 101
• This slide package is meant to review the
This slide package is meant to review the
basic data representation and operations
that we learned in EE 101 but now in the
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
•
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
Unsigned
2’s Complement
Sign and Zero Extension
SIGNED AND UNSIGNED
Hexadecimal Representation
SIGNED AND UNSIGNED
SYSTEMS
© Mark Redekopp, All rights reserved
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Binary Representation Systems
•
Integer Systems
•
Codes
– Unsigned
•
Unsigned (Normal) binary
Signed
– Text
•
ASCII / Unicode
Decimal Codes
– Signed
•
Signed Magnitude
•
2’s complement
•
Excess N*
–
•
BCD (Binary Coded
Decimal) / (8421 Code)
ExcessN
•
1’s complement*
•
Floating Point
–
For very large and small
(fractional) numbers
© Mark Redekopp, All rights reserved
* = Not fully covered in this class
Data Representation
•
In C/C++ variables can be of different
and
______
_____
– Integer Types (signed by default…unsigned with leading
)
keyword)
C Type
Bytes
Bits
Coldfire Name
MIPS Name
[unsigned] char
byte
[unsigned] short [int]
halfword
[unsigned] long [int]
word
[unsigned] long long [int]
double word
– Floating Point Types
C Type
Bytes
Bits
Coldfire/MIPS Name
© Mark Redekopp, All rights reserved
float
double
C examples
int x = 2;
Allocates a 4byte (32bit) chunk of memory
Any operation involving x will use signed operations, if necessary
char c = 0xfa;
Allocates a 1byte (8bit) chunk of memory
unsigned char d = 10;
Allocates a 1byte chunk of memory
Any operation involving d will use unsigned operations, if necessary
fl
t f
3 1
All
t
4 b t
(32 bit)
h
k
f
float f = 3.1;
Allocates a 4byte (32bit) chunk of memory
Any operation involving f will use floating point HW
double g = 1.5;
Allocates an 8byte (64bit) chunk of memory
unsigned long long y;
Allocates an 8 byte (64 bit) chunk of memory
Allocates an 8byte (64bit) chunk of memory
short z = 1;
Allocates a 2byte (16bit) chunk of memory
© Mark Redekopp, All rights reserved
Unsigned and Signed Variables
• Unsigned variables use unsigned binary
Unsigned variables use unsigned binary
(normal powerof2 place values) to represent
numbers
128
64
32
16
8
4
2
1
1
0
0
1
0
0
1
1
= +147
•
Signed variables use the 2’s complement
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 MAYEDA
 Binary numeral system, Mark Redekopp

Click to edit the document details