User talk:Anandpnarayanan

Please Note
Please Note the welcome and introduction at the bottom of your talk page. Which is where new items are put.

Please note this is an online encyclopedia - not a data dump - look at WP:ABOUT and WP:NOT - thank you sats 07:58, 23 July 2013 (UTC)

??
What is Data Communications?

The distance over which data moves within a computer may vary from a few thousandths of an inch, as is the case within a single IC chip, to as much as several feet along the backplane of the main circuit board. Over such small distances, digital data may be transmitted as direct, two-level electrical signals over simple copper conductors. Except for the fastest computers, circuit designers are not very concerned about the shape of the conductor or the analog characteristics of signal transmission.

Frequently, however, data must be sent beyond the local circuitry that constitutes a computer. In many cases, the distances involved may be enormous. Unfortunately, as the distance between the source of a message and its destination increases, accurate transmission becomes increasingly difficult. This results from the electrical distortion of signals traveling through long conductors, and from noise added to the signal as it propagates through a transmission medium. Although some precautions must be taken for data exchange within a computer, the biggest problems occur when data is transferred to devices outside the computer's circuitry. In this case, distortion and noise can become so severe that information is lost.

Data Communications concerns the transmission of digital messages to devices external to the message source. "External" devices are generally thought of as being independently powered circuitry that exists beyond the chassis of a computer or other digital message source. As a rule, the maximum permissible transmission rate of a message is directly proportional to signal power, and inversely proportional to channel noise. It is the aim of any communications system to provide the highest possible transmission rate at the lowest possible power and with the least possible noise.

What is Data Communication? Ads by Google Google AdWords India AdWords.google.com Connect With Potential Customers When They're Searching For You! Data Communication Data Communication Ads by Google Data Communication

Data communication is the transmission of electronic data over some media. The media may be cables, microwaves.

Elements of Data Communication

Four basic elements are needed for any communication system.

1.        Sender. The computer or device that is used for sending data is called sender, source or transmitter. In modern digital communication system, the source is usually a computer.

2.        Medium. The means through which data is sent from one location to another is called transmission medium. If the receiver and transmitter are within a building, a wire connects them. If they are located at different locations, they may be connected by telephone lines, fiber optics or microwaves.

3.        Receiver. The device or computer that receives the data is called receiver. The receiver can be a computer, printer or a fax machine.

4.        Protocols. There are rules under which data transmission takes place between sender and receiver. The data communication s/w are used to transfer data from one computer to another. The s/w follows same communication protocols can communicate and exchange data.

Data Transmission Data Transmission Data Transmission

Data may be transfer from one device to another by means of some communication media. The electromagnetic or light waves that transfer data from one device to another device in encoded form are called signals. Data transmissions across the network can occur in two forms i.e.:

(i) Analog signal.

(ii) Digital signal.

Analog Signal. The transfer of data in the form of electrical signals or continuous waves is called analog signal or analog data transmission. An analog signal is measured in volts and its frequency is in hertz (Hz).

Advantages of Analog Signaling

Allows multiple transmissions across the cable. Suffers less from attenuation.

Disadvantages of Analog Signaling

Suffers from EMI. Can only be transmitted in one direction without sophisticated equipment.

Digital Signal

The transfer of data in the form of digit is called digital signal or digital data transmission. Digital signals consist of binary digits 0 & 1. Electrical pulses are used to represent binary digits. Data transmission between computers is in the form of digital signals. Advantages of Digital Signaling

Equipment is cheaper and simpler than analog equipment. Signals can be transmitted on a cable bidirectional. Digital signals suffer less from EMI.

Disadvantages Digital Signaling

Only one signal can be sent at a time. Digital signals suffer from attenuation.

Techniques of Data Communication

There are two possible techniques of sending data from the sender to receiver, i.e.:-

(1) Parallel transmission.

(2) Serial transmission.

Parallel Transmission. In parallel transmission each bit of character / data has a separate channel and all bits of a character are transmitted simultaneously. Here the transmission is parallel character by character.

Sender       Receiver

Serial Transmission. In serial transmission, the data is sent as one bit at a time having a signal channel for all the bit, i.e.:

Sender        Receiver

Business Data Communications and Networking Business Data Communications and Networking Amazon Price: $119.99 Generic Data Transmission OTG USB Female to Mini 5 Pin Male Adapter Extension Cable For Tablet PC Color Black Generic Data Transmission OTG USB Female to Mini 5 Pin Male Adapter Extension Cable For Tablet PC Color Black Amazon Price: $1.67 Etekcity® FG2800 Wireless Cordless Handheld Strong Decode Laser Scanning Barcode Bar Code Scanner Reader Kit with LED indicator,one - touch pairing, Black, 8-bit or 32-bit Decoder, Anti-interference, Mobile Moveable, Optical Laser, USB Optional, Long-Range, Wireless data transmission Etekcity® FG2800 Wireless Cordless Handheld Strong Decode Laser Scanning Barcode Bar Code Scanner Reader Kit with LED indicator,one - touch pairing, Black, 8-bit or 32-bit Decoder, Anti-interference, Mobile Moveable, Optical Laser, USB Optional, Long-Range, Wireless data transmission Amazon Price: $141.49 INNOVA 3160B ABS/SRS+ Professional CanOBDII Diagnostic Code Scanner with Enhanced Live Data INNOVA 3160B ABS/SRS+ Professional CanOBDII Diagnostic Code Scanner with Enhanced Live Data Amazon Price: $199.00 List Price: $459.44 Types of Serial Transmission

On serial transmission it is very essential to know exactly where one character ends and the next begins. The necessary synchronization that helps determine which bit is the first bit of the incoming character may be synchronous or asynchronous. Asynchronous Serial Transmission

Computer communication that occurs one bit at a time with start and stop bits at the beginning and the end of each character is called Asynchronous Serial Transmission. In this type of transmission, there is no fixed time relationship with one character.

Advantages of Asynchronous Serial Transmission

This type of transmission is very simple. This type of transmission is cheaper.

Disadvantages of Asynchronous Serial Transmission

This type of transmission is slow.

Synchronous Transmission

In this method a clock signal is used and the sending as well as the receiving devices are synchronized with this clock signals. It doesn’t use start and stop bits but the character are sent in character groups called block

Advantages of Synchronous Transmission

It is very fast as compared to Asynchronous Series Transmission.

Disadvantage of Synchronous Transmission

It uses more expensive and complex equipment.

Modes of Data Communication.

The manner in which data is transmitted from one location to another location is called data transmission mode.

There are three ways or modes for transmitting data from one location to another. These are:

(1) Simplex.

(2) Half duplex.

(3) Full duplex.

Half Duplex.

In half duplex mode, data can be transmitted in both directions but only in one direction at a time. During any transmission, one is the transmitter and the other is receiver. So each time for sending or receiving data, direction of data communication is reversed, this slow down data transmission rate.In half duplex modes, transmission of data can be confirmed.

Half Duplex Mode

Wireless communication is an example of half duplex.

Advantages of Half Duplex

Costs less than full duplex. Enables for two way communications.

Disadvantages of Half Duplex

Costs more than simplex. Only one device can transmit at a time.

Etymotic Research MC5 Noise Isolating In-Ear Earphones (Black) Etymotic Research MC5 Noise Isolating In-Ear Earphones (Black) Amazon Price: $59.00 List Price: $79.00 Simplex Mode

In simplex mode, data is transmitted in only one direction. A terminal can only send data and cannot receive it or it can only receive data but cannot send it. Simplex mode is usually used for a remote device that is meant only to receive data. It is not possible to confirm successful transmission of data in simplex mode.

This mode is not widely used. Speaker, radio and television broadcasting are examples of simplex transmission, on which the signal is send from the transmission to your TV antenna. There is no return signal.

Simplex Mode

Advantages of Simplex

Cheapest communication method.

Disadvantage of Simplex

Only allows for communication in one direction.

Full Duplex.

