Monday 20 April 2015

Summary of Microprocessor and Microcomputer Systems


A basic microcomputer system comprises four parts which are:
1.   Microprocessor
2.   Memory
3.   Input/Output
4.   Buses

A microprocessor is a single chip which is capable of processing data and controlling all the components of the microcomputer.
A typical microprocessor contains the following:
1.   Temporary Storage: This is a number of registers that holds bits of binary information.
2.   ALU: This is the unit that carries out arithmetic and logic operations.
3.   Timing and Control Circuit: This keeps the other parts of microcomputer working together in the right time sequence.

A memory is the part of the microcomputer that is used to store programs and data, provide data to the microprocessor on request and accepts new data from the microprocessor for storage.
 

There are two types of memory which are:
1.   ROM (Read Only Memory): This is also known as firmware. They are fixed during manufacture and as such they cannot be altered. They are also non volatile which means that they do not lose their information when power supply is lost. It is used to store OS too.
2.   RAM (Random Access Memory): This memory has read and write capabilities. It is volatile which means that it loses its information when power is lost and it stores programs which the microcomputer user wants to run currently.

Input/Output Port is the link between the microprocessor and the outer world. Both input and output ports may be implemented into one single IC package.

BIOS (Basic Input Output System): This is a program a microcomputer system uses to get the microprocessor started. Once it is switched on it manages data flow from the microprocessor to the rest of the system.

Buses are a group of wires or conduction tracks on PCB board through which binary information is transferred from one part of a microcomputer to another.
There are three types of buses which are:
1.   Address Bus: This is used to transmit the address of the specific storage location to the memory or port. It is unidirectional and has 16 address pins.
2.   Data Bus: It carries data which has been transferred through out the system. It is bidirectional and has 8 data lines. The size and width of a data bus is also important because it determines how much data can be transferred at one time. It also determines what arithmetic can be done and it limits the number of possible instructions. In this case, It is 256.
3.   Control Bus: Each line of a control bus goes one way. READ and WRITE are output lines while INTERRUPT are input lines. Signals used by the control bus are generated by timing control circuits of the microprocessor whenever it needs to perform a specific function.


Each microprocessor has its own unique set of instructions known as instruction set.
An assembler is used to convert the source code to a microprocessor understandable language or object code.
A compiler is used to high level language programs to object code.

Memory Hierarchy


Computer memory hierarchy is a pyramidal structure that is commonly used to illustrate the significant differences among memory types. The memory unit that directly

communicates with the CPU is known as MAIN MEMORY. Devices that provide back up storage are known as AUXILIARY MEMORY.
A special very high speed memory called cache is used to increase the speed of processing by making current programs and data available to CPU at a rapid rate.

Processing speed is limited primarily by the speed of the main memory.
The cache is used for storing segments of programs currently being executed by the CPU and temporary data frequently needed in the present calculation. The typical access time ratio between cache and main memory is about 1 to 7. Auxiliary access time is about 1000 times that of the main memory.
The fundamental idea of a memory hierarchy is that for each k, the faster and smaller device at level k serves as cache for larger, slower device at level k + 1.
The reason why a memory hierarchy works is that programs tend to access data at level k more often than they access at level k + 1.
The net effect is that large pool of memory that costs as little as the cheap storage near the bottom, but serves data to programs at equivalent rate as of the fast storage near the top.

Integrated RAM are available in two possible operating modes which are:

1.   Static
2.   Dynamic

The capacity of the RAM is 128 words of 8 bits (one byte per word). The computing system that the integrating RAM is used in usually stores data at various locations

to retrieve it later from these locations. RAM has directional select signal R/W'; when R/W' = 1, the chip outputs data to the rest of the circuit; when R/W' = 0, the chip inputs data from the rest of the circuit.
 

Note the following:
A.   RAM is packaged as a chip.
B.   Its basic storage unit is a cell (one bit per cell).
C.   Multiple RAM chips form a memory.

Key Features of a Static RAM (SRAM)

