Thursday, September 29, 2022

Computer Organization and Architecture (Solved Answers from QBank - XII) - Tirthankar Pal - MBA from IIT Kharagpur, GATE, GMAT, IIT Written Test, Interview were a part of MBA Entrance, B.S. in Computer Science from NIELIT

 The Status Register

Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0
IRPRP1RP0TOPDZDCC

 

The STATUS register is of most importance to programming the PIC, it contains the arithmetic status of the ALU (Arithmetic Logic Unit), the RESET status and the bank select bit for data memory. As with any register, the STATUS register can be the destination for any instruction. If the STATUS register is the destination for an instruction that affects the Z, DC or C bits, then the write to these three bits is disabled. These bits are set or cleared according to device logic. Furthermore, the TO and PD bits are not writable. Therefore, the result of an instruction with the STATUS register as destination may be different than intended. For example, CLRF STATUS will clear the upper-three bits and set the Z bit. This leaves the STATUS register as 000u u1uu (where u = unchanged).

 

 

The first three bits (STATUS<0> to STATUS<2>) are the carry (C), digit carry (DC) and zero (Z) flags of the ALU respectively. The values of these bits change depending on the results of arithmetic or logical operations performed during program execution. Bits 3 and 4 are the power down PD and watchdog timer timeout TO bits respectively and bits 5and6(RP0 and RP1) are the bank selection bits.

 

R/W-0R/W-0R/W-0R-1R-1R/W-xR/W-xR/W-x
IRPRP1RP0TOPDZDCC
Bit7Bit6Bit5Bit4Bit3Bit2Bit1Bit0

R = Readable bit

W= Writable bit

U = Unimplemented bit, read as ‘0’

-n= Value at POR reset

 

bit 7:

IRP: Register Bank Select bit (used for indirect addressing)
0 = Bank 0, 1 (00h - FFh)
1 = Bank 2, 3 (100h - 1FFh)
The IRP bit is not used by the PIC16F8X. IRP should be maintained clear.
 

bit 6-5:

RP1:RP0: Register Bank Select bits (used for direct addressing)
00 = Bank 0 (00h - 7Fh)
01 = Bank 1 (80h - FFh)
10 = Bank 2 (100h - 17Fh)
11 = Bank 3 (180h - 1FFh)
Each bank is 128 bytes. Only bit RP0 is used by the PIC16F8X. RP1 should be maintained clear.
 

bit 4:

TO: Time-out bit
1 = After power-up, CLRWDT instruction, or SLEEP instruction
0 = A WDT time-out occurred
 

bit 3:

PD: Power-down bit
1 = After power-up or by the CLRWDT instruction
0 = By execution of the SLEEP instruction
 

bit 2:

Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit (for ADDWF and ADDLW instructions) (For borrow the polarity is reversed)
 

bit 1:

DC: Digit carry/borrow
1 = A carry-out from the 4th low order bit of the result occurred
0 = No carry-out from the 4th low order bit of the result
bit (for ADDWF and ADDLW instructions)
 

bit 0:

C: Carry/borrow
1 = A carry-out from the most significant bit of the result occurred
0 = No carry-out from the most significant bit of the result occurred
Note: For borrow the second operand the polarity is reversed. A subtraction is executed by adding the two’s complement of. For rotate (RRFRLF) instructions, this bit is loaded with either the high or low order bit of the source register.


The control unit (CU) is the engine that runs the entire functions of a computer with the help of control signals in the proper sequence. In the micro-programmed control unit approach, the control signals that are associated with the operations are stored in special memory units. It is convenient to think of sets of control signals that cause specific micro-operations to occur as being “micro-instructions”. The sequences of micro-instructions could be stored in an internal “control” memory. 

The micro-programmed control unit can be classified into two types based on the type of Control Word stored in the Control Memory, viz., Horizontal micro-programmed control unit and Vertical micro-programmed control unit. 

  • In the Horizontal micro-programmed control unit, the control signals are represented in the decoded binary format, i.e., 1 bit/CS. Here ‘n’ control signals require n bit encoding. On the other hand. 
  • In a Vertical micro-programmed control unit, the control signals are represented in the encoded binary format. Here ‘n’ control signals require log2n bit encoding. 

Difference between Horizontal and Vertical micro-programmed Control Unit: 

S. NoHorizontal µ-programmed CUVertical µ-programmed CU
1.It supports longer control word.It supports shorter control word.
2.It allows a higher degree of parallelism. If degree is n, then n Control Signals are enabled at a time.It allows a low degree of parallelism i.e., the degree of parallelism is either 0 or 1.
3.No additional hardware is required.Additional hardware in the form of decoders is required to generate control signals.
4.It is faster than a Vertical micro-programmed control unit.it is slower than a Horizontal micro-programmed control unit.
5.It is less flexible than a Vertical micro-programmed control unit.It is more flexible than a Horizontal micro-programmed control unit.
6.A horizontal micro-programmed control unit uses horizontal micro-instruction, where every bit in the control field attaches to a control line.A vertical micro-programmed control unit uses vertical micro-instruction, where a code is used for each action to be performed and the decoder translates this code into individual control signals.
7.The horizontal micro-programmed control unit makes less use of ROM encoding than the vertical micro-programmed control unit.The vertical micro-programmed control unit makes more use of ROM encoding to reduce the length of the control word.

Example: Consider a hypothetical Control Unit that supports 4 k words. The Hardware contains 64 control signals and 16 Flags. What is the size of control word used in bits and control memory in a byte using: 
a) Horizontal Programming 
b) Vertical programming

Solution:

a)For Horizontal 

64 bits for 64 signals % 16 bits for flags
Control Word Size = 64 + 16 = 80 bits

Control Memory = 4 kW = ( (4* 80) / 8 ) = 40 kByte


b)For Vertical
6 bits for 64 signals i.e log264
4 bits for 16 flags i.e log216
12 bits for 4K words i.e log2(4*1024)

Control Word Size = 4 + 6 + 12 = 22 bits

Control Memory = 4 kW = ( (4* 22) / 8 ) = 11 kByte

Tirthankar Pal

MBA from IIT Kharagpur with GATE, GMAT, IIT Kharagpur Written Test, and Interview

2 year PGDM (E-Business) from Welingkar, Mumbai

4 years of Bachelor of Science (Hons) in Computer Science from the National Institute of Electronics and Information Technology

Google and Hubspot Certification

Brain Bench Certification in C++, VC++, Data Structure and Project Management

10 years of Experience in Software Development out of that 6 years 8 months in Wipro

Selected in Six World Class UK Universities:-

King's College London, Durham University, University of Exeter, University of Sheffield, University of Newcastle, University of Leeds


No comments:

Post a Comment