Pre-study: Comp architecture | Assembly Lang (x86) Flashcards
whereas utilization happens to be the attribute of organization
now a generic computer is comprised of various functional units
amongst them the processor is the most important one
the processor itself is a collection of register section and arithmetic and
logic unit also known as alu and a timing and
control unit along with these it also has another
section called interface
processor
the brain of the system
memory
stores all
the instructions reading ways the processor works
accordingly also we can store data inside the memory another
functional unit is the input output peripheral
now the term peripheral is just a fancy version of device
all of these are very essential when computation involving computers
are concerned so the programs or the set of instructions are stored into the
memory using input devices so that the
processor can execute them during execution the required inputs can
either be fed into the system using the same input peripherals or
stored into the memory beforehand
outputs can be generated onto the output devices or else can be
stored into the _________________________________________.
memory for later extraction the
intercommunication of all these functional components is
carried out with the help of system bus
two predominant approaches to the architecture that influence how computer processors function.
Complex instruction set computer (CISC) and reduced instruction set computer (RISC)
CISC
processors have one processing unit, auxiliary memory, and a tiny register set containing hundreds of unique commands. These processors execute a task with a single instruction, making a programmer’s work simpler since fewer lines of code are required to complete the operation. This method utilizes less memory but may need more time to execute instructions.
A reassessment led to the creation of high-performance computers based on the _____ architecture. The hardware is designed to be as basic and swift as possible, and sophisticated instructions can be executed with simpler ones.
RISC
Purpose of computer architecture
Everything a system performs, from online surfing to printing, involves the transmission and processing of numbers. A computer’s architecture is merely a mathematical system intended to collect, transmit, and interpret numbers.
Data in numbers
The computer stores all data as numerals. When a developer is engrossed in machine learning code and analyzing sophisticated algorithms and data structures, it is easy to forget this.
Manipulating data
The computer manages information using numerical operations. It is possible to display an image on a screen by transferring a matrix of digits to the video memory, with every number reflecting a pixel of color.
Multifaceted functions
The components of a computer architecture include both software and hardware. The processor — hardware that executes computer programs — is the primary part of any computer.
Booting up
At the most elementary level of a computer design, programs are executed by the processor whenever the computer is switched on. These programs configure the computer’s proper functioning and initialize the different hardware sub-components to a known state. This software is known as firmware since it is persistently preserved in the computer’s memory.
Support for temporary storage
Memory is also a vital component of computer architecture, with several types often present in a single system. The memory is used to hold programs (applications) while they are being executed by the processor and the data being processed by the programs.
support for permanent storage
There can also be tools for storing data or sending information to the external world as part of the computer system. These provide text inputs through the keyboard, the presentation of knowledge on a monitor, and the transfer of programs and data from or to a disc drive.
User-facing functionality
Software governs the operation and functioning of a computer. Several software ‘layers’ exist in computer architecture. Typically, a layer would only interface with layers below or above it.
Depending on the method of categorization, 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. Within this framework, the computer architecture has eight key components
- Input unit and associated peripherials
- Output unit and associted peripherals
- Storage unit/ memory
- Central Processing Unit (CPU)
- Operating system (OS)
Input unit and associated peripherals
The input unit provides external data sources to the computer system. Therefore, it connects the external environment to the computer. It receives information from input devices, translates it to machine language, and then inserts it within the computer system. The keyboard, mouse, or other input devices are the most often utilized and have corresponding hardware drivers that allow them to work in sync with the rest of the computer architecture.
Output unit and associated peripherals
The output unit delivers the computer process’s results to the user. A majority of the output data comprises music, graphics, or video. A computer architecture’s output devices encompass the display, printing unit, speakers, headphones, etc.
To play an MP3 file, for instance, the system reads a number array from the disc and into memory. The computer architecture manipulates these numbers to convert compressed audio data to uncompressed audio data and then outputs the resulting set of numbers (uncompressed audio file) to the audio chips. The chip then makes it user-ready through the output unit and associated peripherals.
Storage unit/memory
The storage unit contains numerous computer parts that are employed to store data. It is typically separated into primary storage and secondary storage.
RAM
supplies the necessary information straight to the CPU. It is a temporary memory that stores data and instructions intermittently.
ROM
memory type that contains pre-installed instructions, including firmware. This memory’s content is persistent and cannot be modified. ROM is utilized to boot the machine upon initial startup. The computer is now unaware of anything outside the ROM. The chip instructs it on how to set up the computer architecture, conduct a power-on self-test (POST), and finally locate the hard drive so that the operating system can be launched.
Secondary storage unit
inaccessible directly to the CPU. Before the CPU uses secondary storage data, it must be transferred to the main storage. Secondary storage permanently retains vast amounts of data. Examples include hard disk drives (HDDs), solid-state drives (SSDs), compact disks (CDs), etc.
CPU
includes registers, an arithmetic logic unit (ALU), and control circuits, which interpret and execute assembly language instructions. The CPU interacts with all the other parts of the computer architecture to make sense of the data and deliver the necessary output.
Registers
These are high-speed and purpose-built temporary memory devices. Rather than being referred to by their address, they are accessed and modified directly by the CPU throughout execution. Essentially, they contain data that the CPU is presently processing. Registers contain information, commands, addresses, and intermediate processing results.
ALU
The arithmetic logic unit includes the electrical circuitry that performs any arithmetic and logical processes on the supplied data. It is used to execute all arithmetic (additions, subtractions, multiplication, division) and logical (<, >, AND, OR, etc.) computations. Registers are used by the ALU to retain the data being processed.
Control Unit
The control unit collaborates with the computer’s input and output devices. It instructs the computer to execute stored program instructions via communication with the ALU and registers. The control unit aims to arrange data and instruction processing.
The microprocessor is the primary component of computer hardware that runs the CPU. Large printed circuit boards (PCBs) are utilized in all electronic systems, including desktops, calculators, and internet of things (IoT) devices. The Intel 40004 was the first microprocessor with all CPU components on a single chip.
In addition to these four core components, a computer architecture also has supporting elements that make it easier to function, such as:
Bootloader
The firmware contains the bootloader, a specific program executed by the processor that retrieves the operating system from the disc (or non-volatile memory or network interface, as deemed applicable) and loads it into the memory so that the processor can execute it. The bootloader is found on desktop and workstation computers and embedded devices. It is essential for all computer architectures.
Operating system (OS)
The operating system governs the computer’s functionality just above firmware. It manages memory usage and regulates devices such as the keyboard, mouse, display, and disc drives. The OS also provides the user with an interface, allowing them to launch apps and access data on the drive.
Typically, the operating system offers a set of tools for programs, allowing them to access the screen, disc drives, and other elements of the computer’s architecture.
Buses
A bus is a tangible collection of signal lines with a linked purpose; a good example is the universal serial bus (USB). Buses enable the flow of electrical impulses between various components of a computer’s design, transferring information from one system to another. The size of a bus is the count of information-transferring signal lines. A bus with a size of 8 bits, for instance, transports 8 data bits in a parallel formation.
Interrupts
Interrupts, also known as traps or exceptions in certain processors, are a method for redirecting the processor from the running of the current program so that it can handle an occurrence. Such an event might be a malfunction from a peripheral or just the fact that an I/O device has completed its previous duty and is presently ready for another one. Every time you press a key and click a mouse button, your system will generate an interrupt.
Types of Computer Architecture
- ISA
- microarchitecture
- Client-server architecture
- Single instruction, multiple data (SIMD) architecture
- Multicore architecture
Instruction set architecture (ISA) is a bridge between the software and hardware of a computer. It functions as a programmer’s viewpoint on a machine. Computers can only comprehend binary language (0 and 1), but humans can comprehend high-level language (if-else, while, conditions, and the like).
Consequently, ISA plays a crucial role in user-computer communications by translating high-level language into binary language.
ISA outlines the architecture of a computer in terms of the fundamental activities it must support. It’s not involved with implementation-specific computer features. Instruction set architecture dictates that the computer must assist:
Arithmetic/logic instructions: These instructions execute various mathematical or logical processing elements solely on a single or maybe more operands (data inputs).
Data transfer instructions: These instructions move commands from the memory or into the processor registers, or vice versa.
Branch and jump instructions: These instructions are essential to interrupt the logical sequence of instructions and jump to other destinations.
Microarchitecture
Microarchitecture, unlike ISA, focuses on the implementation of how instructions will be executed at a lower level. This is influenced by the microprocessor’s structural design.
Microarchitecture is a technique in which the instruction set architecture incorporates a processor. Engineering specialists and hardware scientists execute ISA with various microarchitectures that vary according to the development of new technologies. Therefore, processors may be physically designed to execute a certain instruction set without modifying the ISA.
Simply put, microarchitecture is the purpose-built logical arrangement of the microprocessor’s electrical components and data pathways. It facilitates the optimum execution of instructions.
Client-server architecture
Multiple clients (remote processors) may request and get services from a single, centralized server in a client-server system (host computer). Client computers allow users to request services from the server and receive the server’s reply. Servers receive and react to client inquiries.
A server should provide clients with a standardized, transparent interface so that they are unaware of the system’s features (software and hardware components) that are used to provide the service.
Clients are often located on desktops or laptops, while servers are typically located somewhere else on the network, on more powerful hardware. This computer architecture is most efficient when the clients and the servers frequently perform pre-specified responsibilities.
Single insttruction, multiple data (SIMD) architecture
Single instruction, multiple data (SIMD) computer systems can process multiple data points concurrently. This cleared the path for supercomputers and other devices with incredible performance capabilities. In this form of design, all processors receive an identical command from the control unit yet operate on distinct data packets. The shared memory unit requires numerous modules to interact with all CPUs concurrently.
Multicore architecture
Multicore is a framework wherein a single physical processor has the logic of multiple processors. A multicore architecture integrates numerous processing cores onto only one integrated circuit. The goal is to develop a system capable of doing more tasks concurrently, improving overall system performance.
The von Neumann architecture, often referred to as the Princeton architecture, is a computer architecture that was established in a 1945 presentation by John von Neumann and his collaborators in the First Draft of a Report on the EDVAC (electronic discrete variable automatic computer). This example of computer architecture proposes five components:
A processor with connected registers
A control unit capable of storing instructions
Memory capable of storing information as well as instructions and communicating via buses
Additional or external storage
Device input as well as output mechanisms
Harvard Architecture
The Harvard architecture refers to a computer architecture with distinct data and instruction storage and signal pathways. In contrast to the von Neumann architecture, in which program instructions and data use the very same memory and pathways, this design separates the two. In practice, a customized Harvard architecture with two distinct caches is employed (for data and instruction); X86 and Advanced RISC Machine (ARM) systems frequently employ this instruction.
You can declare static data regions (analogous to global variables) in x86 assembly using special assembler directives for this purpose.
Data declarations should be preceded by the .DATA directive.
the directives DB, DW, and DD can be used to declare one, two, and four byte data locations, respectively. Declared locations can be labeled with names for later reference — this is similar to declaring variables by ______, but abides by some lower level rules. For example, locations declared in sequence will be located in memory _____ to one another.
name
next
.DATA
var DB 64
Declare a byte, referred to as location var, containing the value 64.
var2 DB ?
DB 10
Declare an uninitialized byte, referred to as location var2.
Declare a byte with no label, containing the value 10. Its location is var2 + 1.
X DW ?
Declare a 2-byte uninitialized value, referred to as location X.
Y DD 30000
Declare a 4-byte value, referred to as location Y, initialized to 30000.
Unlike in high level languages where arrays can have many dimensions and are accessed by indices, arrays in x86 assembly language are simply a number of cells located contiguously in memory.
An array can be declared by just listing the values
common methods used for declaring arrays of data are the DUP directive and the use of string literals. The DUP directive tells the assembler to duplicate an expression a given number of times. For example, 4 DUP(2) is equivalent to
2, 2, 2, 2
Declaration:
Z DD 1, 2, 3
Declare three 4-byte values, initialized to 1, 2, and 3. The value of location Z + 8 will be 3.
bytes DB 10 DUP(?)
Declare 10 uninitialized bytes starting at location bytes.
arr
DD 100
DUP(0)
Declare 100 4-byte words starting at location arr, all initialized to 0
str DB ‘hello’, 0
Declare 6 bytes starting at the address str, initialized to the ASCII character values for hello and the null (0) byte.
Modern x86-compatible processors are capable of addressing up to 2^32 bytes of memory: memory addresses are 32-bits wide.
we used labels to refer to memory regions, these labels are actually replaced by the assembler with 32-bit quantities that specify addresses in memory. In addition to supporting referring to memory regions by labels (i.e. constant values), the x86 provides a flexible scheme for computing and referring to memory addresses:
up to two of the 32-bit registers and a 32-bit signed constant can be added together to compute a memory address. One of the registers can be optionally pre-multiplied by 2, 4, or 8.
stack
LIFO data structure
an array
stack pointer
This instruction has two operands: the first is the destination and the second specifies the source.
mov instruction
mov instructions using address computations:
mov eax, [ebx]
Move the 4 bytes in memory at the address contained in EBX into EAX
mov instructions using address computations:
mov [var], ebx
Move the contents of EBX into the 4 bytes at memory address var. (Note, var is a 32-bit constant).
mov instructions using address computations:
mov eax, [esi-4]
Move 4 bytes at memory address ESI + (-4) into EAX
mov instructions using address computations:
mov [es9+eax], cl mov edx, [esi+4**ebx]
Move the contents of CL into the byte at address ESI+EAX
Move the 4 bytes of data at address ESI+4*EBX into EDX
Some examples of invalid address calculations include:
mov eax, [ebx-ecx]
; Can only add register values
mov [eax+esi+edi], ebx
; At most 2 registers in address computation