Method and apparatus for modifying the contents of a register

Abstract: A method and apparatus as provided that simplifies the software required for modifying the contents of a register. By adding one gate to the register, a single command can be written to the register to modify the states of multiple bits. The system reduces software overhead significantly when multiple registers must be modified.

Description: The present invention relates generally to data logic devices and more particularly to data logic devices that include control registers. In many applications, data logic devices are utilized to transfer information from one point to the next, for example, these logic devices are utilized to connect devices on a network such as two processors. In other instances they may be utilized within a system to facilitate movement of data from one point within the system to another. Such devices utilize registers therewith to facilitate the movement and modification of data within such devices. Typically these registers interact with software for the necessary modification of the data. The following sequence of software steps are necessary in the prior art to provide a new command in the register: READ REGISTER SAVE A COPY OF THE REGISTER CONTENTS MASK OF THE PART OF THE CONTENTS TO BE RETAINED MODIFY THE REGISTER CONTENTS COMBINE THE MODIFIED PART WITH THE RETAINED PART WRITE REGISTER These steps take a significant amount of time and must be done a plurality of times when registers are connected in cascade. US4,175,284 describes a multi-mode process control computer with bit processing. A bit position in a communication register is addressable for bit processing but only a single bit position is addressable at any one time. Hence, there is a long felt but unsatisfied need for a system which is less complex than prior art systems and at the same time, is able to provide a significant increase in the speed of execution of the register. In addition the system should be one that will reduce the software complexity of the system. Finally, the system should be one that adds minimal cost to the hardware. The present invention addresses such a need. Accordingly, we shall disclose an apparatus and a method that reduces the size and complexity of software that must interface with or control hardware. This is accomplished through a novel approach to the command and/or control registers of the hardware. We shall describe an apparatus for modifying the contents of a register. The register includes a plurality of register bits and each register bit having an input terminal and output terminal. Each register bit has a logic high state and a logic low state. The apparatus comprises a plurality of multiplexer means, each multiplexer means having a first input terminal coupled to receive a command bit (Command_Bit), the command bit having a logic state equal to a new logic state of those register bits that are to be modified, a second input terminal coupled to the output terminal of one of the plurality of register bits for receiving the logic state of a register bit a control terminal, and an output terminal coupled to the input terminal of the register bit for modifying the logic state of the register bit and a plurality of logic means, each logic means having a first input terminal for receiving a plurality of mask bits (Mask_Bits), each mask bit corresponding to a register bit and identifying whether one of the corresponding plurality of register bits is to be modified to the new logic state, and an output terminal coupled to the control terminal of the multiplexer means for controlling the multiplexer means so that if the register bit is identified by the mask bit as one that is to be modified to the new logic state, the output of the multiplexer will modify the register bit to the new logic state as determined by the logic state of the command bit. Characterised in that the apparatus further comprises a command word register to provide a command bit for each of said plurality of multiplexer means and to provide a corresponding action mask for said plurality of logic means, comprising a plurality of said mask bits whereby a plurality of said identified register bits is modifiable simultaneously. We shall also describe a method for modifying the contents of a register, the register having a plurality of register bits, each register bit having a high state and a logic low state, the method comprising the steps of (a) storing using software, a plurality of command bits (Command_Bit) in a command word register each having a logic state equal to a new logic state of bits of the register that are to be modified; (b) creating, using software, a corresponding action mask comprising a plurality of mask bits (Mask_Bit), each mask bit corresponding to a register bit and identifying whether one of the corresponding plurality of register bits is to be modified to the new logic state; (c) writing the action mask to the register; and (d) writing the command bits to the register so that a plurality of said identified register bits is modified simultaneously. In the accompanying drawings, by way of example only: Figure 1 is a block diagram of an embodiment of a prior art command register. Figure 2 is a flow chart of a software routine for use with the register of Figure 1. Figure 3 is a flow chart of a software routine for use with a command register in accordance with the present invention. Figure 4 is a block diagram of an embodiment of a command register in accordance with the present invention. Figure 5 is a block representation of a command register in accordance with the present invention. Referring to the drawings, an embodiment of a hardware control register 10 in accordance with the prior art is shown in Figure 1. The prior art register includes a register bit as implemented by a D-type flip-flop 12 coupled to a multiplexer 14. The implementation of the register bit using a D-type flip-flop is for illustration purpose only. The register bit may be implemented by any means capable of storing a logic state. The multiplexer 14 receives a data in signal and a feedback signal from the flip-flop 12. A register select signal steers one of the multiplexer 14 inputs to the flip-flop 12. A masking step is provided for by software prior to providing the data in signal. The masking step indicates which part of the register must be changed and is part of the data in signal. This data in signal must be provided to each register in a cascade and can require a significant amount of software overhead. Previously, when software needed to change the state of hardware, the software had to have access to the current state of the hardware. This is particularly true when the hardware may have more than one independent block controlled through multiple fields in a single register. In this case, the software must know the state of each independent block and change the state of only a subset of those blocks while leaving the remainder unmodified. An example of the prior art routine is shown in Figure 2 in flow chart form. Referring now to Figure 2, the current state of the hardware is first read via step 102. The current state may be in a memory location or in a register in the hardware. Then, a copy of the current state is saved via step 103. Next, the part of the register contents to be retained is masked off via step 104. Thereafter, the register contents are changed to the desired new state, via step 106. Then, the modified part of the register contents is combined with the retained part of the register contents via step 108. Finally, the new state is written to the command and/or control register 10 of the hardware via step 110. As can be seen from this example, four of the six steps above are required so that the portions of the command and/or control register that need to be preserved are not modified when the new state information is written to the hardware. To ensure that the register contents are current, the entire sequence of instructions above must be executed without the possibility of interruption. This may require that interrupts of a processor or the like be disabled for the period when these instructions execute. This requirement leads to added complexity and a large number of instructions. Additionally, these steps take a significant amount of time and must be done a plurality of times when registers are connected in cascade. The present invention changes the way that hardware is controlled so that all of the command and/or control information does not need to be written to the hardware at the same time. The present invention allows only that information that needs to be modified to be written to the hardware. Through the use of the present invention, the hardware maintains the current register contents internal to the register and this information is not required by the software to modify the state of the hardware. A critical feature of the present invention is the use of a command bit through which the software informs the hardware of the type of modification to make to the register contents. In the present invention, a Mask_Bit selects those register bits that are to be changed and a Command_Bit defines what the final state of the register bit will be. The Mask_Bit and the Command_Bit may both be part of the Action_Mask that is written to the command and/or control register or they may be separate. If they are separate, the Command_Bit may be generated through the address decode of the register to be written or through an instruction decode of a separate set of inputs. To more clearly explain the operation of the present invention, refer now to Figures 3 and 4 which is a software flow chart and a control register in accordance with the present invention. The following pseudo-code segment flow chart of Figure 3 illustrates the same function as shown in the prior art flow chart of Figure 2. Referring now to Figure 3, a mask of the bits is created in the registered contents that must be changed with the command bit for the desired action, via step 202. Thereafter, the information required to the command and/or control register is written that will change the current register contents to the desired new state, via step 204. As this Figure shows, only two instructions are required to perform the same operation that required six instructions previously. This reduces the complexity of this portion of a software program and increases the speed of its operation. Because there is only a single access to the hardware, writing the Action_Mask, there is no need to disable interrupts. This reduces the complexity even further. The present invention requires only a very slight change to the implementation of the command and/or control register of the hardware, consisting of as little as one gate per bit. The setting of a command bit indicates which bits within the register are to be changed by the mask. By modifying the register (adding one gate), software use can be significantly reduced. Referring now to Figure 4, what is shown is a command register 10' in accordance with the present invention. The register 10' includes a register bit as implemented by a D-type flip-flop 12' coupled to a multiplexer 14'. The implementation of the register bit using a D-type flip-flop in this embodiment is for illustration purpose only. The register bit may be implemented by any means capable of storing a logic state without departing from the scope and spirit of the present invention. As is seen, the major difference is the AND gate 20 which is coupled to the multiplexer 14' and receives a MASK_BIT input and a REGISTER_SELECT input. The command register 10' of the present invention as shown in Figure 4 logically "ANDs" the masking signal to the select signal via AND gate 20 and utilizes a command bit at the input of the multiplexer 14' to perform this same function in much less time. Although there is one additional gate associated with the invention, software use is significantly reduced. Since software overhead is a significant factor in the overall performance of a logic device this hardware change is insignificant compared to the reduction of software use. In one embodiment, a Host Command register in accordance with the present invention is shown in a block representation as a 16-bit writable and readable register in Figure 5. The values written to this register are bit significant commands that cause the hardware to perform various actions. The most significant bit of this register indicates to the hardware whether the desired command is to set or reset a command bit. When the most significant command bit is one, the commands represented by the other bits that are set in the command word will be set. When the most significant bit is zero, the commands represented by the other bits that are set in the command word will be reset. Multiple commands may be set or reset in a single command word. Command bits (bits other than the most significant bit) that are zero in the command word are not affected. It has been shown that through a small change in the hardware of a command register, a significant performance advantage can be obtained in a data logic device by reducing the software overhead associated with the device. Accordingly, by defining a mask bit and command bit in a register and allowing them to determine if bits must be changed the software use is significantly reduced, particularly when these registers are utilized in a cascade arrangement.

