Chapter 1: Introduction
In this chapter, we present an overview of basic computer organization and representation of data in computers.
Objectives
By the end of this chapter you should be able to:
- Explain the decimal numbers and binary numbers systems.
- Explain the number conversion among binary, decimal and hexadecimal numbers.
- Understand a basic binary addition and the overflow due to a fixed number of bits.
- Represent binary negative numbers to sign/magnitude numbers and two’s complement numbers.
- Demonstrate basic skill in taking two’s complement numbers.
1.1 Overview on Computing Hardware
Basic Definitions
Hardware: Physical parts of a computer. Everything you can touch.
Transistor: A tiny electrically operated switch that can alternate between “on” and “off”. Fig. 1-1 shows a transistor which has three pins.
Fig. ‑. Transistor
Chip (Microchip): A tiny piece of silicon that contains millions of transistors and other electronic components, as shown in Fig. 1-2. Your CPU (Central Processing Unit) is one of Microchips.
Fig. ‑. Chip (Microchip)
Hardware Overview
Typical Personal Computer System consists of lots of components, as shown in Fig. 1-3:
Fig. ‑. Personal Computer System
- System unit: Motherboard is the main circuit board for the computer, which includes CPU, memory, ports, etc.
- Secondary storage devices can “permanently” hold data and information. Some examples include Floppy disk, hard disk drives, Magnetic tape, CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-R, DVD-RW.
- CD-ROM stands for Compact Disc – Read Only Memory.
- CD-R stands for Compact Disc – Recordable and can be written to only once.
- CD-RW stands for Compact Disc – Re-writeable (or Read/Write).
- DVD-ROM stands for Digital Versatile Disc – Read Only Memory.
- DVD-R stands for Digital Versatile Disc – Recordable and can be written to only once.
- DVD-RW stands for Digital Versatile Disc – Re-writeable (or Read/Write).
- Input devices translate data into a form the computer can understand.
- Keyboard, mouse, trackball, and touchpad
- Output devices translate information into a form human can understand.
- Monitor (or Display Screen), Printer, Speaker
- Communications devices send/receive data to/from other computers
- Modem, network card
1.2 Digital Discipline
Binary Values
In digital discipline, there are two discrete values:
- 1, TRUE, HIGH
- 0, FALSE, LOW
1 and 0 can be represented with voltage levels. If the voltage level is high, it represents 1 bit. If the voltage level is low, it represents 0 bit. The two discrete values can be also represented with rotating gears, fluid levels, etc. Digital circuits of your computer use voltage levels to represent 1 and 0. This is a binary digit so we simply call it “bit”.
Number Systems
Decimal numbers can be expressed as shown in Fig. 1-4. The rightmost digit represents 1’s column. As the digit moves forward to left-side, the weight of each digit increases as the power of 10. In the figure, we can read the number, as follows: five thousand, three hundred, seven ten, and four one.
Fig. ‑. Decimal number
A binary number also can be expressed as shown in Fig. 1-5. Here, the rightmost digit represents 1’s column. As the digit moves forward to left-side, the weight of each digit increases as the power of 2. In the figure, we have a binary number 1101. Each bit represents a different weight, the first bit (1) for 8’s column, the second one (1) for 4’s column, the third one (0) for 2’s column, and the last one (1) for 1’s column.
Fig. ‑. Binary number
Fig. ‑. Number Conversion
Let’s convert the decimal number 47 to a binary number. We can start to divide the number with the divisor, where the divisor is always 2. You will the quotient 23 and a remainder 1. Keep repeat this process until the dividend becomes zero, as shown in Fig. 1-6. Now let’s read the remainders from bottom to up, 101111 is the binary representation of the decimal number 47.
1.3 Definitions
The bit is the most basic unit of information in computing and digital communications.
1 0 0 1 0 1 1 0
The above 8 bits show an example of the binary number. The first bit we call it most significant bit (msb), whereas the last bit we call it least significant bit (lsb). A group of 8-bit, we call it a byte.
The large powers of two can be expressed as shown below:
- 210 = 1 kilo: 210 (1024) is approximately equal to 1000
- 220 = 1 mega: 220 (1,048,576) is approximately equal to 1 million
- 230 = 1 giga: 230 (1,073,741,824) is approximately equal to 1 billion
- 240 = 1 tera: 240 (1,099,511,627,776) is approximately equal to 1 trillion
1.4 Signed Binary Numbers
There are two ways of representation of signed numbers, i.e. sign-magnitude form and two’s complement form.
Sign-Magnitude
The sign-magnitude binary format is the simplest conceptual format. To represent a number in sign-magnitude, we simply use the leftmost bit to represent the sign, where 0 means positive and 1 means negative. The remaining bits represent the magnitude (absolute value).
For example, let’s represent +6 and -6 with 4-bit sign-magnitude form. The absolute value for both numbers is equal to . The sign bit for +6 is 0, whereas the sign bit for -6 is 1. We can express both +6 and -6 as shown below:
- +6 = 0110
- -6 = 1110
One of problem in this form is that the addition doesn’t work. If you add these two number as shown below, the result is not correct.
(wrong!)
Another issue is that there are two representation of 0, i.e. 1000 (-0) and 0000 (+0). That reduces the possible number representation.
Two’s Complement
Two’s complement is the most common method of representing signed integers on computers. The msb has value of -2N-1, where N is the total number of bits. For example, if you have 4-bit two’s complement, the most positive 4-bit number is 0111 that is equal to 7. The most negative 4-bit number is 1000 that is equal to -8. In contrast to sign-magnitude form, addition works in two’s complement form and there is single representation for 0.
You can find some YouTube video how to convert the number into two’s complement number in the following link: