Professional Documents
Culture Documents
Chapter 1lecture 1.2 (Machine Instructions) Notes+Homework+References+videoLink
Chapter 1lecture 1.2 (Machine Instructions) Notes+Homework+References+videoLink
MACHINE INSTRUCTIONS
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.
Machine code or machine language is a set of instructions executed directly by a computer’s
central processing unit (CPU). Each instruction performs a very specific task, such as a load, a
jump, or an ALU operation on a unit of data in a CPU register or memory. Every program
directly executed by a CPU is made up of a series of such instructions.
The general format of a machine instruction is
[Label:] Mnemonic [Operand, Operand] [; Comments]
Brackets indicate that a field is optional
Label is an identifier that is assigned the address of the first byte of the instruction in
which it appears. It must be followed by “:”
Inclusion of spaces is arbitrary, except that at least one space must be inserted; no space
would lead to an ambiguity.
Comment field begins with a semicolon “ ; ”
Example:
Here: MOV R5, #25H ; load 25H into R5
Table -1.2.1
INSTRUCTION REPRESENTATION
Table - 1.2.2
INSTRUCTION CYCLE
A program residing in the memory unit of the computer consists of a sequence of instructions.
The program is executed in the computer by going through a cycle for each instruction. Each
instruction cycle in turn is subdivided into a sequence of sub cycles or phases. In the basic
computer each instruction cycle consists of the following phases:
1. Fetch an instruction from memory.
2. Decode the instruction.
3. Read the effective address from memory if the instruction has an indirect address.
4. Execute the instruction.
Upon the completion of step 4, the control goes back to step 1 to fetch, decode, and execute the
next instruction. This process continues indefinitely unless a HALT instruction is encountered.
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.
MACHINE CYCLE
The machine cycle is the amount of cycles needed to do either a fetch, read or write
operation. more here. The read or write may be more than a single bus cycle if the transaction
between the CPU and memory is longer than the data width fetched or written. For example, on
an 8080 machine, the data width is 8 bits. If the CPU needs to fetch or write 16 bits of data, that
will require two bus cycles.
HOMEWORK (ASSESMENT)
Q1. A basic instruction that can be interpreted by computer has
A. Operand and opcode
B. Decoder and Accumulator
C. Sequence register and decoder
D. None of the above
Answer: A
Q2. In generic microprocessor instruction time is
A. Shorter than machine cycle time
B. Larger than machine cycle time
C. Ten times machine cycle time
D. Exactly same as machine cycle time
Answer: D
Q3. In a program using subroutine call instruction, it is necessary
A. initialise program counter
B. Clear the accumulator
C. Reset the microprocessor
D. Clear the instruction register
Answer: D
OTHER REFERENCES
• https://www.eventhelix.com/RealtimeMantra/FaultHandling/bus_cycles.htm
• https://stackoverflow.com/questions/10383354/difference-between-machine-cycle-bus-cycle-and-
execution-cycle#:~:text=The%20bus%20cycle%20is%20the,more%20here.
• https://www.geeksforgeeks.org/machine-instructions/
• http://www.ddegjust.ac.in/studymaterial/msc-cs/ms-07.pdf
• https://www.cs.helsinki.fi/group/nodes/kurssit/tikra/2010s/luennot/luento-06_p2.pdf
VIDEP REFERENCES
https://www.youtube.com/watch?v=Z5JC9Ve1sfI
https://www.youtube.com/watch?v=8b1Cs1Uf6hI