0% found this document useful (0 votes)
5 views9 pages

Computer System Architecture Basics

A computer system consists of a processor, memory, and I/O devices, with the processor performing operations and memory storing data. Communication between the processor and memory is facilitated by buses: the address bus, data bus, and control bus, each serving distinct functions. Registers within the CPU temporarily hold data for quick access, and the flags register indicates the status of operations, aiding in decision-making during processing.

Uploaded by

f240668
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views9 pages

Computer System Architecture Basics

A computer system consists of a processor, memory, and I/O devices, with the processor performing operations and memory storing data. Communication between the processor and memory is facilitated by buses: the address bus, data bus, and control bus, each serving distinct functions. Registers within the CPU temporarily hold data for quick access, and the flags register indicates the status of operations, aiding in decision-making during processing.

Uploaded by

f240668
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

A computer system comprises of a processor, memory, and I/O devices.

 I/O is used for interfacing with the external world.


 while memory is the processor’s internal world.
 Processor is the core in this picture and is responsible for performing operations.

Key points in the above discussion are:

· There must be a mechanism to inform memory that we want to do the read operation

· There must be a mechanism to inform memory that we want to read precisely which element

· There must be a mechanism to transfer that data element from memory to processor

Address Bus
The group of bits that the processor uses to inform the memory about which element to read or
write is collectively known as the address bus.

Data Bus
Another important bus called the data bus is used to move the data from the memory to the
processor in a read operation and from the processor to the memory in a write operation.

Address Bus
The third group consists of miscellaneous independent lines used for control purposes.

For example, one line of the bus is used to inform the memory about whether to do the read
operation or the write operation. These lines are collectively known as the control bus.

Direction of Data Signal:


 The address bus is unidirectional and address always travels from processor to memory.
This is because memory is a dumb device and cannot predict which element the
processor at a particular instant of time needs.
 Data moves from both, processor to memory and memory to processor, so the data bus
is bidirectional.

 Some lines in the control bus carry signals from the CPU to peripherals (e.g., “Read”
or “Write” signals).
 Some lines carry signals from peripherals to the CPU (e.g., “Interrupt Request” or
“Device Ready”).
 This means the control bus is bidirectional in terms of function, but the individual lines
may be unidirectional depending on their purpose.
Memory Cell: A small storage unit in memory, usually 8 bits (1 byte), defined by its width (bits
it can store).

Address Bus: Carries the cell number (address) from CPU to memory to select which memory
cell to access.

Data Bus: Transfers the contents of the selected memory cell between CPU and memory.

Memory Dimensions: Defined by

1. Number of cells (like depth of a well)

2. Cell width (like width of a well)

Word Size vs. Cell Width: For simplest and fastest operation, memory cell width = data bus
width = processor word size, allowing full data transfer in one operation

The control bus carries signals from the CPU that indicate its intent to read or write.

Memory responds to these signals, which defines the direction of data flow.

Proper communication happens only if CPU and memory are synchronized:

 CPU wants to read → memory must provide data.

 CPU wants to write → memory must accept data.

If both are not synchronized (e.g., both try to write or both try to read), data transfer fails.
The basic purpose of a computer is to perform operations, and operations need operands.
Operands are the data on which we want to perform a certain operation. Consider the addition
operation; it involves adding two numbers to get their sum. We can have precisely one address
on the address bus and consequently precisely one element on the data bus. At the very same
instant the second operand cannot be brought inside the processor. As soon as the second is
selected, the first operand is no longer there.

For this reason there are temporary storage places inside the processor called registers.

Registers are small, fast storage units inside the CPU, like a scratch pad RAM.

They store data temporarily for quick access during processing.

Registers have precise locations and remember the data placed in them.

They are used when the CPU needs multiple data elements at the same time.

✅ Registers are similar to memory cells but are inside the processor for faster operations.

 Registers are very limited and precious compared to memory, so their number is small.
 Because there are multiple registers, each must be uniquely named or numbered for
identification.

 Examples: r0, r1, r2 or A, B, C, D.

 Some registers are named according to their special function, e.g., X for an index
register.
 Special-purpose registers may hold addresses or control information instead of regular
data.
 ✅ Registers have varied functionalities, and their roles are often tied to the CPU
architecture.

 The accumulator is the central register in a processor.

 All arithmetic and logical operations are usually performed using the accumulator.

 The word size of the processor is defined by the width of the accumulator.

 Example: A 32-bit processor has a 32-bit accumulator.


 An index register holds the address of data, not the data itself.

 It is useful when accessing memory locations that change dynamically, such as in a loop
iterating over an array.

o Example: In a loop zeroing array elements, the index register points to the
current element’s address.

 Without an index register, each memory access would have to be explicitly coded, which
is inefficient.

 In modern architectures, the distinction between accumulator and index registers is


less strict:

o General-purpose registers can perform arithmetic/logical operations and hold


addresses.

o Some registers still have specialized functions, but basic operations are possible
on all general registers.

1. Flags register (Program Status Word)

 A special register present in every CPU, also called PSW.

 Size can be 8, 16, or 32 bits, similar to the accumulator.

 Unlike the accumulator, its value as a whole is meaningless.

2. Individual bits carry independent meanings

 Each bit in the flags register represents a specific condition or status of the CPU.

 Bits do not work together as a single number like in the accumulator; each bit has a
