Friday, December 13, 2013

Instruction Execution


This sequence of steps is frequently referred to as the fetch-decode-execute cycle.
It is central to the operation of all computer
CPU Organization

The internal organization of part of a simple von Neumann CPU is shown  below.
This part is called the data path and consists of the registers, the ALU (Arithmetic Logic Unit), and several buses conecting the pieces.
The register feed into two ALU input registers, labeled A and B in the figure. These register hold the Alu input while the ALU is performing some computation.



The ALU itself perform addition,subtraction and other simple operation on its inputs, thus yielding a result in the output register. This output register can be stored back into a register. Not all design have the A, B and output register. In the example, addition is illustrated, but ALU can perform other operation.

Instructions can be divided into one of two categories :

# register - memory
allow memory words to be fetched into registers, where they can be used as ALU inputs in subsequent instructions.

# register - register
fetches two operands from the registers, brings them to the ALU input register, perform some operation on them and store result back in one of the registers.


Processor

A processor is the logic circuitry that responds to and processes the basic instructions that drive a computer.
The term processor has generally replaced the term central processing unit (CPU). The processor in a personal computer or embedded in small devices is often called a microprocessor.
It contains a small, high-speed memory used to store temporary result and certain control information
Made up of a number of register each having certain size and function. Usually the register have same size. Each register can hold one number, up to some maximum determined by it size.

Tuesday, December 10, 2013

COMPUTERS SYSTEM ORGANIZATION

DESIGN PRINCIPLE FOR MODERN COMPUTERS

Machine designers should always keep an eyes out for technological changes that may effect the balance among the component.

ALL INSTRUCTIONS ARE DIRECTLY EXECUTED BY HARDWARE

Eliminating a level of interpretation provides high speed for most instruction.

MAXIMIZE THE RATE AT WHICH INSTRUCTION ARE ISSUED

Modern computers resort to many tricks to maximize their performance, chief among which is trying to start as many instructions per second as possible.this principle suggest that parallelism can play a major role in improving performance, since issuing large numbers of slow instruction in short time interval is possible only if multiple instructions can execute at once.

INSTRUCTION SHOULD BE EASY TO DECODE

ONLY LOADS AND STORES SHOULD REFERENCE MEMORY

One of the simplest ways to break operation into separate steps is to require that operands for most instructions come from - and return to - CPU registers.
access memory will take a long time and the delay is unpredictable.
Conclusion, that  only LOAD and STORED instructions should reference memory. All other instructions should operate only on registers.

PROVIDE PLENTY OF REGISTERS

Instruction level- parallelism

Most computer architects look to parallelism (doing two or more thing at once) as a way to get even more performance for given clock speed. Parallelism comes in two general forms, instruction level parallelism and processor level parallelism.

PIPELINING

Pipelining is doing doing two thing at the same time. after one instruction is fetching, the other instruction will follow.
eg.


S1: Instruction fetch unit
S2: Instruction decode unit
S3: Operand fetch unit
S4: Instruction execution unit
S5: Write back unit

Explanation:
During clock cycle 1, stage S1 is working on instruction 1, fetching it from memory.
during clock cycle 2, stage S2 decode instruction 1, while stage S1 fetching instruction 2.
and so on..

This process will take a short time than wait one by one instruction to finish execute.

SUPERSCALAR ARCHITECTURES\

if one pipelining is good two pipelining are better. 




in reality, most functional units in stage 4 take appreciable longer than one clock cycle to execute, certainly the one that access memory or do floating point arithmetic.

MULTIPROCESSORS

the processing element in data parallel processor are not independent CPUs, since there only one control unit there. Multiprocessors is a system with more than one CPU sharing a common memory. They must coordinate to avoid getting in each other,s way. 

MULTICOMPUTERS

Multicomputer is a system consisting of large numbers of interconnected computers, each having its own private memory, but no common memory.


Since multiprocessor are easier to program and multicomputers are easier to build , there is much research on designing hybrid system that combine the good properties of each other.

