Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

The Number System II

CCS 3000: Computer Organization with Assembly


Programming

Quijano, Ma. Christina


Bits, Bytes, Nybbles
The most important base you need to know for
computer organization is base 2.
 We also call this binary, since binary means two valued.

The second most important base is base 16 (or


hexadecimal),
The third is base 8 (octal).
Beyond that, you don't need to know the other bases,
unless other wise required
Bits, Bytes, Nybbles
bit A single binary digit, that can have either value 0 or
1.
byte 8 bits.
nybble 4 bits.
word 32 bits
halfword 16 bits
doubleword 64 bits
Significant Digits
Binary: 11101101

Most significant digit Least significant digit

Hexadecimal: 1D63A7A

Most significant digit Least significant digit


One’s Complement
1’s complement of N is defined as (2n -1)-N.
If n=4 have (2n -1) being 10000 - 1 = 1111
So for n=4 would subtract any 4-bit binary number from
1111.
This is just inverting each bit.
Example: 1’s compliment of 1011001
 is 0100110
**Invert all the way.
Two’s Complement
The 2’s complement is defined as 2n-N
Can be done by subtraction of N from 2n or adding 1 to
the 1’s complement of a number.
For 6 = 0110
The 1’s complement is 1001
The 2’s complement is 1010
** Copy zero, until one is encountered, copy one then
invert
LSB and MSB
In base 2, we refer to the individual 1's and 0's as bits,
rather than digits. This is very common terminology, so
from now on, we won't refer to them as digits.
It's common to define two more terms for an N-bit
number.
least significant bit Bit b0. We'll abbreviate this LSb with
the 'b' in lowercase to represent a bit. (When it's in
uppercase, it will mean byte).
most significant bit Bit bN-1. We'll abbreviate this MSb
with the 'b' in lowercase to represent a bit. (When it's in
uppercase, it will mean byte).
The reason it's called "least significant" bit is because
the bit is associated with the smallest subscript, i.e., the
smallest power of 2. Flipping this bit (i.e., changing it
from 0 to 1, or 1 to 0) would affect the overall value
the least of any bit that one could flip.
The reason it's called "most significant" bit is because
the bit is associated with the largest subscript, i.e., the
largest power of 2. Flipping this bit (i.e., changing it
from 0 to 1, or 1 to 0) would affect the overall value
the most of any bit in the number.
Binary Subtraction
Have previously looked at the subtraction operation. A quick review.
Just like subtraction in any other base
Minuend 10110
Subtrahand - 10010
Difference 00100
And when a borrow is needed. Note that the borrow gives us 2 in the
current bit position.

.
When there is no borrow into the msb position, then the
subtrahend in not larger than the minuend and the result
is positive and correct.

If a borrow into the msb does occur, then the subtrahend


is larger than the minuend.
Operation with 2’s complement
Add 4 and -6
Will use the 2’s complement of -6 or 1010
 4 0100
 -6 1010
 1110
And taking the 2’s complement of 1110 get 0001 + 1 =
0010
A 2’s complement table for 4 bits

You might also like