separate function.

 Example: Zero flag, sign flag, overflow flag, carry flag, etc.

3. Carry flag example

 The carry flag is one bit in the flags register used in binary arithmetic.

 Example: Adding two 16-bit numbers:

o If the result exceeds 16 bits, the 17th bit cannot fit in the accumulator.
o This extra bit is stored in the carry flag.

 Without storing the carry, arithmetic results could be incorrect in multi-byte operations.

4. Purpose of the flags register

 It stores the CPU’s current status after operations.

 Flags indicate conditions like:

o Overflow occurred

o Result is zero

o Carry out happened

 These flags are used by the CPU for decision-making, branching, or further calculations.

✅ Key Idea:

 The flags register is a status indicator, not a data holder.

 Each bit has a special meaning, like the carry flag, zero flag, etc.

 It helps the CPU keep track of conditions during computation.


1. Status Flags

 Definition: Indicators that reflect the result of CPU operations (arithmetic, logic, etc.).

 Nature: Passive – they don’t control execution, just show what happened.

 Examples (Intel processors):

o Zero flag (ZF) → set if result = 0

o Sign flag (SF) → set if result is negative

o Carry flag (CF) → set if unsigned overflow (carry/borrow) occurs

o Overflow flag (OF) → set if signed overflow occurs

o Parity flag (PF) → set if result has even number of 1’s

👉 Used by the CPU or programs to make decisions (e.g., conditional jumps).

2. Control Flags
 Definition: Flags that change or control the behavior of the CPU.

 Nature: Active – they directly influence how instructions are executed.

 Examples:

o Interrupt Enable flag (IF) → allows or blocks CPU interrupts

o Direction flag (DF) → decides whether string/array processing moves forward or backward

o Trap flag (TF) → enables single-step execution (used in debugging)

Mnemonic

A mnemonic is the human-readable abbreviation (symbolic name) of a machine instruction used in assembly
language to represent its operation.

 Example: ADD, MOV, SUB.

Opcode

An opcode (operation code) is the binary or hexadecimal code that represents a machine instruction and is directly
understood by the processor.

 Example: 00000001 (binary) for ADD.

. How are instructions classified into groups?

Processor instructions are usually grouped based on what they do:

1. Data Transfer Instructions

o Move data between registers, memory, and I/O.

o Examples: MOV, LOAD, STORE, PUSH, POP.

2. Arithmetic Instructions

o Perform mathematical operations.

o Examples: ADD, SUB, MUL, DIV, INC, DEC.

3. Logical Instructions

o Perform bitwise operations or comparisons.

o Examples: AND, OR, XOR, NOT, CMP.

4. Control Transfer (Branching) Instructions

o Change the sequence of execution.

o Examples: JMP, CALL, RET, JZ, JNZ.

5. Input/Output Instructions
o Handle data transfer between CPU and I/O devices.

o Examples: IN, OUT.

6. Machine Control Instructions

o Control CPU operations or flags.

o Examples: HLT (halt), NOP (no operation), STI (enable interrupts), CLI (disable interrupts).

2. Names for 4 bits and 16 bits

 4 bits = Nibble

 8 bits = Byte

 16 bits = Word

👉 So:

 Nibble → Byte → Word

1. Maximum Memory 8088 Can Access

 The 8088 has a 20-bit address bus.

 Maximum addressable memory = 220=1,048,5762^{20} = 1,048,576220=1,048,576 bytes = 1 MB.

👉 So, 8088 can access up to 1 MB of memory.

2. Registers of 8088 (14 in total)

1. Flags in 8088 FLAGS Register

The 8088 has a 16-bit FLAGS register, which contains status flags and control flags.

Status Flags (reflect results of operations)

1. Carry Flag (CF)

2. Parity Flag (PF)

3. Auxiliary Carry Flag (AF)

4. Zero Flag (ZF)

5. Sign Flag (SF)

6. Overflow Flag (OF)

Control Flags (control CPU operation)


7. Trap Flag (TF) – single-step execution

8. Interrupt Enable Flag (IF) – allows/disables maskable interrupts

9. Direction Flag (DF) – controls string processing direction

2. Description of the Asked Flags

Zero Flag (ZF)

 Set (ZF = 1) if the result of an operation is zero.

 Cleared (ZF = 0) if the result is non-zero.

 Used for decisions in conditional jumps (e.g., JZ, JNZ).

👉 Example: SUB AX, AX → result = 0 → ZF = 1.

Carry Flag (CF)

 Set (CF = 1) if an arithmetic operation generates a carry out (addition) or borrow (subtraction) beyond the
MSB (most significant bit).

 Cleared (CF = 0) if no carry/borrow.

 Mainly used in unsigned arithmetic.

👉 Example: FFH + 01H = 100H (needs 9 bits) → CF = 1.

Sign Flag (SF)

 Reflects the sign of the result (in 2’s complement signed arithmetic).

 Set (SF = 1) if the result is negative (MSB = 1).

 Cleared (SF = 0) if result is positive (MSB = 0).

👉 Example: 7Fh + 01h = 80h → MSB = 1 → SF = 1.

Overflow Flag (OF)

 Set (OF = 1) when the result of a signed operation is too large or too small to fit in the destination register.

 Indicates a sign error in signed arithmetic.

 Cleared (OF = 0) when no signed overflow occurs.

👉 Example: +127 (01111111) + 1 = -128 (10000000) → OF = 1.

You might also like