You are on page 1of 10

Instruction Set Architecture (ISA)

The Instruction Set Architecture (ISA) is the part of the processor that is visible to the programmer or compiler writer. The ISA serves as the boundary between software and hardware. We will briefly describe the instruction sets found in many of the microprocessors used today. The ISA of a processor can be described using 5 catagories: Operand Storage in the CPU Where are the operands kept other than in memory? Number of explicit named operands How many operands are named in a typical instruction. Operand location Can any ALU instruction operand be located in memory? Or must all operands be kept internaly in the CPU? Operations What operations are provided in the ISA. Type and size of operands What is the type and size of each operand and how is it specified? Of all the above the most distinguishing factor is the first. The 3 most common types of ISAs are: 1. Stack - The operands are implicitly on top of the stack. 2. Accumulator - One operand is implicitly the accumulator. 3. General Purpose Register (GPR) - All operands are explicitely mentioned, they are either registers or memory locations. Lets look at the assembly code of
A = B + C;

in all 3 architectures:
Stack PUSH A PUSH B ADD POP C Accumulator LOAD A ADD B STORE C GPR LOAD R1,A ADD R1,B STORE R1,C -

Not all processors can be neatly tagged into one of the above catagories. The i8086 has many instructions that use implicit operands although it has a general register set. The i8051 is another example, it has 4 banks of GPRs but most instructions must have the A register as one of its operands. What are the advantages and disadvantages of each of these approachs?
Stack

Advantages: Simple Model of expression evaluation (reverse polish). Short instructions. Disadvantages: A stack can't be randomly accessed This makes it hard to generate eficient code. The stack itself is accessed every operation and becomes a bottleneck.
Accumulator

Advantages: Short instructions. Disadvantages: The accumulator is only temporary storage so memory traffic is the highest for this approach.
GPR

Advantages: Makes code generation easy. Data can be stored for long periods in registers. Disadvantages: All operands must be named leading to longer instructions. Earlier CPUs were of the first 2 types but in the last 15 years all CPUs made are GPR processors. The 2 major reasons are that registers are faster than memory, the more data that can be kept internaly in the CPU the faster the program wil run. The other reason is that registers are easier for a compiler to use.

ALU

Short for Arithmetic Logic Unit, ALU is one of the many components within a computer processor. The ALU performs mathematical, logical, and decision operations in a computer and is the final processing performed by the processor. After the information has been processed by the ALU, it is sent to the computer memory. In some computer processors, the ALU is divided into two distinct parts, the AU and the LU. The AU performs the arithmetic operations and the LU performs the logical operations.

An ALU must process numbers using the same format as the rest of the digital circuit. The format of modern processors is almost always the two's complement binary number representation. Early computers used a wide variety of number systems, including Ones' complement, Two's [NB 2] complement, sign-magnitude format, and even true decimal systems, with various representation of the digits. ALUs for each one of these that makes it easier for the ALUs to calculate additions and [citation needed] subtractions. The ones' complement and two's complement number systems allow for subtraction to be accomplished by adding the negative of a number in a very simple way which negates the need for specialized circuits to do subtraction; however, calculating the negative in two's complement requires adding a one to the low order bit and propagating the carry. An alternative way to do two's complement subtraction of AB is to present a one to the carry input of the adder and use B rather than B as the second input. The arithmetic, logic and shift circuits introduced in previous sections can be combined into one ALU with common selection.

Most of a processor's operations are performed by one or more ALUs. An ALU loads data from input registers, an external control unit then tells the ALU what operation to perform on that data, and then the ALU stores its result into an output register. The control unit is responsible for moving the processed data between these registers, ALU and memory.
[edit]Complex

operations

Engineers can design an Arithmetic Logic Unit to calculate any operation. The more complex the operation, the more expensive the ALU is, the more space it uses in the processor, and the more power it dissipates. Therefore, engineers compromise. They make the ALU powerful enough to make the processor fast, yet not so complex as to become prohibitive. For example, computing the square root of a number might use:

1. Calculation in a single clock Design an extraordinarily complex ALU that calculates the square root of any number in a single step. 2. Calculation pipeline Design a very complex ALU that calculates the square root of any number in several steps. The intermediate results go through a series of circuits arranged like a factory production line. The ALU can accept new numbers to calculate even before having finished the previous ones. The ALU can now produce numbers as fast as a single-clock ALU, although the results start to flow out of the ALU only after an initial delay. 3. Iterative calculation Design a complex ALU that calculates the square root through several steps. This usually relies on control from a complex control unit with built-in microcode. 4. Co-processor Design a simple ALU in the processor, and sell a separate specialized and costly processor that the customer can install just beside this one, and implements one of the options above. 5. Software libraries Tell the programmers that there is no co-processor and there is no emulation, so they will have to write their own algorithms to calculate square roots by software. 6. Software emulation Emulate the existence of the co-processor, that is, whenever a program attempts to perform the square root calculation, make the processor check if there is a coprocessor present and use it if there is one; if there isn't one, interrupt the processing of the program and invoke the operating system to perform the square root calculation through some software algorithm.

The options above go from the fastest and most expensive one to the slowest and least expensive one. Therefore, while even the simplest computer can calculate the most complicated formula, the simplest computers will usually take a long time doing that because of the several steps for calculating the formula. Powerful processors like the Intel Core and AMD64 implement option #1 for several simple operations, #2 for the most common complex operations and #3 for the extremely complex operations.
[edit]

