This ppt presentation instruction set in computer architecture
Size: 312.59 KB
Language: en
Added: Oct 08, 2023
Slides: 33 pages
Slide Content
Instruction Sets
A computer instruction is a binary code that determines the micro-operations in a sequence for a computer. They are saved in the memory along with the information. Each computer has its specific group of instructions. They can be categorized into two elements as Operation codes ( Opcodes ) and Address. Opcodes specify the operation for specific instructions. An address determines the registers or the areas that can be used for that operation. The address bits of an instruction code is used as an operand Operands are definite elements of computer instruction that show what information is to be operated on.
Addressing Mode: The addressing mode indicates how the data is represented . The method in which a target address or effective address is recognized within the instruction is known as addressing mode . 1.Direct Addressing − It uses the address of the operand. 2.Indirect Addressing − It facilitates the address as a pointer to the operand . Opcode : The opcode part indicates the operation type on the data . An opcode is a collection of bits that represents the basic operations including add, subtract, multiply, complement, and shift. Operand: The operand part indicates either the data or the address of the data.
O prends Operands are definite elements of computer instruction that show what information is to be operated on. The most important general categories of data are Addresses Numbers Characters
Addresses Addresses are nothing but a form of data. Here some calculations must be performed on the operand reference in an instruction, which is to determine the physical address of an instruction
Numbers 1. Integer or fixed point : 2. Floating point 3. Decimal number
Characters A common form of data is text or character strings. While textual data are most convenient for humans. But computers work in binary. So, all characters, whether letters, punctuation or digits, are stored as binary numbers. All of the characters that a computer can use are called character set s. Here are the two common standards, such as: American Standard Code for Information Interchange (ASCII) Unicode
ASCII uses seven bits , giving a character set of 128 characters. The characters are represented in a table called the ASCII table. The 128 characters include: 32 control codes (mainly to do with printing) 32 punctuation codes, symbols, and space 26 upper-case letters 26 lower-case letters numeric digits 0-9
Character Denary Binary Hexadecimal A 65 1000001 41 Z 90 1011010 5A a 97 1100001 61 z 122 1111010 7A 48 0110000 30 9 57 0111001 39 Space 32 0100000 20 ! 33 0100001 21
Types of operation Computer must have instructions that can perform 4 types of operation: Data Transfer Arithmatic & logic operation I/O transfer System control
Instruction Formats In computer organization, instruction formats refer to the way instructions are encoded and represented in machine language. Depending upon the number of addresses , There are several types of instruction formats, including zero, one, two, and three-address instructions. Here is a brief overview Zero-address instructions : One-address instructions Two-address instructions Three-address instructions
Zero-address instructions : These instructions do not specify any operands or addresses . Instead, they operate on data stored in registers or memory locations implicitly defined by the instruction. For example, a zero-address instruction might simply add the contents of two registers together without specifying the register names . e.g. PUSH ,POP
One(1) Address Instruction format The instruction format in which the instruction uses only one address field is called the one address instruction format In this type of instruction format, one operand is in the accumulator and the other is in the memory location It has only one operand It has two special instructions LOAD and STORE E.g. LOAD C, ADD B
Two(2) Address Instruction format The instruction format in which the instruction uses only two address fields is called the two address instruction format This type of instruction format is the most commonly used instruction format As in one address instruction format, the result is stored in the accumulator only, but in two addresses instruction format the result can be stored in different locations This type of instruction format has two operands It requires shorter assembly language instructions E.g. MOV R1, A; ADD R1, B etc.
Three(3 ) Address Instruction format The instruction format in which the instruction uses the three address fields is called the three address instruction format It has three operands It requires shorter assembly language instructions It requires more bits E.g.ADD A , B , C etc .
Types of Instruction Instruction is set of command that is given to processor so that it can perform some task Types of instruction: 1) Data transfer Instruction 2) Data Manipulation Instruction 3) Input and Output instructions
1) Data transfer Instruction It can perform data transfer between various storage places in computer system e.g register ,memory & I/O As data & instruction both are stored in memory so processor need to read that from memory so for that purpose we need two operations LOAD & STORE Load operation transfer data from memory to processor & store operation moves data from processor to memory. E.g. Load ,store ,Move ,Exchange, Push ,POP
2 ) Data manipulation Instruction This type of instructions perform operations on data & indicate computational capabilities for processor. These operation can be either arithmetic ,logical or shift operation. Arithmetic operations include addition ,subtraction , multiplication, division, increment, decrement and finding the complement of a number. The logical and bit manipulation instructions include AND, OR, XOR, Clear carry, set carry, etc. Similarly, you can perform different types of shift and rotate operations.
Input and Output instructions are used for transferring information between the registers, memory and the input / output devices . It is possible to use special instructions that exclusively perform I/O transfers, or use memory – related instructions itself to do I/O transfers
Addressing Mode The operands of the instructions can be located either in the main memory or in the CPU registers. If the operand is placed in the main memory, then the instruction provides the location address in the operand field . Many methods are followed to specify the operand address. The different methods/modes for specifying the operand address in the instructions are known as addressing modes.
Types of Addressing Mode Immediate Mode Register Indirect Mode Direct Addressing Mode Indirect Addressing Mode
Immediate Mode In this mode, the operand is specified in the instruction itself. An immediate mode instruction has an operand field rather than the address field. For example: ADD 7, which says Add 7 to contents of accumulator. 7 is the operand here.
Register Indirect Mode In this mode, the instruction specifies the register whose contents give us the address of operand which is in memory. Thus, the register contains the address of operand rather than the operand itself. In other words , the instruction defines a register in the CPU whose contents provide the address of the operand in memory. In other words, the selected register includes the address of the operand rather than the operand itself. e.g.MOVA , R5;
Direct Addressing Mode In this mode, effective address of operand is present in instruction itself. No additional calculations to find the effective address of the operand. For Example: ADD R1, 4000 - In this the 4000 is effective address of operand. NOTE: Effective Address is the location where operand is present. E.g MOVR2 , 45H;
Indirect Addressing Mode In this, the address field of instruction gives the address where the effective address is stored in memory. This slows down the execution, as this includes multiple memory lookups to find the operand.
Instruction Cycle An instruction cycle, also known as fetch-decode-execute cycle is the basic operational process of a computer. This process is repeated continuously by CPU from boot up to shut down of computer. Following are the steps that occur during an instruction cycle: 1. Fetch the Instruction The instruction is fetched from memory address that is stored in PC(Program Counter) and stored in the instruction register IR. At the end of the fetch operation, PC is incremented by 1 and it then points to the next instruction to be executed.
2. Decode the Instruction The instruction in the IR is executed by the decoder. 3. Read the Effective Address If the instruction has an indirect address, the effective address is read from the memory. Otherwise operands are directly read in case of immediate operand instruction. 4. Execute the Instruction The Control Unit passes the information in the form of control signals to the functional unit of CPU. The result generated is stored in main memory or sent to an output device. The cycle is then repeated by fetching the next instruction. Thus in this way the instruction cycle is repeated continuously.