Docsity

Building a microprocessor, Slide di Sistemi Embedded

Anteprima parziale del testo

Scarica Building a microprocessor e più Slide in PDF di Sistemi Embedded solo su Docsity!

Embedded Systems

Research Group

Marco Scianna Centro ALGORITMI Department of Industrial Electronics School of Engineering, University of Minho, Guimarães - PORTUGAL

Building a

Microprocessor

ARCHITECTURE DATAPATH SIMULATION

INTRODUCTION

What Is a Microprocessor?

A microprocessor is an integrated circuit that implements the functions of a CPU on a single chip.

What it does

It executes instructions in sequence: it reads, decodes, and processes data according to a stored program.

Where it is found

In every modern electronic device — from PCs to smart appliances.

What sets it apart

Unlike a simple circuit, it is programmable : behavior changes with software, not hardware.

1945 — STILL RELEVANT TODAY

The Von Neumann

Model

Proposed by John von Neumann in 1945 , this architectural scheme still defines the fundamental structure of almost every modern computer today.

Unified memory: instructions and data share the same memory space — the principle of the "stored program". Shared bus: CPU, memory, and I/O communicate through a common bus, the cause of the classic Von Neumann bottleneck.

The Harvard architecture physically separates data and instruction memory, overcoming this limit in modern embedded systems.

CPU Component Map

Registers

PC · IR · MAR · MDR · ACC

Functional Units

ALU · Control Unit (CU)

Interconnection

Internal bus · System bus

Hardware Implementation

A circuit-level schematic showing the PC register's internal logic gates and connections.

Functional Block Diagram

A high-level block diagram showing the PC register with clock input, reset signal, increment logic, and output.

The Instruction Register (IR)

The IR stores the instruction currently being executed , fetched from memory during the fetch phase.

Opcode

The most significant bits encode what to do — e.g. ADD, LOAD, STORE, JUMP.

Operand

The remaining bits indicate what to operate on — a memory address or an immediate value.

16-bit example:

[ 0110 | 0000 1011 0100 ]

→ Opcode ADD (0110) + Address 0x0B

The Control Unit reads the opcode from the IR to generate the appropriate control signals for the rest of the datapath.

Y

A B

Integer

operand

Integer

operand

Integer

result

Status

Status

Opcode

FUNCTIONAL UNIT

The ALU — Arithmetic

Logic Unit

The computational heart of the CPU. It receives two operands as input, performs the operation selected by the CU, and produces a result.

Arithmetic operations

Addition, subtraction, integer multiplication, negation.

Logical operations

AND, OR, NOT, XOR — essential for masks and bit tests.

Status flags

Zero (Z) · Carry (C) · Overflow (V) — used by the CU for conditional branches.

The Control Unit (CU)

The CU is the CPU's "orchestra conductor": it reads the opcode from the IR and generates the control signals that coordinate every component of the datapath.

Hardwired CU

Hardwired combinational logic — maximum speed, minimum flexibility. Used in modern RISC CPUs.

Microprogrammed CU

Complex instructions translated into micro- operations via internal ROM. Flexible, used in CISC architectures.

The generated signals include: RegRead, ALUop, MemWrite, RegWrite, Branch.

The Fetch–Decode–Execute Cycle

The CPU repeats this cycle millions of times per second — it is the heartbeat of every processor.

Fetch

PC Increment

Decode

Execute

Understanding this cycle is the key to reading any architecture — from a simple microcontroller to an out-of-order superscalar CPU.

FETCH: Reading the Instruction

The Fetch phase retrieves the instruction from memory and brings it into the IR. The PC is then incremented to point to the next instruction.

MDR ← Data IR ← MDR PC +

Memory Access

PC → MAR

Each arrow corresponds to a data transfer on the internal bus. The cycle starts with every clock pulse.

EXECUTE: Execute the

Instruction

Concrete example: execution of ADD x — each micro-operation takes one clock cycle.

1

Step 1

ACC → T

Saves the accumulator in the temporary register

2

Step 2

M[x] → T Reads the operand from memory

3

Step 3

ALU(T0+T1) → ACC

Calculates the sum and writes the result

What is an ISA

The Instruction Set Architecture is the processor's "vocabulary": it defines every operation the CPU is able to execute.

Instruction structure

Each instruction is made up of opcode + operand The opcode identifies the operation (e.g. 0001 = LOAD) The operand specifies the address or the data Example: 0001 000010110100 = LOAD 180

The ISA is the boundary between hardware and software: the compiler translates source code into ISA instructions.

Example 16-bit Instruction Encoding

Each instruction is divided into opcode and operand. The opcode identifies the operation, while the operand specifies data or address information. This simple ISA is enough to implement loading, arithmetic, storing, branching, and halting.

TOOL

Logisim-

Evolution

Free and open-source software for digital circuit simulation , used at universities around the world.

Free and cross-platform

Available on Windows, Linux, and macOS (including Apple Silicon M1)

Academic standard

Adopted in computer architecture courses internationally