Chapter 2-MICROPROCESSOR ARCHITECHTURE AND MICROCOMPUTER SYSTEMS

Example E1-Pg 39

In [1]:
#page no 39
#example no 2.1
#MEMORY ADDRESS RANGE.
print ('A7-A0 are  address lines for register select. \n');
print ('A15-A8 are address lines for chip select. \n \n');
print ('A15 A14 A13 A12 A11 A10 A9 A8 \n');
print (' 0  0   0   0   0   0   0  0   =00H \n \n'); #chip select bits have to be active low always to select that chip.
print ('A7 A6 A5 A4 A3 A2 A1 A0 \n');
print (' 0  0  0  0  0  0  0  0   =00H \n'); #this selects the register 00.
print ('The above combination selects the memory address 0000H. \n \n');
print ('A15 A14 A13 A12 A11 A10 A9 A8 \n');
print (' 0  0   0   0   0   0   0  0   =00H \n \n'); #chip select bits have to be active low always to select that chip.
print ('A7 A6 A5 A4 A3 A2 A1 A0 \n');
print (' 1  1  1  1  1  1  1  1   =FFH \n'); #this selects the register FF.
print ('The above combination selects the memory address 00FFH. \n \n');
#thus this chip can select any memory location from 0000H to 00FFH.
#the memory addressed of the chip can be changed by modifying the hardware.For example if we remove the inverter on line A15.
print ('A15 A14 A13 A12 A11 A10 A9 A8 \n');
print (' 1  0   0   0   0   0   0  0   =80H \n \n'); #chip select bits have to be active low always to select that chip.
print ('A7 A6 A5 A4 A3 A2 A1 A0 \n');
print (' 0  0  0  0  0  0  0  0   =00H \n'); #this selects the register 00.
print ('The above combination selects the memory address 8000H. \n \n');
#The memory address range from above change will be 8000H to 80FFH.
#Thus a memory can be assigned address in various locations over the entire map of 0000H to FFFFH.
A7-A0 are  address lines for register select. 

A15-A8 are address lines for chip select. 
 

A15 A14 A13 A12 A11 A10 A9 A8 

 0  0   0   0   0   0   0  0   =00H 
 

A7 A6 A5 A4 A3 A2 A1 A0 

 0  0  0  0  0  0  0  0   =00H 

The above combination selects the memory address 0000H. 
 

A15 A14 A13 A12 A11 A10 A9 A8 

 0  0   0   0   0   0   0  0   =00H 
 

A7 A6 A5 A4 A3 A2 A1 A0 

 1  1  1  1  1  1  1  1   =FFH 

The above combination selects the memory address 00FFH. 
 

A15 A14 A13 A12 A11 A10 A9 A8 

 1  0   0   0   0   0   0  0   =80H 
 

A7 A6 A5 A4 A3 A2 A1 A0 

 0  0  0  0  0  0  0  0   =00H 

The above combination selects the memory address 8000H. 
 

Example E2-Pg 41

In [2]:
##page no 41
##example no 2.2
##MEMORY ADDRESS RANGE.
print ('A9-A0 are  address lines for register select. \n');
print ('A15-A10 are address lines for chip select. \n \n');
print ('A15 A14 A13 A12 A11 A10 \n');
print (' 0  0   0   0   0  0 \n \n'); ##chip select bits have to be active low always to select that chip.
print ('A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 \n');
print (' 0  0  0  0  0  0  0  0  0  0  \n'); ##this selects the register 
print ('The above combination selects the memory address 0000H. \n \n');
print ('A15 A14 A13 A12 A11 A10 \n');
print (' 0  0   0   0   0  0 \n \n'); ##chip select bits have to be active low always to select that chip.
print ('A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 \n');
print (' 1  1  1  1  1  1  1  1  1  1  \n'); ##this selects the register 
print ('The above combination selects the memory address 03FFH. \n \n');
##thus this chip can select any memory location from 0000H to 03FFH.
##the memory addressed of the chip can be changed by modifying the hardware.Like we did in the previous example.
A9-A0 are  address lines for register select. 

A15-A10 are address lines for chip select. 
 

A15 A14 A13 A12 A11 A10 

 0  0   0   0   0  0 
 

A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 

 0  0  0  0  0  0  0  0  0  0  

The above combination selects the memory address 0000H. 
 

A15 A14 A13 A12 A11 A10 

 0  0   0   0   0  0 
 

A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 

 1  1  1  1  1  1  1  1  1  1  

The above combination selects the memory address 03FFH. 
 

Example E3-Pg 43

In [3]:
##page no 43
##example no 2.3
##CALCULATING ADDRESS LINES
##number of address lines are given by x
import math
x=(math.log(8192))/(math.log(2));
print ('Number of address lines= ')
print (x);
Number of address lines= 
13.0

Example E4-Pg 43

In [4]:
##page no 43
##example no 2.4
##CALCULATING NO OF CHIPS.
##chip 1024*1 has 1024(1k) registers & each register can store one bit with one data line. We need 8 data lines for byte size memory. Therefore 8 chips are necessary for 1k byte memory.For 1k byte memory we will need 64 chips. We can arrive at the same ans by dividing 8k byte by 1k*1 as follows:
import math
no=(8192*8)/(1024*1);
print ('No of chips= ');
print (no);
No of chips= 
64

Example E5-Pg 44

In [5]:
##page no 44
##example no 2.5
##FETCHING AN INSTRUCTION.
print ('Memory Location 2005H= 4FH \n');
print ('Address bus= 2005H \n') ##program counter places the 16-bit address on the address bus.
print ('Control bus--> (MEMR) \n'); ##control bus sends memory read control signal.
print ('Data bus= 4FH \n'); ##instruction 4FH is fetched and transferred to instruction decoder.
Memory Location 2005H= 4FH 

Address bus= 2005H 

Control bus--> (MEMR) 

Data bus= 4FH