In full mode, data can be transmitted in both directions simultaneously. It is a faster mode for transmitting data because no time wastes in switching directions.

Full Duplex Mode

Example of full duplex is telephone set in which both the users can talk and listen at the same time.

Advantage of Full Duplex.

Enables two-way communication simultaneously.

Disadvantage of Full Duplex.

The most expensive method in terms of equipment because of two bandwidth channels is required.

Wii Sports Resort Wii Sports Resort Amazon Price: $23.33 List Price: $39.99 Wii Sports Resort Wii Sports Resort Amazon Price: $34.99 List Price: $49.99 Nintendo Wii Sports / Wii Sports Resort - 2 Games on 1 Disc Bundle Version Nintendo Wii Sports / Wii Sports Resort - 2 Games on 1 Disc Bundle Version Amazon Price: $15.20 List Price: $49.95 More Useful Hubs

What is Communication Speed The communication transfer rate is measured in a unit called band. In general band is identical to its bites e.g. at rate of 300 bounds is 300 bps. (bits per second). Different grades of channels provide... Types of Transmission Media The means through which data is transformed from one place to another is called transmission or communication media. There are two categories of... Data Base Concepts A data base is a shared collection of interrelated data design to meet the various information needs of an organization. For example, Consider a student information data base that consist of different data... Computer Related Abbreviations Dear Reader, This is a list of computing and IT abbreviations. Today I am going to share with you Top 90 Abbreviations Which are generally used in Computer Science. I hope that will help you for increasing... Types of Computer Languages with their Advantages and Disadvantages In all over the world, language is the source of communication among human beings. Different countries/regions have different languages. Similarly, in order to communicate with the computer user also needs to... C Language History C language was developed in the 1970 by Dennis Ritchie at Bell Telephone at Bell Telephone Laboratories,Inc(called AT&T Bell Laboratories). Until 1978 C was mostly used within the Bell laboratories. In 1978...

Analog vs Digital
'Analog vs Digital' Technology › Electronics

Analog and digital signals are used to transmit information, usually through electric signals. In both these technologies, the information, such as any audio or video, is transformed into electric signals. The difference between analog and digital technologies is that in analog technology, information is translated into electric pulses of varying amplitude. In digital technology, translation of information is into binary format (zero or one) where each bit is representative of two distinct amplitudes. Comparison chart Embed this chart Analog 	Digital Signal: 	Analog signal is a continuous signal which represents physical measurements. Digital signals are discrete time signals generated by digital modulation. Waves: 	Denoted by sine waves 	Denoted by square waves Representation: 	Uses continuous range of values to represent information 	Uses discrete or discontinuous values to represent information Example: 	Human voice in air, analog electronic devices. Computers, CDs, DVDs, and other digital electronic devices. Technology: 	Analog technology records waveforms as they are. Samples analog waveforms into a limited set of numbers and records them. Data transmissions: 	Subjected to deterioration by noise during transmission and write/read cycle. Can be noise-immune without deterioration during transmission and write/read cycle. Response to Noise: 	More likely to get affected reducing accuracy 	Less affected since noise response are analog in nature Flexibility: 	Analog hardware is not flexible. Digital hardware is flexible in implementation. Uses: 	Can be used in analog devices only. Best suited for audio and video transmission. Best suited for Computing and digital electronics Applications: 	Thermometer 	PCs, PDAs Bandwidth: 	Analog signal processing can be done in real time and consumes less bandwidth. There is no guarantee that digital signal processing can be done in real time and consumes more bandwidth to carry out the same information. Memory: 	Stored in the form of wave signal 	Stored in the form of binary bit power: 	analog instrument draw large power 	digital instrument draw only negligible power cost: 	low cost and portable 	cost is high and easily not portable impedance: 	low 	high order of 100mega ohm errors: 	analog instruments usually have a scale which is cramped at lower end and give considerable observational errors 	digital instruments are free from observational errors like parallax and approximation errors

Basic of Computer Architecture
Computer Architecture

Computer architecture involves the design of computers.

Processor design involves the instruction set design and the organisation of the processor.

