assignment no 1 (solutions) - gehu cs/it deptt · pdf fileassignment no 1 (solutions) ... the...

12
ASSIGNMENT NO 1 (Solutions) Solution 3: a) B) + 42 = 0101010 +13 = 0001101 42 = 1010110 13 = 1110011 (+42)+ (-13) (+42) - (-13) (+42) 0101010 (42) 1010110 (13) 1110011 (+ 13) 0001101 (+29) 0011101 (29) 1100011 c) D) 01 last two carries 1 0 + 70 01000110 70 10111010 + 80 01010000 80 10110000 +150 10010110 150 01101010 greater negative less than positive than 128 +127 8620 (a) BCD 1000 0110 0010 0000 (b) XS-3 1011 1001 0101 0011 (C) Binary 10000110101100 (8192 + 256 + 128 + 32 + 8 + 4)

Upload: nguyenliem

Post on 08-Mar-2018

222 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

ASSIGNMENT NO 1 (Solutions)

Solution 3:

a) B) + 42 = 0101010 +13 = 0001101 – 42 = 1010110 –13 = 1110011 (+42)+ (-13) (+42) - (-13) (+42) 0101010 (– 42) 1010110 (–13) 1110011 (+ 13) 0001101 (+29) 0011101 (– 29) 1100011

c) D)

01 ← last two carries → 1 0 + 70 01000110 – 70 10111010 + 80 01010000 – 80 10110000 +150 10010110 – 150 01101010 ↑ ↑ ↑ ↑ greater negative less than positive than – 128 +127

8620 (a) BCD 1000 0110 0010 0000 (b) XS-3 1011 1001 0101 0011 (C) Binary 10000110101100 (8192 + 256 + 128 + 32 + 8 + 4)

Page 2: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

Solution 2:

(a) (b) (c) (d) 11010 11010 000100 1010100 +10000 +10011 + 010000 + 0101100

1 01010 1 01101 0 010100 1 0000000 (26 – 16 = 10) (26 – 13 = 13) –101100 (no. (84 – 84 = 0) is negative and in 2’scomplement form ) (4 – 48 = –44)

REPRESENTATION IN FLOATING POINT NUMBER

46.5 = 32 + 8 + 4 + 2 + 0.5 = (101110.1)2

Sign 0101110100000000 00000110 24-bit mantissa 8-bit exponent (+6)

Page 3: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

ANS 4:

Figure 8.1 shows the logical layout of a modern computer system: this arrangement of

components is what is generally known as the von Neumann Architecture.

1. The control unit (CU), as the name suggests, has overall responsibility for the system.

2. The arithmetic-logic unit (ALU), as its name also suggests, performs arithmetic (addition,

subtraction, etc.) and logic (and, or, etc.) operations.

3. The registers (register _le, scratchpad memory) form a small memory within the CPU. This is

the only storage to which the ALU has direct access. To manipulate any values from memory

they must first be loaded into registers.

4. Memory (on modern computers a combination of ROM _ Read Only Memory and RAM _

Random Access Memory) is where both program code and data reside while the program is in

execution.

This is the stored program concept, often attributed to John von Neumann.

Memory (or Main Memory) is sometimes referred to as Primary Storage as opposed to

Secondary Storage, which usually refers to disk drives, tape drives and the like. The major

difference between primary and secondary storage is access time.

Input and Output (usually jointly referred to as I/O) are how the system communicates with the

outside world _ outside, in this case, signifying outside the CPU-Memory subsystem. On today's

computers some I/O takes place within the computer system as a whole (e.g. to hard disks, CD-

ROMs) whereas some takes place between the computer system and what the average user

would consider the outside world: across a network for example.

Page 4: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

Memory Subsystem Interface

Memory is where the computer stores information and (running) programs. Memory is made up

of bits: the bit is the smallest unit of storage, it can hold one of two values: 1 and 0 (zero).

For convenience bits are grouped into larger units called bytes. Today the byte is universally

defined as being comprised of eight (8) bits. Bytes are often grouped together into larger fixed-