1.   Each cell stores bit with a six transistor circuit.
2.   The SRAM retains value indefinitely as long as it is kept powered.
3.   It is relatively insensitive to disturbances such as electrical noise.
4.   It is faster and more expensive than DRAM.

Key Features of a Dynamic RAM (DRAM)

1.   Each cell stores bit with a capacitor and transistor
2.   Its value is refreshed every 10 - 100ms.
3.   It is sensitive to disturbances such as electrical noise.
4.   It is slower and cheaper than SRAM.

ROM is used for storing programs that are permanently resident in the computer and for table of constants that do not change in value once the production of the computer is completed. The ROM portion of main memory is needed for storing an initial program called the bootstrap loader, which is to start the computer software when power is turned on/off.

Note the following about ROM:

1.   Data is programmed into the chip using an external ROM programmer.
2.   The programmed chip is used as a component into the circuit.
3.   The circuit does not change the content of the ROM.
4.   Its tables to an be used as look up implement various functions.
5.   It is used by PCs to store the instructions that form their BIOS.
6.   It is non volatile.

Types of ROM

1.   Maskable ROM
2.   PROM
3.   EPROM: Its contents can be erased by ultra violet light.
4.   EEPROM: One can modify individual locations of the memory, leaving others unchanged and is commonly used in BIOS personal computers.

Programs stored in a ROM are:


1.   Boot Time Code
2.   BIOS
3.   Graphics Card
4.   Disk Controllers

Reasons for replacing magnetic tapes with magnetic disks are:

1.   Decreasing Cost per Bit
2.   Higher Transfer Rates
3.   Reliability
4.   Reduced Access Time
5.   Reduced Size and Power Requirements
6.   Increased Capacity


Magnetism is a good way of storing data because it has two states (North and South) which is similar to that of binary (1's and 0's). In a storage disk drive, the mechanism which performs the function of converting the digital states (1's and 0's) to magnetic states which can magnetize the surface area of the disk is called WRITE HEAD. The READ HEAD is used to detect the magnetic states on the surface of the disk and convert them back to digitall states.

Disk capacity is the maximum number of bits that can be stored in a disk.

Factors that determine the disk capacity are:

1.   Recording Density (bits/in): This is the number of bits that can be squeezed into a 1 inch segment of a track.
2.   Track Density: This is the number of tracks that can be squeezed into a 1 inch radial segment.
3.   Areal Density: This is the product of recording density and track density.

Modern disk partitions tracks into disjoint subsets called RECORDING ZONES. Each track has the same number of sectors determined by the circumference of the innermost track. Each zone has a different number of sectors/track.

Average time to access some target sector (Taccess) = Tavg seek + Tavg rotation + Tavg transfer.
 

Seek time is the time to partition heads over cylinder containing target sector.
 

Rotational Latency is the time for the first bit of target sector to pass over under read/write head. Tavg rotation = 1/2 * 1/RPM * 60 s/min
 

Transfer time is the time to read the bits in the target sector = 1/2 * 1/avg #sector/track * 60 s/min.

Software Development

There are 7 steps of software development which are:
1.   Problem Definition
2.   Program Design
3.   Program Coding
4.   Debugging
5.   Testing
6.   Documentation
7.   Maintenance and Redesign

Techniques used in program design are:
1.   Algorithm: This is a precise and finite sequence of actions or instructions required by the computer to solve a particular problem.
2.   Flowchart: This is a capital description of a program or system.
3.   Top-down Design/Step-wise Refinement: The task to be performed is broken down into a few sub tasks which are then each decomposed into smaller sub tasks.
4.   Pseudocode: This is an aggrevated form of a solution.

The 3 basic control structures are:
1.   Sequence
2.   Selection
3.   Iteration

Program coding is the writing of the actual source code in either assembly or high level language.
Debugging is the checking and elimination of bugs in a program.
Testing is simply running the program to ensure it performs optimally and well.
Documentation
is the writing in details how the program was developed and actions carried out.
Maintenance and Redesign is the servicing, improvement and maintenance of a program.

