Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Processor Instructions set. Learning Objectives • Learn how to use mnemonics to write code using assembly language. • Learn the difference between immediate and direct addressing • Learn how to use different types of operation codes: Data transfer, arithmetic operation, logical bitwise operations and branch operations. Processor Instruction Set Instruction set Different types of instruction set with different mnemonics 1. CISC (Complex instruction set) 2. RISC (Reduced instruction set) cmp r1, #10 Compare the value in register 1 with the value 10 cmp R1, #10 OPCODE OPERAND OPERAND # = Addressing Mode Processor Instruction Set Instruction set OPCODE • Mnemonic – style and type determined by the instruction set • Example: CMP, ADD, MOV, LDA • Bits are allocated for opcode, operand and addressing mode • Example – 32 Bit (12 – opcode / 4 – Addressing mode / 16 – Operand) Processor Instruction Set Addressing Direct addressing This is whereby a memory address is provided where the data can be obtained. LDR r1, 100 ‘load data stored in address 100 into the register Immediate Addresssing. This is whereby an actual value is provided rather than a memory address MOV r1, #10 ‘move the value 10 into the register Processor Instruction Set Operation codes • Data transfer operations • Moves data between registers and main memory • MOV, STR,LDR (Move, Store, Load) • Arithmetic operations • Opcodes that do basic arithmetic such as subtract, Add, increment, decrement, negate, compare and shift • ADD, SUB, CMP, LSL, LSR etc.. • Logical Operations • Performs the logical operations – AND, OR, NOT, XOR • Each bit of the data is compared during the operation • Used to compare values and calculate them. • AND, ORR, EOR, MVN Processor Instruction Set Operation codes • Branch Operations • Allows a program to branch to another memory address – thereby a different part of the program after evaluating a condition. Or they can branch unconditionally. • • • • • B – Branch always BNE – Branch if not Equal BEQ – Branch if equal BGT – Branch if greater than BLT – Branch if less than A label then follows the opcode BGT Alabel Processor Instruction Set Task Use the LMC to write a division program that takes in two numbers and outputs both the answer and the remainder.