CPU (Central Processing Unit)

The CPU contains:

  • General purpose registers (about 10 or so)
    • General purpose means that the register can be used for multiple (different) purposes
    • General purpose registers are used as inputs and outputs in arithmetic and logical operations performed by the CPU
      • When the CPU add 2 values . . .
        • The first value of the addition is obtained from a general purpose register
        • The second value of the addition is obtained from another general purpose register
        • The sum is stored in a general purpose register
  • An Arithmetic and Logic Unit (ALU)
    • The ALU is a complex digital circuit can perform arithmetic (+, −, ×, /) and logical (AND, OR, NOT) operations 
  • A number of special purpose register
    • These registers also store binary values (32 or 64 bits)
    • They are “special purpose” meaning that the value stored in the register is used for one (special) purpose
      (I.e.: each special purpose register has a dedicated function)
    • A CPU will always contain the following 3 special purpose registers:
      • Program Counter (PC) – contains the adddress (in the RAM) of the next computer instruction that the processor will fetch and execute (after the processor finish executing the instruction in the Instruction Register)
  • Instruction Register (IR) – contains the instruction (binary) code (obtained from memory) of the current instruction that the CPU is executing
  • Processor Status Register (PSR) – the status code of the result after executing the last (executed) instruction
    • When the processor executes an instruction, the status of the execution may be recorded in the PSR
    • Example: if the last instruction was “x − y”, then PSR will contain status information that indicate whether x < y or x ≤ y or x > y etc…

These 3 special purpose registers together enable the CPU to

  • Fetch the next computer instruction (in memory given by the Program Counter )
  • Execute the (fetched) instruction

CPU will use high/low voltage signals conveyed through the bus wires to specify what operation that the CPU wants to perform

  1. Low voltage ( binary number 0) – CPU issues a WRITE command to the memory
  2. High voltage (binary number 1) – CPU issues a READ  command to the memory

Suppose the CPU wants to store 1010101010101010 into the memory location 4, then the CPU will emits the following electrical signals (in order):

  1.  0000000000000100  (= 4 in binary) on the address bus
  2.      0                 (= code for the write command) on the control bus 
  3.      1010101010101010  (= the data) on the data bus

Data transfer between CPU and memory

  • The CPU can read (= obtain or recall) data that is stored in the memory
  • The CPU can write (= store) data into some cells in the memory
  • The memory address will specify which memory cells the requested operation will be performed

Reference

  1. The structure of the Central Processing Unit (CPU). (n.d.). Retrieved July 22, 2021, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syl-ARM/4-intro/cpu.html
  2. Usage of the general purpose registers. (n.d.). Retrieved July 22, 2021, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syl-ARM/4-intro/gen-reg.html
  3. Details of the Instruction Execution Cycle explained with diagrams. (n.d.). Retrieved July 22, 2021, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syl-ARM/4-intro/instr-exec-cycle2.html

--- :: Skyferia Tech's Related Posts :: ---