DT027G Datorarkitektur-English

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Machine Translated by Google

Computer architecture
Structure and data manipulation

Jimmy Åhlander
2023-09-04

jimmy.ahlander@miun.se 1
Machine Translated by Google

Agenda

• Computer architecture.

– Processor (CPU).
- Memories.
– Prefixes and their meaning.

• Machine code.

• The machine cycle.


• Performance and bottlenecks.

2
Machine Translated by Google

Computer architecture
von Neumann architecture

3
Machine Translated by Google

The processor
Central Processing Unit (CPU)
• Arithmetic Logic Unit (ALU).
- Perform the work.

• Control unit (CU).


– Control the program
flow. •
Registers: – General.
– Registers for intermediate storage of data to and from the ALU.

- Specialized.
– Program counter (PC).
– Instruction register (IR).

4
Machine Translated by Google

Memories
Minneshierarchy

• Primary memory.
– Working memory. Called casually RAM memory.
• Secondary mine.
– Hard drives, solid-state drive (SSD), flash memory. •
Cache memory.
– Temporary storage between memory and registers in the
CPU. • Registry.

• The processor only processes data in


registers.
– Data is copied to and from registers.

5
Machine Translated by Google

Primary memory
Working memory

• Fast, but normally requires power to maintain


the memory.

• Organized into cells containing several pieces,


usually 1 byte (8 bits).
– 1 B = 1 byte –
1 b = 1 bit

• RAM – Random Access Memory.


• ROM – Read Only Memory.
– Maintains memory without power.

6
Machine Translated by Google

The pieces in memory

High-order end 1001 1101 Low-order end

7
Machine Translated by Google

Secondary mine
Storage memory
• Differences from primary
memory: – Slower.
– Retains memory without power.
- Stores more cheaper.

• Storage principles: –
Magnetism: hard drives, floppy disks.
– Optical: CD, DVD.
– Electrostatic: Flash, SSD.

• Reading and writing: –


Mechanics (not random access = not constant access time): hard disk, CD.
– Ej mekanik (random access): flash, ssd.

8
Machine Translated by Google

Prefixes and their meanings

• Confusing representation of kilos:


– Kilo is often used incorrectly: 1 kilobyte = 1024 bytes?
• New system introduced by IEC since 1998 following SI standard,
with new units:
– Kilobinary (Ki), Megabinary (Mi), Gigabinary (Gi), osv.

• SI is followed in:
– data transfer (100 – = 108 ),

hard drives (1 = 1012 ), – academia,

– several operating systems, but notably not Microsoft Windows.

• Always pay attention!

9
Machine Translated by Google

Prefixes and their meanings


Storage capacity

prefix SI (IEC) Older convention

kB 1 000 bytes (103 ) 1 024 bytes (2 10)

MB 1 000 000 bytes 1 048 576 bytes

KiB 1024 bytes


-

MiB 1 048 576 bytes


-

10
Machine Translated by Google

11
Machine Translated by Google

Machine code

• Early computers separated code and data.

• Stored-program concept (von Neumann): –


Instructions and data are stored in the same memory.
– Machine instructions are coded.

• Machine code:
– Op-code Instruction
– Operand Data that the instruction operates on
12
Machine Translated by Google

Machine code
Central Processing Unit (CPU)
• Machine code:
– Op-code Instruction
– Operand Data that the instruction operates on

For example. store the contents of register 0x5 at memory address 0xA7.

13
Machine Translated by Google

Machine code
Machine instructions

• Data transfer:
– LOAD, STORE.

• Arithmetic and logical:


– ADD, SUB, AND, OR, ROTATE, SHIFT.

• Flow control:
– JUMP, BRANCH.

14
Machine Translated by Google

Machine code
Example: Add two numbers

Add two numbers located in primary memory and store


the result in primary memory.

Example:
1. Get the first number into a register.
2. Get the second number into another register.
3. Tell the ALU to add the registers to a third register.

4. Store the result in primary memory.


5. Stop.

15
Machine Translated by Google

The machine cycle


The instruction cycle (one turn per instruction)

16
Machine Translated by Google

The machine cycle

17
Machine Translated by Google

The machine cycle

18
Machine Translated by Google

The machine cycle

19
Machine Translated by Google

The machine cycle

• The controller repeats the machine cycle: fetch,


decode, execute.

• The program counter always points to the next instruction.


• Read into the instruction register. •
Interpret the instruction.
• Perform requested activity.

• No difference between code and data. A program


can change its own code.

20
Machine Translated by Google

Performance and bottlenecks


Peripheral devices

• Buses:
– Address, data, control.

• von Neumann
bottleneck.

• Enlarge?
• Cache
memories. • Branch prediction.

21
Machine Translated by Google

22
Machine Translated by Google

Performance and bottlenecks


CPU

• Word length: 16, 32 or 64-bit CPU.


• Processor speed vs. "throughput".
– Pipelining: fetch, decode, execute can proceed simultaneously through
several channels (pipes) to the ALU.

• Multiple cores in CPU.

– Parallelization.
– Determinism and Amdahl's law.

• Several CPUs in the computer:


- General.
– Specialized (for e.g. Graphics).

23
Machine Translated by Google

Performance and bottlenecks


Bottleneck

The bottleneck is the limiting factor for the overall


performance of the system. •
Can be different bottlenecks for different purposes.

• Processor, bus and memory speed. • Bus


width.
• Size of primary memory. •
Secondary memory (hard disk or SSD). •
Graphics card.

24
Machine Translated by Google

Computer architecture
Summary
• The structure of the computer.
• The internal workings of the processor.

• Machine close programming. •

Performance and capacity. • We

don't agree on what kilo means.

25

You might also like