Number Systems and Computer Architecture Notes
Number System
- A number system is a system for writing and expressing numbers, using digits or symbols in a consistent way.
- It uniquely represents numbers and their arithmetic and algebraic structure, allowing operations like addition, subtraction, multiplication, and division.
- The value of a digit depends on:
- The digit itself
- Its position in the number
- The base of the number system
Types of Number Systems
- Decimal:
- Base 10
- Uses 10 characters (0-9)
- Example: 11010, 3410, 4610, 13010, 14710
- Binary:
- Base 2
- Uses 2 characters (0 and 1)
- Machine language
- Example: 12, 102, 112, 1012, 1112
- Octal:
- Base 8
- Uses 8 characters (0-7)
- Example: 148, 278, 328, 1298, 14158
- Hexadecimal:
- Base 16
- Uses 16 characters (0-9 and A-F)
- A=10, B=11, C=12, D=13, E=14, F=15
- Example: 3C016, 15E16, C116, F16, 141516
Conversions
- Binary to Decimal
- Binary to Octal
- Binary to Hexadecimal
- Decimal to Binary
- Decimal to Octal
- Decimal to Hexadecimal
- Octal to Binary
- Octal to Decimal
- Octal to Hexadecimal
- Hexadecimal to Binary
- Hexadecimal to Decimal
- Hexadecimal to Octal
HDL (Hardware Description Language)
- Used to describe the structure and behavior of Integrated Circuits (ICs).
- Used to simulate circuits and check their response.
Types of HDL:
- Verilog HDL
- VHDL (Very High-speed Digital Language)
Computer System
- A set of integrated devices that input, output, process, and store data and information.
- Built around at least one digital processing device.
- Five main hardware components:
- Input
- Processing
- Storage
- Output
- Communication devices
- Computer: A programmable machine that receives input, stores and manipulates data/information, and provides output in a useful format.
- Basic microcomputer (PC) includes components like the system unit, screen/monitor, keyboard, mouse, and speakers.
- Block Diagram of a Basic Computer System:
- CPU
- ROM
- RAM
- I/O Interface
- I/O Devices
- Address bus
- Data bus
- Control bus
- Central Processing Unit (CPU):
- Carries out the instructions of a computer program.
- Reads and executes program instructions.
- The data in the instruction tells the processor what to do.
- Memory:
- Physical devices used to store data or programs temporarily or permanently.
- Two principal varieties: random-access memory (RAM) and read-only memory (ROM).
- RAM can be read and written to anytime the CPU commands it.
- ROM is pre-loaded with data and software that never changes, so the CPU can only read from it.
- ROM stores the computer's initial start-up instructions.
- Contents of RAM are erased when the power is turned off, but ROM retains its data indefinitely.
- In a PC, the ROM contains a specialized program called the BIOS that orchestrates loading the computer's operating system from the hard disk drive into RAM.
- Input/Output (I/O) Unit:
- Communication between an information processing system (computer) and the outside world.
- Inputs are the signals or data received by the system, and outputs are the signals or data sent from it.
- Devices that provide input or output to the computer are called peripherals.
- Peripherals include input devices like the keyboard and mouse, and output devices such as the display and printer.
- Hard disk drives, floppy disk drives, and optical disc drives serve as both input and output devices. Computer networking is another form of I/O.
Hardware & Software
- Hardware: Physical components of a computer system.
- Examples: CD-ROM, computer display monitor, printer, and video card.
- Without hardware, a computer would not function, and software would have nothing to run on.
- Hardware and software interact with one another: software tells hardware which tasks it needs to perform.
- Software: Collection of computer programs, procedures, and documentation that perform some task on a computer system.
- Practical computer systems divide software systems into three major classes: system software, programming software, and application software.
- Software is an ordered sequence of instructions for changing the state of the computer hardware in a particular sequence.
- Software is typically programmed with a user-friendly interface that allows humans to interact more efficiently with a computer system.
Hardware vs. Software
| Feature | Hardware | Software |
|---|
| Definition | Devices required to store and execute software. | Collection of instructions that enables a user to interact with the computer. |
| Types | Input, storage, processing, control, and output devices. | System software, Programming software, and Application software. |
| Function | Serves as the delivery system for software solutions. | |
| Infrequently changed. | To perform specific tasks. | |
| Generally not needed for basic hardware tasks. | | |
| Examples | CD-ROM, monitor, printer, video card, scanners, label makers, routers, and modems. | QuickBooks, Adobe Acrobat, Google Chrome, Microsoft Word, Microsoft Excel, Apple Maps. |
| Interdependency | Starts functioning once software is loaded. | To deliver its set of instructions, Software is installed on hardware. |
| Failure | Failure is random. | |
| Increasing failure at the last stage. | Failure is systematic. | |
| Does not have an increasing failure rate. | | |
| Durability | Wears out over time. | Does not wear out over time. |
| However, bugs are discovered as time passes. | | |
| Nature | Physical. | Logical. |
Microprocessor & Microcontroller
- Microprocessor:
- A computer processor that incorporates the functions of a central processing unit on a single integrated circuit (IC), or at most a few integrated circuits.
- A multipurpose, clock-driven, register-based, digital-integrated circuit that accepts binary data as input, processes it according to instructions stored in its memory, and provides results as output
- A computer Central Processing Unit (CPU) on a single chip.
- Contains both combinational logic and sequential digital logic
- Operates on numbers and symbols represented in the binary numeral system.
- Microcontroller:
- A modified and developed form of Microcomputer, in which all the necessary components like programmable input/output peripherals, processor core and memory are present in a single microchip.
- This technology is mostly used in embedded applications.
- Microcomputer:
- Simply a personal computer; where you can see the association of microprocessor, I/O peripherals, data and programmable memory as well as other supporting circuits at one place, but not in a single chip.
Classification of Microprocessors
- General Purpose Processors (GPP)
- GPP proper: general purpose applications
- Microcontrollers: industrial applications
- Application Specific Processors (ASP)
- Requirements:
- high performance
- low cost
- low power consumption
- DSP (Digital Signal Processor): programmable microprocessor for extensive numerical real-time computations
- ASIC (Application Specific Integrated Circuit): algorithm completely implemented in hardware
- ASIP (Application Specific Instruction Set Processor): programmable micro-processor where hardware and instruction set are designed together for one special application
- CPU or central processing unit is responsible for execution of all computer operations by following instructions of computer programs that we apply.
- A microprocessor is just a microchip that can perform all the operations of CPU. On the other hand, a microcomputer is the association of different computer parts.
Microprocessor vs Microcontroller vs Microcomputer
| Feature | Microcontroller | Microprocessor |
|---|
| Task specificity | Designed to perform specific tasks. | |
| Need small resources like RAM, ROM, I/O ports etc. and hence can be embedded on a single chip. | Find applications where tasks are unspecific like creating documents and software development. | |
| Need high amount of resources like RAM, ROM, I/O ports etc. | | |
| Clock speed | Operates from a few MHz to 30 to 50 MHz. | Operate above 1GHz as they perform complex tasks. |
| Components | ROM, Micro Processor, RAM, I/O | N/A |
| Definition | in micro form including microprocessor, circuits, memories and I/O peripherals, but not in the form of a single chip that is specialty of only microcontroller having all these computer parts just in the form of a microchip. | N/A |
Microprocessor vs Digital Signal Processor
- The purpose of a microprocessor is to accept digital data as input, process it as per the instructions, and then provide the output.
- The DSP processor, on the other hand, is a particular type of microprocessor, wherein there is basically any signal processing that is done on a digital signal or information signal.
| Feature | DSP |
|---|
| Functionality | supports repetitive, high-performance, and large numbers of complex arithmetic calculation often used in image processing, speech recognition and telecommunications more efficient at performing basic arithmetic operations especially multiplication. |
| Program | |
| Memory Address | |
| PM Data Address | N/A |
- Electrical Numerical Integrator and Calculator (ENIAC)
- Designed for the U.S. Army's Ballistic Research Laboratory
- Built out of
- 17,468 vacuum tubes
- 7,200 crystal diodes
- 1,500 relays
- 70,000 resistors
- 10,000 capacitors
- Consumed 150 kW of power
- Took up 72 m2
- Weighted 27 tons
- Suffered a failure on average every 6 hours
- Intel Created the First Commercial Microprocessor
- Introduced the 4004 in 1971, contained 2,300 transistors
- Had roughly the same processing power as ENIAC
- 4-bit microprocessor-programmable controller on a chip
- addressed 4096, 4-bit-wide memory locations
- instruction set contained 45 instructions
- fabricated with then-current state-of-the-art P-channel MOSFET technology
- Executed instructions at 50 KIPS (kilo-instructions per second).
- difference was that 4004 weighed less than an ounce
- main problems with early microprocessor were speed, word width, and memory size
- Intel 8008
- released in 1971 as the extended 8-bit version of 4004 microprocessor
- Addressed expanded memory of 16K bytes.
- A byte is generally an 8-bit-wide binary number and a K is 1024.
- memory size often specified in K bytes
- Contained additional instructions, 48 total
- IBM Introduced its Original PC in 1981
- Used the Intel 8088 processor containing 29,000 transistors
- Used operating system (MS-DOS) designed by Microsoft
- Von-Neumann Architecture
- It is a theoretical design based on the stored-program computer concept.
- It uses the same physical memory address for instructions and data.
- The processor needs two clock cycles to execute an instruction.
- Simpler control unit design, and development of one is cheaper and faster.
- Data transfers and instruction fetches cannot be performed simultaneously.
- Used in personal computers, laptops, and workstations.
- Harvard Architecture
- It is a modern computer architecture based on the Harvard Mark I relay-based computer model.
- It uses separate memory addresses for instructions and data.
- The processor needs one cycle to complete an instruction.
- The control unit for two buses is more complicated which adds to the development cost.
- Data transfers and instruction fetches can be performed at the same time.
- Used in microcontrollers and signal processing.
Instruction
- An order or command in the form of a code that tells a computer to perform a particular operation.
- A group of bits used to perform a particular operation on the data stored in the computer.
- Fetched by the processor from memory and decoded to be executed.
- Differs from one computer to another.
Instruction Cycle
- Fetch the instruction: The next instruction is fetched from the memory address that is
currently stored in the program counter and stored into the instruction register. At the end of the
fetch operation, the PC points to the next instruction that will be read at the next cycle. - Decode the instruction: During this cycle, the encoded instruction present in the instruction
register is interpreted by the decoder. - Read the effective address: In the case of a memory instruction (direct or indirect) the
execution phase will be during the next clock pulse. If the instruction has an indirect address,
the effective address is read from main memory, and any required data is fetched from main
memory to be processed and then placed into data registers (clock pulse: T3). If the instruction
is direct, nothing is done during this clock pulse. If this is an I/O instruction or a register
instruction, the operation is performed during the clock pulse. - Execute the instruction: The CU passes the decoded information as a sequence of control
signals to the relevant function units of the CPU to perform the actions required by the
instruction such as reading values from registers, passing them to the ALU to perform
mathematical or logic functions on them, and writing the result back to a register. If the ALU is
involved, it sends a condition signal back to the CU. The result generated by the operation is
stored in the main memory or sent to an output device. Based on the feedback from the ALU,
the PC may be updated to a different address from which the next instruction will be fetched.
A computer is given instructions by a human using a keyboard or
other input device. To interpret these instructions, the computer
uses an operating system or software that is also programmed by a
human to translate the user commands into something the
computer can understand.
QUIZ #1
- is an information in numerical form that can be digitally transmitted or processed?
- holds data that the computer processor has direct access.
- are way to copy out keys and location addresses from data structures in files, tables, and data sets.
- How much size in bit is a nibble?
- -7. Give the three characteristics of information.
- is designed to perform specific tasks.
- is designed to perform unspecific tasks like creating documents, and software development?
- is called the brain of the computer.
- What does ENIAC mean?
- When did the first commercial microprocessor release?
- What is ALU?
- -15. Give at least 2 Microprocessor Manufacturers.
Structural Components of Microprocessors and Microcontrollers
- Internal CPU interconnection
- ALU and CU
- Registers
- Peripherals
INTERNAL CPU INTERCONNECTION
- Refers to the intricate network of pathways within a microprocessor or microcontroller that enables communication between various components such as the Arithmetic Logic Unit (ALU), Control Unit (CU), registers, cache, and other functional units.
- These pathways are typically composed of buses, control lines, and other interconnects that facilitate the transfer of data, instructions, and control signals within the CPU.
ALU AND CU
- Arithmetic Logic Unit (ALU)
- Responsible for performing Arithmetic (addition, subtraction, multiplication, & division) and Logical (AND, OR, NOT) operations on Data.
- It operates on binary data, manipulating bits according to the instructions fetched from memory.
- Importance:
- ALUs are essential for executing computational tasks in various applications, including scientific computing, data analytics, graphics rendering, and AI.
- Control Unit (CU)
- Responsible for coordinating the operation of the entire CPU.
- It fetches instruction from memory, decodes them, and controls the execution of these instructions by coordinating the operation of the other CPU components, such as ALU, registers, and memory interface.
- Importance:
- CU’s role in managing instruction execution and control flow is critical for CPU’s performance.
REGISTERS
- Registers are small, high-speed storage locations within the CPU used to store data temporarily during processing.
- They hold operands, intermediate results, memory addresses, and other essential data required for executing instructions.
- Importance:
- Efficient use of registers enhances the execution of instructions and enables the CPU to handle complex tasks efficiently.
PERIPHERALS
- Peripherals are external devices or components connected to the microprocessor to extend its functionality and interact with the external environment.
- There include I/O devices such as keyboard, mouse, monitors, sensors, actuators, and storage devices.
- Importance:
- It enables diverse applications and interactions in embedded systems, consumer, electronics, automotive, industrial automation, and other domains.
The Fetch-Decode-Execute Cycle
- Memory
- Instructions
- Commands
- Results
COMPUTER PROGRAM
- A computer program is a collection of instructions encoded in the binary numbering system.
- The stages of the fetch execution cycle are the steps followed by the Central Processing Unit (CPU) while executing instructions and functions.
FETCH-DECODE CYCLE
- The fetch-decode-execute cycle, also known as the instruction cycle or fetch-execute cycle
- The basic operation cycle of the computer
- It is the process in which a computer receives information (data) and decides what to do with that data.
- This cycle is run continuously by the central processing unit (CPU)
- The three main parts of the CPU that do this are the registers, control unit, and Arithmetic Logic Unit (ALU)
FETCH STAGE
- Instructions loaded from main memory into registers
- Program counter (pc) holds memory address of next instruction
- Instruction copied to Instruction Register (IR)
DECODE STAGE
- Processing of decoded data.
- CPU actions based on decoded instructions, e.g., print command.
EXECUTE STAGE
- Instruction analyzed in Control Unit; split into:
- Opcode: Command to be executed.
- Operand: Memory address for data interaction.
MEMORY
- RAM (random access memory) is a computer's short-term memory, where the data that the processor is currently using is stored.
- Your computer can access RAM memory much faster than data on a hard disk, SSD, or other long-term storage device, which is why RAM capacity is critical for system performance.
- Role of RAM in the Cycle:
- RAM is used on the Fetch and Execute part of the cycle as a storage for instruction data and results.
- Memory Address Register’s Role:
- Memory Address Register (MAR) is a component located in a computer's processor, more precisely a register type which maintains memory locations where the next piece of data or instruction will be read from or written to during the processing cycles.
- Responsible for copying PC content and sending it to the RAM. This is done through the CPU’s address pins.
- OTHER REGISTERS
- Program Counter: It works by pointing towards the next memory line, where the next instruction for the processor is stored.
- Memory Data Register: It takes the responsibility of copying the memory address to the internal register.
- Instruction Register: It has involvement in the last step of the fetch phase. It is where the instruction is written. The control unit from here copies the content for carrying out the instruction cycle.
INSTRUCTION
- A computer instruction is an order given to a computer processor by a computer program.
- At the lowest level, each instruction is a sequence of 0s and 1s that describes a physical operation the computer is to perform.
- Computer instructions typically have three fields: an operation code, or opcode, field that identifies the operation to be performed, such as "add" data in memory to a specific register; an address field, showing where registers and memory are located; and a mode field, showing how the registers and memory will perform.
Instruction Flow Throughout the Cycle
- This cycle is repeated continuously by the central processing unit (CPU) to execute instructions and carry out tasks.
- Fetch: In the fetch stage, the CPU retrieves an instruction from memory. This memory is typically the main memory (RAM), but it could also be from a cache if the instruction has been recently used. The instruction is fetched by the CPU's fetch unit, which is responsible for accessing the memory address specified by the program counter (PC). The program counter is a register that holds the address of the next instruction to be fetched. After the instruction is fetched, the program counter is incremented to point to the next instruction.
- Decode: The decode stage involves interpreting the instruction that has been fetched. The CPU's decoder circuitry breaks down the instruction into its constituent parts, which typically include an operation code (opcode) and operands. The opcode specifies the type of operation to be performed (e.g., add, subtract, jump), while the operands provide the data on which the operation will be performed and the destination for the result. This stage is crucial because it translates the binary code of the instruction into a form that the CPU can understand and act upon.
- Execute: In the execute stage, the CPU carries out the operation specified by the decoded instruction. This involves using the CPU's functional units, such as the arithmetic logic unit (ALU) for arithmetic and logical operations, the register file for storing operands and results, and the control unit for managing the flow of data and instructions. The operands are fetched from memory or registers, and the operation is performed according to the instruction. The result of the operation is then stored back in a register or memory, depending on the instruction. After the execute stage, the cycle starts over with the fetch stage, and the CPU continues to execute instructions in a sequential manner. This cycle repeats continuously as long as the computer is on and executing a program.
COMMANDS
- REGISTER
- A register keeps track of our instruction cycle and loads our instructions from memory, and an Accumulator.
- They are the one responsible in order to complete the fetch stage.
- Registers are compared to government administration offices, where all information is stored.
- There are 4 registers:
- Program Counter
- Memory Address Register
- Memory Data Register
- Current Instruction Register
- MEMORY
- Store instruction and data that is in the form of a Computer Program.
- This where the CPU also fetch data and instruction.
- There are 2 types of RAM:
- Dynamic Random-Access Memory
- Static Random-Access Memory
- ACCUMULATOR
- Special register in a CPU used for intermediate arithmetic and logic operations.
- Temporarily stores data and intermediate results
- Common operations that use the accumulator include addition, subtraction, bitwise operations (AND, OR, XOR), and shifting.
RESULTS
- The outcomes of executing instructions, which may include calculations, data transfers, or changes to the CPU's internal state.