This application claims the priority benefit of Taiwan application serial no. 95141290, filed on Nov. 8, 2006. All disclosure of the Taiwan application is incorporated herein by reference.
1. Field of the Invention
The present invention relates to a data processing apparatus for loop structure, and more particularly to a data processing apparatus for loop structure capable of improving the loop structure speed of the processor and enhancing the overall operational performance of the system and the processing method thereof.
2. Description of Related Art
An electronic system usually includes a processor and a memory, wherein a nonvolatile memory can still hold program instructions and/or data of the processor without power source. The nonvolatile memory consumes relatively small power, and unlike magnetic storage media such as hard discs, the nonvolatile memory will not be easily influenced by the vibration, and thus it is widely used in digital audio-visual devices, electronic equipments, portable computers, and digital cameras. Therefore, the nonvolatile memory such as a flash memory is typically used to store firmware or used as a basic input/output system (BIOS) memory.
However, the data reading/writing speed of the flash memory is usually slower than the data processing speed of the processor, and especially the data reading/writing speed of a series flash is far lower than the data processing speed of the processor. Therefore, when the processor performs the loop structure, the operational performance is greatly reduced as the data reading of the flash memory takes a long time, which further affects the overall operational performance of the system.
In view of the above problems, the present invention provides a data processing apparatus for loop structure for enhancing the operational performance of the processor. When the processor is required to perform the loop structure, the loop structure data corresponding to the loop structure is stored in a fast memory device for the processor to perform the loop structure, thereby improving the loop structure speed of the processor and enhancing the overall operational performance of the system.
The present invention further provides a method for processing a loop structure data to avoid delaying the reading of data and affecting the operational performance of the processor. When the processor executes the loop structure, the loop structure data corresponding to the loop structure is stored in the fast memory device for the processor to perform the loop structure, thereby improving the loop structure speed of the processor and enhancing the overall operational performance of the system.
In order to achieve the above and other aspects, a data processing apparatus for loop structure comprising a fast memory device and a loop detector is provided. The loop detector is coupled to the processor for detecting whether or not the processor performs a loop structure. When the processor performs the loop structure, the loop detector outputs a control signal, and the data processing apparatus for loop structure stores the loop structure data corresponding to the loop structure in the fast memory device for the processor to perform the loop structure according to the control signal.
According to a preferred embodiment of the present invention, the data processing apparatus for loop structure further comprises a multiplexer. The multiplexer is coupled to the fast memory device and slow memory device, and one of the fast memory device and the slow memory device is selected according to the control signal so as to provide the loop structure data to the processor. When the processor performs the loop structure, if the fast memory device has the loop structure data, the fast memory device provides the loop structure data to the processor, whereas if the fast memory device does not store the loop structure data, the slow memory device provides the loop structure data to the processor and then duplicates the loop structure data into the fast memory device.
According to a preferred embodiment of the present invention, the processor is an 8051 microprocessor or 8086 microprocessor. The loop data processing apparatus of the present invention determines whether or not the processor requires the loop data according to the program code in the processor, and then stores the corresponding loop data in the fast memory device, for example, a static random access memory (SRAM) or a dynamic random access memory (DRAM). The above slow memory device comprises, for example, a flash memory.
According to an aspect of the present invention, a method for processing the loop structure data is provided. The method comprises detecting whether or not the processor performs the loop structure, and when it is determined that the processor performs the loop structure, the loop structure data corresponding to the loop structure is stored in a fast memory device for the processor to perform the loop structure.
According to a preferred embodiment of the present invention, the fast memory device provides the loop structure data to the processor when the fast memory device has the loop structure data by, and the slow memory device provides the loop structure data to the processor and duplicates the loop structure data into the fast memory device when the fast memory device does not store the loop structure data.
The present invention utilizes the loop detector to detect whether or not the processor performs the loop structure. When it is determined that the processor performs the loop structure, the loop detector outputs a control signal, and according to the control signal, the data processing apparatus for loop structure stores the loop structure data corresponding to the loop structure in the fast memory device for the processor to perform the loop structure. Therefore, the present invention improves the loop structure speed of the processor and enhances the overall operational performance of the system.
In order to make the aforementioned and other aspects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the invention as claimed.
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
The fast memory device 132 can be, for example, a static random access memory (SRAM) or a dynamic random access memory (DRAM). Compared with the flash memory or other storage devices such as a hard disc or an optical disc, SRAM and DRAM are memories with higher accessing speed, and thus the speed of the processor 110 reading the desired loop structure data through the SRAM and DRAM is much higher than that of the processor 110 reading the required loop structure data through the flash memory. Thus, in this embodiment, when the processor 110 performs the loop structure, the desired loop data is read through the fast memory device 132, so as to avoid delaying the reading of data and accelerate the operation speed of the system. Furthermore, since the fast memory device 132 is only responsible for storing the loop data, a memory device with a proper capacity is required to be disposed only, thus saving a memory device with large capacity and reducing the design cost.
It should be mentioned that although several possible configurations of the data processing apparatus for loop structure have been illustrated in the above embodiment, it would be known to those of ordinary skill in the art that each manufacturer has a different design of the processor 110, the fast memory device 132, and the loop detector 131, and the application of the present invention is not limited to those possible configurations. In other words, it conforms to spirits of the present invention that when the processor 110 performs the loop structure, the loop structure data corresponding to the loop structure is stored in the fast memory device 132 for the processor 110 to perform the loop structure.
When it is determined that the processor 110 performs the loop structure, the fast memory device 131 provides the loop structure data to the processor 110 when the fast memory device 131 has the loop structure data. When the fast memory device 131 does not store the loop structure data, the slow memory device 220 provides the loop structure data to the processor 110 and duplicates the loop structure data into the fast memory device 131. In this embodiment, the loop structure data is pre-stored in the slow memory device 220. Therefore, after it is detected that the processor 110 is required to perform the loop structure, the loop data is duplicated from the slow memory device 220 into the fast memory device 132. After the duplication is completed, the processor 110 reads the desired loop data directly from the fast memory device 132 to continue performing the loop structure. Since the fast memory device 132 has a higher data-accessing speed, the wait time of the processor 110 is reduced, thereby enhancing the operational performance of the system. In another embodiment of the invention, the loop structure data could be stored in a buffer when the processor performs the loop structure, and then duplicates the loop structure data into the fast memory device from the buffer.
The slow memory device 220 can be a flash memory or a storage device, such as a hard disc. In a general system application, BIOS is, for example, also a flash memory, such as a series flash or a parallel flash.
In the above embodiment, the loop structure can be divided into a pre-test loop and a post-test loop. Taking the embodiment of
If the processor 110 performs the pre-test loop structure, the loop detector 131 detects and outputs a control signal CT before the processor 131 performs the loop structure. Therefore, the data processing apparatus for loop structure 330 first duplicates the loop structure data into the fast memory device 132 for the processor 110 to read the desired loop structure data from the fast memory device 132. For example, if the processor 110 is an 8051 microprocessor, the loop detector 131 detects whether the program code of the processor 110 has a “DJNZ/CJNE tag”, so as to determine whether the processor 110 performs the loop structure. If the processor 110 is an 8086 microprocessor, the loop detector 131 detects whether the program code of the processor 110 has a “DEC CX/JNZ tag”, so as to determine whether the processor 110 performs the loop structure or not.
Furthermore, if the processor 110 is an 80x86 microprocessor, the loop specific instruction of the program code of the processor 110 is used to determine whether the processor 110 performs the loop structure or not. For example, the loop specific instruction can be a “LOOP”, “LOOPZ”, “LOOPE” instruction that are commonly used in C language or a combination thereof, which are selected depending upon the program designing. Those of ordinary skill in the art can define the loop specific instructions freely according to the adopted systems and processors which are within the scope of the present invention.
Therefore, regardless of whether the above loop structure is a post-test loop or a pre-test loop, the present invention can be used to achieve the purposes of improving the loop structure speed of the processor and enhancing the overall operational performance of the system. Furthermore, those of ordinary skill in the art should know that the data accessing and duplication of the fast memory device 131 and the slow memory device 220 can be achieved by a memory controller or can be integrated into the data processing apparatus for loop structure 330, and the details will not be described herein again.
In Step S42, when the loop structure data corresponding to the loop structure is stored into the fast memory device, if the fast memory device has the loop structure data, the fast memory device provides the loop structure data to the processor. If the fast memory device does not store the loop structure data, the slow memory device provides the loop structure data to the processor, and then duplicates the loop structure data into the fast memory device. In another embodiment of the invention, the loop structure data could be stored in a buffer when the processor performs the loop structure, and then duplicates the loop structure data into the fast memory device from the buffer in Step S42.
According to the teachings of the loop data processing apparatus in the above embodiments, those of ordinary skill in the art can easily understand the detailed operations of Step S42, which will not be described herein again. In the embodiment of
To sum up, in the present invention, when the processor performs the loop structure, the desired loop data is duplicated into the fast memory device, for example, DRAM, SRAM, etc. Therefore, the processor directly reads the desired loop data from the fast memory device, thereby improving the loop structure speed of the processor and enhancing the overall operational performance of the system.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the present invention without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the present invention cover modifications and variations of this invention provided they fall within the scope of the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
95141290 | Nov 2006 | TW | national |