Section B (Use a separate answer book for this Section) 2a i) Among several poss
ID: 3712773 • Letter: S
Question
Section B (Use a separate answer book for this Section) 2a i) Among several possible fields of an instruction, name one field that each instruction must have. What does that field specify? ii) For an instruction with one or more operands, name two possible places where the operands can be located (or stored). Which place will provide the faster instruction execution and why'? iii) If a general purpose register stores an operand in two's complement format, what is the effect by shifting the register by 2 bit positions to the left? If we are allowed to examine only the most significant bit of the register before and after the shift, how can we tell whether the shift provides the expected, correct result? iv) When an interrupt is just generated and received by a typical CPU (e.g., Pentium), specify a few steps that the CPU will take to respond to the interrupt and finally resume the original program execution.Explanation / Answer
Solution of the Question:
2(a) (i)
In computer assembly/machine language each instruction has the following fields and format:
Opcode srcOpreand, destOperand
For Example
MOV source, destination
Out of these ‘Opcode’field is the part of the instruction, which is always there in any of the instruction.
Here MOV is Opcode and it signifies what operation needs to be executed as part of instruction. It kinds of instruction to CPU for operation.
2(a) (ii)
In any instruction the operands are stored at any of following locations:
Based on the location of data in operand specified as part of instruction there various types of addressing modes:
Out of these when the operand are specified in Registers that part of access is the fastest. This is because the access to registers in fastest operation in terms if all types of access mechanisms.
2(a) (iii)
In computer shifting the bits of a number (+ve or negative) by n bit means that multiplying that number by 2^2. In our case as we are shifting by 2 bits that means that number is multiplied by 4.
However for negative numbers and positive numbers care should be taken as by shifting if the sign of the number is getting changed from earlier sign of number then the result is undefined. This can be checked using checking the MSB. Thus we can say that checking MSB we can infer that if left shift is defined as per rule or undefined if sign change happens.
2(a) (iv)
When an interrupt occurs the programs execution flow is altered and execution goes to interrupt service routine (ISR). This is a special routine and used based on the type of interrupt. This uses Interrupt Vector Table that stores the pointers to the associated interrupt handler. Some steps during this are as follows:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.