amni dalilah(B031310284)

Wednesday, December 4, 2013

2.1TERMINALS

Many programs are interactive and need to access the user's terminal. Although the terminal is a file which can be connected with an OPEN statement, its name is system-dependent. Fortran solves the problem by providing two special files usually called the standard input file and the standard output file.

These files are pre-connected for example:no OPEN statement is needed (or permitted). They are both formatted sequential files and, on interactive systems, handle input and output to the terminal. You can READ and WRITE from these files simply by having an asterisk  ``*"  as the unit identifier.

These files make terminal I/O simple and portable; examples of their use can be found throughout this book.
When a program is run in batch mode most systems arrange for standard output to be diverted to a log file or to the system printer. There may be some similar arrangement for the standard input file.

The asterisk notation has one slight drawback:
-the unit numbers is often specified by an integer variable so that the source of input or destination of output can be switched from one file to another merely be altering the value of this integer. This cannot be done with the standard input or output files.



3.1MICE

Pointing Devices
The graphical user interfaces (GUIs) in use today require some kind of device for positioning the on-screen cursor.

Typical pointing devices are: mouse, trackball, touch pad, trackpoint, graphics tablet, joystick, and touch screen.
Pointing devices, such as a mouse, connected to the PC via a serial ports (old),PS/2  mouse port (newer), or USB port (newest). Older Macs used ADB to connect their mice, but all recent Macs use USB (usually to a USB port right on the USB keyboard).


1)Mouse




The mouse pointing device sits on your work surface and is moved with your hand. In older mice, a ball in the bottom of the mouse rolls on the surface as you move the mouse, and internal rollers sense the ball movement and transmit the information to the computer via the cord of the mouse.
The newer optical mouse does not use a rolling ball, but instead uses a light and a small optical sensor to detect the motion of the mouse by tracking a tiny image of the desk surface. Optical mice avoid the problem of a dirty mouse ball, which causes regular mice to roll unsmoothly if the mouse ball and internal rollers are not cleaned frequently.
A cordless or wireless mouse communicates with the computer via radio waves (often using BlueTooth hardware and protocol) so that a cord is not needed (but such mice need internal batteries).
A mouse also includes one or more buttons (and possibly a scroll wheel) to allow users to interact with the GUI. The traditional PC mouse has two buttons, while the traditional Macintosh mouse has one button. On either type of computer you can also use mice with three or more buttons and a small scroll wheel (which can also usually be clicked like a button).


Two-button mouse with scroll wheel



Wireless Macintosh Mouse



2)Touch pad





Most laptop computers today have a touch pad pointing device. You move the on-screen cursor by sliding your finger along the surface of the touch pad. The buttons are located below the pad, but most touch pads allow you to perform “mouse clicks” by tapping on the pad itself.
Touch pads have the advantage over mice that they take up much less room to use. They have the advantage over trackballs (which were used on early laptops) that there are no moving parts to get dirty and result in jumpy cursor control.






3)Trackpoint




Some sub-notebook computers (such as the IBM ThinkPad), which lack room for even a touch pad, incorporate a trackpoint, a small rubber projection embedded between the keys of the keyboard. The trackpoint acts like a little joystick that can be used to control the position of the on-screen cursor.







4)Trackball


The trackball is sort of like an upside-down mouse, with the ball located on top. You use your fingers to roll the trackball, and internal rollers (similar to what’s inside a mouse) sense the motion which is transmitted to the computer. 





Advantage
-the body of the trackball remains stationary on your desk, so you don’t need as much room to use the trackball.
 Early laptop computers often used trackballs (before superior touch pads came along).

Disadvantage
-dirty rollers can make their cursor control jumpy and unsmooth.

But there are modern optical trackballs that don’t have this problem because their designs eliminate the rollers.



5)Joysticks




Joysticks and other game controllers can also be connected to a computer as pointing devices. They are generally used for playing games, and not for controlling the on-screen cursor in productivity software.







