Docsity

Understanding Addressing Modes and Instruction Types in Computer Science, Lecture notes of Business networking

Toggle sidebar
bg1
CONTENTS
Unit 1 Principles of Computer Design 5
1.1 Introduction
1.2 Software
1.3 Hardware
1.4 Software-Hardware Interaction Layers in Computer Architecture
1.5 Operating System
1.6 Application Software
1.7 Central Processing Unit
1.8 Machine Language Instructions
1.9 Addressing Modes
1.10 Instruction Cycle
1.11 Execution Cycle (Instruction Execution)
1.12 Summary
1.13 Keywords
1.14 Review Questions
1.15 Further Readings
Unit 2 Control Unit and Microprogramming 25
2.1 Introduction
2.2 Control Unit
2.3 Basic Control Unit Operation
2.4 Data Path and Control Path Design
2.5 Microprogramming
2.6 Hardwired Control Unit
2.7 Overview of RISC/CISC
2.8 Complex Instruction Set Computer (CISC)
2.9 Pipelining Processing
2.10 Superscalar Processors
2.11 Summary
2.12 Keywords
2.13 Review Questions
2.14 Further Readings
Unit 3 Memory Organization 61
3.1 Introduction
3.2 Memory system
3.3 Storage Technologies
3.4 Memory Array Organization
3.5 Memory Management
3.6 Memory Hierarchy
3.7 Memory Interleaving
3.8 Virtual Memory
3.9 FIFO Algorithm
3.10 LRU Algorithm
3.11 Cache Memory
3.12 Summary
3.13 Keywords
3.14 Review Questions
3.15 Further Readings
Unit 4 Input-Output Devices and Characteristics 96
4.1 Introduction
4.2 I/O and their Brief Description
4.3 Input-output Processor (IOP)
4.4 Bus Interface
4.5 Isolated Versus Memory-mapped I/O
4.6 Data Transfer Techniques
4.7 Interrupt-Initiated I/O
4.8 Communication between the CPU and the Channel
4.9 I/O Interrupts
4.10 Performance Evaluation - Benchmark
4.11 TPC-H
4.12 TPC-R
4.13 TPC-W
4.14 Summary
4.15 Keywords
4.16 Review Questions
4.17 Further Readings
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b

Partial preview of the text

Download Understanding Addressing Modes and Instruction Types in Computer Science and more Lecture notes Business networking in PDF only on Docsity!

CONTENTS

Unit 1 Principles of Computer Design 5 1.1 Introduction 1.2 Software 1.3 Hardware 1.4 Software-Hardware Interaction Layers in Computer Architecture 1.5 Operating System 1.6 Application Software 1.7 Central Processing Unit 1.8 Machine Language Instructions 1.9 Addressing Modes 1.10 Instruction Cycle 1.11 Execution Cycle (Instruction Execution) 1.12 Summary 1.13 Keywords 1.14 Review Questions 1.15 Further Readings

Unit 2 Control Unit and Microprogramming 25 2.1 Introduction 2.2 Control Unit 2.3 Basic Control Unit Operation 2.4 Data Path and Control Path Design 2.5 Microprogramming 2.6 Hardwired Control Unit 2.7 Overview of RISC/CISC 2.8 Complex Instruction Set Computer (CISC) 2.9 Pipelining Processing 2.10 Superscalar Processors 2.11 Summary 2.12 Keywords 2.13 Review Questions 2.14 Further Readings

Unit 3 Memory Organization 61 3.1 Introduction 3.2 Memory system 3.3 Storage Technologies 3.4 Memory Array Organization 3.5 Memory Management 3.6 Memory Hierarchy 3.7 Memory Interleaving 3.8 Virtual Memory 3.9 FIFO Algorithm 3.10 LRU Algorithm 3.11 Cache Memory 3.12 Summary 3.13 Keywords 3.14 Review Questions 3.15 Further Readings

Unit 4 Input-Output Devices and Characteristics 96 4.1 Introduction 4.2 I/O and their Brief Description 4.3 Input-output Processor (IOP) 4.4 Bus Interface 4.5 Isolated Versus Memory-mapped I/O 4.6 Data Transfer Techniques 4.7 Interrupt-Initiated I/O 4.8 Communication between the CPU and the Channel 4.9 I/O Interrupts 4.10 Performance Evaluation - Benchmark 4.11 TPC-H 4.12 TPC-R 4.13 TPC-W 4.14 Summary 4.15 Keywords 4.16 Review Questions 4.17 Further Readings

