[go: up one dir, main page]

0% found this document useful (0 votes)
7 views10 pages

Chapter 7 Comp Arch

Uploaded by

Paulo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views10 pages

Chapter 7 Comp Arch

Uploaded by

Paulo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

CHAPTER 7.

ASSEMBLY LANGUAGE
INTRODUCTION
Programmers write instructions in various programming languages, some directly understandable by
computers and others requiring intermediate translation steps. Hundreds of computer languages are
in use today. These can be divided into three general types:

a. Machine Language

b. Low Level Language

c. High level Language

I- MACHINE LANGUAGE
Any computer can directly understand its own machine language. Machine language is the “natural
language” of a computer and such is defined by its hardware design. Machine languages generally
consist of strings of numbers (ultimately reduced to 1s and 0s) that instruct computers to perform
their most elementary operations one at a time. Machine languages are machine dependent (i.e a
particular machine language can be used on only one type of computer). Such languages are
cumbersome for humans, as illustrated by the following section of an early machine language
program that adds overtime pay to base pay and stores the result in gross pay.

Advantages of Machine Language

i. It uses computer storage more efficiently


ii. ii. It takes less time to process in a computer than any other programming language

Disadvantages of Machine Language


i. It is time consuming
ii. It is very tedious to write
iii. It is subject to human error

1.2 LOW LEVEL LANGUAGE

Machine Language were simply too slow and tedious for most programmers. Instead of using strings
of numbers that computers could directly understand, programmers began using English like
abbreviations to represent elementary operations. These abbreviations form the basis of Low
Level Language. In low level language, instructions are coded using mnemonics. E.g. DIV, ADD, SUB,
MOV. Assembly language is an example of a low level language. An assembly language is a low-level
language for programming computers. It implements a symbolic representation of the numeric
machine codes and other constants needed to program a particular CPU architecture. This
representation is usually defined by the hardware manufacturer, and is based on abbreviations
(called mnemonics) that help the programmer remember individual instructions, registers, etc. An
assembly language is thus specific to a certain physical or virtual computer architecture (as opposed
to most high-level languages, which are usually portable). A utility program called an assembler is
used to translate assembly language statements into the target computer's machine code. The
assembler performs a more or less isomorphic translation (a one-to-one mapping) from mnemonic
statements into machine instructions and data. (This is in contrast with high-level languages, in which
a single statement generally results in many machine instructions.)
Advantages of Low Level Language i. It is more efficient than machine language ii. Symbols make it
easier to use than machine language iii. It may be useful for security reasons
Disadvantages of Low Level Language i. It is defined for a particular processor ii. Assemblers are
difficult to get iii. Although, low level language codes are clearer to humans, they are
incomprehensible to computers until they are translated to machine language.
1.3 HIGH LEVEL LANGUAGE:

Computers usage increased rapidly with the advent of assembly languages, but programmers still
had to use many instructions to accomplish even the simplest tasks. To speed up the programming
process, high level language were developed in which simple statements could be written to
accomplish substantial tasks. Translator programs called compilers convert high level language
programs into machine language. High level language allows programmers to write instructions that
look almost like everyday English and contain commonly used mathematical notations. A payroll
program written in high level language might contain a statement such as grossPay=basePay +
overTimePay
Advantages of High Level Language i. Compilers are easy to get ii. It is easier to use than any other
programming language iii. It is easier to understand compared to any other programming language
Disadvantages of High Level Language i. It takes more time to process in a computer than any other
programming language

HLL (High Level Language) programs are machine


independent. They are easy to learn, easy to use,
and convenient for managing complex tasks.
Assembly language programs are machine
specific. It is the language that the processor
“directly” understands.

ASSEMBLER

Example assembly language programs


Example 1 f = g + h – i
Assume that f, g, h, i are assigned to $s0, $s1, $s2, $s3
II - INSTRUCTION SETS
CPU Architecture also known as Instruction Set Architecture (ISA).

ISA allows communication between software and hardware.

ISA is also a group of commands for CPU in machine Language.

Basically ISA tall you how processor is going to process your program and instructions (commands).
Instructions is also called opcode or operation code.

Example of opcode: add ,Jump ,Load , store

There are two type of ISA:

- CISC

- RISC
CISC:

CISC is stand for Complex Instruction Set Computing. It is architecture for large number of
instructions.

Example of CISC:

-The microprocessor of CISC is Intel 80286 which is the 64bit version of 8086 instructions set.

-Its used on desktop (PC) and laptop.

RISC

RISC is stand for Reduced Instruction Set Computing. It is has lesser number of instructions.

Example of RISC:

-ARM processor

- Its used on taplet, smart phone and even in game consle.

The Semantic Gap:


Semantic gap is the difference between the operations provided in HLLs and those provided in
computer architecture.

In order to improve efficiency of software development, powerful high-level programming languages


have been developed (e.g., C++, Java).

They support higher levels of abstraction.


This evolution has increased the semantic gap between programming languages and machine
languages.

Main features of CISC