size chunks, called words (16 bits). A 32-bit chunk is variously referred to as a doubleword or a

longword.

An important term, though, is cell, usually defined as _the smallest addressable piece of

memory_

cell size have ranged between 1 bit and 64 bits; today the cell size is almost universally the 8-bit

byte.

Page 5: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

There are two important attributes associated with every chunk of memory:

_ its address and

_ its contents

Memory Operations

We can deduce from the discussion above that memory needs to be able to do two things:

1. Deliver the current contents of a designated memory cell to the CPU.

2. Store new contents in a designated memory cell.

For the firrst operation (known as a memory read) the CPU must pass two pieces of information

to the memory subsystem:

1. The address of the memory cell to be read.

2. An indication that a read is requested (as opposed to a write, see below).

The memory subsystem, having retrieved the information, must then forward it on to the CPU. In

order to carry out the second operation (a memory write), the CPU must pass:

1. The address of the memory cell to be stored into.

2. The new contents to be stored.

3. An indication that a write is requested.

In order to be able to achieve this, we need the following interface to the memory subsystem:

The Memory Address Register (MAR)

_ which contains the address of the requested cell, the one we want either to read

from or to write into.

The Memory Data Register (MDR) into which

_ the memory subsystem places the retrieved contents of memory (read)

_ the CPU places the new contents of memory (write).

A Read/Write Line (R/W)

_ used to indicate whether the required operation is a read or a write.6

Figure 8.2 shows the memory subsystem interface.

The basic memory operations, then, are performed as follows:

Page 6: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

READ

1. CPU places the requested memory address into the MAR.

2. CPU places the appropriate value to indicate a READ7 onto the R/W line.

3. After waiting for memory to do its work (the memory cycle time) the CPU retrieves the value

which is now present in MDR.

WRITE

1. The CPU places the new contents to be stored in the MDR

2. CPU places requested memory address into the MAR.

3. CPU places the appropriate value to indicate a WRITE onto the R/W line.

The Input/Output Subsystem:

In order to communicate with the outside world _ by which we mean anything outside the

CPU/Memory system _ we need an I/O subsystem. This subsystem needs to be able to control

many different types of device, for example: Screen, keyboard, printer, are all _obvious_ input

and output devices, but they all have very different characteristics.

For information storage (mass-storage) we shall need to employ devices such as hard drives,

floppies, CD, tapes, whose operating characteristics are different again.

Mass storage devices, such as disks and tapes, can be categorized by their access method.

The Central Processing Unit:

The CPU is split into two parts:

1) The Control Unit (CU): The Control Unit is responsible for running the Information

Processing Cycle; it is, therefore, as the name suggests, in control of the entire machine.

2) The Arithmetic/Logic Unit (ALU): The Control Unit is responsible for the IPC, the ALU

does most of the actual work.

The ALU is responsible for what of us consider the _real work_ of the computer; it is inside the

ALU that the arithmetic (e.g. addition) and logic (e.g. AND) operations are performed. Hence

the name.

What will probably surprise you about the ALU is that it always calculates every operation it is

capable of and then delivers the result asked for _ this is actually faster than trying only to

calculate the desired result. The CU is responsible for setting the values on the lines that control

the ALU.

Page 7: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

The Information Processing Cycle

All computer systems today use the stored program concept, by which we mean that the program

being executed is contained in the computer's memory, as is the data the program is operating on.

The Central Processing Unit13 continually runs the following steps, known as the Information

Processing Cycle (IPC):

_ Fetch

_ Decode

_ Execute

By which is meant:

_ Fetch: get the next instruction from memory

_ Decode: analyze the instruction and decide what is to be done

_ Execute: do it

Ans 6:

Qn Qn+1 BR=11011

BR’+1=00101

AC

00000

QR

00010

Qn+1

0

SC

101

0 0 ashr 00000 00001 0 100

1 0 Subtract BR 00101

ashr

00101

00010

10000

1

011

0 1 Add BR 11011

ashr

11101

11110

11000

0

010

0 0 ashr 11111 01100 0 001

