x
y
z
EECS 270, Fall 2009, Lecture 4
Page
1
of
8
Class status
•
Group assignment 1 due today at 2pm.
It will likely be picked up at 2pm sharp.
•
Individual homework 2 is posted and is due next week Monday.
•
Inlab 1 and prelab 2 are due at the start of lab this week.
Lab 2 is all about delay…
I.
Representing negative numbers in binary (p194197)
When we represent negative numbers in decimal we use an additional symbol, the minus sign “–“, to
indicate that the number is negative.
When using a computer we only have ones and zeros, so we can’t
use some extra character to indicate that the number is negative.
One trick we could play is to have one of
the bits of the number indicate sign.
Signedmagnitude representation
One scheme you could use is just to have one of the bits in the number be the sign bit.
Say if the leftmost
bit (i.e. the most significant bit) is a one the rest of the number is negative and if it’s zero then the number
is positive.
So 1100 is 4 while 0100 is 4.
•
How would we write 6? ___________ . 6? _____________
In a computer or other digital device we generally have a fixed number of bits per number.
•
Say we are using 4bit numbers.
What is the smallest number we can represent? _______
The
largest?
•
For an nbit number using signed magnitude representation, what is the range of representation?
_________ How many different values can we represent with nbits? _______________
This scheme has any number of downsides.
The most obvious is that building an equals comparator is a bit
tricky.
Why?
Another issue is that building an adder which can add two signedmagnitude numbers is a bit tricky…
2’s complement representation
The scheme that is most commonly used to represent negative numbers in a computer is called “2’s
complement”.
The text goes into a good degree of background about the name and why it works.
But the
basic idea is that we treat the most significant bit as being negative but of the same magnitude it would be
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '11
 david
 Addition, sumofproducts

Click to edit the document details