-A large number of instructions (> 200) and complex instructions and data types.
- Many and complex addressing modes.
- Direct hardware implementations of high-level language statements.
For example, CASE (switch)
- Microprogramming techniques are used so that complicated instructions can be implemented.
- Memory bottleneck is a major problem, due to complex addressing modes and multiple memory
accesses per instruction.

Main Characteristics of RISC:

-A small number of simple instructions (desirably < 100).

Simple and small decode and execution hardware are required.

A hard-wired controller is needed, rather than using microprogramming.

The CPU takes less silicon area to implement, and runs also faster.

-Execution of one instruction per clock cycle.

-The instruction pipeline performs more efficiently due to simple instructions and similar execution
patterns.

- Complex operations are executed as a sequence of simple instructions.

In the case of CISC they are executed as one single or a few complex instructions.

- An illustrative example with the following assumption:

* A program with 80% of executed instructions being simple and 20% complex.

*CISC: simple instructions take 4 cycles, complex instructions take 8 cycles; cycle time is 100 ns.

* RISC: simple instructions are executed in one cycle; complex operations are implemented as a
sequence of instructions (14 instructions on average); cycle time is 75 ns.
RISC VS. CISC
- CISC has more instrution sets than RISC so instrution cycle in CISC is more complex than RISC.

-CISC is in hardware and RISC is in software.

-Execution time

*CISC has multiple number of cycle per instrution

* RISC has 1 cycle per instrution

- CISC CPUs are more larger than RISC CPUs.

* RISC CPUs can but in a single chip which make RISC light and portable.

- Speed:

* CISC CPU take little while to process the instructions

* RISC can only perform simple task quicker than CISC.

- Most recent processors are not typical RISC or CISC, but combine advantages of both approaches.
*Called EPIC (Explicity Parallal Instrution Computing).

III- ADDRESSING MODES OF 8086:


 Specifies a rule for interpreting or modifying the address field of the instruction before the operand
is actually referenced.

 Computers use addressing mode techniques for the purpose of accommodating the following
purposes:-
o To give programming versatility to the user by providing such facilities as pointers to memory,
counters for loop control, indexing of data and various other purposes.
o To reduce the number of bits in the addressing field of the instructions.
 Other computers use a single binary for operation & Address mode.
 The mode field is used to locate the operand.
 Address field may designate a memory address or a processor register.
 There are 2 modes that need no address field at all (Implied & immediate modes).
Effective address (EA):
- The effective address is defined to be the memory address obtained from the computation dictated
by the given addressing mode.
-The effective address is the address of the operand in a computational-type instruction.
The most well known addressing mode are:
 Implied Addressing Mode.

 Immediate Addressing Mode

 Register Addressing Mode

 Register Indirect Addressing Mode

 Auto-increment or Auto-decrement Addressing Mode

 Direct Addressing Mode

 Indirect Addressing Mode

 Displacement Address Addressing Mode

 Relative Addressing Mode

 Index Addressing Mode

 Stack Addressing Mode

IMMEDIATE ADDRESSING MODE


• The operand is specified with in the instruction.
• Operand itself is provided in the instruction rather than its
address.
Move Immediate
MVI A , 15h A ← 15h Here 15h is the immediate operand
Add Immediate
ADI 3Eh A ← A + 3Eh Here 3Eh is the immediate operand

2. REGISTER ADDRESSING MODE


• The operand is specified with in one of the processor register.
• Instruction specifies the register in which the operand is stored.
Move
MOV C , A C ← A Here A is the operand specified in register
Add
ADD B A ← A + B Here B is the operand specified in register

DIRECT ADDRESSING MODE


• The instruction specifies the direct address of the operand.
• The memory address is specified where the actual operand is.
Load Accumulator
LDA 2805h A ← [2805]
It loads the data from memory location 2805 to A.

RELATIVE ADDRESSING MODE


• In relative addressing mode, contents of Program Counter PC is
added to address part of instruction to obtain effective address.

Store Accumulator
STA 2803h [2803] ← A
It stores the data from A to memory location 2803.

INTERRUPT SIGNALS:
 The key interrupt interface signals are interrupt request (INTR) and interrupt acknowledge
(INTA).
 INTR is an input to the 8086 that can be used by an external device to signal that it need to
be serviced.
 Logic 1 at INTR represents an active interrupt request. When an interrupt request has been
recognized by the 8086, it indicates this fact to external circuit with pulse to logic 0 at the
INTA output.
 The TEST input is also related to the external interrupt interface. Execution of a WAIT
instruction causes the 8086 to check the logic level at the TEST input.
 If the logic 1 is found, the MPU suspend operation and goes into the idle state. The 8086 no
longer executes instructions; instead it repeatedly checks the logic level of the TEST input
waiting for its transition back to logic 0.
 As TEST switches to 0, execution resume with the next instruction in the program. This
feature can be used to synchronize the operation of the 8086 to an event in external hardware.
 There are two more inputs in the interrupt interface: the nonmaskable interrupt NMI and the
reset interrupt RESET.
 On the 0-to-1 transition of NMI control is passed to a nonmaskable interrupt service routine.
