intro archi
intro archi
COMPUTER ARCHITECTURE
Examples:
T = 1/F
The CPU cache is a CPU internal memory. And its job is to store
copies of data and instructions from RAM that’s waiting to be
used by the CPU.
RISC Architecture
CISC Processor
RISC CISC
It uses LOAD and STORE that are It uses LOAD and STORE
independent instructions in the instruction in the
register-to-register a program's memory-to-memory
interaction. interaction of a
program.
Example:
1. Number Systems
2. Bits and Bytes
3. Text codes
Number Systems
∴ (14)10 = 11102
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
=11012
Hexadecimal to Octal Number System
Example:
Convert (1056)16 to an octal number.
Solution:
Given, (1056)16 is a hexadecimal number.
First, we need to convert the given hexadecimal number into
decimal number
(1056)16
= 1 × 163 + 0 × 162 + 5 × 161 + 6 × 160
= 4096 + 0 + 80 + 6
= (4182)10
Now we will convert this decimal number to the required octal
number by repetitively dividing by 8.
8 4182 Remainder
8 522 6 MSB
8 65 2
8 8 1
8 1 0
0 1 LSB
Then taking the value of the remainder from bottom to top, we
get;
(4182)10 = (10126)8
Therefore,
(1056)16 = (10126)8
Binary to Decimal Number System
Example:
Convert (1001001100)2 to a decimal number.
Solution:
(1001001100)2
= 1 × 29 + 0 × 28 + 0 × 27 + 1 × 26 + 0 × 25 + 0 × 24 + 1 × 23 +
1 × 22 + 0 × 21 + 0 × 20
= 512 + 64 + 8 + 4
= (588)10
Using Grouping
0 000
1 001
2 010
3 011
4 100
5 101
Octal Digit Value Binary Equivalent
6 110
7 111
So, if you make each group of 3 bit of binary input number, then
replace each group of binary number from its equivalent octal
digits.
That will be octal number of given numbers.
Note that you can add any number of 0’s in leftmost bit (or in
most significant bit) for integer part and add any number of 0’s
in rightmost bit (or in least significant bit) for fraction part
for completing the group of 3 bit, this does not change value of
input binary number.
Example:
Convert (10101)2 to octal number system
Solution:
We can write the given binary number as:
010 101
Now as we know, in the octal number system,
010 → 2
101 → 5
Therefore, the required octal number is (25)8
Hexadecimal to Decimal Number System
Example:
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Example:
Convert A2B16 to an equivalent binary number.
Solution: Given hexadecimal number = A2B16
First, convert the given hexadecimal to the equivalent decimal
number.
A2B16 = (A × 162) + (2 × 161) + (B × 160)
= (A × 256) + (2 × 16) + (B × 1)
= (10 ×256) + 32 + 11
= 2560 + 43
= (2603)10(Decimal number)
Bit
Byte
Number of Different
bits Patterns
1 0 1
00 = 0
01 =1
2 =42
10 = 2
11 = 3
000 = 0
3 2 3
=8 001 = 1
010 = 2
011 = 3
100 = 4
101 = 5
110 = 6
111 = 7
0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
4 24 = 16 1001 = 9
1010 = 10 – A
1011 = 11 – B
1100 = 12 – C
1101 = 13 -D
1110 = 14 – E
1111 = 15 - F
Number of Different
bits Patterns
1 0 1
2 00 01 10 11
Each letter, number, and symbol are represented by an 8-
bit ASCII code.
In blank space, there is also an ASCII code.
Each number is stored in one byte (so the number is in
0..255)
A is 65
B is 66
a is 96
space is 32
"Unicode" is an encoding for mandarin, Greek, Arabic, etc.
languages, typically 2-bytes per "character"
Typing, Bytes, and You
N
umbers in Computers
Text Code
0 to (r-1)
0 to (10 – 1)
0 to 9 (Are the 10 distinct digits we are having in a decimal
digit)
Example:
Example:
1 = 0001
7 = 0111
= (14)10 Result
2. 1001001 BCD
= (49)10
8 4 2 1
10001100011 1st 0011 2nd 0110 3rd 0 1 0 0 463
Example:
1. Using the ASCII code table above, convert the word “Blue” to
binary.
B = 1000010
l = 1101100
u = 1110101
e = 1100101
1000010110110011101011100101
64 32 16 8 4 2 1 Decimal Letter
equivalen assigne
t d
1 0 0 1 1 0 0 76 L
1 1 0 0 1 0 1 101 e
1 1 0 1 1 0 1 109 m
1 1 0 1 1 1 1 111 o
1 1 0 1 1 1 0 110 n
Extended ASCII
UNICODE
Computer knows only 0s and 1s. They go into the computer memory
for processing.
On the other side, we have 0s and 1s, the only language that
computers can understand.
But the problem is, we cannot convert the symbols directly into
0s and 1s, because 0s and 1s are actually numbers and belong to
binary number system.
Example:
The table was created in 1960 and became famous as ASCII table.
The decimal code is then converted into binary and send to the
computer for processing.
For example,
The ASCII table returns the number 80 to the decoding system and
finally the decoding system converts 80 into a binary and then
sends it to the computer for processing.
This is how decoding and encoding works and the role of ASCII
table.
There are three basic I/O mechanisms that computer systems can
use to communicate with peripheral devices:
memory-mapped input/output
I/O-mapped input/output
direct memory access (DMA).
Memory-Mapped I/O
I/O-mapped input/output
The instruction
used are LDA (load
in location A) and The instruction
Instructions STA(Store in used are IN and
Used location A), etc. OUT.
Cycles involved
Cycles involved during operation
during operation are IO read and IO
are Memory Read, writes in the case
Cycles Memory Write. of IO Mapped IO.
data bus
control bus
address bus
computers.
"1:" is the label which lets the computer know where to begin
the operation.
"MOV" is the mnemonic command to move the number "3" into a part
of the computer processor.
The first line of code loads "3" into the register "eax."
The second line of code loads "4" into the register "ebx."
Finally, the last line of code adds "eax" and "ebx" and stores
the result of the addition, which is seven, in "ecx."
For instance:
Instruction: ADD 7
Opcode (using a mnemonic): ADD
Operand: 7
Example:
AX = 1234H
AM = 9
AM = 16 final value
A = 2FH
Direct Addressing
In this mode, we directly copy the data from the given address
into the register. Whatever the data given in a memory address
will be stored into the register or accumulator.
Example:
Instruction Register
(OPCODE>>Operation
Code)
LOAD R1, R2
Indirect Addressing
Example:
1) LDAX B
Example:
1)MOV A, B
Before execution:
A = 10H
B = 20H
A = 20
B = 20H
Example:
A = CCH
Computer Organization
control signals
interfaces between computer and peripherals
the memory technology being used
Control Signals
1. FA with output
2. FA without output
1. Moore Machine
2. Mealy Machine
1.
The diagram shows the structure of the Deterministic Finite
Automata.
So, first of all, the first thing that we need to know our
states are the circles which are represented by A, B, C, and D.
A >>>>>> B >>1
A >>>>>> C >>0
C >>>>>> A >>0
C >>>>>> D >>1
D >>>>>> C >>1
B >>>>>> D >>0
D >>>>>> B >>0
A >>>>>>> B transition:
So, the labeling of the edges are called inputs, and the circles
are called the states.
Whenever an arrow coming from any of the state which means that
it is the starting point of the reading.
Those are the main things that we need to know about a DFA.
Example:
Q = {A, B, C, D}
Sigma = {0, 1}
Qo = {A}
F = {D}
δ =
State Inputs
s
0 1
A C B
B D A
C A D
D B C
2.
3.
Q = {q0. Q1, q2, q3}
F = {q3}
Q0 = {q0}
Sigma = {0.1)
Delta
States Inputs
0 1
Q0 Q1 Q0
Q1 Q2
Q2 Q3
Q3 Q1 Q3
Logic Gates
The symbol takes the place of the operator and the variables are
the inputs to the gate. The resulting value from the expression
equation is the output of the gate.
For example:
Truth statements
By taking some facts and putting them into a logical form, we
can make an arithmetic that helps us analyze them and make a
conclusion.
Using the examples just mentioned, let’s turn them into some
logical word equations:
X and Y = Z
Z = X.Y = XY
~A = B
X or Y = X + Y = Z
Z = X + Y
You see the AND, NOT, and OR in the example word equations.
These are called logical operators.
Making a decision may require more than just one or two facts.
(x + y)Z = r
To prove that you’re floating, the two facts that you can swim
or you are in a boat must be made into a single fact that is
combined with the other fact that you are also in water.
Q = A + B + C
It could be that you’re easy to please and you just have to feel
well to be happy.
So, you’re happy when you’re NOT sick. We’ll use the ~ to mean
NOT in our equation.
Q = ~A
Example:
For the sun to shine on you, the sky must be clear and it has to
be daytime. We put these two facts together with the AND
symbol ·.
Q = A · B
Expressions
Sometimes different operations on the same conditions can make
equivalent results.
If we take the opposite case of the last example where the sun
is not shining, the variables for that are:
~Q = ~(A · B)
If the sky isn’t clear OR it’s not daytime, then the sun isn’t
shining.
So, the NOT symbol is put in before the variables for each
condition so that "the sun is NOT shining" has another equation
like this:
~Q = ~A + ~B
~(A · B) = ~A + ~B
The logic equation now doesn’t include the result variable Q but
instead there are two expressions that are logically equivalent
on each side.
De Morgan’s Theorem
– AND –
~(A + B) = ~A · ~B
Truth tables
A truth table is a way to see all possible conditions for the
variables in a logical expression and to chart the results.
Using the truth statement about when it’s freezing outside and
you have no coat, here’s the truth table showing the possible
conditions and their results:
Because you feel cold only when both conditions are true, the
statement becomes an AND expression in Boolean algebra.
A · B = Q
A truth table for the variables in the expression have the same
values as the table for the truth statement (true and false are
abbreviated to just T and F).
A B Q
F F F
F T F
T F F
T T T
To write a Boolean equation for when you feel cold, we find the
conditions in the table where Q is true.
Here we see that you will feel cold only in one row, when
condition A is true and condition B is false.
A · ~B = Q
Gate symbols
Logic gates are symbols that can directly replace an expression
in Boolean arithmetic.
NOT gate
OR gate
Th OR gate has a curved input side and a sharp pointed output.
AND gate
The AND gate has a flat input side and round output side.
The exclusive or gate symbol is just like the OR gate but it has
an additional curved line crossing the inputs.
Combined logic
When you connect multiple gates together you have a combined
logic system or combinatorial logic.
We’ll find all the conditions that cause a true result and
create a Boolean expression for them.
A ⊕
A B
B
F F F
F T T
T F T
T T F
A ⊕ B = (~A · B) + (A · ~B)
Notice how each gate “connects” the variables together just like
the logic blocks in the code above.
De Morgan’s Theorem
– AND –
~(A + B) = ~A · ~B
1. instruction registers
2. microprogrammed/microinstruction address generator
3. microprogram counter
4. control signals
1. RD (Read)
2. WR (Write)
3. ALE (Address Latch Enable)
Example:
Decode instruction
Ix Iz
Iy
t1 C,A,H G D,A,C
t2 G,C B,C
3 Instruction Registers:
1.Ix
2. Iy
3. Iz
1. Horizontal
2. Vertical
Example:
Solution:
16 – BITS GPRs
REGIS ENCODE DECODED FORMAT
TERS D
FORMAT
A B C D D D D D D D D D D D D10 D11 D12 D13 D14 D15
0 1 2 3 4 5 6 7 8 9
R0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R2 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
R3 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
R4 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
R5 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
R6 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
R7 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
R8 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
R9 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
R10 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
R11 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
R12 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
R13 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
R14 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
R15 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
DECODED FORMAT
MUL R3, R6
Add R7, R9
Indivi Individu
dual al
CS Control
(Inter Micro-instruction Branch
Signal
nal to Address
lines
CPU)
2. Vertical Micro-instruction
Solution:
INSTRUCTION ENCODED FORMAT DECODED FORMAT
A B D0 D1 D2 D3
ADD 0 0 1 0 0 0
SUB 0 1 0 1 0 0
MUL 1 0 0 0 1 0
DIV 1 1 0 0 0 1
16 – BITS GPRs
REGIS ENCODE DECODED FORMAT
TERS D
FORMAT
A B C D D D D D D D D D D D D10 D11 D12 D13 D14 D15
0 1 2 3 4 5 6 7 8 9
R0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R2 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
R3 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
R4 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
R5 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
R6 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
R7 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
R8 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
R9 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
R10 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
R11 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
R12 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
R13 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
R14 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
R15 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
ENCODED FORMAT
MUL R3, R6
10 0011 0110 Answer
Data
Source
D1
D2
D3
D4
D5
Return Address Equivalent to Decimal:
1, 2, 3, 6, 4, 5, 7, 7, 7
Activity:
References:
https://www.javatpoint.com/risc-vs-cisc#:~:text=Examples%20of
%20CISC%20processors%20are,x86%20and%20the%20System%2F360.
https://www.youtube.com/watch?v=yi0FhRqDJfo
https://byjus.com/maths/number-system/
https://web.stanford.edu/class/cs101/bits-bytes.html#:~:text=a
%20%22bit%22%20is%20atomic%3A,states%20can%20store%201%20bit
https://www.intel.com/content/dam/www/program/education/us/en/
documents/the-journery-inside/digital/tji-digital-info-
handout4.pdf
https://www.youtube.com/watch?v=3CKaka6n_ek
https://www.youtube.com/watch?v=0rLiYpy2CqQ
https://www.webopedia.com/definitions/ascii/#:~:text=It%20is%20a
%20code%20for,from%20one%20computer%20to%20another.
https://www.youtube.com/watch?v=hyXGB8UYDVg
https://www.youtube.com/watch?
v=LNPBr3WvuNg&list=RDLVhyXGB8UYDVg&index=4
https://www.vivaxsolutions.com/web/lmc.aspx
https://tesdanciireviewer.blogspot.com/2012/08/identifying-
motherboard-hardware-parts.html
https://www.javatpoint.com/examples-of-deterministic-finite-
automata
https://www.youtube.com/watch?v=WsGAo-_rHSo