Instruction Set Architecture (ISA)

ISA | HLL | Assembly Language | Computer Organisation — 101

ROHIT CHOUHAN
5 min readSep 6, 2022

This is series of blogs in which I am explaining more about Instruction set architecture. This article is first article of this series.

What we will Learn in this Series?

Other Important Computer organization topics:

  • SRAM and DRAM
  • Number Representation

The Instruction set architecture (ISA) acts as an interface between the hardware and the software. It provides the only way through which a user is able to interact with the hardware. Computer does some operations based on instructions provided by us (so basically there is one operation corresponding to one instruction). And in similar way if we provide the N number of commands then it will execute N corresponding operations. Computer is just dumb box the instruction set provides commands to the processor, to tell it what it needs to do. And we used assembly language to write (or convert our code to assembly language) this instructions.

High Level Languages and Low level Languages

A high level language (HLL) is a programming language that enables a programmer to write programs that are more or less independent of a particular type of computer. Such language are considered high level because they are more closer to human languages and further from machine languages.

On the other hand low level languages are closer to the computer instruction set. And we have two different type of low level languages assembly language and machine code.

Assembly language is in between HLL and machine code in terms of ease of use.

Machine code is set of set of instructions that CPU understands directly and can act upon. Machine code contains only 0’s and 1’s (binary) which is very difficult to read, write, debug and manage.

Example of High level language : C/C++, Python, Java, Pascal, FORTRAN.

Example of Low level language: Assembly language

We prefer to use the high level languages over low languages because they are easier to read, write and maintain. But at the end high level languages will be translated into low level languages by compiler or interpreter.

Low level languages are quite faster than HLL but it quite hard to understand and debug for programmers and also it is machine dependent.

Operations initial idea

Operation is performing some action to get result. And there are four basic operations Add, Subtract, Multiply and Divide. We perform these operations on some values to get result. In below first example we are performing Add operation on A1 and B1 to get result C1 so here A1, B1 and C1 are called operands and more specifically A1 and B1 are called source operands (in some books it also called read operands) and C1 destination operands (or also called write operands because we used this operands to store the value). And +, — , * , / are the operators.

Example :

A1 + B1 = C1 A2 — B2 = C2 A3 * B3 = C3 A4 / B4 = C4

Our compiler will convert the High level language (HLL) code into low level assembly language. It generates a sequence of instructions from HLL program such that each instruction specifies one operation. Resultant program containing this sequence of MIPS instructions is called a MIPS assembly program.

Usually each operation has three operands (in most computers) in which two are source operands and one is destination operand

As I told you earlier that high level language code will convert into low level instructions sets, consider one such MIPS instruction add x, y, z

  • Here add is the name of the instruction which define the operation need to be done when this instruction is encountered by the computer.
  • And just right after the add that is x is the destination operand (MIPS syntax) and after this we put next two source operands y and z
  • So this operation is saying that add y and z and put result in x.

Consider you want to add x y, z, a, b and store the output into w.

python code: w = x + y + z + a + b

The corresponding MIPS assembly language code is :

add w, x, y
add w, w, z
add w, w, a
add w, w, b

For now this is good enough to go forward, you will read more about this in next articles.

Operands

Mostly we write code in High level languages, and translating HLL to assembly program involved two basic steps.

  1. Mapping HLL operators to computer instructions. example addition will map to add instruction, subtraction will map to sub and so on.
  2. Mapping HLL operands to computer instruction operands. Each operands get fixed memory location, so this step requires deciding which operands store where and when.

And after that it involved three basic steps to execute the hardware operations. consider the following MIPS assembly instruction: add C, A, B

  1. First reads the source operands from some storage.
  2. Perform the operation (write value of A + B into C)
  3. Write back the value of destination operands to some storage.

Here the storage can be either a register from the register file inside the processor or a memory location (usually DRAM) but accessing a register is faster then accessing memory (even faster than SRAM cache) so it motivates us to load operands values in register.

Now you will think that we will load all the operands values in register before executing operations. But we are not that much lucky, due the restricted number of registers every time it is not possible to allocated variables in register. Variables (operands) are allocated and de-allocated from the registers (filled from and spilled into memory).

There are three different type of operands

  • Register operands are represented by register names and register names have one-to-one mapping to register numbers
  • A memory operand address is represented as the sum of a base register content and a displacement
  • Immediate operands represent constants

— — — — — — — — — — — — — — — — — — — — — — — — — —

To get more idea on operands and assembly language I suggest you guys to read next article. I hope you liked this articles.

Kudos……………………………………………………………………………… Thanks for Reading this article.

--

--