Instruction set architecture (ISA) describes the processor in terms of what the assembly language programmer sees, i.e. the instructions and registers.

Organisation is concerned with the internal design of the processor, the design of the bus system and its interfaces, the design of memory and so on. Two machines may have the same ISA, but different organisations.

The organisation is implemented in hardware and in turn, two machines with the same organisation may have different hardware implementations, for example, a faster form of silicon technology may be used in the fabrication of the processor.

Introduction

The first point that must be made about computer architecture is that there is no standard computer architecture, in the same way as there is no such thing as a standard house architecture or standard motor car design

However, just as all cars have some basic features in common, so too do computers. In this section, we take a high level look at the components of computer architecture that are common to all computers, noting that any particular computer will differ in various details from the general model presented.

As we have seen earlier, computer programs are translated to machine code for execution by the CPU. Once a program has been loaded into the computer’s memory (carried out by the operating system on our behalf), the program may then be executed.

This means that the CPU obeys the instructions making up the program and carries them out one at a time.

It is worth noting, at this point, the primitive nature of the CPU. The CPU does not understand programs, rather it obeys individual instructions.

6.2 Instruction Set

One of the crucial features of any processor is its instruction set, i.e. the set of machine code instructions that the processor can carry out. Each processor has its own unique instruction set specifically designed to make best use of the capabilities of that processor. The actual number of instructions provided ranges from a few dozen for a simple 8-bit microprocessor to several hundred for a 32-bit VAX processor. However, it should be pointed out that a large instruction set does not necessarily imply a more powerful processor.

Many modern processor designs are so called RISC (Reduced Instruction Set Computer) designs which use relatively small instruction sets, in contrast to so called CISC (Complex Instruction Set Computer) designs such as the VAX and machines based on the Intel 8086 and Motorola 68000 microprocessor families.

Classification of Instructions

The actual instructions provided by any processor can be broadly classified into the following groups:

• Data movement instructions: These allow the processor move data between registers and between memory and registers (e.g. 8086 mov, push, pop instructions). A ‘move’ instruction and its variants is among the most frequently used instructions in an instruction set.

• Transfer of control instructions: These are concerned with branching for loops and conditional control structures as well as for handling subprograms (e.g. 8086 je, jg, jmp, call, ret instructions). These are also commonly used instructions.

• Arithmetic/logical instructions: These carry out the usual arithmetic and logical operations (e.g. 8086 cmp, add, sub, inc, and, or, xor instructions). Surprisingly, these are not frequently used instructions, and when used, it is often in conjunction with a conditional jump instruction rather than for general arithmetic purposes. Note that we have included the cmp instruction with the arithmetic/logical instructions because it actually behaves like a sub instruction except it does not modify its destination register.

• Input/output instructions: These are used for carrying out I/O (e.g. 8086 in, out instructions) but a very common form of I/O called memory mapped I/O uses ‘move’ instructions for I/O.

• Miscellaneous instructions (e.g. 8086 int, sti, cti, hlt, nop) for handling interrupts and such activities. The hlt instruction halts the processor and the nop instruction does nothing at all! These instructions are again not that frequently used relative to data movement and transfer of control instructions. The int instruction could also be classified as a transfer of control instruction and interrupts are described in more detail below.

This is not the only way to classify instructions. For example, the arithmetic/logical instructions mentioned above may be classified as operate instructions. Operate instructions also include instructions that move data between registers and manipulate stacks. Memory-access instructions refer to those that transfer data between registers and memory.

Fixed and Variable length Instructions

Instructions are translated to machine code. In some architectures all machine code instructions are the same length i.e. fixed length. In other architectures, different instructions may be translated into variable lengths in machine code.

This is the situation with 8086 instructions which range from one byte to a maximum of 6 bytes in length. Such instructions are called variable length instructions and are commonly used on CISC machines.

The advantage of using such instructions, is that each instruction can use exactly the amount of space it requires, so that variable length instructions reduce the amount of memory space required for a program.

On the other hand, it is possible to have fixed length instructions, where as the name suggests, each instruction has the same length. Fixed length instructions are commonly used with RISC processors such as the PowerPC and Alpha processors.

