You are on page 1of 7

Computer Architecture Which is a set of instructions executed by the

• Deals with functional behavior of CPU and it’s the only language that is capable
computer systems of understanding.
• Design Implementation for the
various parts of computer
Low Level Language
Computer Organization
• Deals with structural relationship
It is a programming language that provides no
• Operational attributes are linked
abstraction from the hardware, and it is
together and contribute to realize the represented in 0 or 1 forms, which are the
machine instructions.
architectural specification.
Low level is closer to the machine for it to
understand. It is easier for the machine to
Hierarchy of Application Programs translate 0’s and 1’s.

Application Programs Advantages


Application Programs
- Directly executable without using a
compiler or interpreter.
High-Level Language - Complete control over things like
Machine Independent High-Level Languages memory allocation.
Machine Specific Low-Level Languages - Writing OS/Firmware is great in using
low level languages.
Assembly Language
Disadvantages
Machine Language - Difficult to use
- Longer development time
Microprogram Control

Machine-level language
Hardware
Machine language, or machine code, is a low-
level language comprised of binary digits (ones
and zeros). As we know that computers can
understand only machine instructions, which are
Other way to look at it: in binary digits, i.e., 0 and 1, so the instructions
given to the computer can be only in binary codes

C,C++,Pascal

This the language that is native to the


High Level Language computer/microprocessor and the only
language it knows. Whether a modern or old
computer has a to be a machine language, or the
Assembly Language
CPU won’t know how to execute it.

Machine Language
A machine-level language is not portable as
each computer has its machine instructions, so if
Hardware we write a program in one computer will no
longer be valid in another computer.

The level indicates the amount of abstraction


between programming language and machine
Language
Additional Note: machine code is to convert the
directly executed by assembly code into
Programming Languages like BASIC, Java, the computer. machine code.
Python, Ruby, and pearl are all interpreted
language, and it means it need a separated piece
of software called an interpreter, or a Run Time Compiler and Assembler
environment.
The interpreter will look at the instruction at a
time and then convert that into machine learning
instructions for the CPU.
The interpreter must be present at all times in
order for the code to work.

C#, C++, PASCAL, COBOL, ASSEMBLY uses


a compiler transforms the code into machine
language permanently. Once the process is
finished, it no longer needs the compiler for the Translating Languages
program to run. It is only needed when there are
changes of the code.

Assembly Language
The assembly language contains some human-
readable commands such as mov, add, sub, etc.
The assembly language code is not portable
because the data is stored in computer registers,
and the computer has to know the different sets of
registers.
Why Learn Assembly Language?
Assembly language has some abstraction from
the hardware while machine language has zero Accessibility to system hardware
abstraction. - Assembly Language is useful for
Compilers translate high-level programs to implementing system software
machine code either directly or indirectly via an - Also useful for small embedded
assembler. system applications

Machine-level Assembly language Space and time efficiency