The 8085 microprocessor is an 8 - bit microprocessor with a 40 pin dual-in-line package (DIP). The address and data bus are multiplexed in this microprocessor which helps provide more control signals.

Note that Intel 8085 has one non maskable interrupt and three maskable interrupt. It provides serial interfacing with serial input data and output data.

Classification of Intel 8085 Signals:

1.   Power Supply and Frequency Signal
2.   Address Signals:  These signals are associated with lower order address bus and time multiplexed higher order address bus.
3.   Data Signals
4.   Control and Status Signals:  These signals are used in the timing and controlling of microprocessors. For Example: HOLD, RD, WR
5.   Interrupt Signals: Examples of interrupt signals are ==> TRAP, RST 5.5, RST 6.5
6.   Serial I/O Signals: Example ==> S/O
7.   Acknowledgement Signals: Examples ==>  INTA, HLDA

Properties of the Control Unit

1.   It generates signals in the microprocessor to enable it carry out decoded instructions.
2.   It directs the flow of data in the microprocessor.
3.   It directs arithmetic and logic unit operations.

Properties of the Arithmetic and Logic Unit

1.   It carries out arithmetic instructions.
2.   It carries out logical operations.
3.   It fetches data from the memory and accumulator.
4.   It stores result in the accumulator.
5.   It processes data.

There are basically 8 types of 8 - bit registers which are:

1.   Register A (Accumulator)
2.   Register B
3.   Register C
4.   Register D
5.   Register E
6.   Register H
7.   Register L
8.   Flag Register

Note that data copy instructions are used to store data in registers. The flag register is not a general purpose register, only 5 bits out of the 8 bits are used. Bit positions of the flag are used to test data conditions. The programmer can examine the flag by accessing the register through an instruction such as the assembly language, JNZ, JZ.

The stack pointer is a 16-bit register. It has a last in first out (LIFO) structure. It points to a memory location in read/write memory called the STACK. The stack pointer is used to call up a sub program or a sub routine which is external to the main program being executed.

The program counter (PC) is a 16-bit register that gives sequence to the execution of instructions. It is also a memory pointer. When a machine code is fetched the program counter increases by one to point to the next memory location. It contains the 16-bit address of the next location to be executed.

The instruction register/decoder is a form of temporary storage the holds the operation code for the current instruction to be performed by the microprocessor in the next cycle. The decoder receives from memory prior to the execution, interprets the instruction and passes it on.

The control generator generates signals within the microprocessor and enables the microprocessor carry out decoded instructions. It opens and closes connections between the different parts of the microprocessor to enable adequate operation.

The registered selector helps in carrying out selection between different registers.

The buffer serves as an electronic connection between the external and internal data buses.

An assembly language is a symbolic language that allows the use of symbols and hexadecimal numbers for programming which makes programs readable, easier to write and understandable as compared to machine language.

Assemblying is known as the translation from assembly language to machine language while assembly is the process of code conversion done by an assembler that translates an assembly language source code into a machine language.

A machine language is a series of binary digits (1's and 0's) executed by a microprocessor to accomplish individual tasks.

An object code is a halfway step between source code and executable machine language which is not directly executed by the computer and must go through a linking process that resolves external and address references.

Linking is the process of resolving external and address references of an object code of which the resulting machine language is executed by the computer.

Reasons for writing with assembly language are:

1.   It is used for system programming.
2.   It is very fast, flexible, versatile and produces compact code.
3.   It is used to write assembly language routines that augment the capabilities of the high level languages in which the program will be used.

Assembly Language Tools are:


1.  Assembler
2.  Linker
3.  Debugger

Assembly Language Instruction Format

[Label] [Operation] [Operand] [;comments]

Types of Field are:

1.   Optional Field []: This consists of the type of instruction that leaves the programmer to determine whether they should be included or not.

2.   Label Field:   This field gives a name to an instruction which one can use as an operand in another instruction.