Since each instruction occupies the same amount of space, every instruction must be long enough to specify a memory operand, even if the instruction does not use one. Hence, memory space is wasted by this form of instruction. The advantage of fixed length instructions, it is argued, is that they make the job of fetching and decoding instructions easier and more efficient, which means that they can be executed in less time than the corresponding variable length instructions.

Thus the comparison between fixed and variable length instructions comes down to the classic computing trade off of memory usage versus execution time.

In general, computer programs that execute very quickly tend to use larger amounts of storage, while programs to carry out the same tasks, that do not use so much storage, tend to take longer to execute.

Fetch-Execute Cycle

This is the fundamental operation of the processor. The CPU executes the instructions that it finds in the computers memory. In order to execute an instruction, the CPU must first fetch (transfer) the instruction from memory into one of its registers.

This is a non-trivial task requiring several steps and is described later.

The CPU then decodes the instruction, i.e. it decides which instruction has been fetched and finally it executes (carries out) the instruction.

The CPU then repeats this procedure, i.e. it fetches an instruction, decodes and executes it. This process is repeated continuously and is known as the fetch-execute cycle.

This cycle begins when the processor is switched on and continues until the CPU is halted (via a halt instruction, e.g. 8086 hlt instruction or the machine is switched off).

Instead of looking at the details of a particular microprocessor's architecture at this point, we will use a simple hypothetical microprocessor to explain the basic concepts of computer architecture.

We call the machine SAM (Simple Architecture Machine). Figure 1 illustrates the major components of SAM. It is a 16-bit microprocessor with 4 general purpose registers r0 to r3, a program counter register PC, a stack pointer register SP and status register SR. The status register is made up of similar flags to the 8086 flags register, e.g. a zero flag, an overflow flag, a carry flag and so on.

The fetch-execute cycle operates by first fetching an instruction. The program counter register PC always contains the address of the next instruction to be executed.

Let us assume that a particular program has been loaded into memory and is currently being executed. Program execution has reached a certain point (the move instruction is being executed) and the three instructions of the program are listed in Example 1.

To illustrate how the fetch execute cycle operates, we will trace the execution of these instructions.

We assume that these instructions are stored in memory beginning at location 3000H.

The instructions and their machine code equivalents (in hexadecimal) are listed below.

We use hexadecimal instead of binary as it is easier to work with but you must remember that it is the binary form of the instructions that are actually stored in memory.

Example 1: The following is a SAL program fragment and its machine code version. It also shows the addresses of where the instructions are stored in memory.

The memory variable x is stored at location 0100H in memory which contains the value 6.

The label Next is 16 (10H) bytes forward from the je instruction.

SAL Code SAM Code Memory Address

Hex Decimal

move r0, 6 0180H 3000H 4096

0006H 3002H 4098

load r1, x 0284H 3004H 4100

0100H 3006H 4102

cmp r0, r1 0F01H 3008H 4104

je Next 2F10H 300AH 4106

..... 300CH 4108

.....

This code fragment assigns register r0 the value 6, assigns register r1 the value of x (also 6) and compares the values of registers r0 and r1.

If the registers are equal, which they are in this case, control transfers to the instruction stored at Next not shown in this example.

The fetch-execute cycle operates by first fetching an instruction. The program counter register PC always contains the address of the next instruction to be executed.

For the code fragment under consideration, the move instruction is currently being executed. Thus, the program counter contains the value 3004H at the point where we begin tracing execution of the program i.e. the address of the next instruction, in this case the load instruction.

Having executed the move instruction, the load instruction is fetched.,

After fetching the load instruction, the control unit updates the program counter to point to the next instruction to be fetched. The control unit increments the program counter by the size of the current instruction, in this case the PC register is incremented by 4, giving it the value 3008H.

The program counter now points to the cmp instruction.

The MDR register (see later) contains the instruction just fetched from memory and this is transferred to the instruction register, IR.

