Introduction - mbits-mirafra/computerArchitectureCourse GitHub Wiki
What is a computer?
The term "computer" is derived from the Latin word "computare" which means to calculate. A computer is an electronic device that manipulates information, or data. It has the ability to store, retrieve, and process data. It works with the help of programs and it has a memory that stores the data, programs. Computers can be categorized into various types based on their size, capabilities, and usage, such as personal computers (desktops and laptops), servers, mainframes, supercomputers, and embedded systems. Computer systems consist mainly of two parts. They are hardware and software. The hardware is electronic circuitry that helps to compute the mathematical computations, and the software is the programs that help the hardware to compute.
What is computer architecture?
All computers are based around a set of rules stating how software and hardware join together and interact to make them work. This is known as computer architecture. It determines how its components interact with each other. It’s like the blueprint of a computer. It specifies how the machine communicates with programming languages and the processors that are specifically designed for it. It is concerned with balancing the performance, efficiency, cost, and reliability of a computer system.
The parts of a computer architecture can be subdivided in several ways. The main components of a computer architecture are the CPU, memory, and peripherals. All these elements are linked by the system bus, which comprises an address bus, a data bus, and a control bus.
Key components of computer architecture include:
Input/Output (I/O) devices
These devices allow the computer to communicate with the external world. Examples include keyboards, mice, monitors, printers, and networking devices.
Input devices
Mouse
Keyboard
Output devices
Monitor
Printer
central processing unit (CPU)
The central processing unit (CPU) is the brain of a computer, and its primary function is to execute programs. The CPU is divided into three units:
1)Control unit
2)Memory unit
3)Arithmetic and Logic Unit (ALU)
control unit: Contol all the activities of computer.
memory unit:
Memory unit is used to store and retrieve data.There are different types of memory, including RAM (Random Access Memory) for temporary data storage and ROM (Read-Only Memory) for permanent data storage. The memory has categorized into two types
Volatile memory
volatile memory is the type of memory in which data is lost as it is powered-off. Contents of Volatile memory are stored temporarily. It is faster than non-volatile memory. Random Access Memory is an example of volatile memory.
Non-volatile memory
It is the type of memory in which data or information is not lost within the memory even power is shut-down. ROM (Read Only Memory) is an example of non-volatile memory. Non-volatile memory has a huge impact on a system’s storage capacity.
ALU :
The ALU is responsible for the actual execution of instructions.
Data is entered through input devices, such as a keyboard, and is controlled by the control unit. The control unit sends this data to memory for temporary storage in RAM. The temporarily stored data is then directed to the ALU for processing through the control unit. The ALU processes the data, and the processed data is sent back to the memory unit for permanent storage through the control unit. Processed data can also be sent directly to an output unit through the control unit, or it can be sent from the permanently stored memory to an output device.
Instruction Set
This defines the set of instructions that a CPU can execute. It serves as an interface between the hardware and the software, allowing software developers to write programs without needing to understand the underlying hardware details.
Pipelining
Pipelining enhances system performance through basic hardware design changes, enabling parallel execution at the hardware level. While it doesn't decrease the execution time of individual instructions, it reduces the overall program execution time by processing multiple instructions simultaneously in an overlapped manner within distinct timing states. Pipelining improves the speed of a machine. Pipeline improves performance by increasing instruction throughput, without decreasing the execution time of each instruction.
The CPU hardware consists of multiple functional units called pipeline stages, each dedicated to an independent task. The number of stages varies between processors, and it determines the simultaneous execution capability of the CPU. The number of instructions simultaneously executed equals the number of stages in the pipeline. Each stage corresponds to one machine cycle, and the cycle length is determined by the slowest stage's time. The control unit manages all stages using control signals, and each stage has a buffer register holding data. The CPU clock synchronizes the stages, and at each clock cycle, each stage takes input from its buffer-in register.
Cache Memory
Cache memory lies on the path between the CPU and the main memory. It facilitates the transfer of data between the processor and the main memory at the speed which matches to the speed of the processor. The most important use of cache memory is that it is used to reduce the average time to access data from the main memory.
System Bus
The system bus connects the CPU to other major components like memory and I/O devices, facilitating data transfer. system bus is a set of wires. The elements of the computer are linked to the buses. It can transfer data from one element to another, the source element outputs data onto the bus. The destination element then inputs this information from the bus. As the complexity of a computer system improves, it becomes more effective at using buses instead of a direct connection between each pair of devices. The system has three buses.
1)address bus-address bus used to access the suitable memory location.
2)control bus-control bus is a collection of individual control signals. These signals indicate whether data is to be read into or written out of the CPU.
3)data bus-Data is shared via the data bus.
Why learn Computer Architecture?
Studying Computer Architecture provides a number of benefits, includes :
1. Understanding of Computers :
Learning about computer architecture helps to understand how computers work at the most basic level. It also helps to understand the fundamental components of a computer system, such as the central processing unit (CPU), memory, input/output devices, and the interconnection between these components. This knowledge is essential for computer engineers, software developers, and IT professionals who need to have a deep understanding of computer systems.
2. Design and Development :
This knowledge will be helpful to design / build a new computer or a new version of a computer. The opportunity for designing a new processor or new computer is very very rare and you may or may not get it, it is very less likely that you will get that opportunity. Studying computer architecture helps to understand the trade-offs and decisions that go into designing efficient and effective computer systems.
3. Problem solving :
Understanding computer architecture helps in solving complex technical problems, as well as improving the performance and reliability of computer systems. In the development process, issues and bugs may arise. Problem-solving skills will helps to identify the root cause of problems, debug hardware-related issues, and implement effective solutions.
4. Advancements in technology :
You can become aware of new advancements in technology and understand how they can be used to improve the performance and capabilities of computer systems. Advances in memory technologies, such as the development of new types of RAM (Random Access Memory) and non-volatile memory, influence the design of memory hierarchies in computer systems. Learning about technological advancements opens up opportunities for research and innovation in computer architecture. This involvement in research contributes to personal and professional growth.
5. Career opportunities :
Having a strong foundation in computer architecture is a valuable skill in many fields,offering opportunities for both hardware and software-focused roles including software development, system programming and hardware design.
Abstraction
In computer architecture, abstraction means to leave out information that is less relevant and focus on information that is more important at the time of observation. As one goes into depth one gets more and more information. If we see the relationship between architecture and circuit they are separated by several layers of abstraction. With abstraction it is easier to develop complex systems that are easier to understand and manage.
Abstraction can divided into 2 Software Abstraction and Hardware abstraction.
Software abstraction
Computers only understand binary; they are also called machine level language. If you had to add 2 numbers, say a and b then the binary equivalent would look something like 1001010100101110 This would be tiresome for programmers,
To solve this problem an Assembler is used. Assembler converts human readable code to computer readable i.e, Machine level language.
There is a compiler that converts high level language to a low level language.
To cut the long story short, A high level code is converted to low level code by the compiler, the low level code is converted to machine level code by the assembler
Hardware Abstraction
We have multiple hardware components in the computer like CPU, RAM, ROM. They are connected to each other. But if we dissect each component like the CPU, it is made up of Adders, Mux and many more components. If we go deeper into the layers again we find Adders made up of gates. Finally the gates are made up of Transistors.
Architecture Levels
In the context of computer architecture, there are typically five abstraction levels, starting from the lowest level of digital logic circuits and progressing to the highest level of assembly language.
Fig: Different architecture levels
Digital logic level: Also called as the Circuit Level focuses on the design and implementation of electronic circuits by using digital logic components. Binary data is used to compute any operations with the gates present.
Microarchitecture level: This layer actually fills the gap between the instruction and the logic modules, that is it deals with the internal organization of the processor or CPU and defines how the processor executes instructions at the hardware level.
- When we consider the logic modules they are nothing but the ALU or the register files present inside the CPU which themselves will not define any instructions and perform accordingly but they work based on the way how they are connected and how the input data is let to flow between them which defines the instructions.
Instruction set level: It is the lowest level visible to the user or the programmer and is the interface between the software and the hardware.
- It defines the set of instructions that a processor can execute for example we as an user are not bothered about the presence of transistors or gates or the flip flops or mux present inside but are only concerned about the instructions set for computations of required operations.
Fig: Instruction set Architecture placed in between the hardware and the software
From the above diagram
- The layers above ISA form the software and the layers below ISA form the hardware.
- The top most Application program runs on the processor with the help of the system software.
- That is, the compiler translates high level programs to machine level code and OS (operating systems) manages the resources to compile, load and execute programs.
- Below ISA is the CPU board design and the circuit design.
- Next we need to have a layout indicating the position of the transistors, wires and the interconnections between them and then the fabrication is done accordingly.
Assembly language: Is a low-level programming language representing the machine code instructions that a CPU can execute.
- It defines what a processor state is and how this state changes from instruction to instruction when we execute.
- The state is defined in terms of contents of its memory with permanent data and program and contents of various registers present in the processor that is the data which is currently under use. For example when we perform any arithmetic operations the operand will come from a register file and the result will go back to the register file.
- Assembly language provides a more human-readable format for programming compared to machine code, which consists of binary instructions.