The RESET input is used to provide a hardware reset for the 8086. Switching RESET to logic
0 initializes the internal register of the 8086 and initiates a reset service routine.

IV-. INTERFACING TECHNIQUES


Interfacing & I/O Devices
• To communicate with the outside world microcomputer use peripheral (I/O devices)
• Commonly used peripherals are: A/D converter, D/A converter, CRT, printers, hard disks,
floppy disks etc.
• Peripherals are connected to the microcomputer through electronic circuits, called interfacing
circuit
• The interfacing circuit converts the data available from an input device into compatible
format
• The interface associated with the output device converts the output of the microcomputers Into the
desired peripheral format
There are two ways of communication in which the microprocessor can connect with the outside
world.
 Serial Communication Interface
 Parallel Communication interface

Serial Communication Interface − In this type of communication, the interface gets a single byte of
data from the microprocessor and sends it bit by bit to the other system serially and vice-a-versa.
Parallel Communication Interface − In this type of communication, the interface gets a byte of data
from the microprocessor and sends it bit by bit to the other systems in simultaneous (or) parallel
fashion and vice-a-versa.

General & Special Purpose Interfacing Devices


• General purpose devices are:
• I/O Port
• Programmable Peripheral Interface (PPI)
• DMA Controller
• Communication Interface
• Special purpose interfacing devices are designed to interface a particular type of I/O device,
examples as:
• CRT Controller
• Optical Disk Controller
• Key Board and Display Interface
I/O Ports
• An input device is connected to the microprocessor through an input port
• An input port is a place for unloading data
• An input device sends data to the input port
• The microprocessor reads data from the input port
• Thus data are transferred from the input device to the accumulator via input port
• Similarly, an output device is connected to the microprocessor through an output port
• The microprocessor sends data to an output port

I/O Ports Description


• An I/O port may be programmable or non-programmable
• A non-programmable port behaves as an input port if it has been designed so and connected
in input mode
• Similarly, a non-programmable port designed so and connected in output mode, acts as an
output port
• But a programmable I/O port can be programmed to act either as an input port or output port
• The electrical connections remain same

V -SPECIAL PROCESSOR
V.1 Digital signal processor

digital signal processor (DSP) is a specialized microprocessor chip, with its architecture
optimized for the operational needs of digital signal processing.[1]: 104–107 [2] DSPs
are fabricated on MOS integrated circuit chips.[3][4] They are widely used in audio signal
processing, telecommunications, digital image processing, radar, sonar and speech
recognition systems, and in common consumer electronic devices such as mobile phones, disk
drives and high-definition television (HDTV) products.[3]
The goal of a DSP is usually to measure, filter or compress continuous real-world analog signals.
Most general-purpose microprocessors can also execute digital signal processing algorithms
successfully, but may not be able to keep up with such processing continuously in real-time. Also,
dedicated DSPs usually have better power efficiency, thus they are more suitable in portable
devices such as mobile phones because of power consumption constraints.[5] DSPs often use
special memory architectures that are able to fetch multiple data or instructions at the same time.
Digital Signal Processing

DSP is a technique of performing the mathematical operations on the signals in digital domain. As
real time signals are analog in nature we need first convert the analog signal to digital, then we have
to process the signal in digital domain and again converting back to analog domain. Thus ADC is
required at the input side whereas a DAC is required at the output end. A typical DSP system is as
shown in figure 1.1.
Block diagramm of didital signal processing

1.2 Need for DSP

Analog signal Processing has the following drawbacks:  They are sensitive to environmental
changes  Aging  Uncertain performance in production units  Variation in performance of units 
Cost of the system will be high  Scalability If Digital Signal Processing would have been used we can
overcome the above shortcomings of ASP.

V.2 MICROCONTROLLERS
A microcontroller (MCU for microcontroller unit) is a small computer on a single VLSI integrated
circuit (IC) chip. A microcontroller contains one or more CPUs (processor cores) along
with memory and programmable input/output peripherals. Program memory in the form
of ferroelectric RAM, NOR flash or OTP ROM is also often included on chip, as well as a small
amount of RAM. Microcontrollers are designed for embedded applications, in contrast to
the microprocessors used in personal computers or other general purpose applications consisting
of various discrete chips.
In modern terminology, a microcontroller is similar to, but less sophisticated than, a system on a
chip (SoC). An SoC may connect the external microcontroller chips as the motherboard
components, but an SoC usually integrates the advanced peripherals like graphics processing
unit (GPU) and Wi-Fi interface controller as its internal microcontroller unit circuits.
Microcontrollers are used in automatically controlled products and devices, such as automobile
engine control systems, implantable medical devices, remote controls, office machines,
appliances, power tools, toys and other embedded systems. By reducing the size and cost
compared to a design that uses a separate microprocessor, memory, and input/output devices,
microcontrollers make it economical to digitally control even more devices and processes. Mixed
signal microcontrollers are common, integrating analog components needed to control non-digital
electronic systems. In the context of the internet of things, microcontrollers are an economical
and popular means of data collection, sensing and actuating the physical world as edge devices.

You might also like