The instruction register is another of the CPU's hidden registers which we have not encountered to date. It is logically part of the control unit and its function is to store an instruction so that it can be decoded for execution.

The load instruction is now executed and the fetch-execute cycle begins again.

Figure 1 illustrates the state of the SAM registers after the move instruction has been fetched. Only the relevant portions of memory are shown.

We assume that the general purpose registers have the value 0 except for r2 which has the value 1. The SP register is shown to have "?" as its value to indicate that we are not interested in its contents, in this example. The status register, SR, has value 0, indicating that the flags are all set to 0.

Note: We show memory to contain text for illustrative purposes. memory will always contain binary and in this example, it will contain the machine code of the given instructions.

Accessing Memory

In order to execute programs, a microprocessor fetches instructions from memory and executes them, fetching data from memory if it is required.

In Figure 1 we introduced two registers that we have not mentioned before namely the memory address register, MAR and the memory data register, MDR. There are a number of such CPU registers that do not appear in the programming model of a CPU. We shall refer to these registers as hidden CPU registers to distinguish them from the programming model registers R0 to R4, PC, SR and SP registers.

The MAR and MDR registers are used to communicate with memory (and other devices attached to the system bus).

In addition, Figure 1 shows the buses that allow the devices making up a SAM computer system communicate with each other.

The MAR register is used to store the address of the location in memory that is to be accessed for reading or writing.

When we retrieve information from memory we refer to the process as reading from memory.

When we store an item in memory, we refer to the process as writing to memory.

In either case, before we can access memory, we must specify the location we wish to access, i.e. the address of the location in memory. This address must be stored in the MAR register.

The MAR register is connected to memory via the address bus whose function is to transfer the address in the MAR register to memory. In this way the memory unit is informed as to which location is to be accessed.

The address bus is a uni-directional bus, i.e. information can only travel along it in a single direction, from the CPU to memory and other devices.

The MAR register is a 16-bit register like all the other SAM registers. This means that the maximum address it can contain is 216 - 1 (65,535) bytes, i.e. it can address up to 64Kb of memory.

The MDR register is used either to store information that is to be written to memory or to store information that has been read from memory. The MDR register is connected to memory via the data bus whose function is to transfer information, to or from memory and other devices.

The data bus is a bi-directional bus, i.e. information can travel along it, both, to and from the CPU.

The control bus plays a crucial role in I/O. It carries control signals specifying what operation is to be carried out and to synchronise the transfer of information.

For example, one line of the control bus is the read/write (R/W) line which used to specify whether a read or write operation is to be carried out.

Another line is the valid memory address (VMA) line which indicates that the address bus now carries a valid memory address. This tells the memory unit when to look at the address bus to find the address of the location to be accessed. A third line is the memory operation complete (MOC) line which signals that the read/write operation has now completed. We should note at this point, that the other devices attached to the computer, such as I/O and storage devices, usually communicate with the CPU in a similar fashion to that described for communicating with memory

Reading from Memory

The following steps are carried out by the SAM microprocessor to read an item from memory. The item may be an instruction or a data operand.

1. The address of the item in memory is stored in the MAR register.

2. This address is transferred to the address bus.

3. The VMA line and R/W line of the control bus are used to indicate to memory that there is a valid address on the address bus and that a read operation is to be carried out.

4. Memory responds by placing the contents of the desired address on the data bus.

5. Memory enables the MOC line to indicate that the memory operation is complete, i.e. the data bus contains the required data.

6. The information on the data bus is transferred to the MDR register.

7. The information is transferred from the MDR register to the specified CPU register.

Writing to Memory

This procedure is similar to that for reading from memory:

1. The address of the item in memory is stored in the MAR register.

2. This address is transferred to the address bus.

3. The item to be written to memory is transferred to the MDR register.

4. This information is transferred to the data bus.

5. The VMA line and R/W line of the control bus are used to indicate to memory that there is a valid address on the address bus and that a write operation is to be carried out.

6. Memory responds by placing the contents of the data bus in the desired memory location.

7. Memory uses the MOC line to indicate that the memory operation is complete, i.e. the data has been written to memory.

