1. Field of the Invention
The present invention relates to a data transfer device for transferring data to a discontinuous storage area.
2. Description of the Related Art
While transferring data from a certain area to another area of memory, access control by a CPU or direct memory access (DMA) transfer is performed. In the access control by a CPU, the CPU reads data in the memory and transfers data specifying the address of a transfer destination. In this case, the load of a CPU is heavy. Therefore, when transferring data to the continuous area of memory, a DMA transfer is performed that is capable of transferring data at a high speed without occupying a CPU.
Generally, in the DMA transfer, data is read from the memory of its transfer source in units of prescribed transfer sizes and data is efficiently transferred by continuing the operation of writing the data into the transfer destination.
However, the hardware configurations of transfer destinations are not uniform. For example, some devices have individual control registers and some transfer destination addresses are discontinuous, and discontinuity depends on the hardware of a transfer destination. When a device operates while periodically updating a part of the register after its initial setting, its update position becomes a discontinuous storage area.
Conventionally, even when transferring data to a discontinuous storage area, it is necessary to transfer current data to an area where updating is not necessary. Therefore, since it is necessary to secure the area of a transfer source for data for which updating is not necessary and also since it is necessary to transfer the data for which updating is not necessary, an extra access cycle is necessary.
Laid-open Japanese Patent Application No. 07-262127 discloses a technique relating transferring data from a continuous area to a discontinuous area. This invention stores data in a transfer source and the address information of a transfer destination in pairs and then transfers the data.
However, in the technique of the above Laid-open Japanese Patent Application No. 07-262127, since it is necessary to store not only data to be transferred but also the address of a transfer destination, a large capacity of memory is necessary. Since it is also necessary to transfer the address data, it is necessary to transfer much data.
This is a data transfer device for reducing the amount of transfer data and efficiently transferring data when transferring data to a discontinuous storage area. When transferring data to a transfer destination circuit having a discontinuous storage area, the data transfer device stores only transfer data for which updating is necessary in a storage unit in a transfer source, transfers the transfer data by a transfer control unit, temporarily stores the transfer data in a register provided for the transfer destination circuit, and transfers the transfer data stored in the register to the discontinuous storage area of the transfer destination circuit on the basis of map information stored in a map register.
By such a configuration, a data transfer device capable of transferring only data for which updating is necessary to a transfer destination circuit can be provided, thus reducing the number of transfers and thereby realizing an efficient transfer process.
The map information stored in the map register is the address information of the discontinuous storage area of the transfer destination circuit and transfer data can be correctly transferred to a position specified by this address information.
Furthermore, the map information stored in the map register is flag information instructing the transfer of data to the discontinuous storage area of the transfer destination circuit, and the transfer data can then be transferred to the transfer destination circuit on the basis of this flag information.
The preferred embodiments of the present invention are described below with reference to the drawings.
Then, the hardware circuit 5 of a transfer destination requests the DMA controller 3 to transfer subsequent transfer data (d in
The comparator 11 comprises comparators 11-I1˜11-I4 corresponding to the I1˜I4 of the registers 8 and determines to which register data transferred to the register 8 is addressed. For example, an address bus is connected to the comparator 11-I1 and a write-enable signal is input into the comparator 11-I1. Then, map information is input from the I1 of the map register 9. Thus, the comparator 11-I1 recognizes that data is transferred to the I1 of the register 8 and determines to which register of a transfer destination the data is transferred on the basis of the map information.
The address bus is also connected to the comparator 11-I2 and the write-enable signal is input into the comparator 11-I2. The comparator 11-I2 recognizes that data is transferred to the 12 of the register 8 and determines to which register of a transfer destination the data is transferred on the basis of the map information from the 12 of the map register 9. Similarly, an address bus is also connected to each of the comparators 11-I3 and 11-I4 and a write-enable signal is input into each of the comparators 11-I3 and 11-I4. Then, each of the comparators 11-I3 and 11-I4 recognize that data is transferred to the I3 or I4 of the register 8 and determines to which register of a transfer destination the data is transferred on the basis of the map information from the I3 or I4 of the map register 9.
The selector circuit 12 is provided for each of the registers A (A11, A12, A2 and A3) and the registers B (B1, B21, B22 and B3) and selects data transferred from the register 8. Specifically, the selector circuit 12 comprises eight selector circuits, 12-a11, 12-a12, 12-a2, 12-a3, 12-b1, 12-b21, 12-b22 and 12-b3, and transfers data transferred from the register 8 to the corresponding register A (A11, A12, A2 and A3) and register B (B1, B21, B22 and B3) according to determination signals output from the comparators 11-I1˜I4. In this case, the determination signals output from the comparators 11-I1˜I4 are output as “I1(˜I4)_is_A11(A12˜B3)” for each register of a transfer destination to be selected.
The write-enable signals output via the comparators 11-11˜14 are supplied to the corresponding registers A (A11, A12, A2 and A3) and registers B (B1, B21, B22 and B3) via an OR gate 14 in order to instruct the writing of data into the registers.
In the case of the conventional data transfer process shown in
However, in the embodiment, as shown in
Although
The detailed transfer process is described below with reference to
As described earlier, the DMA controller 3 starts DMA transfer from the memory 4 according to an instruction from the CPU 2. Then, as described above, data A1, A3 and B3 for which updating is necessary is transferred to the register 8. In this case, the higher-order 8 bits of data A1 is transferred to the 11 of the register 8 and the lower-order 8 bits of the same data A1 is transferred to the 12 of the register 8. Data A3 and B3 is transferred to the 13 and 14, respectively, of the register 8.
Then, as described above, an address bus is connected to the comparator 11-I1 and map information is output from a corresponding map register 9-11. The comparator 11-I1 recognizes that data is transferred to the 11 of the register 8 and determines to which register of a transfer destination data is transferred. In this case, the comparator 11-I1 determines that the data transferred to the 11 of the register 8 should be transferred to the register A (A11) and outputs a determination signal of “11_is_A11”.
However, an address bus is connected to the comparator 11-I2 and map information is output from a corresponding map register 9-12. The comparator 11-I2 recognizes that data is transferred to the 12 of the register 8 and determines that the data transferred to the 12 of the register 8 should be transferred to register A (A12) and outputs a determination signal of “12_is_A12”.
Furthermore, similarly, the comparators 11-I3 and 11-I4 receive map information from corresponding map registers 9-13 and 9-14, determine that the data transferred to the 13 and 14 of the register 8 should be transferred to register A (A3) and register B (B3), and output determination signals of “13_is_A3” and “14_is_B3”, respectively.
The selector circuit 12-a11 that is supplied with the above signal selects the data of the higher-order 8 bits of A1 transferred from the 11 of the register 8 and outputs the data to the register A (A11) of a transfer destination. The selector circuit 12-a12 that is supplied with the above signal selects the data of the lower-order 8 bits of A1 transferred from the 11 of the register 8 and outputs the data to the register A (A12) of a transfer destination.
The selector circuit 12-a3 selects the data of the 8 bits of A3 transferred from the 13 of the register 8 and outputs the data to the register A (A3) of a transfer destination. Furthermore, the selector circuit 12-b3 selects the data of the 8 bits of B3 transferred from the 14 of the register 8 and outputs the data to the register B (B3) of a transfer destination.
However, since the selector circuits 12-a2, 12-b1, 12-b21 and 12-b22 are not selected by the comparator 11, they output no transfer data. Therefore, the data of corresponding registers A (A2) and B (B1, B21 and B22) are updated and are used, for example, in the internal hardware of a transfer destination.
Thus, the number of transfers can be reduced and further it is sufficient to store only data for update in which updating is necessary in the memory of a transfer destination, thereby reduce memory capacity.
However, in this case, the hardware circuit 5 of the transfer destination is neither register A nor B and is a hardware circuit having a memory configuration, and the addresses to which the update data A1, A3 and B3 are transferred are also scattered in the memory. Even in such a case, according to the embodiment, by enabling the map register 9 to obtain in advance the address information of a transfer destination as map information, the data of A1, A3 and B3 transferred to the register 8 can be transferred to corresponding memory positions by the circuit process of the access control unit 10.
Next, the preferred embodiment 2 is described below.
Although in the above preferred embodiment 1 data is transferred to the register or memory of a transfer destination according to address information, in this preferred embodiment data can be DMA-transferred to a discontinuous transfer area by applying a flag setting to the map register 9.
In this preferred embodiment as well, the hardware circuit 5 comprises the assist circuit 6 and the data transfer device also comprises the register 8, a map register 13, and the access control unit 10. However, in this preferred embodiment, the configuration of the map register 13 differs from that of the above preferred embodiment 1 and comprises two map registers 13a and 13b. Each of these map registers 13a and 13b has the configuration shown in
In this preferred embodiment, a flag for specifying the update/non-update status of data transferred to the register A (A11, A12, A2 and A3) and a flag for specifying the update/non-update status of data transferred to the register B (B1, B21, B22 and B3), for example, is in the map registers 13a and 13b, respectively. In this case, in the above example, as shown in
Thus, data to be transferred is determined by flag information set in the map registers 13a and 13b, and the number of data transfers to the register 8 can be determined by the number of flags to be updated that are set in the register 8.
For example, in the above example of a flag setting, data to be updated is data in which flag “1” is set in the map registers 13a and 13b and, for the number of data transfers to the register 8, if the number of settings of flag “1” is 1˜4, the number of data transfers is n and if the number of settings of flag “1” is 5˜8, it is 2n.
Therefore, if the data to be updated is 4 bytes or less, the number of data transfers, which is conventionally 2n, can be halved to n. In the above example, since the number of settings of flag “1” is 4 and the number of settings of flag “1” is 1˜4, the number of data transfers, which is conventionally 2n, can be halved to n.
Transfer positions to the register 8 can be obtained by sequentially mapping data in which flag “1” is set in the map register 13. For example, in the above example, data A11 in which flag “1” is set is mapped to the first 11 of the register 8, then data A12 in which flag “1” is set is mapped to the subsequent 12 of the register 8, and further data A3 in which flag “1” is set is mapped to the subsequent 13 of the register 8 and lastly data B3 in which flag “1” is set is mapped to the last 14 of the register 8.
Even when the configuration is other than the above, the flag settings of the map registers 13a and 13b differ from those shown in
Thus, the data of A11, A12, A3 and B3 that are read from the memory 4 are transferred to each mapped position of the register 8. The number of transfers is also specified by the above setting, and if data to be updated is 4 bytes or less, it can be reduced to half of the conventional number of data transfers.
As in the above, the preferred embodiment 1, since it is sufficient to store only data for which updating is necessary in the memory 4 of a transfer source, the memory capacity can be reduced.
Although in preferred embodiments 1 and 2, an example of the transfer of data having a configuration of one word (32 bits) is described, transfer data is not limited to the above configuration.
Although in the above descriptions data A11, A12, A3 and B3 are described as data to be continuously transferred, other data can also be transferred.
Although in this preferred embodiment, DMA transfer using a DMA controller (DMAC) is described as data transfer to a discontinuous storage area, it can also be data transfer under the access control of a CPU.
Furthermore, although in this preferred embodiment the register 8 temporarily stores transfer data, it can also be an address area having no function to store data.
As described above, according to the present invention, by transferring only data for which updating is necessary from a transfer source to a transfer destination circuit, both the amount of data to be transferred and the number of transfers can be reduced, thereby realizing an efficient transfer process and also reducing the storage capacity needed for storing transfer data of a transfer source.
Number | Date | Country | Kind |
---|---|---|---|
2008-048348 | Feb 2008 | JP | national |