There are two ways one can use a Label and they are:
A.   Jump Instruction:   When one wants to jump to an instruction, one gives it a label and then jumps to the instruction.
B.   Data Names:   One can assign a name to a data storage area in the program, then and instruction can refer to the data are by name rather than by numeric address.

3.   Operation Field:   This field tells the computer what to do. It states the specific operation to be carried out.

4.   Operand Field:   This field supplies the values on which the operation stated in the operation field is to be carried out on or the memory locations where the values can be found when necessary.
 

There are three basic types of operand which are:
A.   Register Names
B.   Memory Address
C.   Immediate Data

5.   Comment Field:   This field is used to document the programs that are ignored by the assembler. They are just comments or guide which the programmer inserts for certain reasons eg: as a guide or reminder etc.

An instruction is a command given to the microprocessor to perform a given task.
Note that an instruction set of a microprocessor is the limited number of instructions the microprocessor can execute.

I would love to write a bit about stack instructions

Stack instructions are those instructions that deals with the operation of the stack which is a section of read/write memory organized in a LIFO (Last In First Out) structure.
 

The stack is accessed by two instructions which are:

1.   Push:  This is a stack instruction that saves the content of the microprocessor registers on a stack of memory before a sub routine is executed. For Example: PUSH

A places the data from A at the top of the stack.

2.   Pop:   This is a stack instruction that restores the value of the register after completion of the sub routine is executed. For Example: POP A places data from the top of the stack into A.

Miscellaneous ===> Note that wherever you see SPHL it means copy address from HL to SP (Stack Pointer).

There are six categories of computer instructions which are:

1.   Data Transfer Instructions
2.   Data Manipulation Instructions
3.   Input/Output Instructions
4.   Program Flow Control Instructions
5.   Machine Control Instructions
6.   Assembly Directives

Data Transfer Instructions:   These are instructions that moves data between the various processor registers or between a processor register and a memory location. For

Example: MOV A, B means move the contents of B register into register A.

Data Manipulation Instructions:   These are instructions that perform arithmetic and logical operations on data which is either in a specified processor register or in a memory location.

Program Flow Control Instructions:   These are instructions that include unconditional and conditional jump instructions, sub routine calls and return instructions.

These instructions act on the program counter, These instructions makes programs and computers more flexible. For Example JMP Labell 12 results in the microprocessor breaking its normal mode of sequential instruction execution and instead jump unconditionally to symbolic address Label 12 for the next instruction to be executed.

Unconditional Jump Instructions are those instructions when encountered in a system simply loads the program counter with the address which specifies the program location.
Conditional Jump Instructions are those instructions when encountered tests the flag registers for a certain condition and only if the condition exits does the jump occur.
Sub routine Jump or Call Instructions is a form of unconditional jump instruction which when encountered in a program pushes the content of the program counter and other programs into the stack before control is passed to the sub routine and on completion of the sub routine, control is returned to the main program and the saved

program counters and registered contents have popped up the stack and placed back in the program counters and registers.

Input/Output Instructions:   These are those instructions that are used to transfer data between the accumulator and a specified port. For Example: IN PORT and OUT PORT.

Machine Control Instructions:   These are those instructions that has interrupt instructions and miscellaneous instructions. Example of Interrupt Signals are: DI => Disable Interrupt, EI => Enable Interrupt. Miscellaneous instructions include microprocessor instruction set such as NOP (No Operation) HALT.

Assembler Directives:   These are those instructions that control the assembler and not the machine (computer). Example END which means end the assembly program etc.

There are 3 types of instruction word sizes which are:

1.   1 Word (1 - byte) Instruction:   In this instruction, the opcode and operands are included in one byte and require only one memory location. The operand or opcode are internal registers and are coded into instructions.
 

2.   2 Word (2 - byte) Instruction:   In this instruction, the first byte specifies the opcode while the second byte specifies the operand. The source operand is a data byte and this instruction requires two memory locations.
 