Claims: An apparatus for modifying the contents of a register (10'), the register having a plurality of register bits (12'), each register bit having an input terminal (D), and an output terminal (Q), each register bit having a logic high state and a logic low state, the apparatus comprising: a plurality of multiplexer means (14'), each multiplexer means having a first input terminal (0) coupled to receive a command bit (Command_Bit), the command bit having a logic state equal to a new logic state of those register bits that are to be modified, a second input terminal (1) coupled to the output terminal of one of the plurality of register bits for receiving the logic state of a register bit, a control terminal, and an output terminal coupled to the input terminal (D) of the register bit for modifying the logic state of the register bit; and a plurality of logic means (20), each logic means having a first input terminal for receiving a plurality of mask bits (Mask_Bits), each mask bit corresponding to a register bit and identifying whether one of the corresponding plurality of register bits is to be modified to the new logic state, and an output terminal coupled to the control terminal of the multiplexer means for controlling the multiplexer means so that if the register bit is identified by the mask bit as one that is to be modified to the new logic state, the output of the multiplexer will modify the register bit to the new logic state as determined by the logic state of the command bit; characterised in that : the apparatus further comprises a command word register to provide a command bit for each of said plurality of multiplexer means and to provide a corresponding action mask for said plurality of logic means, comprising a plurality of said mask bits whereby a plurality of said identified register bits is modifiable simultaneously. The apparatus as claimed in Claim 1, wherein each of the plurality of logic means further comprises a second input terminal for receiving a register select signal (Register_Select). The apparatus as claimed in Claim 1 or 2, wherein the register bit further comprises a D-type flip-flop. A method for modifying the contents of a register (10'), the register having a plurality of register bits, each register bit having a logic high state and a logic low state, the method comprising the steps of: (a) storing, using software, a plurality of command bits (Command_Bit) each having a logic state equal to a new logic state of bits of the register that are to be modified; (b) creating, using software, a corresponding action mask comprising a plurality of mask bits (Mask_Bit), each mask bit corresponding to a register bit and identifying whether one of the corresponding plurality of register bits is to be modified to the new logic state; (c) writing the action mask to the register; and (d) writing the command bits to the register so that a plurality of said identified register bits is modified simultaneously.

Inventors: O'HARA ROBERT B JR, ROBERTS DAVID G, O'HARA, ROBERT B., JR., ROBERTS, DAVID G.
Applicants: ADVANCED MICRO DEVICES INC, ADVANCED MICRO DEVICES INC.
Application year: 1994
Main classification: G06F9
IPC codes: G06F9, G06F7