Documente Academic
Documente Profesional
Documente Cultură
Lecture #1
Digital systems
Dr Dirk Sudholt
Department of Computer Science
University of Sheffield
d.sudholt@sheffield.ac.uk
https://staffwww.dcs.shef.ac.uk/people/D.Sudholt/campus_only/COM1006.htm
X(t)
Time
Time
COM1006/1090/165 Devices and Networks/Computer Architectures 4
Logic values and signal levels
Logic variables assume one of two discrete states, 0 or 1.
Represented by low/high voltage.
In a system using a 5V power supply you might expect a variable to
be represented by exactly 0V or 5V:
Such precise electronic devices cannot be made cheaply
In practice, two ranges of voltage are used to represent logic values,
e.g. 00.4V for 0 state and 2.85V for 1 state.
13
Conversion: decimal to binary
How to convert decimal numbers to binary numbers?
What is 310 in binary?
310 = 112
What is 1810 in binary?
1810 = 100102
What is 24510 in binary?
14
Conversion: decimal to binary
Algorithm: Example:
Successively divide the Convert 24510 to binary
number by 2 and 245 / 2 = 122 R=1
record the remainder 122 / 2 = 61 R=0
(which is either 0 or 1). 61 / 2 = 30 R=1
30 / 2 = 15 R=0
Stop when the result of 15 / 2 = 7 R=1
the division is 0. 7/2=3 R=1
Remainders read 3/2=1 R=1
1/2=0 R=1
backwards give
binary number. The result is read upwards:
24510 = 111101012
15
Why does this work?
Convert 24510 to binary
245 / 2 = 122 R=1 24510 = 111101012
122 / 2 = 61 R=0 12210 = 11110102
61 / 2 = 30 R=1 6110 = 1111012
30 / 2 = 15 R=0 3010 = 111102
15 / 2 = 7 R=1 1510 = 11112
7/2=3 R=1 710 = 1112
3/2=1 R=1 310 = 112
1/2=0 R=1 110 = 12
16
Conversion: binary to decimal
Algorithm: Convert 10101112 to decimal:
Multiply the
first non-zero 1 0 1 0 1 1 1
bit by 2 and
add the bit on
2*1+0=2
its right. 2*2+1=5
Continue with
2*5+0=10
the remaining 2*10+1=21
bits and stop 2*21+1=43
after adding 2*43+1=87
the smallest
bit. Therefore 10101112 = 8710
COM1006/1090/165 Devices and Networks/Computer Architectures 18
Why does this work?
Binary Decimal
102 2*1+0=2
1012 2*2+1=5
10102 2*5+0=10
101012 2*10+1=21
1010112 2*21+1=43
10101112 2*43+1=87