Patent Publication Number: US-5155823-A

Title: Address generating unit

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to an address generating unit within a DMA controller. 
     The conventional address generating unit, using a base address and a word length as parameters, generates addresses through addition or subtraction between an output from a word counter and the base address. 
     The address generating unit having such a construction has a problem that the generated addresses are always successive and skipped addresses can not be generated. 
     This is not problematic in the case where data to be transferred are always mapped on a memory so that they are successively accessed in the ascending or descending order thereof. However, in inter-processor communications through complicated networks, etc., data sources (transmitter) and data destinations (receivers) are not necessarily fixed. In many cases, certain collected data are not stored in successive memory regions but the respective data are stored at certain regularly skipped addresses. In this case, if the data are accessed through the conventional manner, disadvantages such as a necessity of rewriting the value of a register storing a base address whenever one word is accessed will be encountered, thereby extremely greatly reducing the efficiency of the address generating unit. 
     SUMMARY OF THE INVENTION 
     An object of the present invention is to provide an address generating unit which can successively generate skipped addresses. 
     In order to attain the above object, in accordance with one aspect of the present invention, there is provided an address generating unit comprising a first counter connected with a data bus which counts a set lower limit to an upper limit value in response to each input of a clock and outputs the counted value as a first selection signal, and a group of registers connected with the data bus and comprised of a plurality of registers corresponding to input values of the first selection signal wherein the value set in each of the registers corresponding to the selection signal is repeatedly outputted as an address. 
     In accordance with another aspect of the present invention, there is provided an address generating unit comprising a first counter connected with a data bus which counts from a set lower limit to an upper limit value in response to input of a first control signal and outputs its carry as a second control signal, a first register connected with the data bus, an output of which is connected with a first input terminal of a first adder having two input terminals, a second register which sends an output from the first adder, to a first input terminal of a second adder and a second input terminal of the first adder in response to input of the first control signal and is reset to 0 in response to input of the second control signal, and a second counter connected with the data bus which counts from a set lower limit to an upper limit value in response to input of the second control signal, and outputs the counted value to a second input terminal of the second adder. 
     In accordance with the arrangement of this aspect of the present invention, if the counted value in the first counter as a first selection signal is outputted as a pointer for the group of registers, one of the group of registers is selected and the value in the selected register is outputted as an address from the group of registers. Then, the first counter repeatedly counts from the set lower limit to upper limit values while a clock signal is inputted, and the contents of the register corresponding to the first selection signal are outputted as addresses from the group of registers. Therefore, if a plurality of skipped addresses are stored in the group of registers, these skipped addresses can be successively generated. 
     Further, in accordance with another aspect of the present invention, the values outputted from the second register constitute an arithmetic series having a difference of the contents of the first register in response to input of the first control signal and is reset in response to input of the second control signal. The second counter serves to count the lower limit to the upper limit value in response to input of the control signal and to input the counted value to the second adder. 
     In this way, it is possible to successively generate skipped addresses at the output of the second adder. Accordingly, the address generating unit in accordance with the present invention permits regularly skipped addresses to be successively generated. This practical effect is very great. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of an address generating unit in accordance with a first embodiment of the present invention; 
     FIG. 2 is a view showing the data structure in a memory accessed by the address generating unit in accordance with the first embodiment and an accessing order thereof; 
     FIG. 3 is a view showing the internal arrangement of a second group of registers in FIG. 1 and of a group of registers in FIG. 10; 
     FIG. 4 is a timing chart of data storage into the second group of registers in the first embodiment of the present invention; 
     FIG. 5 is a timing chart of data read from the second group of registers in the first embodiment of the present invention; 
     FIG. 6 is a timing chart for explaining the operation of the address generating unit in accordance with the first embodiment of the present invention; 
     FIG. 7 is a block diagram of an address generating unit in accordance with a second embodiment of the present invention; 
     FIG. 8 is a view showing the data structure in a memory accessed by the address generating unit in accordance with the second embodiment and an accessing order thereof; 
     FIG. 9 is a timing chart for explaining the operation of the address generating unit in accordance with the second embodiment of the present invention; 
     FIG. 10 is a block diagram of an address generating unit in accordance with a third embodiment of the present invention; 
     FIG. 11 is a view showing the data structure in a memory accessed by the address generating unit in accordance with the third embodiment of the present invention and an accessing order thereof; and 
     FIG. 12 is a timing chart for explaining the operation of the address generating unit in accordance with the third embodiment of the present invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 1 is a block diagram showing the schematic arrangement of an address generating unit in accordance with a first embodiment of the present invention. The operation thereof will be explained with reference to FIGS. 2 to 6. 
     FIG. 2 shows data arrangement of a memory accessed on the basis of addresses of data blocks, generated by the address generating unit of FIG. 1. There are three kinds of array variables each consisting of two words. The base address of each array variable is represented by a relative address of ra0, ra1 and ra2 from a Base (address). It is assumed that the addresses of data blocks to be accessed are generated in the order of 1→2→3→4→5→6. 
     In the address generating unit of FIG. 1, with all counters 12, 14 and 18 reset by inputting a reset signal thereto, a Base is stored in a first register 11 in response to input of a first load signal 101, {the value of the number of array variables to be used-(minus) 1} (i.e. 2 in this embodiment) is stored as an upper limit value in a first counter 14 in response to input a third load signal 102, and {the value of the number of words in one array variable-1} is stored in a second counter 12 in response to input of a fourth load signal 103. FIGS. 3, 4 and 5 show the internal structure of a second group of registers in FIG. 1, a timing chart of data storage (input), and a timing chart of data read (output), respectively. Explanation will be given for a method of storing the base address ra0, ra1 and ra2 of the respective array variables in the second group of registers 13. In FIGS. 1 and 3, when the second load signal 104 is inputted, a second selection signal (input pointer) 19 which is an outputted from the third counter 18 becomes 0 signal and then the data ra0 existing on a data bus is stored in a first register 601. Subsequently, when the second load signal 104 is inputted, the second selection signal (input pointer) 19 becomes 1 and then the data ra1 is stored in a second register 602. Further, the data ra2 is stored in a third register 603 in the same manner. Thus, initialization is made for the second group of registers 13. The timings of storage of ra0, ra1 and ra2 will be clearly understood from FIG. 4. It should be noted that, although the second group of registers include 16 (sixteen) registers, in this embodiment, only three registers 601 to 603 are used. 
     Thereafter, when a clock signal is inputted to a first counter 14, the first counter 14 repeatedly counts 0 to the previously set upper limit value 2. The counted values are successively sent to the second group of registers 13 as a first selection signal 16. In response to the first selection signal 16, the address data are repeatedly sent from the second group of registers 13 to a first adder 15 in the order of ra0→ra1→ra2→ra0→ra1→ra2 . . . The timings of data read from the second group of registers 13 are shown in FIG. 5. As seen from FIG. 5, prior to inputting of a clock, it will be unique that ra0 is read from the first register 601 (through an output bus in FIG. 3) in response to the first selection signal 16 (output pointer). The first counter 14 outputs a carry when it counts the upper limit 2 so that a logical product of the carry and a subsequent clock (first control signal 17) for synchronization with the subsequent clock is sent to a second counter 12 as a clock. Then, as seen from FIG. 6, the output value of the second counter 12 is converted from 0 to 1, and the value of 1 is sent to a first adder 15. 
     Prior to input of a clock, a Base which is an output from the first register 11, ra0, which is an output from the second group of registers 13, and 0 signal, which is an output from the second counter 12 have been supplied to three input terminals of the first adder 15. Thus, (Base+ra0+0) is outputted from the first adder 15. A latch 105 serves to send the address output from the first adder 15 to an address bus in synchronism with a clock. In this state, when a first clock is inputted to the first counter 14, the address Base+ra0+0 is outputted to the address bus until a next clock is inputted. Thereafter, in response to each input of a clock the addresses Base+ra1+0, Base+ra2+0, Base+ra0+1, Base+ra1+1, and Base+ra2+1 are successively outputted (FIG. 6). Thus, the addresses for accessing in the order of 1→2→3→4→5→6 as shown in FIG. 2 are generated. The whole operation of the address generating unit of FIG. 1 is shown in a timing chart of FIG. 6. 
     As explained above, in accordance with this embodiment, by previously setting the addresses of skipped destinations, regularly skipped addresses can be successively generated. It is noted that, although above explanation has been given for the case where each of the skipped three kinds of array variables consists of the words, the same effect can be obtained for the case where each of m (m: integer) kinds of array variables consists of n (n: integer) words. 
     FIG. 7 shows a schematic arrangement of the address generating unit in accordance with a second embodiment of the present invention. An operation of the address generating unit will be explained with reference to FIGS. 8 and 9. 
     FIG. 8 shows the data arrangement in a memory to be accessed on the basis of addresses generated by the address generating unit of FIG. 7. It is assumed here that six data regularly skipped with a fixed address value are accessed in the order of 1→2→3→4→5→6, and the skip value from the base address (Base) is set to a. 
     In the address generating unit of FIG. 7, with all counters 26, 27 reset by inputting a reset signal thereto, a Base is stored in a third register 21 in response to input of a first load signal 201, the skip value a is stored in a first register 22 in response to input of a second load signal 202, the number 3 of addresses used for one turn accessing (1 2 3 or 4 5 6) is stored as an upper limit value in a first counter 26 in response to input of a third load signal 203, and {the number of turns-1} (equal to 1 in this embodiment) is stored in a second counter 27 in response to input of a fourth load signal 204. 
     FIG. 9 is a timing chart showing the operation of the address generating unit of FIG. 7. The operation of the address generating unit of FIG. 7 will be explained below referring to FIG. 9. Prior to input of a first control signal 29 (clock), an output value Base from the third register 21, an output value 0 from a second register 24 and an output value 0 from the second counter 27 have been supplied to input terminals of a second counter 25, and hence Base+0+0 is provided as an output value from the second adder 25. It is noted that a first adder 23 outputs an output value a from the first register 22 as it is. A latch 205 serves to supply the address output from the second adder 25 to an address bus in synchronism with the first control signal (clock) 29. 
     Thus, when the first control signal 29 is supplied to the first counter 26, the address Base+0+0 is generated and sent to the address bus (1). At the same time, the first counter 26 is updated to 1 and the second register 24 is updated to a. Then, an output value a from the second register 24 is sent to the second adder 25 and also sent to the first adder 23. Therefore, Base+a+0 is calculated in the second adder 25 while calculation of a a+a=2a is started in the first adder 23. Likewise, when a next first clock signal 29 is supplied to the first counter 26, the address Base+a+0 is generated (2). At the same time, Base+2a+0 is calculated in the second adder 25 while calculation of a+2a=3a is started in the first adder 23. Further, when a next first clock signal 29 is supplied to the first counter 26, the generated address Base+2a+0 is outputted from the latch 205 (3). However, then the first counter 26 counts the previously set upper limit value &#34;3&#34; so that it outputs a second control signal 28. This second control signal 28 updates the second counter 27 from 0 to 1 and resets the second register 24 to 0. Thus, Base+0+1 is calculated in the second adder 25 while calculation of a+0 is started in the first adder 23. Further, when a next first control signal 29 is supplied to the first counter 26, the generated address Base+0+1 is outputted (4). At the same time, Base+a+1 is calculated in the second adder 25 while calculation of a+a is started in the first adder 23. Thereafter, whenever the first control signal 29 is inputted, the generated addresses Base+a+1 (5) and Base+2a+1 (6) are successively outputted from the latch 205. In this way, the accessing order 1→2→3→4→5→6 shown in FIG. 9 can be realized. 
     In accordance with this embodiment, by previously setting the skip value a, skipped addresses with a fixed skip value can be successively generated. It is noted that, although in this embodiment, the skip value of address is set to a, the number of addresses used for one turn accessing is set to 3 and the number of turns is set to 2, the same effect can be obtained for the number n (n: integer) of turns which may be less than the skip value a (a: integer). 
     FIG. 10 shows a schematic arrangement of the address generating unit in accordance with a third embodiment of the present invention. An operation of the address generating unit will be explained with reference to FIGS. 11 and 12. 
     FIG. 11 shows the data arrangement in a memory to be accessed on the basis of addresses generated by the address generating unit of FIG. 10. It is assumed here that two kinds of array variables each comprising successive four word data are arranged and the relative addresses at the base addresses of the respective array variables with respect to a base address (Base) are ra0 and ra1, respectively. Also it is assumed that the skip value in each array variable is 2 and the data are accessed in the order of 1→2→3→4→5→6→7→8. The address generating unit of FIG. 10 permits addresses to be generated in the form of combining the address generating units of FIGS. 1 and 7. 
     The address generating unit of FIG. 10 has also a combined structure of the address generating units of FIGS. 1 and 7. 
     In FIG. 10, a counter 1 is a first counter 311 which counts previously set values in response to input of a clock and outputs the counted value as a second pointer 35; a third register 309 which stores the upper limit value of count in the first counter 311 in response to input of a third control signal 308; and a first comparator circuit 312 which compares the second pointer and an output from the third register 309 and outputs a first completion signal 313 when they are equal. One of a group of registers 304 corresponding to the second pointer 336 sends its contents to a second adder 34 as a second address 305. A counter 2 is constituted by a second counter 316 which operates by a clock of an eighth control signal which is a signal resulting when the first completion signal 301 is in synchronism with a clock and outputs the counted value as a third pointer 317; a fourth register 315 which stores the upper limit value of count in the second counter 316 in response to input of a fourth control signal 314; and a second comparator circuit 318 which compares the third pointer 317 and an output from the fourth register 315 and outputs a second completion signal 319 when they are equal. A counter 3 is constituted by a third counter 324 which operates by a new clock of the result of a logical product of the second completion signal 319, the first completion signal 313 and the clock, and outputs the counted value as a fourth address; a fifth register 323 which stores the upper limit value of count in the third counter 324 in response to input of a fifth control signal 321; and a third comparator circuit 325 which compares the fourth address 326 and an output from the fifth register 323 and outputs a third completion signal 327 when they are equal. In this way, the address generating unit of FIG. 10 carries out control for generating successive address by a series of loop counters of the counter 1→the counter 2→the counter 3. The control operation will be explained in detail. 
     First, in response to input of a reset signal, all the counters 306, 311, 316, 324, 331, a seventh register 38 and a latch 2 (336) are reset. Then, in response to input of a first control signal 31, Base is stored in a first register 32; in response to a second control signal 35, the skip value 2 is stored in a second register 36; and in response to each input of a seventh control signal, ra0 and ra2 are successively stored in the group of registers 304. Further, in response to input of the third control signal 308, a value 1 which is (the number of array variables to be used-1) is stored in the third register 309; in response to input of the fourth control signal 314, a value 1 which is {(the number (1 3, 5 7, 2 4 or 6 8) of addresses for one turn accessing in each array variable)-1} is stored in the fourth register 315; and in response to input of the fifth control signal 315, a value 1 which is (the number of accessing turns in each array variable-1) is stored in the fifth register 323; and in response to input of a sixth control signal 328, the number 8 of words to be transferred (word length) is stored in a sixth register 329. 
     The first counter 311, the second counter 316 and the third counter 324 (or counter 1, counter 2 and counter 3) serves as a loop counter, and the fourth counter 331 individually counts the number of the transferred words (word length). 
     Explanation will be given for the operation of the address generating unit with reference to a timing chart of FIG. 12 noting the operation of the above four counters. 
     Prior to input of a clock, the second adder 34 performs an addition of Base supplied as its first address 33, ra0 supplied as its second address 305, 0 supplied as its third address 39 and 0 supplied as its fourth address 326. Also the first address 37 performs an addition of 2 which is an output from the second register 36 and 0 which is an output from the seventh register 38. Now, when a first clock is inputted, the generated address Base+ra0+0+0 is output through a first latch 337. Then, the first counter 311 is updated so that the second pointer which represents the updated value is 1 and ra1 is outputted as the second address 305 from the corresponding register in the register group 304. Thus, the second adder 34 performs an addition of Base+ra1+0+0 while the first adder 37 still performs an addition of 2+0. Then the first comparator circuit 312 decides that both of an output value from the first counter 311 and that from the third register 309 both are 1 and equal to each other, thus producing the first completion signal 313 (1). Thereafter, when a next clock is inputted, the eighth control signal 301 is generated and also the first counter 311 is reset so that the second pointer 336 returns to 0. Thus, ra0 appears again at an output from the register group 304. Further, the seventh register 38, in response to input of the eighth control signal 301, is updated to 2 and so the third address 39 becomes 2. The second counter 316 is updated from 0 to 1. Then, the second comparator 318 decides that this output value (1) from the second counter 316 is equal to that from the fourth register 315, thus producing the second completion signal 319. Thus, the second adder 34 starts an addition of Base+ra0+2+0, while the generated address Base+ra1+0+0 calculated in response to the previous clock (2). Further, when a next clock is inputted, the generated address Base+ra0+2+0 is outputted. Then, only the first counter 311 in the loop counter is updated so that the second adder 34 calculates Base+ra1+2+0 and the first adder 37 calculates 2+2. The first comparator circuit 312 outputs the first completion signal 313 again (3). Thereafter, when a next clock is inputted, the third counter 324 is updated from 0 to 1 and at the same time, the second counter 316 and the seven register 38 are reset. And, the third comparator 325 decides that the fourth address 326 which is an output value from the third counter 324 is equal to that from the fifth register 323, thus producing the third completion signal 327. Thus, the generated address Base+ra1+2+0 is outputted. Then, the first adder 37 calculates 2+0 while the second adder 34 calculates Base+ra0+0+1 (4). Likewise, in response to each input of a clock, the generated address is successively outputted in the order of Base+ra0+0+1 (5)→Base+ra1+0+1 (6)→Base+ra0+2+1 (7)→Base+ra1+2+1 (8). 
     Independently from the operation of the loop counter mentioned above, in response to each input of a clock, the fourth counter 331 is updated in the order of 0→1→2→3→4→5→6→7→8. When an eighth clock is inputted, the fourth comparator 332 decides that an output value 8 from the sixth register 329 is equal to that from the fourth counter 331, thus producing a fourth completion signal. Since the third completion signal 327 has already been outputted, in response to the trailing edge of the last clock, a fifth completion signal 335 is latched by a second latch 336 and sent to the exterior. 
     In this way, the accessing order of 1→2→3→4→5→6→7→8 as shown in FIG. 11 can be realized. 
     It is noted that, although in the first embodiment, the first counter and the second counter are constructed by an adder, they may be a subtractor. Also, although in the second embodiment, the second counter is constructed by an adder, it may be a subtractor.