0 0 ashr 11111 10110 0 000

Result is : 11111 10110

Number is negative and in 2s complement form

Page 8: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

1 1111 10110

- 000001010(2s complement)

-10 ans

Solution 5:

Step 1: Find the number of parity bits required.

Let p= 3, then

2p

= 2 3

=8

x+p+1= 4+3+1=8

Three parity bits are required

Total code bits=4+3= 7

Step 2:

Construct bit location table:

Bit

Designation

D7 D6 D5 P4 D3 P2 P1

Bit Location 7 6 5 4 3 2 1

Binary

Location

Number

111 110 101 100 011 010 001

Information

Bits

1

0

1

1

Parity Bits

(even

Parity)

0

0

1

Page 9: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

Step 3:

Determine the parity bits: For

P1:Bit locations 3,5 and 7have three 1’s and therefore to have an even parity P1 must be 1

For P2: Bit locations 3, 6,and 7 have two 1’s and therefore to have an even parity P2 must be

zero.

For P4: Bit locations 5,6 and 7 two 1’s and therefore to have an even parity P4 must be zero

Step 4:

Enter the parity bits into the table to form seven bit hamming code=1010101

Ans 1:

1. Generations of Computer

The computer has evolved from a large-sized simple calculating machine to a smaller but much

more powerful machine. The evolution of computer to the current state is defined in terms of the

generations of computer. Each generation of computer is designed based on a new technological

development, resulting in better, cheaper and smaller computers that are more powerful, faster

and efficient than their predecessors. Currently, there are five generations of computer. In the

following subsections, we will discuss the generations of computer in terms of—

i. the technology used by them (hardware and software),

ii. computing characteristics (speed, i.e., number of instructions executed per second),

iii. physical appearance, and

iv. their applications.

1.1. First Generation (1940 to 1956): Using Vacuum Tubes

Hardware Technology: The first generation of computers used vacuum tubes for

circuitry and magnetic drums for memory. The input to the computer was through

punched cards and paper tapes. The output was displayed as printouts.

Software Technology: The instructions were written in machine language. Machine

language uses 0s and 1s for coding of the instructions. The first generation computers

could solve one problem at a time.

Computing Characteristics: The computation time was in milliseconds.

Physical Appearance: These computers were enormous in size and required a large

room for installation.

Page 10: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

Application: They were used for scientific applications as they were the fastest

computing device of their time.

Examples UNIVersal Automatic Computer (UNIVAC), Electronic Numerical Integrator

and Calculator (ENIAC), and Electronic Discrete Variable Automatic Computer

(EDVAC).

The first generation computers used a large number of vacuum tubes and thus generated a lot of

heat. They consumed a great deal of electricity and were expensive to operate. The machines

were prone to frequent malfunctioning and required constant maintenance. Since first generation

computers used machine language, they were difficult to program.

1.2. Second Generation (1956 to 1963): Using Transistors

Hardware Technology: Transistors replaced the vacuum tubes of the first generation of

computers. Transistors allowed computers to become smaller, faster, cheaper, energy

efficient and reliable. The second generation computers used magnetic core technology

for primary memory. They used magnetic tapes and magnetic disks for secondary

storage. The input was still through punched cards and the output using printouts. They

used the concept of a stored program, where instructions were stored in the memory of

computer.

Software Technology: The instructions were written using the assembly language.

Assembly language uses mnemonics like ADD for addition and SUB for subtraction for

coding of the instructions. It is easier to write instructions in assembly language, as

compared to writing instructions in machine language. High-level programming

languages, such as early versions of COBOL and FORTRAN were also developed during

this period.

Computing Characteristics: The computation time was in microseconds.

Physical Appearance: Transistors are smaller in size compared to vacuum tubes, thus,

the size of the computer was also reduced.

Application: The cost of commercial production of these computers was very high,

though less than the first generation computers. The transistors had to be assembled

manually in second generation computers.

Examples PDP-8, IBM 1401 and CDC 1604.

Second generation computers generated a lot of heat but much less than the first generation