Datapath
A datapath is a collection of functional units, such as arithmetic logic units or multipliers, that perform data processing operations. It is a central part of many central processing units (CPUs) along with the control unit, which largely regulates interaction between the datapath and the data itself, usually stored in registers or main memory. Recently, there has been growing research in the area of reconfigurable datapathsdatapaths that may be re-purposed at run-time using programmable fabricas such designs may allow for more efficient [1] processing as well as substantial power savings.

Functional blocks of a datapath Functional blocks of a datapath


In computer processors, the datapath often consists of the following functional blocks, or some variation thereof: The Instruction register stores the current instruction to be executed. The Program Counter (PC) stores the address of the next instruction to be fetched.

Memory address register (MAR) - A register that either stores the memory address from which
data will be fetched to the CPU or the address to which data will be sent and stored.

Memory data register (MDR) - A register of a computer's control unit that contains the data to be
stored in the computer storage (e. g. RAM), or the data after a fetch from the computer storage.

As well as various registers that may be read and written to by software. The number of general purpose registers on a given processor can vary, but in general the size of the register file is substantially smaller than that of the cache. In addition, many processors have various special purpose registers, which are often transparent to software. These can be used as a temporary storage medium for the processor, or as model-specific registers for processor configuration.

Single bus organization of datapath


The first and foremost important interconnecting medium for all the registers inside the processor is the System bus. This bus is the processor bus and is not to be confused with the external bus that connects different memory chips and I/O devices to the processor. This external bus is connected to the internal System bus via the MAR and the MDR registers. The data lines of the external bus are connected to MDR and the address lines of the external bus are connected to the MAR. The MDR is a bidirectional register implying that it can receive and send data to and from any one of the two internal or external buses. The MAR is a unidirectional register. It receives its input from the internal bus and gives its output to the external bus. The Arithmetic logic unit(ALU) is used for performing arithmetic and logic operations on the data contained in different registers. It is the heart of the microprocessor. The multiplexer is provided for

selecting either the constant value 4 or the register X. The constant value 4 is selected when one instruction is completed and The Program Counter is to be incremented. {As mentioned before : (PC (PC)+4)}. The "instruction decoder and control logic" block decodes and carries out the instruction present in the IR register. The processor uses all these blocks together to carry out different primary operations such as : 1. Inter Register data transfers 2. Arithmetic or Logical operations 3. Retrieving data from Memory 4. Writing data into the Memory

Multi-Bus Organizations of datapath


The Internal Organization of Processor discussed above was a single bus organization. It was discussed to get the basic idea. Practically,however,such single bus microprocessors are not feasible. They result in lengthy control signal sequences. Therefore,to cut down on the number of steps needed to execute an instruction a multi-bus organization is used.

PIPELINE IN PPT

Memory in PDF

Input/output
In computing, input/output or I/O is the communication between an information processing system (such as a computer) and the outside world, possibly a human or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it. The term can also be used as part of an action; to "perform I/O" is to perform an input or output operation. I/O devices are used by a person (or other system) to communicate with a computer. For instance, a keyboard or a mouse may be an input device for a computer, while monitors and printers are considered output devices for a computer. Devices for communication between computers, such as modems and network cards, typically serve for both input and output. Note that the designation of a device as either input or output depends on the perspective. Mouse and keyboards take as input physical movement that the human user outputs and convert it into signals that a computer can understand. The output from these devices is input for the computer. Similarly, printers and monitors take as input signals that a computer outputs. They then convert these signals into representations that human users can see or read. For a human user the process of reading or seeing these representations is receiving input. These interactions between computers and humans is studied in a field called humancomputer interaction. In computer architecture, the combination of the CPU and main memory (i.e. memory that the CPU can read and write to directly, with individual instructions) is considered the brain of a computer, and from that point of view any transfer of information from or to that combination, for example to or from a disk drive, is considered I/O. The CPU and its supporting circuitry providememory-mapped I/O that is used in lowlevel computer programming, such as the implementation of device drivers. An I/O algorithm is one designed to exploit locality and perform efficiently when data reside on secondary storage, such as a disk drive.

Interface
An I/O interface is required whenever the I/O device is driven by the processor. The interface must have necessary logic to interpret the device address generated by the processor. Handshakingshould be implemented by the interface using appropriate commands (like BUSY, READY, and WAIT), and the processor can communicate with an I/O device through the interface. If different data formats are being exchanged, the interface must be able to convert serial data to parallel form and vice-versa. There must be provision for generating interrupts and the corresponding type numbers for further processing by the processor if required. A computer that uses memory-mapped I/O accesses hardware by reading and writing to specific memory locations, using the same assembly language instructions that computer would normally use to access memory.

Higher-level implementation
Higher-level operating system and programming facilities employ separate, more abstract I/O concepts and primitives. For example, most operating systems provide application programs with the

concept of files. The C and C++ programming languages, and operating systems in the Unix family, traditionally abstract files and devices as streams, which can be read or written, or sometimes both. The C standard library provides functions for manipulating streams for input and output. In the context of the ALGOL 68 programming language, the input and output facilities are collectively referred to as transput. The ALGOL 68 transput library recognizes the following standard files/devices: stand in, stand out, stand errors and stand back. An alternative to special primitive functions is the I/O monad, which permits programs to just describe I/O, and the actions are carried out outside the program. This is notable because the I/Ofunctions would introduce side-effects to any programming language, but this allows purely functional programming to be practical.

You might also like