Lecture 1.2.2 (Assembly Language Instructions Instruction Cycle, Machine Language Program Execution)
Lecture 1.2.2 (Assembly Language Instructions Instruction Cycle, Machine Language Program Execution)
ASSISTANT PROFESSOR
BE-CSE
ASSEMBLY LANGUAGE INSTRUCTIONS
The time a microprocessor needs to fetch and execute one entire instruction is
known as an instruction cycle.
There are typically four stages of an instruction cycle that the CPU carries out-
i. Fetching the instruction: The next instruction is fetched from the memory
address that is currently stored in the program counter (PC) and stored in the
instruction register (IR). At the end of the fetch operation, the PC points to the
next instruction that will be read at the next cycle.
ii. Decode the instruction: During this cycle the encoded instruction present in
the IR (instruction register) is interpreted by the decoder.
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 condition of any feedback from the ALU, Program
Counter may be updated to a different address from which the next instruction
will be fetched.
Instruction Cycle State Diagram
For an instruction cycle, various states can be null, while others can be visited
more than once. The below figure provides a large aspect of the instruction cycle
of a basic computer.
Instruction Address Calculation − The address of the next instruction is
computed. A permanent number is inserted to the address of the earlier
instruction.
Instruction Fetch − The instruction is read from its specific memory location
to the processor.
Instruction Operation Decoding − The instruction is interpreted and the
type of operation to be implemented and the operand(s) to be used are decided.
Operand Address Calculation − The address of the operand is evaluated if it
has a reference to an operand in memory or is applicable through the
Input/Output.
Operand Fetch − The operand is read from the memory or the I/O.
Data Operation − The actual operation that the instruction contains is executed.
Store Operands − It can store the result acquired in the memory or transfer it to
the I/O.
Machine Instructions are commands or programs written in machine code of
a machine (computer) that it can recognize and execute.
●A machine instruction consists of several bytes in memory that tells the
processor to perform one machine operation.
●The processor looks at machine instructions in main memory one after
another, and performs one machine operation for each machine instruction.
●The collection of machine instructions in main memory is called a machine
language program.
BUS CYCLE: The bus cycle is the cycle or time required to make a
single read or write transaction between the CPU and an external device such
as external memory.
For example, on an 8085 machine, the data bus width is 8 bits. If the CPU needs
to fetch or write 16 bits of data, that will require two bus cycles and one machine
cycle as it will use a 16- bit register directly to fetch or write the data.
References
Reference Books:
J.P. Hayes, “Computer Architecture and Organization”, Third Edition.
Mano, M., “Computer System Architecture”, Third Edition, Prentice Hall.
Stallings, W., “Computer Organization and Architecture”, Eighth Edition, Pearson
Education.
Text Books:
Carpinelli J.D,” Computer systems organization &Architecture”, Fourth
Edition, Addison Wesley.
Patterson and Hennessy, “Computer Architecture” , Fifth Edition Morgaon
Kauffman.
Reference Website
https://www.slideshare.net/shweta-sharma99/instruction-cycle
http://www.eie.polyu.edu.hk/~enyhchan/addrmode.pdf
http://www.cs.uwm.edu/classes/cs458/Lecture/HTML/ch05s05.html
Video References
https://www.youtube.com/watch?v=p9n91lXeJ8Y
https://www.youtube.com/watch?v=3MfyrwPjYk4