computers. They required less maintenance than the first generation computers.

1.3. Third Generation (1964 to 1971): Using Integrated Circuits

Hardware Technology: The third generation computers used the Integrated Circuit (IC)

chips. In an IC chip, multiple transistors are placed on a silicon chip. Silicon is a type of

semiconductor. The use of IC chip increased the speed and the efficiency of computer,

manifold. The keyboard and monitor were used to interact with the third generation

computer, instead of the punched card and printouts.

Page 11: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

\

Software Technology: The keyboard and the monitor were interfaced through the

operating system. Operating system allowed different applications to run at the same

time. High-level languages were used extensively for programming, instead of machine

language and assembly language.

Computing Characteristics: The computation time was in nanoseconds.

Physical Appearance: The size of these computers was quite small compared to the

second generation computers.

Application: Computers became accessible to mass audience. Computers were produced

commercially, and were smaller and cheaper than their predecessors.

Examples IBM 370, PDP 11.

The third generation computers used less power and generated less heat than the second

generation computers. The cost of the computer reduced significantly, as individual components

of the computer were not required to be assembled manually. The maintenance cost of the

computers was also less compared to their predecessors.

1.4. Fourth Generation (1971 to present): Using Microprocessors

Hardware Technology: They use the Large Scale Integration (LSI) and the Very Large

Scale Integration (VLSI) technology. Thousands of transistors are integrated on a small

silicon chip using LSI technology. VLSI allows hundreds of thousands of components to

be integrated in a small chip. This era is marked by the development of microprocessor.

Microprocessor is a chip containing millions of transistors and components, and,

designed using LSI and VLSI technology. This generation of computers gave rise to

Personal Computer (PC). Semiconductor memory replaced the earlier magnetic core

memory, resulting in fast random access to memory. Secondary storage device like

magnetic disks became smaller in physical size and larger in capacity. The linking of

computers is another key development of this era. The computers were linked to form

networks that led to the emergence of the Internet. This generation also saw the

development of pointing devices like mouse, and handheld devices.

Software Technology: Several new operating systems like the MS-DOS and MS-

Windows developed during this time. This generation of computers supported Graphical

User Interface (GUI). GUI is a user-friendly interface that allows user to interact with the

computer via menus and icons. High-level programming languages are used for the

writing of programs.

Computing Characteristics: The computation time is in picoseconds.

Physical Appearance: They are smaller than the computers of the previous generation.

Some can even fit into the palm of the hand.

Application: They became widely available for commercial purposes. Personal

computers became available to the home user.

Examples: The Intel 4004 chip was the first microprocessor. The components of the

computer like Central Processing Unit (CPU) and memory were located on a single chip.

In 1981, IBM introduced the first computer for home use. In 1984, Apple introduced the

Macintosh.

Page 12: ASSIGNMENT NO 1 (Solutions) - GEHU CS/IT Deptt · PDF fileASSIGNMENT NO 1 (Solutions) ... The second generation computers used magnetic core technology ... manually in second generation

The microprocessor has resulted in the fourth generation computers being smaller and cheaper

than their predecessors. The fourth generation computers are also portable and more reliable.

They generate much lesser heat and require less maintenance compared to their predecessors.

GUI and pointing devices facilitate easy use and learning on the computer. Networking has

resulted in resource sharing and communication among different computers.

1.5. Fifth Generation (Present and Next): Using Artificial Intelligence

The goal of fifth generation computing is to develop computers that are capable of learning and

self-organization. The fifth generation computers use Super Large Scale Integrated (SLSI) chips

that are able to store millions of components on a single chip. These computers have large

memory requirements.

This generation of computers uses parallel processing that allows several instructions to be

executed in parallel, instead of serial execution. Parallel processing results in faster processing

speed. The Intel dual-core microprocessor uses parallel processing.

The fifth generation computers are based on Artificial Intelligence (AI). They try to simulate the

human way of thinking and reasoning. Artificial Intelligence includes areas like Expert System

(ES), Natural Language Processing (NLP), speech recognition, voice recognition, robotics, etc.