6)Touch screen
Some computers, especially small hand-held PDAs, have touch sensitive display screens. The user can make choices and press button images on the screen. You often use a stylus, which you hold like a pen, to “write” on the surface of a small touch screen.









7)Graphics tablet




A graphics tablet consists of an electronic writing area and a special “pen” that works with it. Graphics tablets allows artists to create graphical images with motions and actions similar to using more traditional drawing tools. The pen of the graphics tablet is pressure sensitive, so pressing harder or softer can result in brush strokes of different width (in an appropriate graphics program).








NUR LIYANA BT ROSLAN
B031310295

Tuesday, December 3, 2013

I/O

CHARACTER CODE

Each computer has a set of characters that it uses. As a bare minimum, this set includes the 26 uppercase letter, the 26 lowercase letters, the digits 0 through 9, and a set of special symbols, such as space, period, minus sign, comma, and carriage turn. 

In order to transfer these character into the computer, each one is assigned a number : for example, a=1 , b=2, ....., z=26, +=27, -=28. The mapping of character onto integers is called a character code

THREE IMPORTANT CHARACTER CODE

  1. ASCII
  2. UNICODE
  3. UTF-8

ASCII (American Standard Code for Information Interchange)

Each ASCII code has :
  • 7 bits
  • 128 characters 
standard ASCII Table
However, because computers are byte oriented, each ASCII character is normally stored in separate byte. Codes 0 to 1F (hexadecimal) are control character and do not print. Code from 128 to 255 are not part of ASCII, but the IBM PC defined them to special characters like smiley face and most computers still support them.

The ASCII printing characters are straightforward.They includes the upper and lowercase letters,digits,,punctuation marks, and few math symbols.

Unicode

An example of Unicode table

ASCII is fine for English but less fine for other languages. French needs some accents (e.g, système) ; German needs diacritical marks (e.g für) and so on.Some European language have a few letters not found in ASCII, such as the German Î² and the Danish Î¦. Some language have entirely different alphabets (e.g Russian and Arabic), and few languages have no alphabets at all (e.g Chinese) . As computers spread to the four corners of the globe and software vendors want to sell products in countries where most users does not speak English, a different characters sets needed.

1st  attempt -  extending ASCII was IS 646, which added another 128 characters to ASCII
                  -  making it 8-bit code call Latin-1. The additional characters were mostly Latin letters with                                   accents and diacritical marks. 
2nd attempt - IS 8859, introduced the concept of a code page
                  - a set of 256 characters for a particulars language or group of language 
                  - IS 8859-1 is Latin-1
                  - IS 8859-2 handles the Latin-based Slavic languages (e.g Republic Czech, Polish and Hungarian).
                  - IS 8859-3 contains the characters need for Turkish, Maltese, Esperanto,Galician and so on.
The trouble with the code-page approach is that the software has to keep track of which page it is currently on, it is impossible to mix language over pages, and the scheme does not cover Japanese and Chinese at all.

A group of computers companies decided to solve this problem by forming a consortium to create new system, called Unicode, and getting it proclaimed an International Standard (IS 10646). Unicode now supported by programming language (e.g Java), operating system (e.g Windows), and many applications.

The idea behind Unicode is to assign every characters and symbols a unique 16-bit value, called code point.
No multibyte characters or escape sequence are used.Having every symbol be 16 bits makes writing software simpler.

UNICODE 

  • 16-bit symbols
  • has 65,536 code points
  • world's languages collectively use about 200,000 symbols,code point are a scarce resource that must be allocated with great care.
  • to speed the Unicode ,used Latin-1 as code points 0 to 255, making conversation between ASCII and Unicode easy.
  • code point divided into blocks :-each one a multiple of 16 code points
  • to allow user to invent special character for special purpose, 6400 code points have been allocated for local use.

UTF-8

UTF-8 data