We can see from the above descriptions (which have been simplified!) that accessing memory or any device is quite complicated from an implementation viewpoint. So, when an instruction such as

load r1, i

to load a register with the contents of a memory variable is to be executed, a lot of work has to be carried out.

Firstly the instruction must be fetched from RAM, then the value of i must be fetched from RAM and finally the transfer of the value of i to register r1 is carried out.

It is important to realise that every operation concerning memory involves either reading or writing memory.

Memory is a passive device. It can only store information. No processing can be carried out on information in memory. The information, stored in memory, must be transferred to a CPU register for processing and the result written back to memory.

So, for example, when an instruction such as the 8086 inc instruction is carried out to increment a memory variable (as in inc memvar ), its execution involves both a memory read operation and a memory write operation.

Firstly, the value of memvar must be transferred to the CPU where it can be incremented by the ALU. This transfer is carried out via a memory read operation. Then, once this value has been incremented by the ALU, the new value of memvar must be written out to memvar's address in memory, via a memory write operation.

Encoding Instructions in Machine Code

Instructions are represented in machine code as binary numbers in same way as all other information is represented in a computer system. We noted earlier that assembly language instructions for most processors are broadly similar and have the form:

[label] operation [operand ..] [;comment]

The general form of a machine code instruction is illustrated in Figure 2 with the bits making up the instruction being grouped into opcode and operand fields.

Figure 2: Machine code instruction format

The opcode field contains a binary code that specifies the operation to be carried out (e.g. add, jmp ). Each operation has its own unique opcode. The operand field specifies the operand or operands that the operation is to be carried out on..

It should be emphasised that the instruction encoding for SAM is designed for illustration purposes. The aim is to keep it as simple as possible while remaining basically similar to the encoding of instructions on real processors. The reader is encouraged to look at ways the instructions could be more efficiently encoded.

Table 1 lists the opcodes of the commonly used SAM instructions in binary and hexadecimal.

Instruction

Binary Code

Hex Code

move

0000 0001

01

load

0000 0010

02

store

0000 0011

03

add

0000 1000

08

sub

0000 1001

09

cmp

0000 1111

0F

jmp

0001 1111

1F

je

0010 1111

2F

Table 1: SAM opcodes

The operand field of an instruction must be able to specify the registers, memory addresses or constants that the instruction is to operate on. SAM instructions have at most two operands. If there are two operands then one is always a register.

If a memory address is specified (e.g. in the case of a memory variable or label) then the instruction is encoded using 32-bits.

Since SAM has four general purpose registers we can represent them using 2-bit codes as follows:

00 for r0

01 for r1

10 for r2

11 for r3.

Thus, 4 bits are required to represent the two registers that may be used in an instruction. Bit numbers 0 and 1, represent the source register and bit numbers 2 and 3 represent the destination register.

Example: Encoding of load r1, X where X refers to a memory variable stored at location 00FFH (255D) in memory,

Instruction and binary encoding Hex encoding

(1)

load r1, X ; r1 = X

0000 0010 1000 01 00 0000 0000 1111 1111 0284 00ffH

(address of val)

ß B-field> ß W-field à

Explanation

This instruction is encoded using 32-bits. The opcode for load is 0000 0010 (02H), the destination register r1 is encoded as 01, while the source register is encoded as 00, but is not used because the load instruction looks for its source operand in memory, hence bit 7 of the B-field is set to 1, indicating a memory operand. Finally, the address of the memory variable X (00ffH) is stored in the W-field.

Bold text

OOPS Concept
OOPS Concept

Q1) What is polymorphism?

Ans) Polymorphism gives us the ultimate flexibility in extensibility. The abiltiy to define more than one function with the same name is called Polymorphism. In java,c++ there are two type of polymorphism: compile time polymorphism (overloading) and runtime polymorphism (overriding).

When you override methods, JVM determines the proper methods to call at the program’s run time, not at the compile time. Overriding occurs when a class method has the same name and signature as a method in parent class.

Overloading occurs when several methods have same names with