linkers, debuggers, and so on. An Integrated development environment (IDE) merges those tools into a software bundle, and a programmer may not need to type multiple commands for compiling, interpreter, debugging, tracing, and etc., because the IDE usually has an advanced graphical user interface, or GUI.

  • Application software allows end users to accomplish one or more specific (non- computer related) tasks. Typical applications include industrial automation, business software, educational software, medical software, databases, and computer games. Businesses are probably the biggest users of application software, but almost every field of human activity now uses some form of application software. It is used to automate all sorts of functions.

Operation

Computer software has to be "loaded" into the computer's storage (such as a hard drive, memory, or RAM). Once the software is loaded, the computer is able to execute the software. Computers operate byexecuting the computer program. This involves passing instructions from the application software, through the system software, to the hardware which ultimately receives the instruction as machine code. Each instruction causes the computer to carry out an operation -- moving data, carrying out a computation, or altering the control flow of instructions. Data movement is typically from one place in memory to another. Sometimes it involves moving data between memory and registers which enable high-speed data access in the CPU. Moving data, especially large amounts of it, can be costly. So, this is sometimes avoided by using "pointers" to data instead. Computations include simple operations such as incrementing the value of a variable data element. More complex computations may involve many operations and data elements together. Instructions may be performed sequentially, conditionally, or iteratively. Sequential instructions are those operations that are performed one after another. Conditional instructions are performed such that different sets of instructions execute depending on the value(s) of some data. In some languages this is known as an "if" statement. Iterative instructions are performed repetitively and may depend on some data value. This is sometimes called a "loop." Often, one instruction may "call" another set of instructions that are defined in some other program or module. When more than one computer processor is used, instructions may be executed simultaneously. A simple example of the way software operates is what happens when a user selects an entry such as "Copy" from a menu. In this case, a conditional instruction is executed to copy text from data in a 'document' area residing in memory, perhaps to an intermediate storage

area known as a 'clipboard' data area. If a different menu entry such as "Paste" is chosen, the software may execute the instructions to copy the text from the clipboard data area to a specific location in the same or another document in memory. Depending on the application, even the example above could become complicated. The field of software engineering endeavors to manage the complexity of how software operates. This is especially true for software that operates in the context of a large or powerful computer system. Currently, almost the only limitations on the use of computer software in applications is the ingenuity of the designer/programmer. Consequently, large areas of activities (such as playing grand master level chess) formerly assumed to be incapable of software simulation are now routinely programmed. The only area that has so far proved reasonably secure from software simulation is the realm of human art— especially, pleasing music and literature. Kinds of software by operation: computer program as executable, source code or script, configuration.

Hardware

Computer hardware is the physical part of a computer, including the digital circuitry, as distinguished from the computer software that executes within the hardware. The hardware of a computer is infrequently changed, in comparison with software and data, which are "soft" in the sense that they are readily created, modified or erased on the computer. Firmware is a special type of software that rarely, if ever, needs to be changed and so is stored on hardware devices such as read-only memory (ROM) where it is not readily changed (and is therefore "firm" rather than just "soft").

Most computer hardware is not seen by normal users. It is in embedded systems in automobiles, microwave ovens, electrocardiograph machines, compact disc players, and other devices. Personal computers, the computer hardware familiar to most people, form only a small minority of computers (about 0.2% of all new computers produced in 2003).

Personal computer hardware

A typical pc consists of a case or chassis in desktop or tower shape and the following parts:

  • Networking - to connect the computer to the Internet and/or other computers o Modem - for dial-up connections o Network card - for DSL/Cable internet, and/or connecting to other computers.
  • Other peripherals

In addition, hardware can include external components of a computer system. The following are either standard or very common.

  • Input devices o Text input devices ƒ Keyboard o Pointing devices ƒ Mouse ƒ Trackball o Gaming devices ƒ Joystick ƒ Game pad ƒ Game controller o Image, Video input devices ƒ Image scanner ƒ Webcam o Audio input devices ƒ Microphone
  • Output devices o Image, Video output devices ƒ Printer: Peripheral device that produces a hard copy. (Inkjet, Laser) ƒ Monitor: Device that takes signals and displays them. (CRT, LCD) o (^) Audio output devices ƒ Speakers: A device that converts analog audio signals into the equivalent air vibrations in order to make audible sound. ƒ Headset: A device similar in functionality to that of a regular telephone handset but is worn on the head to keep the hands free.

Student-Activity

  1. What is computer Software?
  2. What is computer Hardware?
  3. List various Input and Output devices.
  4. Describe various Audio Output devices.
  5. What is the function of RAM

Software-Hardware Interaction layers in Computer

Architecture

In computer engineering, computer architecture is the conceptual design and fundamental operational structure of a computer system. It is a blueprint and functional description of requirements (especially speeds and interconnections) and design implementations for the various parts of a computer — focusing largely on the way by which the central processing unit (CPU) performs internally and accesses addresses in memory.