3.   3 Word (3 - byte) Instruction:   In this instruction, the first byte specifies the opcode while the other two bytes specifies the 16-bit address where the second is the lower order address while the first byte is the higher order address.

Addressing is the process by which the microprocessor is instructed by the data source and instruction.

The various formats for specifying operands are called Addressing Modes.

There are four types of addressing modes which are:

1.   Register Addressing
2.   Immediate Addressing
3.   Direct Addressing
4.   Indirect Addressing

Register Addressing:   This is a type of addressing mode whereby data is provided through the registers. For Example: MOV B, C

Immediate Addressing:   This is a type of addressing mode whereby the actual data to be operated on is present in the instruction. For Example: MVI A, FE

Direct Addressing:   This is a type of addressing mode whereby data is accepted from an external device or memory location and stored in the accumulator or to send data from the accumulator to external device or memory location.

Indirect Addressing:   This is a type of addressing mode whereby data is accepted from an external device or memory location and stored in any other register but the accumulator or to send data from any other register but the accumulator to external device or memory location.

Cache memory is a smaller, faster storage device that acts as a staging area for subsets of data in large and slower devices.
The performance of cache memory is frequently measured in terms of a quantity called HIT RATIO. When the CPU refers to the memory and finds the word in cache it is said to produce a HIT. Otherwise a MISS. Therefore, HIT RATIO = HIT/(HIT + MISS)
The basic characteristics of cache memory is its fast access time. The transformation of data from the main memory to the cache is known as MAPPING PROCESS.

There are three types of mapping which are:
1.   Associative Mapping
2.   Direct Mapping
3.   Set-Associative Mapping

Memory address map is a pictorial representation of assigned address space for each chip in the system.

Memory Read Transaction
1.   CPU places address A on address bus.
2.   Main memory reads A from memory bus, retrieves word x and place it on bus.
3.   CPU reads word x from bus and copies it into register %eax.

Memory Write Transaction
1.   CPU places address A on bus; main memory reads it and waits for corresponding data word to arrive.
2.   CPU places data word y on bus.
3.   Main memory reads data y from bus and stores it at address A.

The memory location that are directly addressed by the microprocessor is known PHYSICAL MEMORY SPACE.

An interface is a concept that refers to a point of interaction between components and is applicable at the level of hardware and software.

Features of Higher Order Address Bus
1.   It is unidirectional.
2.   It carries the most significant 8-bit of a 16-bit address of memory or I/O devices.
3.   Address remains on lines as long as the operation is not completed.

Features of Low Order Address Bus/Data Bus
1.   It is bidirectional and works on time division multiplexing between address and data.
2.   During the first cycle it serves as the least significant 8-bit of memory and I/O devices.

3.   During the second and third cycles, it behaves as a data bus.

Demultiplexing refers to separating data and address signals for read/write operations.

Memory Address Decoding is the assigning of an address for each location in the memory chip.

There are two types of memory address decoding techniques which are:

1.   Exhaustive Decoding
2.   Partial Decoding

In exhaustive decoding, if all lines are connected to a single memory device, it will decode these 16 address lines internally and produces 2^16 different addresses.

This is also known as ABSOLUTE ADDRESS DECODING.

Advantages of Exhaustive Decoding
1.   Complete Address Utilization
2.   Ease in Future Expansion
3.   No bus contention, as all addresses are unique

Disadvantages of Exhaustive Decoding
1.   Speed is less due to increased delay
2.   Increased hardware and cost

In partial decoding, minimum number of address lines are used as required to select a memory location in a chip.

Advantage of Partial Decoding
1.   It is simple, cheap and fast.

Disadvantages of Partial Decoding
1.   There is bus contention
2.   Difficult in future expansion
3.   Unutilized space and fold back (multiply mapping)

Interfacing I/O devices

In parallel I/O, data is transferred between the microprocessor and the outside world in groups of 8-bit using the entire data bus.
In serial I/O, one bit is transferred at a time using SID and SOD pins on the microprocessor.

There are two ways to interface 8085 I/O devices in parallel which are:

