Tuesday, December 13

CHAPTER 7: THE PROCESSOR

SINGLE CYCLE CPU DATAPATH

That sure sounds complicated. So let's try making it sounds as simple as we possibly can. 

Before that, you need to know... what is a combinational circuit??

Credits to Google


A combinational circuit is only right if it comes together with some combinational elements.

Introducing the Combinational Logic - half adder & full adder.

Half Adder
- Two inputs and two outputs (carry and sum)


One output will represent sum and the other will represent carry.

Full Adder
- Three inputs and two outputs (carry and sum)



Now, something to not be confuse about - sequential circuit.

What is a sequential circuit??

Credits to Google

Sequential logic circuit is said to be a combinational logic circuit but with the addition of state (memory).

In sequential logic, we have 2 types - synchronous and asynchronous logic. I'm gonna be focusing on the synchronous logic circuit since most CPUs are that type. In synchronous logic, a sequence of repetitive pulses known as the clock signal is distributed to all the memory elements in the circuit. There is a technique known as pipeline, which purpose is to improve the clock rate.

Now, you need to know CPU clocking. Keep in mind that

single cycle = one instruction per second

Clock cycle is typically long to ensure each instruction to complete all stages without interruption. So, each cycle will take a constant amount of time to execute every instruction (in one cycle), regardless of the complexity of the instructions. It can be a big disadvantage of single cycle CPU as it operates at the speed of the slowest instruction to complete the exeution in one clock tick.

One cycle CPU consists of the following:-

Step 1: Instruction fetch (fetched from memory)
Step 2: Decode/ Register read (read the opcode to determine instruction types and field lengths)
Step 3: Arithmetic-Logic Unit (the real work; arithmetic, shifting, logic and comparisons)
Step 4: Memory Access (only for the load and store instructions as the others remain idle)
Step 5: Register write (write the result of some computation into a register)


Multiple cycles CPU on the other hand requires multiple cycles to execute a single instruction. The number of cycles needed to execute a certain instruction is flexible depending on the complexity of the instruction.

In the CPU, there are 2 other parts which is Control Unit and Datapath.

Control Unit
It does not execute any program instructions but instead it tells the datapath what needs to be done. It deals with the ALU and memory.

Datapath
It perform operations required by the program instructions.


To summarize, processor has 4 main functions which are fetch, decode, execute and write back. And the basic elements of a processor are:

1. Arithmetic Logic Unit (ALU)
- which is the core to arithmetic and logic operations

2. Floating Point Unit (FPU)
- specializing in solving numbers quicker than a basic microprocessor circuitry can

3. L1 and L2 cache memory
- saves time compared to retrieving data from the RAM

Briefly, processor is most commonly referred to as the Central Processing Unit (CPU) but

DO YOU KNOW?

CPU isn't the only processor in a computer. There is also Graphics Processing Unit (GPU) and other hardwares performing some processing independently within a computer!

The main competitors for processor in the current market - Intel and AMD

Pheww! Hope you find this post to be somewhat helpful. If there seems to be any mistake, don't hesitate to hit me up! Til then, ALL THE BEST!!


Glossary:

state - In computer science, the state of a digital logic circuit is a term used for all stored information.
clock rate - An indicator to the frequency of the processor's speed.
clock cycle - Measurement for a clock rate is clock cycles per second or the SI unit is known as hertz (Hz).
throughput - Number of instructions completed per second.
CPI - Cycles per instruction


Reference 1
Reference 2
Reference 3
Reference 4

No comments:

Post a Comment