Although better than ASCII , Unicode eventually ran out of code points and it also requires 16 bits per character to represent pure ASCII text, which is wasteful.Consequently, another coding scheme was developed to address these concerns. It is called UTF-8 UCS Transformation Format where UCS stands for Universal Character Set, which is essentially Unicode. UTF-8 codes are variables length, from 1 to 4 bytes, and can code about two billion character. It is the dominant character set used on the World Wide Web.


what make UTF-8 nice is :
  • codes 0 to 127 are the ASCII characters
  • allowing them to be expressed in 1 byte (versus 2 bytes in Unicode)
  • if program or document uses only characters that are in the ASCII character set, each can be represent in 8 bits.
  • the first bytes of every UTF-8 characters uniquely determines the number of bytes in the characters
  • continuation bytes in an UTF-8 character always start with 10
  • making the code self synchronizing 

I believe that if you show people the problems and you show them the solutions they will be moved to act 
Bill Gates 
posted by
Nur Aqeelah Napis(B031310448)


INPUT/OUTPUT

1.1BUSES

The input/output bus or io bus is the pathway used for input and output devices to communicate with the computer processor.

A bus is a shared communication link,which uses one set of wires to connect multiple subsystems.

Bus is a set of wires connecting multiple modules(processor,memory,IO devices)





Sometimes shared bus with memory,sometimes a separate I/O bus






1.2Advantage and Disadvantage of Buses


Advantages:

1)versatility
-new devices can be added easily.
-peripherals can be moved between computer systems that use the same bus standard

2)low cost
-a single set of wires is shared in multiple ways

Disadvantages:

1)It creates a communication bottleneck.

2)The bandwidth of that bus possibly limiting the maximum I/O throughput.

3)The maximum bus speed is is largely limited by:
- physical factors:the length of the bus and the number of devices.

4)The need to support a range of devices with widely varying latencies and data transfer rates also makes bus design challenging.

5)It becomes difficult to run many parallel wires at high speed due to clock skew and reflection.


1.3Characteristics of Buses

-a bus standard provides flexibility:can connect multiple devices from different manufacturers

-but a bus maybe a communications bottleneck

-a bus maybe a synchronous or asynchronous

-to coordinate transmission on an asynchronous bus,a hand shaking protocol can be used.

There are two basics schemes  for communication on the bus:

-Synchronous
-Asynchronous




1.4Synchronous

-If a bus is a synchronous(e.g Processor-memory),it includes a clock in the control lines and a fixed protocol for communicating that is relative to the clock.




-This type of protocol can be implemented easily in a small finite state machine.Because the protocol is predetermined and involves little logic,the bus can run very fast and the interface logic will be small.


Two Major Disadvantages:

1)Every device on the bus must run at the same clock rate.

2)Because of clock skew problems,synchronous buses cannot be long if they are fast.





1.5Asynchronous

-An asynchronous bus is not a clocked.

-It can accommodate a wide variety of devices

-It can be lengthened without worrying about clock skew or synchronization  problems.

-It requires a handshaking protocol.

Three special control lines required for hand-shaking:

1)Read-req:used to indicate a read request for memory.The address is put on the data lines at the same time.

2)DataRdy:used to indicate that the data word is now ready on the data lines;asserted by:Output/Memory and Input/I_O Device.

3)Ack:used to acknowledge the ReadReq or the DataRdy signal of the other party.






Steps after the device signals a request by raising ReadReq and putting the address on the Data lines:

1)When memory sees the ReadReq line,it reads the address from the data busand raises Ack to indicate it has been seen.

2)As the Ack line is high-I/O releases the ReadReq and data lines.

3)Memory sees that ReadReq is low and drops the Ack line to acknowledge the ReadReq signal(Mem. Reading in progress now)

4)This step starts when the memory has the data ready.It places the data from the read request on the data lines and raises DataRdy.

5)The I/O device sees DataRdy,reads the data from the bus,and signals that it has the data by raising Ack.

6)On the Ack signal,M/M drops DataRdy,and raises the data lines.
7)Finally,the I/O device,seeing DataRdy go low,drops the Ack line,which indicates that the transmission is completed.