1.   I/O Mapped I/O
2.   Memory Mapped I/O

In I/O Mapped I/O


1.   I/O is treated as I/O
2.   It requires 8-bit addressing.
3.   Less decoder hardware
4.   It can address 256 locations.
5.   Whole memory address space is available
6.   Special instructions are used like IN, OUT
7.   Special control signals are used
8.   Arithmetic and Logic Operations can not be performed on data.
9.   Data transfer between accumulator and I/O

In Memory Mapped I/O

1.   I/O is treated as memory
2.   It requires 16-bit addressing.
3.   More decoder hardware
4.   It can address 64k locations.
5.   Less memory is available
6.   Memory instructions are used
7.   Memory control signals are used
8.   Arithmetic and Logic Operations can be performed on data
9.   Data transfer between register and I/O

Sub routines are sections of code that are written outside the main program. Sub routines receive control through calls and not through jumps. Sub routine releases control back to the instruction line following the call instruction in the main program once the return instruction is encountered.

Note that a sub routine can have more than one return instruction. In order to avoid unexpected outcomes the contents of the registers and memory are saved on the stack and once the sub routine is completed these contents are restored.

Subroutine works by making use of PUSH and POP instructions.

Advantages of Subroutines are:

1.   It makes codes reusable.
2.   It enables individual sections of code to be tested separately.

There are basically two types of sub routines which are:

1.   Nested Sub routine
2.   Input/Output Sub routine

Nested Sub routine:
This is a type of sub routine that enables a sub routine to call another sub routine.
The LIFO structure of the stack always ensures that the correct return address is at the top of the stack when the RETURN instruction is encountered.

Four ways by which data and parameters pass between the sub routine and the main program:

1.   Using a data register ===> This can be used for small data.
2.   Using a common data area  ===> This can be used for large quantities of data.
3.   Using the address of the location where the data is stored
4.   Through the stack

In the I/O sub routines the major issue between the microprocessor and the input/output devices is the difference in speed of operation.

There are two ports between the terminal and the microprocessor:

One of the port is used for input/output of data while the other is used for status information.
The status information tells us if the terminal has an input byte ready to be read or an output byte ready to be received.
Note that every port has a 1 - byte address.

Call Instructions

Call instructions are those instructions that allow control to be passed from the main program to a sub routine. Call instructions have a 2 - byte operand which is usually the 16-bit address of the sub routine to be called.

There are basically 9 types of call instructions which are:

1.   Call   ===>   Call Unconditionally
2.   CC     ===>   Call if Carry Flag is On
3.   CNC    ===>   Call if Carry Flag is Off
4.   CM     ===>   Call if Sign Flag is On [IF NEGATIVE]
5.   CP     ===>   Call if Sign Flag is Off [IF POSITIVE]
6.   CPE    ===>   Call if Parity is Even
7.   CPO    ===>   Call if Parity is Odd
8.   CZ     ===>   Call if Zero Flag is On
9.   CNZ    ===>   Call if Zero Flag is Off

Return Instructions

Return instructions are those instructions that allow control to be passed from the sub routine back to the main program. Return instructions have no operands.

There are basically 9 types of return instructions which are:

1.   RET   ===>   Return Unconditionally
2.   RC    ===>   Return if Carry Flag is On
3.   RNC   ===>   Return if Carry Flag is Off
4.   RM    ===>   Return if Sign Flag is On [IF NEGATIVE]
5.   RP    ===>   Return if Sign Flag is Off [IF POSITIVE]
6.   RPE   ===>   Return if Parity is Even
7.   RPO   ===>   Return if Parity is Odd
8.   RZ    ===>   Return if Zero Flag is On
9.   RNZ   ===>   Return if Zero Flag is Off

Bottleneck:
  This is a defect whereby the microprocessor has to wait for the memory to process and respond for the next activity to go on.
Handshake:
  This is the presence of cache memory as a middle man between the CPU and main memory.

No comments:

Post a Comment