
The digital logic level - intro to binary (week 3)
Numerical system
What is a numerical system?
This is a way of representing numbers i.e your fingers
What is a positional system?
This is when a numbers position defines its weight, for example in our number system moving to the left increase the weight by 10
What is the other way of saying positional system?
place-value notation
What base is our decimal number system?
base 10
0 to 9
How much does a position effect a numbers weight?
What is the equation for a numbers value?
sum(weight(is it in the tens or hundreds) * digit(is its a 9 or 1))
What does the subscript represent?
The base value of a number
What base is binary?
base 2
0 to 1
What base is octal?
base 8
0 to 7
Binary
What does ve+ and ve- stand for?
A positive and Negative number respectively
How to convert decimal to binary SUBTRACTION METHOD
- Subtract the largest 2^n you can
- Add a one
- 2^(n-1) if cannot subtract then add a 0 else add a 1
- repeat until you reach 2^0
What is a bit?
1 or 0
What is a nibble?
4 bits
What is a byte?
8 bits or 2 nibbles
What is a word?
The amount of data the cpu can process in one go, i.e. 32bit or 64bit
/Untitled%202.png)
What is signed binary?
This is where the largest bit represents 1 = -ve and 0 = +ve
How to add signed binary?
- Add like normal, so if
- 1 + 1 = carry the one
- 0 + 1 = 1
- 0 + 0 = 0
- If you get a overflow carry it around to the start and add it
How to do ones compliment and convert a positive number to a negative one?
- Flip all bits
In ones compliment is 0 positive or negative?
It is both, thats why it is bad
What do you do with a overflow?
Carry it to the start and add it
How to convert a ones compliment to a digit?
- If the signed bit is negative (1), filp all bits
- Add the bits up
What is twos compliment?
This is where the most significant bit is negative
Why is twos compliment better than ones compliment?
- It is slow
- It is hard to implement into hardware
- Doesn't have the -+0 problem
What do you do if there if a overflow bit in twos compliment?
Leave it, on the left
What is the most significant bits value in all the different methods 4bit?
SB +-
1s -7 (flip everything then read it)
2s -8
How do you convert a positive number negative or visa versa in twos compliment?
Flip all bits and then add one
How to multiply?
- Look at the bottom row, look at the first bit, multiply that by each bit above
- Once completed shift to the left, then repeat till no more bits
- Finally add them
0000 0101
0000 0011
0000 0101
0000 1010 +
0000 1111
What base is Hexadecimal?
base 16
Write out the conversion from decimal to hex
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- A
- B
- C
- D
- E
- F
How to convert binary to Hex?
first split into groups of nibbles
0100 1101
then convert the nibbles into denery
4 D
/Untitled.png)
/Untitled%201.png)