1.6Increasing the bus bandwidth:

1)Data bus width:

-By increasing the width of the data bus,transfers of multiple words require fewer bus cycles.
-Example:SPARCstation 20?s memory bus is 128 bit wide.

-Cost:more bus lines

2)Block transfers:

-Allow the bus to transfer multiple words in back-to-back bus cycles.

-Only one address needs to be sent at the beginning

-The bus is not released until the last word is transferred

-Cost:(a)increased complexity
          (b)decreased response time for request
    

1.7Bus Arbitration

Any device that can control the bus is called a bus master

Bus arbitration scheme:

-A bus master wanting to use the bus asserts the bus request

-A bus master cannot use the bus until its request is granted

-A bus master signal to the arbiter after it has finished using the bus


Bus arbitration schemes usually try to balance two factors:

1)Bus priority:the highest priority device should be serviced first

2)Fairness:Even the lowest priority device should never be completely locked out from the bus


The Daisy Chain Bus Arbitrations Scheme


Advantage:

-simple

Disadvantages:

-cannot assure fairness:
A low-priority device may be locked out indefinitely

-the use of the daisy chain grant signal also limits the bus speed







Recall that I/O buses are the electronic channels that allows the various input/output and storage devices to communicate with the CPU.On most motherboards,the I/O buses are organized as follows:




As the diagram shows,
-The I/O panel(on the back of the motherboard)contains ports and connectors for standard input/output devices(keyboard,mouse,etc) as well as integrated components(audio,video,LAN).
-Device headers (attached to the surface of the motherboard)are used to connect storage devices(FDD,HDD,DVD)




1.8Giving Commands to I/O Devices

1)Two methods are used to address the device:

-special I/O instructions

-memory-mapped I/O

2)Special I/O instructions specify:

-Both the device number and the command word
     -Device number:the processor communicates this via a set of wires 

-Normally included as part of the I/O bus
      -Command word:this is usually send on the bus data lines

3)Memory-mapped I/O:

-Portions of the address space are assigned to I/O device

-Read and writes to those addresses are intrepreted as commands to the I/O devices



1.9Notifying the OS

1)The OS needs to know when:
-The I/O device has completed an operation
-The I/O operation has encountered an error

2)This can be accomplished in two different ways:

Polling:
-The I/O device put information in a status register
-The OS periodically check the status register

I/O Interrupt:
-Whenever an I/O device needs attention from the processor,it interrupts the processor.



1.10Controlling Input/Output Transfers

1)Polling
-Check the device a regular intervals.

Advantage:
Simple-the processor is totally in control and does all the work

Disadvantage:
Polling overhead can consume a lot of CPU time


2)Interrupt Driven Data Transfer

Advantage:
-User program progress is only halted during actual transfer

Disadvantage:
-special hardware is needed to:
 -cause an interrupt(I/O device)
-detect an interrupt(processor)
-save the proper states to resume after the interrupt(processor)


3)Delegating I/O Responsibility from the CPU:DMA




 Direct Memory Access(DMA):

-External to the CPU
-Act as a maser on the bus
-Transfer blocks of data to or from memory without CPU invention

  
 Block Diagram of a DMA Controller


Sequence of Operations-Input:

1)CPU loads register-Address,Count and Device

2)CPU Sets Status to Input

3)Controller asks for bus

4)Gets bus-does read from device,puts Address on the bus,does write to memory and decrements count.

     **Repeat 4 until count=0

5)Interrupt CPU to signal end of transfer


***Output is similar but status is set to Output and data is read from memory and written to the output device





4)Intelligent Controllers(microprocessors themselves)

-handle basic control of IO device in addition to block transfers


Example:
 -error checking for communication lines,transfer of multiple sectors from disk



I/O buses connect these ports and headers to the super I/O and southbridge support chips, which in turn are connected to the northbridge chip, which allows the devices to communicate with the CPU and memory.
The division of I/O buses is according to data transfer rate.Specifically,

