The Status Register
Bit7 | Bit6 | Bit5 | Bit4 | Bit3 | Bit2 | Bit1 | Bit0 |
IRP | RP1 | RP0 | TO | PD | Z | DC | C |
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 = 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) bit 6-5: RP1:RP0: Register Bank Select bits (used for direct addressing) bit 4: TO: Time-out bit bit 3: PD: Power-down bit bit 2: Z: Zero bit bit 1: DC: Digit carry/borrow bit 0: C: Carry/borrow 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.
Difference between Horizontal and Vertical micro-programmed Control Unit:
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: 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
|
No comments:
Post a Comment