Vous êtes sur la page 1sur 31

Assignment I

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.

I. Decimal (Khan, 2013):

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.

Additional power of number 10 need the addition of another positional number.


Therefore, the position of the first digit on the left side of the decimal point is 0, the second
digit on the left side of the decimal point is 1 as so on. Similar to that, the position of the first
digit on the right side of the decimal point is -1, the second is -2 and so on.

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.

For example: Let’s inspect the value of number 139.78.

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:

 Value of digit 1 is: 1 x 102 = 100.


 Value of digit 3 is: 3 x 101 = 30.
 Value of digit 9 is: 9 x 100 = 9.
 Value of digit 7 is: 7 x 10 - 1 = 0.7.
 Value of digit 8 is: 8 x 10 - 2 = 0.08.
 The value of the number is: 100 + 30 + 9 + 0.7 + 0.08 = 139.78.

II. Hexadecimal (Khan, 2013):

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.

For example: Let’s inspect the decimal value of 3A16:

Position 4 3 2 1
Weights 163 162 161 160
Face Value 3 A 1 6

Similar to decimal, the value of a hexadecimal number can be calculated by multiplying


the digits with their position’s weights then adding the result.

 Value of 3 is: 3 x 163 = 12288.


 Value of A is: 10 x 162 = 2560.
 Value of 1 is: 1 x 161 = 16.
 Value of 6 is: 6 x 160 = 6.
 The value of the number is: 12288 + 2560 + 16 + 6 = 14870.

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.

III. Interaction between systems:

1. Convert Decimal to Binary (Anon., 2017):

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.

For example: Let’s convert 55 to binary.

 First we divide 55 by 2 and take the remainders:


55/2 = 27 Remain: 1
27/2 = 13 Remain: 1
13/2 = 6 Remain: 1
6/2 = 3 Remain: 0
3/2 = 1 Remain: 1
1/2 = 0 Remain: 1

 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:

Let’s convert 10100001 to decimal value:


 Decimal = ((1 x 27) + (0 x 26) + (1 x 25) + (0 x 24) + (0 x 23) + (0 x 22) + (0 x 21) + (1 x 20)).
 Decimal = 128 + 0 + 32 + 0 + 0 + 0 + 0 + 1.
 Decimal = 161.

3. Convert Binary to Hexadecimal (Anon., 2017):

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. Convert hexadecimal to decimal (Anon., 2017):

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:

 Value of A is: 10 x 162 = 2560.


 Value of 6 is: 6 x 161 = 96.
 Value of C is: 12 x 160 = 12.
 Adding the values together and we have A6C converting to decimal system is 2668.

5. Adding two binary numbers (Anon., 2017):

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

 Finally, we sum the fifth column to get the final result:

1001

+ 1111

11000

 So adding 1001 with 1111 we will get 11000.

6. Interpret negative decimal numbers (Finley, 2000):

To present negative numbers, an alternative method need to be used. In this case we


will use the Two’s Complement method to present the negative decimal number -35 by starting
with the positive version of it, convert it to binary form, reverse each bit then add 1:

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.

7. Store floating point number using Binary (Anon., n.d.):

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:

Floating point: 1000.1001

 First normalizing the number: 1000.1001 = 1.0001001 x 23.


 Next let’s Bias Exponent: Exponent + 127 = 3 + 127 = 130.
 Finally, convert 130 to binary: 1000 0010.
 Then fill in the bit areas:

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:

The American Standard Code for Information Interchange or so called ASCII is a


numerical representation for characters such as ‘a’ or ‘@’ for computers. Since computers only
understand numbers, it is created by programmers in order to communicate with computers
and give commands to them.

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:

1. AND Truth table (Bigwood, 2005):

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.

2. OR Truth table (Bigwood, 2005):

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.

4. NAND Truth table (Bigwood, 2005):

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.

5. NOR Truth table (Bigwood, 2005):

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.

6. EXOR Truth table (Bigwood, 2005):

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.

7. EXNOR Truth table (Bigwood, 2005):

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.

V. Logical Expression Table:

A B A AND B A OR B NOT A A NAND B A XOR B

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

Expression After Calculation Result


(T AND F) NOR (T XOR F) F NOR T F
(NOT T) XOR ( T NAND F) F XOR T T
(T NAND T) OR (NOT T) F OR F F
(T AND F) AND (T OR F) F AND T F

VI. Key Components of a Computer:

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:

Hardware Components Of A Computer (Martin, 2009)

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:

 Input devices: Keyboard, mouse, microphone, etc.


 Output devices: Screen, speaker, etc.
 Processor: System unit, monitor, etc.

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).

1. CPU (Fisher, 2017):

CPU, or Central Processing Unit is considered the brain of a computer. It is an electronic


hardware inside a computer that gives directions for a PC program by performing basic
arithmetic, logical, control and input/output operations specified by the instructions of the
user. CPU operates by reading the binary code which consist of 0 and 1. It will read and follow
the instructions one by another, hence known as a complex integrated circuit consisting of
millions of transistors on a small circuit board. Millions of instructions can be executed by the
CPU per second, so in a typical CPU chip there are many complex components with functions.

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:

Computer components relationship diagram (Comer, 2006)

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).

VII. Computer Memory (Comer, 2006):

Any physical device capable of storing data temporary or permanently is called


computer memory. Therefore, there any many types of computer memory, each has its own
advantages and disadvantages.

• 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.

• RAM or Random Access Memory: Is a hardware component connected through the


motherboard, which is also a type of computer memory. RAM allows read-write
function randomly to any location in memory based on memory cell address. The
information stored on the RAM is only temporary, which means they will be deleted
when the power supply is off. The greater the amount of RAM, the more space you have
to manage programs run on your computer, therefore making the computer faster and
more stable.

• 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.

Memory Hierarchy Chart.

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.

VIII. Polling and Interrupt (Lin, 2003):

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:

• Order the printer to receive the paper.


• “Poll” to determine whether paper has advanced or not.
• Order the printer’s head to move to the beginning of the line.
• “Poll” to check whether the printer’s head reaches the beginning of the line or
not.
• Determine a character to print and start the ink spraying device.
• “Poll” to check if the printing process is finished.
• Order the printer’s head to move to the next character position
• Continue the same process with each latter character.

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.

IX. Central Processing Unit Architecture (Agarwal, n.d.):

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.

CISC: Or Complex Instruction Set Computing is an approach that attempt to minimize


the number of instructions given per program by sacrificing the number of cycles per
instruction. Computer that built based on the CISC architecture are meant to be minimize the
memory cost. By embedding many operations in a single instruction, the number of instructions
reduce significantly, however the instruction become more complex.

21
CISC Architecture.

Advantages of CISC Architecture:

• Microprogramming is easy assembly language to implement, and less expensive


than hard wiring a control unit.
• The ease of micro-coding new instructions allowed designers to make CISC
machines compatible with many devices.
• As each instruction became more accomplished, fewer instructions could be
used to implement a given task.

22
Disadvantages of CISC Architecture:

• Slow performance due to the amount of clock time taken by different


instructions are not similar.
• Only 20% of the existing instructions is used in a typical programming event,
even though there are various specialized instructions in reality which are not
even used frequently.
• The conditional codes are set by the CISC instructions as a side effect of each
instruction which takes time for this setting, and the compiler has to examine
the condition code bits before this happens.

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.

Advantages of RISC Architecture:

• RISC Architecture has a set of instructions, so high-level language compilers can


produce highly efficient code.
• It allows freedom of using the space on microprocessors because of its simplicity.
• Many RISC processors use the registers for passing arguments and holding the
local variables.
• RISC functions use only a few parameters, and the RISC processors cannot use
the call instructions, and therefore, use a fixed length instruction which is easy to
pipeline.

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.

Disadvantages of RISC Architecture:


• Mostly, the performance of the RISC processors depends on the programmer or
compiler as the knowledge of the compiler plays a vital role while changing the
CISC code to a RISC code.
• While rearranging the CISC code to a RISC code, termed as a code expansion, will
increase the size. And, the quality of this code expansion will again depend on
the compiler, and also on the machine’s instruction set.
• The first level cache of the RISC processors is also a disadvantage of the RISC, in
which these processors have large memory caches on the chip itself. For feeding
the instructions, they require very fast memory systems.

CISC and RISC comparison:

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:

Step 1: MAR <=[PC].

Step 2: MBR <=[Memory]MAR address ; PC <=PC+1;

Step 3: CIR <=[MBR];

Step 4: [CIR] Decoded then executed.

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

_start: ;tell linker entry point


mov eax,'7'
sub eax, '0'

mov ebx, '4'


sub ebx, '0'

cmp eax, ebx


jg display_msg1
sub ebx, eax
add ebx, '0'
mov [sum], ebx
jmp done

display_msg1:
sub eax, ebx
add eax, '0'

mov [sum], eax


mov ecx,msg
mov edx, len
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel

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

mov eax,1 ;system call number (sys_exit)


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.

The advantages of 64-Bit Processors Compared with 32-bit Processors:


• Better RAM performance If the computer needs less than 4GB of RAM to
process, the 64-bit processor and the 32-bit processor are the same. But if the
computer needs more than 4GB of RAM, only 64-bit processors can handle it.
Okay.
• Better application processing and better memory allocation than 32-bit
processors. Win 64bit is not limited to RAM for the application, meaning that
your needs are not limited, you can run heavy RAM-intensive applications such
as 3D models, autocad, or Photoshop, Roof, the application will work more
efficiently, more stable and faster in the platform.

XII. References:

 Two’s Complement - Thomas Finley:


https://www.cs.cornell.edu/~tomf/notes/cps104/twoscomp.html
 Number System in Computer - Jawad Khan: http://www.byte-notes.com/number-
system-computer

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

Vous aimerez peut-être aussi