It may also be defined as the science and art of selecting and interconnecting hardware components to create computers that meet functional, performance and cost goals.

"Architecture" therefore typically refers to the fixed internal structure of the CPU (i.e. electronic switches to represent logic gates) to perform logical operations, and may also include the built-in interface (i.e. opcodes) by which hardware resources (i.e. CPU, memory, and also motherboard, peripherals) may be used by the software.

It is frequently confused with computer organization. But computer architecture is theabstract image of a computing system that is seen by a machine language (or assembly language) programmer, including the instruction set, memory address modes, processor registers, and address and data formats; whereas the computer organization is a lower level, more concrete, description of the system that involves how the constituent parts of the system are interconnected and how they interoperate in order to implement the architectural specification.

In computing, firmware is software that is embedded in a hardware device. It is often provided on flash ROMs or as a binary image file that can be uploaded onto existing hardware by a user. Firmware is defined as:

  • the computer program in a read-only memory (ROM) integrated circuit (a hardware part number or other configuration identifier is usually used to represent the software);
  • the erasable programmable read-only memory (EPROM) chip, whose program may be modified by special external hardware, but not by [a general purpose] application program.
  • the electrically erasable programmable read-only memory (EEPROM) chip, whose program may be modified by special electrical external hardware (not the usual optical light), but not by [a general purpose] application program.

Assembler

An assembly language program is translated into the target computer's machine code by a utility program called an assembler.Typically a modern assembler creates object code by translating assembly instruction mnemonics into opcodes, and by resolving symbolic names for memory locations and other entities. The use of symbolic references is a key feature of assemblers, saving tedious calculations and manual address updates after program modifications.

Kernel

In computing, the kernel is the central component of most computer operating systems (OSs). Its responsibilities include managing the system's resources and the communication between hardware and software components. As a basic component of an operating system, a kernel provides the lowest-level abstraction layer for the resources (especially memory, processor and I/O devices) that applications must control to perform their function. It typically makes these facilities available to application processes through inter-process communication mechanisms and system calls.

These tasks are done differently by different kernels, depending on their design and implementation. While monolithic kernels will try to achieve these goals by executing all the code in the same address space to increase the performance of the system, micro kernels run most of their services in user space, aiming to improve maintainability and

modularity of the code base. A range of possibilities exists between these two extremes.

Fig : A kernel connects the application software to the hardware of a computer.

Operating System

An operating system (OS) is a computer program that manages the hardware and software resources of a computer. At the foundation of all system software, an operating system performs basic tasks such as controlling and allocating memory, prioritizing system requests, controlling input and output devices, facilitating networking, and managing files. It also may provide a graphical user interface for higher level functions. It forms a platform for other software.

Application Software

Application software is a subclass of computer software that employs the capabilities of a computer directly to a task that the user wishes to perform. This should be contrasted with system software which is involved in integrating a computer's various capabilities, but typically does not directly apply them in the performance of tasks that benefit the user. In this context the term application refers to both the application software and its implementation.

Central Processing Unit

Copy introduction from page-66, BSIT-301, PTU

The type of instruction is recognized by the computer control from the four bits in position 12 through 15 of the instruction. If the three opcode bits in positions 12 through 14 are not equal to 111, the instruction is a memory reference type and the bit in the position 15 is taken as the addressing mode. If the bit is 1, the instruction is an input-output instruction.

Only three bits of the instruction are used for the operation code. It may seem that the computer is restricted to a maximum of eight distinct operations. Since register reference and input output instructions use the remaining 12 bits as part of the total number of instruction chosen for the basic computer is equal to 25.

Data Movement Instructions:

Assembly Language Instruction: Example:^ Meaning:^

Machine Language Instruction:

LOAD [REG] [MEM] STORE [MEM] [REG] MOVE [REG1] [REG2]

LOAD R2 13 STORE 8 R MOVE R2 R

R2 = M[13] M[8] = R R2 = R

1 000 0001 0 RR MMMMM 1 000 0010 0 RR MMMMM 1 001 0001 0000 RR RR

Arithmetic and Logic Instructions:

Instruction: Example: Meaning: Machine LanguageInstruction:

ADD [REG1] [REG2] [REG3] SUB [REG1] [REG2] [REG3] AND [REG1] [REG2] [REG3] OR [REG1] [REG2] [REG3]

ADD R3 R R SUB R3 R R AND R0 R R OR R2 R R

R3 = R2 + R R3 = R1 - R R0 = R3 & R R2 = R2 | R

