Page 63 - Computer_Science_F5
P. 63

Computer Science  Registers                        the outcome of recent operations,
                                                          such as carry flags or zero flags,
           In the heart of a computer processor lies a
                                                          used for conditional branching and
           critical set of high-speed memory locations
                                                          error handling.
           called registers. Registers act as the CPU’s
           workbench, temporarily storing data that
          FOR ONLINE READING ONLY
           is actively involved in calculations or
                                                     registers
           manipulations. Their close proximity to   Function and operations of CPU
           the processor allows for significantly faster   (a)  Data  storage         and
           access compared to fetching data from         manipulation:  Registers act as a
           cache and main memory.                        temporary holding ground for data
                                                         being processed. Instructions  in
           Classification of registers:                  the ISA typically reference specific
           There are two main classifications of         registers for operands (data involved
           registers within an ISA, each with distinct   in the operation) and destinations for
           purposes:                                     the results.
                                                     (b)  Improving performance: By keeping
           (a) General Purpose Registers (GPRs):         frequently accessed data readily
           These are versatile  storage locations        available, registers significantly
           that can be used by any instruction in        reduce the need to fetch data from
           the  CPU.  They  can  store a  variety  of    slower main memory, leading to faster
           data  types  like  integers,  floating-point   execution speeds.
           numbers, or memory addresses during       (c)  Facilitating function calls: When a
           program execution.                            program calls a function, arguments
                                                         are often passed through registers,
           (b) Special Purpose Registers (SPRs):         enabling efficient communication
           These registers are dedicated to specific     between different parts of the code.
           control functions for the CPU  itself.    (d)  Conditional branching: Status flags
           They hold vital information for smooth        set in special purpose registers are
           operation. Examples are;                      used for conditional branching in
           (i)   Program Counter (PC): This register     programs.
                 keeps track of the next instruction to
                 be executed, ensuring that program   Visualizing registers
                 flows seamlessly.                   As depicted in Figure 1.52, a processor

           (ii)  Stack Pointer (SP): This register   houses  multiple  register  files  such
                 plays an important role in managing   as GPRs, and SPRs. Data paths,
                 function calls and local variables   illustrated in the form of arrows, show
                 within a program.                   how  data  flows  between  registers,  and
           (iii)  Status  Registers (SR):  These     the  Arithmetic Logic Unit (ALU) for
                 registers hold information about    performing calculations,  and the main


                                                  54
                                                                for Advanced Secondary Schools



     Computer Science Form 5.indd   54                                                      23/07/2024   12:32
   58   59   60   61   62   63   64   65   66   67   68