MACHINE ARCHITECTURE
Memory architecture
The memory capacity unit: bit
or Byte
1 Byte= 8 bits
1 KB= 1024 Bytes = 210 Bytes
1 MB = 220 Bytes
1 GB = 230 Bytes
1 Tbits = 240 bits
Memory types
Memory types
Memory types
Memory types
Memory architecture
The CPU sees the
memory as a long table
Each element of the
table represents a Byte
(8 bits) of information
Each box (element)
has a unique id called
location or address
Memory architecture
Memory and CPU
The memory is managed by
the CPU
The CPU does:
Reading from the Central Memory
Writing to the RAM
Memory and CPU
Memory and CPU and Bus
The Bus is the medium of
transporting data between the
CPU and the Central Memory
Three types:
Data bus
Address bus
Command bus
How the CPU reads/ writes
from/on the memory?
What is a Program in Computer
science?
A set of instructions to be executed by a
CPU
An instruction is a command or an order to
be executed by a CPU/computer.
Example: B:=3; C:= 5; A:= B+C;
Information manipulated by the
CPU
We can store the result in the RAM
Information manipulated by the
CPU
Data (Values, Variables, Addresses)
Code (Machine code of instructions)
Where we store Data and
Instruction Code?
Where we store Data and
Program?
Harvard: Two Memories (one for data
and the second for Program code
Von Neumann: A single memory for
both data and program
Von Neumann Vs Harvard
Harvard Architecture
Architecture of Von Neumann
Architecture of Von Neumann
Harvard Vs Von Neumann
Von Neumann Architecture
CPU Architecture
CPU Architecture
The CPU is composed of three fondamental units: CU, ALU and MU
Inside buses connect different units
CPU Architecture/ UAL
What is an arithmetic-logic unit (ALU)?
An arithmetic-logic unit is the part of a central
processing unit that carries out arithmetic and
logic operations on the operands in computer
instruction words.
CPU Architecture/ UAL
What is an arithmetic-logic unit (ALU)?
CPU Architecture/ UAL
CPU Architecture/CU
CPU Architecture/CU
CPU Architecture/ Registers
CPU Architecture/ Registers
Registers are small, high-speed storage locations
within the CPU itself.
These registers are used for various purposes
in the execution of instructions and the
management of data within the CPU.
CPU Architecture/ Registers
Program Counter (PC): The program counter is a
register that holds the memory address of the next
instruction to be fetched and executed. It keeps
track of the current position in the program's
instruction sequence.
Instruction Register (IR): The instruction register
temporarily stores the currently executing
instruction fetched from memory. It holds the opcode
and operand(s) of the instruction being executed.
CPU Architecture/ Registers
CPU Architecture/ Registers
CPU Architecture/ Registers
Memory Address Register (MAR): The memory
address register holds the memory address of data
that needs to be read from or written to in the
computer's memory. When a program needs to
access memory, the CPU loads the MAR with the
appropriate address.
Memory Buffer Register (MBR): The memory buffer
register is used to temporarily hold data being
transferred between the CPU and memory. When
data is read from memory, it is placed in the MBR
before being processed.
CPU Architecture/ Registers
Accumulator (ACC): The accumulator is a general-
purpose register that is often used for performing
arithmetic and logical operations. The results of
these operations are typically stored in the
accumulator.
Index Register (IX): Some CPU architectures include
index registers that are used for performing
operations on memory addresses. These registers
can be added to or subtracted from memory
addresses to access data structures efficiently.
CPU Architecture/ Registers
Stack Pointer (SP): The stack pointer is a register
used to keep track of the top of the stack in the
computer's memory. It is crucial for managing
function calls, local variables, and the execution of
subroutines.
Flags Register (FLAGS): The flags register, also
known as the status register, contains various
condition code flags that indicate the outcome of
arithmetic and logical operations. Common flags
include the zero flag, carry flag, overflow flag, and
sign flag.
CPU Architecture/ Registers
Program Status Register (PSR): The program status
register is used to store various status and control
bits that affect the overall behavior of the CPU. It
may include interrupt enable/disable bits, privilege
levels, and other control flags.
General-Purpose Registers (GPRs): In addition to the
accumulator, CPUs typically have multiple general-
purpose registers that can be used for various data
manipulation tasks. The number and naming of
these registers may vary between CPU architectures.