Lecture 01
Lecture 01
computer systems
Assoc. Prof. Dr. Ezgi Deniz Ülker
European University of Lefke
Department of Computer Engineering
COMP333- Computer Organization and Architecture
A chronology of early computing
• 3000 BC: The first abacus is likely invented and used by the
Babylonians.
• Address bus: is used to transfer data between devices. The devices are identified by the hardware
address of the physical memory. The address is stored in the form of binary numbers to enable the
data bus to access memory storage.
• Data bus: is a system within a computer or device, consisting of a connector or set of wires, that
provides transportation for data.
• Registers are temporary storage locations inside the CPU that hold data and
addresses.
• The register file is the component that contains all the general purpose registers
of the microprocessor.
• Computers all about operating on information:
- information arrives into memory from input devices.
- memory is a large "byte array" which can hold anything we want.
• Computer conceptually takes values from memory, performs
whatever operations, and then stores results back
• In practice, CPU operates on registers:
- a register is an extremely fast piece of on-chip memory.
- modern CPUs have between 8 and 128 registers, each 32/64 bits.
- data values are loaded from memory into registers before operation.
- result goes into register; eventually stored back to memory again.
Registers and Register Files
• A register is a box of chocolates and a computer usually has many.(The number depends on the architecture
and whether the computer is diabetic or not
•
The slots you see are the registers and the pieces of chocolate are analogous to the bits which are zero or
one in computer language. So either you can get a dark chocolate(a zero) or a milk chocolate(a one) in there.
Now what these registers can be used for?
They can be used for storing instructions.
They can be used for storing results of operations.
Can be used to manipulate the data stored in them.
So basically any program you write in a high level language like say Java, is translated to some basic
instructions (specific to that particular processor) by the compiler of that language. These basic
operations will let you add,subtract,multiply,shift,compare(think of if conditions in the
programming language of your choice).signal is low, no new values are written.
Registers and Register Files
• The main job of the CPU is to execute programs using the fetch-decode-
execute cycle (also known as the instruction cycle). This cycle begins as
soon as you turn on a computer.
• To execute a program, the program code is copied from secondary storage
into the main memory. The CPU's program counter is set to the memory
location where the first instruction in the program has been stored, and
execution begins. The program is now running.
• In a program, each machine code instruction takes up a slot in the main
memory. These slots (or memory locations) each have a unique memory
address. The program counter stores the address of each instruction and
tells the CPU in what order they should be carried out.
• When a program is being executed, the CPU performs the fetch-decode-
execute cycle, which repeats over and over again until reaching the STOP
instruction.
Fetch-Decode-Execute Cycle
2. ASSEMBLY LANGUAGES: They represent an effort to make programming easier for the human. The machine
language instructions are replaced with simple pneumonic abbreviations (e.g., ADD, MOV). Thus assembly
languages are unique to a specific computer (machine). Prior to execution, an assembly language program
requires translation to machine language. This translation is accomplished by a computer program known as an
assembler. Assemblers are written for each unique machine language.
3. HIGH LEVEL LANGUAGES: High-level languages, like C,C++, JAVA etc., are more English-like and, therefore,
make it easier for programmers to “think” in the programming language. High-level languages also require
translation to machine language before execution. This translation is accomplished by either a compiler or an
interpreter. Compilers translate the entire source code program before execution.(Eg: C++, Java)
Interpreters translate source code programs one line at a time. (Eg: Python) Interpreters are more interactive
than compilers.
Number representation
• In computer system, the numbers are represented in binary, octal and
hexadecimal .
• Unsigned numbers; represents values from 0 to 2𝑛−1 .
• For large numbers binary is unwieldy: use hexadecimal base 16.
• To convert to binary numbers, hexadecimals are converted into groups of 4.
• Sign magnitude is a very simple representation of negative numbers. In sign
magnitude the first bit is dedicated to represent the sign and hence it is called
sign bit.
For example,
• Sign bit ‘1’ represents negative sign. +25 = 011001
where 11001 = 25
• Sign bit ‘0’ represents positive sign. And 0 for ‘+’
-25 = 111001
where 11001 = 25
and 1 for ‘-‘.
Number representation
• 2’s complement: It is used in computing as a method of signed number representation.
• To represent a negative number in this form, first we need to take the 1’s complement of the
number represented in simple positive binary form and then add 1 to it .
Example: (8)10 = (1000)2
1’s complement of 1000 =
0111
Adding 1 to it, 0111 + 1 =
1000
So, (-8)10 = (1000)2
• Please don’t get confused with (8)10 =1000 and (-8)10=1000. As with 4 bits, we can’t represent a
positive number more than 7. So, 1000 is representing -8 only. (4 bits is not enough to represent a
positive number above 7)
• In practice, all modern computers use 2’s complement.
Unsigned arithmetic
011110 30
000111 7
+
100101 37
5-bit register is not enough
to keep this data.
2’s complement of 27
Representation of signed numbers
Signed Addition Overflow Rule
• If 2 Two's Complement numbers are added, and they both have the same sign
(both positive or both negative), then overflow occurs if and only if the result
has the opposite sign. Overflow never occurs when adding operands with
different signs.
i.e. Adding two positive numbers must give a positive result
Adding two negative numbers must give a negative result
Overflow occurs if
-5 try using 4 bit, then 5 bits.
(+A) + (+B) = −C -3 1011+1101=Overflow
(−A) + (−B) = +C -8 01011+01101=11000 (-8)
RULE:
-7 1001 (n=4)
-6 1010
-13 1 0011 Overflow!! (LARGEST NEGATIVE NUMBER IS -8 THAT WE CAN REPRESENT
(3)
Signed Addition –Self Examples
Signed Addition
Signed Addition
Bus hierarchy
In practice, there are lots of different buses with different characteristics e.g. Data width, max
number of devices , max length.
Mainly, there are 2 types of buses;
Synchoronous buses:
• A bus used to interconnect devices that comprise a computer system where the timing of
transactions between devices is under the control of a synchronizing clock signal.
• A device connected to a synchronous bus must guarantee to respond to a command within a
period set by the frequency of the clock signal or a transmission error will occur.
Asynchronous buses:
• A bus that interconnects devices of a computer system where information transfers between
devices are self-timed rather than controlled by a synchronizing clock signal.
• A connected device indicates its readiness for a transfer by activating a request signal. A
responding device indicates the completion of this transfer by activating an acknowledge
signal.
• The time required to complete the transaction is determined by the response times of the
devices and the delays along the interconnecting bus and may vary for different devices.
Synchoronous Buses