Understanding Computer Architecture and Number Systems

NAND

AND

OR

NOT

A B C

Base System Numbers

Binary (Base 2): 0, 1

Octal (Base 8): 0, 1, 2, 3, 4, 5, 6, 7

Decimal (Base 10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Hexadecimal (Base 16): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Decimal to Other Number Systems

To convert a decimal number to another base, repeatedly divide the decimal number by the desired base (e.g., 16 for hexadecimal, 8 for octal). The remainders, written in reverse order, form the converted number. Don’t forget to include the base at the end.

Other Number Systems to Decimal

To convert a number from another base to decimal, use the following method:

  • Multiply each digit of the number by the base raised to the power of its position (starting from the rightmost digit as position 0).
  • Add the results of all multiplications.

For example, to convert the octal number 123 to decimal:

  • (1 * 8^2) + (2 * 8^1) + (3 * 8^0) = 64 + 16 + 3 = 83

Binary to Decimal

To convert a binary number to decimal, use the same method as above, but with base 2. For example, to convert the binary number 1011 to decimal:

  • (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0) = 8 + 0 + 2 + 1 = 11

Binary to Octal

To convert a binary number to octal, group the binary digits into sets of three, starting from the rightmost digit. If necessary, add leading zeros to complete the leftmost group. Then, convert each group of three binary digits to its octal equivalent.

Binary to Hexadecimal

To convert a binary number to hexadecimal, group the binary digits into sets of four, starting from the rightmost digit. If necessary, add leading zeros to complete the leftmost group. Then, convert each group of four binary digits to its hexadecimal equivalent.

Hexadecimal to Binary

To convert a hexadecimal number to binary, convert each hexadecimal digit to its four-bit binary equivalent. If the binary representation has fewer than four digits, add leading zeros.

Hexadecimal to Octal

To convert a hexadecimal number to octal, first convert the hexadecimal number to binary. Then, group the binary digits into sets of three and convert each group to its octal equivalent.

Hexadecimal to Decimal

To convert a hexadecimal number to decimal, first convert the hexadecimal number to binary. Then, convert the binary number to decimal using the method described earlier.

Binary Addition

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 0 (carry-over 1)

Octal Addition

0, 1, 2, 3, 4, 5, 6, 7, 10, 11, …

Hexadecimal Addition

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, …

Integrated Circuits

All modern processors are etched onto a single integrated circuit (chip). Each processor chip has a set of pins through which it communicates with the outside world: address, data, and control.

Conclusion

Digital electronic circuits can be implemented to solve everyday problems. A processor consists of a set of circuits that store and process information in binary format.

Computer Basics

Question 1

In your opinion, what is the difference between CPU and processor?

Answer: There is no difference. CPU (Central Processing Unit) and processor refer to the same component of the computer.

Question 2

List the storage devices that you know.

Answer:

  • Hard drive
  • Flash drive
  • CD
  • DVD
  • Main memory (RAM)
  • Cache memory

Question 3

List the input devices that you know.

Answer:

  • Keyboard
  • Mouse
  • Optical readers
  • Magnetic card readers
  • Video cameras
  • Microphones
  • Sensors

Question 4

List the output devices you know.

Answer:

  • Printers
  • Monitors
  • Video projectors
  • Plotters
  • Actuators
  • Switches

History of Computers

Phase Zero (Until 1945)

  • John Napier (1550-1617) invented the”Napier’s bones” a tool for multiplication and division.
  • Blaise Pascal (1623-1662) invented the first mechanical calculator.
  • Charles Babbage (1792-1871) designed the”Analytical Engine” a precursor to the modern computer.
  • Ada Lovelace (1815-1852) is considered the first computer programmer.
  • George Boole (1815-1864) developed Boolean logic.
  • Herman Hollerith (1860-1929) developed a tabulating machine for processing census data.
  • Konrad Zuse (1910-1995) built the Z1, the first electromechanical computer.
  • Howard Aiken (1900-1973) led the development of the Mark I computer.

First Phase (1945-1955)

  • ENIAC, the first general-purpose electronic computer, was built.
  • EDVAC and IAS computers were developed.
  • UNIVAC I, the first commercial computer, was introduced.
  • Vacuum tubes were the primary electronic component.
  • Programming was done through wiring.

Second Phase (1956-1965)

  • Transistors and magnetic core memory were introduced.
  • First high-level programming languages (Assembly, Fortran) were developed.
  • First operating systems were created.
  • Input/output devices included punched cards, paper tape, and operator consoles.
  • Batch processing was the dominant mode of operation.

Third Phase (1966-1980)

  • Integrated circuits (ICs) and microprocessors were developed.
  • IBM System/360 mainframes and DEC PDP-8 minicomputers were introduced.
  • Multiprogramming operating systems were developed.
  • Input/output devices included video display terminals, keyboards, and magnetic disks.
  • Online interaction and time-sharing systems emerged.
  • UNIX operating system was developed.
  • Early microcomputers, such as the Apple II, used 8-bit processors and the CP/M operating system.

Fourth Phase (1981-1990)

  • Large-scale integration (LSI) and very-large-scale integration (VLSI) enabled the production of more powerful microprocessors.
  • Personal computers (PCs) became widely available.
  • MS-DOS became the dominant operating system for PCs.
  • Multitasking operating systems and graphical user interfaces (GUIs) were introduced.
  • Wide area networks (WANs) using the TCP/IP protocol suite and local area networks (LANs) became increasingly common.
  • The original IBM PC was released in 1981.

Fifth Phase (1991-Present)

  • VLSI and ultra-large-scale integration (ULSI) continued to increase the power of microprocessors.
  • Parallel architectures, distributed processing, and mobile computing became prevalent.
  • Operating systems such as Microsoft Windows, macOS, and Linux became dominant.
  • The internet and the World Wide Web experienced explosive growth.
  • Mobile devices, such as smartphones and tablets, proliferated.
  • Cloud computing emerged as a major trend.

Computer Architecture

Bus Width

The width of a bus refers to the number of data lines it has. Common bus widths include 8-bit, 16-bit, 32-bit, and 64-bit. The wider the bus, the more data can be transferred simultaneously.

  • Address Bus: Determines the maximum amount of memory that can be addressed.
  • Data Bus: Determines the number of bits transmitted for each operation.

Activity

The Intel 8086 processor has a 16-bit data bus and a 20-bit address bus. Determine whether the following statements are true or false:

  • (True) Each memory read operation fetches two bytes of data.
  • (False) Each memory read operation fetches 20 bits of data.
  • (True) The maximum addressable memory size is 1 MB (2^20 bytes).
  • (False) The maximum addressable memory size is 64 KB.

Conclusion

The basic structure of a computer comprises the CPU, memory, input/output devices, and buses. The CPU continuously executes instructions in a cycle. Processing speed depends not only on the processor speed but also on factors such as bus width and memory speed.

Memory

Memory is the part of the computer where programs and data are stored. Without memory, the concept of a stored-program digital computer would not be possible.

Units of Memory

  • Bit (Binary Digit): The smallest unit of data, representing a 0 or 1.
  • Byte: A group of 8 bits.
  • Kilobyte (KB): 1024 bytes (2^10 bytes).
  • Megabyte (MB): 1024 kilobytes (2^20 bytes).
  • Gigabyte (GB): 1024 megabytes (2^30 bytes).
  • Terabyte (TB): 1024 gigabytes (2^40 bytes).
  • Petabyte (PB): 1024 terabytes (2^50 bytes).

Memory Access Methods

  • Sequential Access: Data is accessed in a linear order.
  • Direct Access: Data can be accessed directly at any location.
  • Random Access: Data can be accessed randomly, regardless of its location.
  • Associative Access: Data is located based on its content rather than its address.

Memory Technologies

  • Magnetic Memory: Data is stored on magnetized surfaces (e.g., hard disk drives).
  • Optical Memory: Data is stored as microscopic pits on an optical disc (e.g., CDs, DVDs).
  • Semiconductor Memory: Data is stored in electronic circuits (e.g., RAM, ROM).

Memory Characteristics

  • Volatile Memory: Data is lost when power is removed (e.g., RAM).
  • Nonvolatile Memory: Data is retained even when power is removed (e.g., ROM, flash memory).
  • Erasable Memory: Data can be erased and rewritten (e.g., RAM, flash memory).
  • Non-erasable Memory: Data cannot be erased once written (e.g., ROM).

Memory Hierarchy

Modern computers use a memory hierarchy to improve performance. The fastest and most expensive memory (cache) is located closest to the CPU, while slower and less expensive memory (secondary storage) is located further away.

  • Level 1 Cache: The fastest and smallest cache, located on the CPU chip.
  • Level 2 Cache: Larger and slower than L1 cache, often located on the CPU chip or on a separate chip.
  • Main Memory (RAM): The primary memory used by the CPU to store programs and data that are currently in use.
  • Secondary Storage: Nonvolatile memory used for long-term storage of data (e.g., hard disk drives, solid-state drives).

Input/Output (I/O)

Input/output devices allow the computer to interact with the outside world.

I/O Techniques

  • Programmed I/O: The CPU directly controls the I/O operation.
  • Interrupt-Driven I/O: The I/O device interrupts the CPU when it is ready to transfer data.
  • Direct Memory Access (DMA): The I/O device can transfer data directly to or from memory without involving the CPU.

Interfaces

Interfaces connect I/O devices to the computer system. Examples include USB, FireWire, PCI Express, and SATA.

Communication

Data can be transmitted between the CPU and I/O devices serially (one bit at a time) or in parallel (multiple bits simultaneously).

  • Synchronous Transmission: Data is transmitted at a fixed rate using a clock signal.
  • Asynchronous Transmission: Data is transmitted at variable intervals.

Conclusion

The organization of a computer determines how its components are interconnected. The implementation of this organization using specific technologies is called the computer’s architecture. The four key elements of computer organization are the CPU, memory, I/O devices, and buses.

Processor Components

Question 1

Explain what the ALU and CU are and their functions.

Answer:

  • ALU (Arithmetic Logic Unit): Performs arithmetic and logical operations.
  • CU (Control Unit): Controls the operation of all components of the computer by providing timing and control signals.

Question 2

What are the phases of the instruction cycle?

Answer:

  1. Fetch: The instruction to be executed is fetched from memory.
  2. Decode: The type of operation to be performed is identified, and the instruction operands are read from registers.
  3. Execute: The arithmetic or logical operation is performed.
  4. Memory Access: If the instruction requires memory access, data is read from or written to memory.
  5. Write Back: The results of the operation are written back to registers.

Question 3

Define bus width.

Answer: Bus width refers to the number of data lines a bus has. A bus with a width of 32 bits can transmit 32 bits of data simultaneously.

USB and Cache Memory

Question 4

a. A USB bus can be connected to 127 devices.

b. The transmission speed of USB 2.0 is 480 Mb/s.

Answer:

  • a. True
  • b. True (Note: 60 MB/s = 480 Mb/s. One measure is in megabytes, while the other is in megabits.)

Cache memory is faster and more expensive than main memory.

Modern computers can have up to four levels of cache memory.

Question 5

Which of the following characteristics does not match the USB 2.0 bus?

Answer: Uses parallel communication.

Explanation: USB 2.0, like PCI Express, uses serial communication.

USB and FireWire

USB (Universal Serial Bus)

USB is a plug-and-play interface that allows peripherals to be connected to a computer without turning it off. The PnP (Plug and Play) standard was introduced to simplify the installation and configuration of peripherals.

FireWire (IEEE 1394)

FireWire is a high-speed serial interface for connecting digital devices, such as cameras, camcorders, and external hard drives. It is known for its real-time data transfer capabilities and is often used for audio and video applications.