language - Understanding sources
The machine-level The assembly inefficiency
language comes at the language comes - Tuning program performance
lowest level in the above the machine
- Writing compact code.
hierarchy, so it has language means that it
zero abstraction level has less abstraction
from the hardware. level from the
hardware. Assembler
It cannot be easily It is easy to read,
understood by write, and maintain. Software tools are needed for editing,
humans. assembling, linking, and debugging assembly
The machine-level The assembly language programs
language is written in language is written in An assembler is a program that converts source-
binary digits, i.e., 0 simple English
code programs written in assembly language into
and 1. language, so it is
easily understandable object files in machine language
by the users.
It does not require any In assembly language,
translator as the the assembler is used
Popular Assemblers - Compared to low level programs, they are
generally less memory efficient.
- TASM(Turbo Assembler for
- Cannot communicate directly with the
Borland)
hardware.
- NASM(Netwide Assembler for
both windows and Linux. Low Level High Level
- GNU assembler attributed by the It is a machine- It is a user-friendly
free software foundation friendly language, language as this
- MASM(Macro Assembler from i.e., the computer language is written in
Microsoft,) understands the simple English words,
machine language, which can be easily
Linker and Link libraries which is represented understood by
in 0 or 1. humans.
You need a linker program to produce executable The low-level It executes at a faster
files. language takes more pace.
It combines your program’s object file created by time to execute.
It requires the It requires the
the assembler with other object files and link
assembler to convert compiler to convert
libraries and produces a single executable
the assembly code the high-level
program. into machine code. language instructions
LINK32.EXE is the linker program provided into machine code.
with the MASM distribution for linking 32-bit The machine code The high-level code
cannot run on all can run all the
programs.
machines, so it is not platforms, so it is a
We will use a library for input and output. a portable language. portable language.
It is memory efficient. It is less
memory efficient.
Debugging and Debugging and
High-Level Language
maintenance are not maintenance are
The high-level language is a programming easier in a low-level easier in a high-level
language that allows a programmer to write the language. language.
programs which are independent of a
particular type of computer. Programmer’s View of a Computer System
It has high level statements which means fewer
instructions to code.
The high-level languages are considered as high-
level because they are closer to human
languages than machine-level languages.
Contain few machine-dependent details.
Compiler translates to the target machine
language.
Advantages
- The high-level language is easy to read, write,
and maintain as it is written in English like Application Programs (Level 5)
words.
- The high-level languages are designed to - Written in high-level
overcome the limitation of low-level programming languages
language, i.e., portability. The high-level - Such as Java, C++, Pascal,
language is portable; i.e., these languages are Visual Basic…
machine independent. - Programs compile into assembly
language level (Level 4)
Disadvantages
- It takes additional translation times to
translate the source to machine code.
- High level programs are comparatively
slower than low level programs.
Application Programs (Level 4) Each digit(bit) is either 1 or 0
- Instruction mnemonics are used Each bit represents a power of 2:
- Have one to one correspondence
to machine language
- Calls function written all the
operating system level(level 3)
- Programs are translated into
machine language(Level 2)
Operating System (Level 3) Every binary number is a sum of powers of 2

- Provides services to level 4 and 5


programs
- Translated to run at the machine
instruction level(Level 2)
Instruction Set Architecture (Level 2)
- Specifies how a processor
function
- Machine instructions, registers,
and memory are exposed Converting Binary to Decimal
- Machine language is executed by
Weighted posistional notations show how to
level 1(microarchitecture)
calculate decimal value of each bit
Microarchitecture (Level 1)
d = binary digit
- Controls the execution of
machine instructions (Level 2)
- Implemented by digital logic
(Level 0) binary: 00001001 = decimal 9
Digital Logic (Level 0)
- Implements the
microarchitecture Convert Unsigned Decimal to Binary
- Uses digital logic gates Repeatedly divide the decimal by integer 2.
- Logic gates re implemented
using transitions.

Data Presentation
Binary Numbers
- Digits are 1 and 0 where 1 = true and 0 =
false
- MSB – Most significant bit Hexadecimal Integers
- LSB – least significant bit Binary values are represented in hexadecimal/
Bit numbering:
Converting Hexadecimal to Decimal Hexadecimal Addition
Multiply each digit by its corresponding power of Divide the sum of two digits by the number of
16 bases 16.
The quotient becomes the carry value
The remainder is the sum digit
d= hexadecimal digit

Converting Decimal to Hexadecimal


Signed Integers
Repeatedly divide the decimal integer by 16.
Several ways to represent a signed number
- Sign-Magnitude
- Biased
- 1’s complement
- 2’s complement
Divide the range of values into 2 equal parts
- First pare corresponds to the
positive numbers (>=0)
Integer Storage Sizes
- Second part corresponds to the
negative numbers(<0)
Focus will be on the 2’s complement
representation
- Has many advantages over ither
representations
- Used widely in processors to
represent signed integers
Two’s Complement Representation
Positive numbers
Binary Addition
- Signed value =Unsigned value
- Start with the least significant
bit(rightmost bit) Negative numbers
- Add each pair of bits
- Signed value = unsigned value -
- Include the carry in the addition,
2^n
if present.
- n = numbers of bits
Negative weight for MSB
- Another way to obtain the signed
value is to assign a negative
weight to most-significant bit.
Sign Extension

Two’s Complement of A hexadecimal

Forming The Two’s Complement

Binary Subtraction

Signed bit

Hexadecimal Subtraction
Carry and Overflow Control Characters

Examples:

TERMINOLOGY FOR DATA


REPRESNTATION

Printable Hexadecimal

Character Storage

You might also like