150 likes | 324 Views
Computer Organization & Assembly Language. University of Sargodha, Lahore Campus Prepared by Ali Saeed. The CPU. It is brain of computer It controls the computer by executing programs stored in memory A program might be System program or Application program written by user
E N D
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed
The CPU • It is brain of computer • It controls the computer by executing programs stored in memory • A program might be System program or Application program written by user • CPU understand only bit string or machine language
Execution Unit • EU is responsible to execute instructions • It contain ALU • ALU perform Arithmetic and Logic operations • Data for operation is stored in registers • Register is like a memory except it has some specific name • EU has 8 register for storing data • AX BX CX DX SI DI BP SP • EU have temporary register to hold operands • Flag register whose individual bits reflect the result of computation
Bus Interface Unit • BIU is responsible for communication between EU and memory or I/O • It transmit address, data, and control signals • The registers CS, DS, ES, SS hold address of memory location • IP contain the address of next instruction to be executed • BIU fetch up to 6 bytes of next instructions and place them in a queue • This process is called instruction prefetch
I/O Ports • I/O devices are connected to computer through I/O circuits which contain several registers called I/O ports • Some use for data and other use for control signals • Like memory, I/O ports have addresses and are connected to bus • These address are known as I/O addresses
I/O Ports • I/O ports function as transfer points between CPU and I/O devices • Data input from I/O device sent to Port and read by CPU • On output CPU write data to I/O port and I/O circuit send it to I/O device
Serial and Parallel Ports • Data travel between I/O ports and I/O devices can be 1 bit at a time (Serial) or more then 1 bit at a time (Parallel) • Slow devices like keyboard always connected to Serial Ports • Fast devices like disk drivers always connected to parallel ports • Some devices like printer can be connected either serial ports or parallel ports
Instruction Execution • Fetch the instruction from memory • Decode the instruction to determine operation • Fetch data from memory • Perform the operation on data • Store the result in memory if needed
Timing • Clock circuit controls the processor by generating a train of clock pulses • Time interval between two pulses are known as clock period • No. of pulses per second called clock rate or clock speed • It measures in MHz • The original IBM had clock speed of 4.77 MHz
I/O Devices • I/O devices use to get information into and out of computer • Primary I/O devices are • Magnetic Disk • Keyboard • Display Monitor • Printers
Machine and Assembly Language • CPU can only execute machine instructions • Machine language consist of stream of 0’s and 1’s • Assembly language is symbolic language • It use symbolic names to represent operations, registers, and memory locations • Assembly language have one-to-one correspondence with machine language • Before execution assembly program must be converted into machine language • Assembler is use to convert assembly language into machine instructions
High Level languages • Assembler is use to convert assembly language into machine instructions • It is difficult to write program in assembly then high level language like C++, C, Java etc… • Compiler is use to translate high level language into machine instructions
Advantages of Assembly Language • It is efficient • Some operations like read or write to I/O port or memory can be done easily in assembly • Many high level languages also accept sub program written in assembly language • By learning you can gain a feeling for the way a computer think