Documente Academic
Documente Profesional
Documente Cultură
This is a booklet about computer system base type, created to help people who study
about technology, especially computer systems have a deeper understanding of the building
block of computers and how do they work. This booklet will go through some of the most used
base system for computers nowadays such as Decimal and Hexadecimal, how to convert them
to binary and the other way around.
Decimal system can be understood as a 10-base number system, which is arguably the
most used number system in the world at the moment. This specific system consists of 10 base
characters, also known as single-digit number varies from 0 to 9. These digits can be used to
present value of any number. The number after 9 is 10, the number after 19 is 20 and it goes on
like that.
The value of a number is calculated by multiplying the digits with their position’s
weights then adding the result. This is called expansion method.
Position 2 1 0 -1 -2
Weights 102 101 100 . 10-1 10-2
Face 1 3 9 7 8
Value
1
As you can see in the table above:
Unlike Decimal system type, Hexadecimal system consists of 16 digits varies from 0 to 9
and A to F. The characters from A to F represent decimal number from 10 to 15. Therefore, the
base number of hexadecimal system is 16, each position of digit in this system represent a
power of 16. This 16-number system is best used to represent long binary numbers.
Position 4 3 2 1
Weights 163 162 161 160
Face Value 3 A 1 6
2
Hexadecimal system is a very useful and flexible system. Due to the fact that it uses 16
base number system, each hex digit can represent a 4-bit binary sequence, and 8-bit binary
number can be presented by using only two different hex digits. This simplifies the presenting
process of binary by a lot, making it much easier to write numbers, especially large and long
number as hexadecimal than to write them in binary.
To convert a decimal value to a binary value, the simplest method is to use the division
by 2 with remainder method. We take a decimal and divide it by 2 and take the remainder,
continue doing so until there is nothing left to divide, then we take all the remainder put them
together.
Then we take all the remainders and put them together from bottom to top, the binary
value of 55 is: 110111.
3
2. Convert Binary to Decimal (Anon., 2017):
To convert a binary value to decimal value, it is also very simple. You just need to do the
other way around like when you convert a decimal value to binary. All you have to do is
multiply each digit’s position weights then add the results together:
To convert a binary value to hexadecimal value, in this case is 10001111, we use the
following method:
First, divide the binary digits of the number into group of 4, in case you don't have
enough 4 digits for a group, add as many zeros as necessary to the front to make it four
digits. So we will have 2 groups: 1000 and 1111.
Write a small "1" character above the last digit of a group. Each number in a group
signifies a kind of decimal system number. The last digit of a group is the first position.
Continue to write a small "2" character above the third digit, a "4" character above the
second, and an "8" character above the first digit. We will have: 18040201, and 18141211.
Multiply each number with its appropriate character: 8 0 0 0, and 8 4 2 1.
Add the numbers of each group together: 8 + 0 + 0 + 0 = 8; 8 + 4 + 2 + 1 = 15.
If any number is larger than 9, change it to letter from A to F. So we will have 8, F.
Finally put those numbers together and you will have the final result: 8F.
4
In order to convert a hexadecimal number to decimal number, we use the same method
as we use to calculate the decimal value of a hexadecimal. First we valuate the position of each
digit of the hexadecimal number, then multiply it with the value of each digit, then add the
results together:
Position 3 2 1
Weights 162 161 160
Face Value A 6 C
As you can see, from the above table we can calculate the value of each digit. Note that
A is 10 and C is 12:
To add two binary numbers, first you need to write them down, one below the other,
then add them up, column by column, starting from the right and remember to keep track of
what is brought to the next column. For example, to add 1001 and 1111:
1001
+ 1111
First add up the rightmost column. We have 1+1 is 2 but in binary it is 10 so we write
down 0 then bring the 1 to the next column:
5
1
1001
+_ 1111
1000
Continue to add the second column from the right. We have 1+0+1 is 10 in binary again,
so we write down the 0 and carry the 1 to the next column. Keep repeating the process
until the 1 is on the left most side:
1
1001
+_ 1111
1000
1001
+ 1111
11000
6
Converting 35 to binary form and we will get: 0010 0011.
Reverse each bit and we will get: 1101 1100.
Adding 1 to it: 1101 1100 + 1 = 1101 1101.
And the result is 1101 1101 – binary code for -35.
Decimal floating-point numbers often use scientific notation as a form with an explicit
point always between the 1st and 2nd digits. The exponent is either written explicitly including
the base, or an e is used to separate it from the significand.
For example:
S Exponent Mantissa
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 ... 0
0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 ... 0
8. ASCII Table:
7
ASCII Table (Anon., 2010)
To show how the ASCII table actually work, we will try to convert alphanumeric
characters into binary that can be sent as messages to other computers. Let’s try with the word
‘MINH’:
Decimal value of M is 77, convert it to binary and we will have: 100 1101.
Decimal value of I is 73, convert it to binary and we will have: 100 1001.
Decimal value of N is 78, convert it to binary and we will have: 100 1110.
Decimal value of H is 72, convert it to binary and we will have: 100 1000.
Adding all the binary values together and we will have the binary code for ‘MINH’ is
1001 1011 0010 0110 0111 0100 1000.
8
IV. Logic gates:
A logic gate is a basic building block of a digital circuit. Almost all logic gates have two
inputs and one output. At any time, every terminal is in one of the two binary conditions low (0)
or high (1), which is presented by different levels of voltage. The logic state of a terminal can
change quite often as the circuit processes data. In most logic gates, the low state is presented
by zero volts (0 V), while the high state is presented by five volts positive (+5 V). There are
seven basic logic gates: AND, OR, XOR, NOT, NAND, NOR, and XNOR:
The AND gate is an electronic circuit that only gives a high output (1) if all its inputs
are high. A dot is used to show the AND operation i.e. A.B. Note that this dot is sometimes
omitted i.e. AB.
The OR gate is an electronic circuit that will give a high output (1) if one or more of its
inputs are high. A plus (+) is used to show the OR operation.
9
3. NOT Truth table (Bigwood, 2005):
The NOT gate is an electronic circuit that produces an inverted version of the input at
its output. Therefore, it is also known as an inverter. If the input variable is X, the inverted
output will be NOT X. This can also be called X', or X with a bar over the top, as shown at the
table above.
This is a NOT-AND gate which is like an AND gate followed by a NOT gate. The
outputs of all NAND gates are going to be high if any of the inputs are low. The symbol is an
AND gate with a small circle on the output represents inversion.
10
This is a NOT-OR gate which is like an OR gate followed by a NOT gate. The outputs of
all NOR gates are going to be low if any of the inputs are high. The symbol is an OR gate with a
small circle on the output represents inversion.
The Exclusive-OR gate is a circuit which will give a high output if either, but not both,
of its two inputs are high. An encircled plus sign ( ) is used to show the EOR operation.
11
The Exclusive-NOR gate circuit does the opposite of the EOR gate. It will give a low
output if either, but not both, of its two inputs are high. The symbol is an EXOR gate with a
small circle on the output circle represents inversion.
T T T T F F F
T F F T F T T
F T F T T T T
F F F F T T F
Computer has become too familiar and too important to be missed in our daily life,
almost everyone own a computer. However, not many truly know how a computer work, and
what makes a computer. But if you are a computer engineer, or a programmer, it is crucial that
you understand the functioning progress of a computer along with its parts.
A common computer usually has 4 key components: CPU, memory, interface, and buses.
It is not hard to memorize all the parts, but to understand completely each part’s function takes
work and time. By knowing exactly what each component does, this can help you solve many
problems with a computer.
12
Hardware components of a basic computer:
As you can see hardware components consist of outside device that connect to your
computer that you use them to interact with it. These devices can be categorized into different
groups:
And for the computer to actually run, software components need to be installed or
integrated into the motherboard. The inner working flow of a CPU can be understood as this:
13
Working flow of computer system (Comer, 2006).
Control Unit: Performs the program commands and controls the processing operations,
which is accurately regulated by the clock system.
Arithmetic & Logical Unit: Include registers, usually 32 or 64 bits. It performs command
of the control unit and signal processing. As shown in the name, the purpose of this unit is to
14
perform simple arithmetic operations (addition, subtraction, multiplication, division of integers)
or logical statements (AND, OR, NOT, NAND, XOR).
System clock: Is a method used to synchronize the in and out process of the CPU at
constant intervals, the time interval between two pulses is called a clock cycle. The speed at
which the system clock generates clock signal is called clock speed - Mhz.
2. Memory:
The computer memory is kind of like a temporary storage. It contains data and
commands that the CPU (Central Processing Unit) is given to. Before a program is actually
started, it is loaded from a storage medium into the memory. This gives the CPU direct access
to the program. Memory is essential for any computer, there are two types of memory called
RAM and ROM.
RAM or Random Access Memory: Is the latter generation of ROM. RAM and ROM are
both "random access memory", which means it temporary stores data for the computer to
work with, and when the work is finished all the data is erased. It can be read and/or written
out. More RAM means a computer can work with more information at the same time, which
usually has an effect on total system performance.
ROM, or Read Only Memory: Is a “built-in” type of memory that contains data that
usually can only be read, not be able to be written to. Unlike a computer's Random Access
Memory (RAM), the data in ROM is not lost when the computer power is turned off. The ROM
is maintained by a small battery inside your computer.
3. Interface:
Interfaces an incredibly important part of the computer system that decide a computer
is good or bad. It is used to exchange information between hardware, computer software,
peripheral devices, humans and combinations of all the above. Similar computer software such
15
as a touchscreen can send and receive data through its interface, while speaker only receive
data and mouse can only provide an interface to send data to a given system through a click.
4. BUS:
There are many internal components inside a computer. In order for these component
to interact and communicate with each other, they used physical connections such as wires and
cables to connect all the components together. A BUS is a common pathway through which
data from a computer’s component is transferred to another component. There are 3 main
types of BUS in a computer: Control bus, address bus and data bus.
To furtherly show you how all components connect to each other in a computer, take a
look at this diagram of relationship between components:
16
As shown in the diagram above, bus controller transmits data information to control the
system operation. Normally, the control data consists of cyclic signals to synchronize the pulses
and movements of the system. The control bus is usually controlled by the CPU to synchronize
the pacing and the data exchanged on the buses. Control bus connect the CPU with other
components inside the computer using wires, cables and circuits.
Bus addresses are one-way logic paths that transmit address references to memory
locations and indicate where data should be stored in the memory space. During address bus
operation will be CPU controlled to transfer data between the memory area and the CPU.
Addresses usually are memory areas or input/output areas. Data stored in these areas is usually
8bit (1 byte), 16bit, or 32bit depending on the architecture of the processor or microcontroller.
Most microcontrollers address data in 8bit blocks. 8bit, 16bit, and 32bit microprocessors in
general can also work with 8bit and 16bit data types.
Data bus transfers data between the CPU and memory. The bus size affects the speed of
computer and clarifies the size of the processor. A processor can be 8/16/32/64-bit processor.
An 8-bit processor has 8 wire data bus to carry 1 byte of data. In a 16-bit processor, 16-wire bus
can carry 16 bits of data (transfers 2 bytes).
• Register: Data being processed by the CPU is stored in registers. Registers have a very
small storage, however, it can be accessed instantly. The fastest way to access memory
is through registers. The register is normally measured by the number of bits they can
store, for example, 8-bit register or 32 -bit register.
• Caches: Are small memories, used to store frequently accessed data in the main storage.
Caches work as a temporary storage to store the instructions the CPU need to process.
17
These commands will be listed on after the other waiting to be processed. Therefore,
when the CPU needs more instructions it can just get in the cache without recompiling,
thus reducing the timeout and increase the performance of the CPU. Memory cache is
divided into three main types:
1. Memory Cache L1 usually has a few tens of KB (from 8KB to 32KB).
Despite the fact being the memory with smallest capacity, the speed of
L1 cache is the fastest.
2. Memory Cache L2 is larger than L1, usually has from 256KB to 8MB. If the
requested data is not on the cache L1, the CPU tries to retrieve data from
the L2 cache, before trying it on the main storage. Even though L2 is
slower than L1, it's still faster than main memory, and because of its size,
it can store more data in it.
3. Memory Cache L3: Usually has a few MB similar to the Cache L2. If the
requested data is not on the cache L1, the CPU tries to retrieve data from
the L2 cache. Hence, the speed of L2 cache is still faster than speed of L3
cache.
• Flashes: Are non-volatile memories used for storage. It has the ability to be
electronically reprogrammed and erased. It is often found under USB flash drives, MP3
players, digital cameras and solid-state drives form. The flash memory can maintain its
18
data without the need of power supply. Flash memory is a popular type of memory as it
is very flexible and versatile.
When the CPU starts the data handling process, the registers will be responsible for
storing results of those processes. Hence, the speed of the registers will be the fastest. In
addition to that, temporary data is stored within individual pacemaker of the register, so its
capacity is only a few tens of kilowatts. Cache memory is a flash memory type integrated into
your computer's memory (L1 cache) or in some cases located next to it on a separate chip (L2
cache). L1 cache is faster than L2 cache because it is integrated directly into the CPU.
These days, new generation of computer comes with L3 cache faster than RAM but
slower than L1 and L2 cache. Memory cache is used to store repetitive instructions that are
19
required for some programs to run and to help improving the system overall speed. Finally, the
off-line storage memory, which is the largest memory which can store up to several terabytes.
Because it is peripheral equipment, it takes a lot of processing time so its speed is slower than
registers and caches.
Polling: Operating principle is that its microcontroller continuously checks the status of
all devices, and if any device respond to it, it stops serving that device. It then continues to
check the status of the next device to the end. This is an old mechanism used before Interrupt is
created. For example: polling used to query and work with the printer:
The main issue with polling is that although the CPU is very fast, the device its connect
with is very slow. Therefore, there can be period when the CPU has to wait for the device to
finish, it will check the device many times.
Interrupt: Just as its name, an interrupt allows any peripherals to interrupt the
processor to show some information. For example, when you press a key on your keyboard, an
interrupt is generated to transfer the key-press event to the operating system, where it will be
processed, hence showing the result of pressing that key on your screen. Each peripheral is
given an interrupt by some combination of the operating system and BIOS.
20
Interrupt is considered to be the more advance mechanism when compared to polling
as not only it saves time because peripherals are usually slower than processors, it can also set
priority for devices to be handle so that more important task can be done first. This is not viable
using the polling mechanism.
CPU are built based on ISA – Instruction Set Architecture to fully function. There are two
main type of architecture that give different instruction to work flow on hardware: RISC and
CISC.
21
CISC Architecture.
22
Disadvantages of CISC Architecture:
RISC: Or Reduced Instruction Set Computing are often used in portable devices due to
its power efficiency. Some famous examples are Apple iPod and Nintendo DS, which us RISC
and have a very long lasting battery. RISC processor focus on using highly optimized set of
instructions. Opposite to CISC, RISC Architecture reduce the number of cycles per instruction by
decreasing number of instruction per program. One unique feature of RISC is overlapping the
execution of several instructions in a pipeline fashion. It has higher performance than CISC.
23
RISC Architecture.
24
• The speed of the operation can be maximized and the execution time can be
minimized. Very less number of instructional formats, a few numbers of
instructions and a few addressing modes are needed.
CISC RISC
It is prominent on hardware It is prominent on software
High cycles per second Low cycle per second
It has transistors to store complex More transistors are used to store memory
instructions
LOAD and STORE memory-to-memory is LOAD and STORE register-to-register are
induced in instructions independent
Has multi-clock Has single-clock
25
X. Processor Register:
To understand how processor registers work, let’s inspect the process of a subtraction
program. First look at the cycle:
First, the computer is set with memory location of the first instruction (01), the MAR
register will receive the location of the computer (01).
Now the computer will increment by 1, the MBR register will receive the data that the
MAR register points to it (LOAD 05). Here the CIR will point to 05 to load the data (55).
26
SUB 06 will be decoded after being loaded from MDR to current CIR, it will be decoded
into subtract accumulator content with the content of memory address 06 (value 33). 55 will be
subtracted by 33 and thus giving 22 in the accumulator. The computer is incremented by 1.
Now the computer is 03, MAR receive computer’s location (03). Since data is in
address (03), the data bus is passed to the MBR (Store) register. Then the computer
27
continues to increase to 4. Here the MBR receives the data (HALT), which is the stop
command that the program is executing. The program stops.
To give example of code implementing, here is a program used to subtract the value
of a number:
section .text
global _start ;must be declared for using gcc
display_msg1:
sub eax, ebx
add eax, '0'
done:
mov ecx,sum
mov edx, 1
28
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
section .data
msg db "The subtract is:", 0xA,0xD
len equ $ - msg
segment .bss
sum resb 1
In this example of code above, some registers are called in order for the program to run.
32-bit registers for arithmetic, logical, and other operations: EAX, EBX, ECX, EDX. These are data
registers.
Line 4: mov eax, ‘7’ : mount value for eax = 7
Line 5: sub eax, ‘0’ : eax – 0
Line 6: mov ebx, ‘4’ : mount value for ebx = 4
Line 7: sub ebx, ‘0’ : ebx – 0
Line 8: cmp eax, ebx : compare eax and ebx, if eax > ebx (true)
Line 15: sub eax, ebx: eax – ebx
Line 16: add eax, 0 : eax + 0
Line 17: mov [sum], eax: mount value [sum] = eax
Line 18: mov ecx, msg: mount value msg = ecx
Line 19: mov edx, len: mount value len = edx
Line 20: mount value ebx = 1, file descriptor (stdout)
Line 21: mount value eax = 4, system call number (sys_write)
Line 22: call kernel Line 23: done
29
XI. Bit Size (Comer, 2006):
BIT or Binary Digit is the smallest unit in the electronic algorithm which is presented by a
queue of 1 and 0. Therefore, 1-bits represents two values (1 or 0), 2-bits represent 4 values
(00,01,10,11) and so on increasing exponentially.
Electronic algorithms wise, bits are associated with data storage and data processing.
The architecture of computer is divided into two types 32-bit processor and 64-bit processor.
The 32-bit processor is the width of the register inside the CPU. It can handle 232 bytes of RAM
which is 4GB of RAM. 64-bit processor can handle 128 ++ GB of RAM. The size of bus depends
on the 32-bit or 64-bit processor. The larger the width of the registers, the larger the width of
the buses, hence the transmission speed is also faster.
XII. References:
30
Computer – Number Conversion:
http://www.tutorialspoint.com/computer_fundamentals/computer_number_conversio
n.htm
Basic Gates and Functions - Richard Bigwood:
http://www.ee.surrey.ac.uk/Projects/CAL/digital-
logic/gatesfunc/index.html#introduction
Floating Point Numbers: http://floating-point-gui.de/formats/fp/
What is RISC and CISC Architecture with Advantages and Disadvantages - Tarun Agarwal:
http://www.edgefxkits.com/blog/what-is-risc-and-cisc-architecture/
External Interrupts - Charles C. Lin:
https://www.cs.umd.edu/class/sum2003/cmsc311/Notes/IO/extInt.html
Central Processing Unit (CPU) – Tim Fisher: https://www.lifewire.com/what-is-a-cpu-
2618150
Essential of Computer Architecture – Douglas E. Comer (Book).
31