Controller
Port / Device
Typical Data Transfer Rate
Super I/O
PS/2 (keyboard / mouse)
2 KB/s
Serial Port
25 KB/s
Floppy Disk
125 KB/s
Parallel Port
200 KB/s
Southbridge
Integrated Audio
1 MB/s
Integrated LAN
12 MB/s
USB
60 MB/s
Integrated Video
133 MB/s
IDE (HDD, DVD)
133 MB/s
SATA (HDD, DVD)
300 MB/s




1.11PS/2 Ports

The circular ports with 6 holes are called PS/2 connectors. They are used to connect the keyboard and mouse.
In early PCs, mice were usually connected to the PC using the serial port, and were therefore known as serial mice.Microsoft developed another type of mouse that could be connected to the PC by an expansion card, which plugged into one of the expansion slots on the motherboard.This type of mouse was called a bus mouse.By using a bus mouse, the serial port could be used for other devices, such as a modem.In 1982, IBM took this idea one step further with their new PS/2 computer.In the PS/2, the motherboard contained built-in mouse controller circuitry and a built-in mouse connector, which eliminated the need for an expansion card.Today, the term "PS/2 connector" is still a reference to the 1982 computer where they first appeared.



1.12Universal Serial Bus (USB) Ports

The Universal Serial Bus (USB) is a serial bus technology that was developed jointly by seven companies, including Intel, IBM and Microsoft.The USB has significantly higher data transfer rates than the standard serial interface; however, it's most attractive feature is called "hot-plugging", which means that devices can be plugged in and used immediately, without powering down or rebooting the system.When the device is plugged into any USB port, the USB controller in the PC will detect the device, and automatically determine and allocate the resources and drivers that are required.
The USB interface can be used to connect a maximum of 127 different peripheral devices, including keyboards, mice, joysticks, speakers, microphones, printers, modems, scanners,videos cameras and more.This can either be done by "chaining" the devices together (provided each device contains 2 of it's own USB ports), or by using a series of USB "hubs" which can connect multiple devices, and can themselves be chained together.
Most PCs have additional USB connectors on their front panel.Extra USB ports can be purchased and installed on the back of the PC (using an expansion card opening), or on the front of the PC (into a device bay opening). The wires from these ports have plastic connectors on the other end, which are then plugged into appropriate pin banks on the motherboard.



1.13Serial and Parallel Ports

1)Serial ports are used to connect slower devices that communicate using serial (one bit at a time) signals, such as a modem or a serial mouse.Serial ports are easily identifiable, with 9 or 25 small metal pins arranged over two rows (most other ports have holes).Motherboards usually identify the serial port as COM1.

2)Parallel ports are used to connect devices that communicate using parallel (8 bits at a time) signals, such as printers, scanners and disk cartridge drives. The parallel port is usually the widest port on the motherboard, with 25 holes arranged over 2 rows.Motherboards usually identify the parallel port as LPT1.
Since most I/O devices now use USB, more and more motherboards are being manufactured without a parallel / serial port on the back of the board.However, these motherboards may still support older parallel or serial devices. External parallel / serial ports can be purchased and installed on the back of the PC (using an expansion card opening).The wires from these ports have plastic connectors on the other end, which are then plugged into appropriate pin banks on the motherboard.



1.14Additional Ports

Additional I/O ports will vary from motherboard to motherboard, depending on the number of integrated features. 
For example, in the diagram above:
-VGA port for attaching a monitor.
-LAN port for attaching an Ethernet cable to connect the PC to a local area network.
-Standard audio jacks (blue / pink / green) for standard sound input and output
Not shown in the diagram above, but found on some specialized motherboards:
-Audio jacks to connect surround sound speakers (grey / black / orange)
-Game port / midi connection
-SPDIF ports to send the sound from the PC to a stereo receiver
Firewire ports for connecting camcorders, DVD players and digital audio equipment

to be continued...
Nur Liyana Bt Roslan
B031310295