Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Lecture-1.

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

MACHINE LANGUAGE PROGRAM EXECUTION

A computer executes machine language programs mechanically -- that is without understanding


them or thinking about them -- simply because of the way it is physically put together. This is
not an easy concept.
A computer is a machine built of millions of tiny switches called transistors, which have the
property that they can be wired together in such a way that an output from one switch can turn
another switch on or off. As a computer computes, these switches turn each other on or off in a
pattern determined both by the way they are wired together and by the program that the computer
is executing.
Machine language instructions are expressed as binary numbers. A binary number is made up of
just two possible digits, zero and one. So, a machine language instruction is just a sequence of
zeros and ones. Each particular sequence encodes some particular instruction.
The data that the computer manipulates is also encoded as binary numbers. A computer can work
directly with binary numbers because switches can readily represent such numbers: Turn the
switch on to represent a one; turn it off to represent a zero.
Machine language instructions are stored in memory as patterns of switches turned on or off.
When a machine language instruction is loaded into the CPU, all that happens is that certain
switches are turned on or off in the pattern that encodes that particular instruction. The CPU is
built to respond to this pattern by executing the instruction it encodes; it does this simply because
of the way all the other switches in the CPU are wired together.

WHAT HAPPENS DURING INSTRUCTION EXECUTION?

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.

Fig. 1.2.1 Instruction cycle


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.

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

SUGGESTED BOOK REFERENCES


• 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.

VIDEP REFERENCES
 https://www.youtube.com/watch?v=Z5JC9Ve1sfI
 https://www.youtube.com/watch?v=8b1Cs1Uf6hI

You might also like