Overloading is determined at the compile time. Different method signature and different number or type of parameters. Same method signature but different number of parameters. Same method signature and same number of parameters but of different type

Example of Overloading int add(int a,int b)    float add(float a,int b)     float add(int a ,float b)     void add(float a)     int add(int a)     void add(int a)                 //error conflict with the method int add(int a)

Example: Overloading

Class BookDetails{ String title; String publisher; float price;

setBook(String title){ }   setBook(String title, String publisher){ }   setBook(String title, String publisher,float price){ }

}

Example: Overriding

class BookDetails{ String title;

setBook(String title){ } }

class ScienceBook extends BookDetails{

setBook(String title){}                                            //overriding

setBook(String title, String publisher,float price){ } //overloading

}

Q2) What is inheritance?

Ans) Inheritance is the property which allows a Child class to inherit some properties from its parent class. In Java this is achieved by using extends keyword. Only properties with access modifier public and protected can be accessed in child class.

public class Parent{

public String parentName; public int parentage; public String familyName; }

public class Child extends Parent{

public String childName; public int childAge;

public void printMyName{ System.out.println(“ My name is “+ chidName+” “ +familyName) }

}

In above example the child has inherit its family name from the parent class just by inheriting the class.

Q3) What is multiple inheritance and does java support?

Ans) If a child class inherits the property from multiple classes is known as multiple inheritance. Java does not allow to extend multiple classes but to overcome this problem it allows to implement multiple Interfaces.

Q4) What is abstraction?

Ans) Abstraction is way of converting real world objects in terms of class. For example creating a class Vehicle and injecting properties into it. E.g

public class Vehicle {

public String colour; public String model; }

Q5) What is encapsulation?

Ans) The encapsulation is achieved by combining the methods and attribute into a class. The class acts like a container encapsulating the properties. The users are exposed mainly public methods.The idea behind is to hide how thinigs work and just exposing the requests a user can do.

Q6) What is Association?

Ans) Association is a relationship between two classes. In this relationship the object of one instance perform an action on behalf of the other class. The typical behaviour can be invoking the method of other class and using the member of the other class. public class MyMainClass{

public void init{

new OtherClass.init;

}

}

Q7) What is Aggregation?

Ans) Aggregation has a relationship between two classes. In this relationship the object of one class is a member of the other class. Aggregation always insists for a direction. public class MyMainClass{

OtherClass otherClassObj = new OtherClass;

}

Q8) What is Composition?

Ans) Composition is a special type of aggregation relationship with a difference that its the compulsion for the OtherClass object (in previous example) to exist for the existence of MyMainClass.

Welcome
 Hello Anandpnarayanan, and Welcome to Wikipedia!  Welcome to Wikipedia! I hope you enjoy the encyclopedia and want to stay. As a first step, you may wish to read the Introduction.

If you have any questions, feel free to ask me at my talk page – I'm happy to help. Or, you can ask your question at the New contributors' help page.

--- Here are some more resources to help you as you explore and contribute to the world's largest encyclopedia...

Finding your way around:


 * Table of contents


 * Department directory

Need help?


 * Questions – a guide on where to ask questions
 * Cheatsheet – quick reference on Wikipedia's mark-up codes
 * Wikipedia's 5 pillars – an overview of Wikipedia's foundations


 * Article wizard – a Wizard to help you create articles
 * The simplified ruleset – a summary of Wikipedia's most important rules
 * Guide to Wikipedia – a thorough step-by-step guide to Wikipedia

How you can help:


 * Contributing to Wikipedia – a guide on how you can help


 * Community portal – Wikipedia's hub of activity

Additional tips...


 * Please sign your messages on talk pages with four tildes ( ~ ). This will automatically insert your "signature" (your username and a date stamp). The [[File:Button sig.png]] or [[File:Insert-signature.png]] button, on the tool bar above Wikipedia's text editing window, also does this.


 * If you would like to play around with your new Wiki skills the Sandbox is for you.

Anandpnarayanan, good luck, and have fun. – sats 07:55, 23 July 2013 (UTC)