1 010 0001 00 RR RR RR 1 010 0010 00 RR RR RR 1 010 0011 00 RR RR RR 1 010 0100 00 RR RR RR

Branching Instructions:

Instruction: Example: Meaning: Machine LanguageInstruction:

BRANCH [MEM] BZERO [MEM] BNEG [MEM]

BRANCH 10 BZERO 2 BNEG 7

PC = 10 PC = 2 IF ALU RESULT IS ZERO PC = 7 IF ALU RESULT IS NEGATIVE

0 000 0001 000 MMMMM 0 000 0010 000 MMMMM 0 000 0011 000 MMMMM

Other Instructions:

Instruction: Example: Meaning: Machine LanguageInstruction:

NOP HALT

NOP HALT

Do nothing. Halt the machine.

0000 0000 0000 0000 1111 1111 1111 1111

Student Activity

  1. How will you express machine level instructions?
  2. How does the computer control recognize the type of instruction?
  3. Describe various types of machine level instructions.
  4. Describe the addressing mode of computer instructions.

Instruction Set Selection

Copy from page-30, MCA-204, GJU (While designing …….. upto 4 points, before timing and control)

Instructions on a RISC architecture are structured in a systematic way. They can be categorized into ALU operations, memory operations, and control operations. ALU operations always work on registers, and every register from the register set can be addressed by every ALU operation. Memory operations move values between the register set and memory. This structure makes instruction selection relatively easy, and the Java data types map 1:1 to the instruction architecture.

The optimal selection of instructions is more complex on x86 than it is on Alpha for the following reasons:

  • Different addressing modes: Because a lot of operations exist in different addressing modes, unlike a RISC processor, the correct kind of instruction needs to be chosen in order to avoid any additional instructions for moving values. For example if the values for an addition operation are in a memory and in a register
  • A program has a sequence of instructions which gets executed through a cycle , called instruction cycle. The basic parts of and instruction cycle include fetch, decode, read the effective address from memory and execute.

Keywords

Copy the following from page-33, MCA-204, GJU

  • Instruction code
  • Computer register
  • System bus
  • External bus
  • Input/Output
  • Interrupt Copy the following from page-69, MCA-301, PTU
  • Common Bus
  • Fetch
  • Control Flow Chart

Review Questions

  1. Define software and hardware.
  2. Describe the function of firmware.
  3. What is the role of kernel.
  4. What are applications?
  5. Describe various machine language instructions.
  6. Give different phases of instruction cycle.
  7. What is the significance of instruction?
  8. How are computer instructions identified.
  9. What do you understand by the term instruction code?
  10. Describe the time and control of instructions.

Further Readings

Copy from page-34, MCA-204, GJU

Unit-

Control Unit and Microprogramming

Learning Objectives

After completion of this unit, you should be able to :

  • describe control unit
  • describe data path and control path design
  • describe microprogramming
  • comparing microprogramming and hardwired control
  • comparing RISC and CISC architecture
  • Describe pipelining in CPU Design
  • Describe superscalar processors

Introduction

Copy from page-97-98, MCA-301, PTU

Control Unit

As the name suggests, a control unit is used to control something. In this case, the control unit provides instructions to the other CPU devices (previously listed) in a way that causes them to operate coherently to achieve some goal as shown in Fig. (2.1). Basically, there is one control unit, because two control units may cause conflict. The control unit of a simple CPU performs the FETCH / DECODE / EXECUTE / WRITEBACK von Neumann sequence.

Figure 2.1: A general control unit.

To describe how the CPU works we may describe what signals the control unit issues and when. Clearly these instructions are more complicated than those that the control unit receives as input. Thus the control unit must store the instructions within itself, perhaps using a memory or perhaps in the form of a complicated network.

  • Program Counter , : Stores the number that represents the address of the next instruction to execute (found in memory).
  • General Purpose Registers : Examples are , , , , , to store intermediate results of execution.

Consider the example of a as shown in Fig. (2.3). The control unit is not shown.

Figure 2.3: PDP8 micro-architecture.

Modern computers are more complex, but the operation is essentially the same. First consider the micro-program executed by the Control Unit to provide the FETCH:

Note the first line may be written , but in this case the path is inferred from the diagram. The second line instructs the memory sub-system to retrieve the contents of the memory at address given by , the contents is put into. The third line does two things at the same time, moves the into the for DECODING and EXECUTING plus it instructs the to increase by 1, so as to point to the next instruction for execution. This increment instruction is available for some registers like the. The ALU does not have to be used in this case. Consider some more small examples of micro-programs which use the PDP8 micro-architecture.

Example zero into the register:

Example the contents of the to the and put the result in the .

Example the two's complement of.