Summary of the invention
For solving the problems of the technologies described above, the application embodiment provides a kind of method for generating pulse and device, and to improve the frequency of the pulse that programmable way produces, technical scheme is following:
A kind of method for generating pulse, this method comprises:
A, the current Waveform Control instruction that resolve to obtain obtain the memory address of the waveform instruction that current Waveform Control instruction carries and the memory address of next bar Waveform Control instruction;
The waveform instruction that B, parsing are obtained according to the memory address of said waveform instruction; Obtain output waveform; Simultaneously, next bar Waveform Control instruction that the memory address of instructing according to said next bar Waveform Control obtains is returned execution in step A as current Waveform Control instruction.
Preferably, in advance with the Waveform Control instruction storage at least one first storage area, with the waveform instruction storage at least one second storage area.
Preferably, in advance with Waveform Control instruction and waveform instruction storage in a storage area with a plurality of independently reading-writing port.
Preferably, in advance with Waveform Control instruction and waveform instruction storage in a plurality of storage areas with a plurality of independently reading-writing port, each said storage area comprises two independent reading-writing port at least, and stores the Waveform Control instruction simultaneously and waveform instructs.
A kind of pulse generating device comprises: memory cell, Waveform Control instruction decoder and waveform decoder, wherein, store Waveform Control instruction and waveform instruction in the said memory cell, and comprise first reading-writing port and second reading write port;
Said memory cell is sent to said Waveform Control instruction decoder through first reading-writing port with current Waveform Control instruction and resolves; Obtain the memory address that said current Waveform Control instructs corresponding waveform to instruct, and the memory address of next bar Waveform Control instruction;
Said memory cell is through first reading-writing port; Next bar Waveform Control instruction that will obtain according to the memory address that next bar Waveform Control that said Waveform Control instruction decoder provides is instructed; Being sent to said Waveform Control instruction decoder as current Waveform Control instruction resolves; And through the second reading write port; The waveform instruction that the memory address that will instruct according to the waveform that said Waveform Control instruction decoder provides obtains is sent to waveform decoder and resolves, and obtains output waveform.
Preferably, said memory cell comprises: at least one stores the storage area of Waveform Control instruction and waveform instruction simultaneously, and this storage area has independently first reading-writing port and second reading write port.
Preferably; Said memory cell comprises: at least one links to each other with said first reading-writing port; And first storage area that is used for the stored waveform control command, and at least one links to each other with said second reading write port, and be used for second storage area of stored waveform instruction.
Preferably, above-mentioned pulse generating device also comprises: microcontroller, be used to carry out initialization, and the operating state of controlling said Waveform Control instruction decoder and waveform decoder and memory cell.
Use the technical scheme that above the application provides; Pulse generating device can obtain Waveform Control instruction simultaneously and instruct with waveform and carry out decoding processing, and a plurality of decoders are decoded simultaneously and demonstrated continuous productive process, and the decoding of pipeline system is that the decode procedure with an instruction is divided into multistep and carries out; Each grade circuit is only handled a step wherein; Multi-level pmultistage circuit is handled a plurality of instructions on the streamline simultaneously like this, is implemented in when resolving instruction output waveform; An instruction in a plurality of clock cycle, could resolving before making shortened in the average clock cycle; Reduce the used time of decoding, improved decoding efficiency, and then improved speed and frequency that impulse waveform produces.
Embodiment
The application embodiment provides a kind of method for generating pulse; Be used to improve the pulse generation speed and the frequency of programmable pulse producing method; Can obtain Waveform Control instruction simultaneously instructs with waveform and carries out dissection process; And adopt pipeline system to resolve instruction, and being divided into multistep and carrying out because pipeline system is a decode procedure with an instruction, each grade circuit is only handled a step wherein; Multi-level pmultistage circuit is handled many instructions on the streamline simultaneously like this, and an instruction could resolving in the cycle at a plurality of work clock before making shortens to an average work clock cycle with interior completion.Reduce the used time of decoding, improved decoding efficiency, and then improved speed and frequency that impulse waveform produces.
For above-mentioned purpose, the feature and advantage that make the application can be more obviously understandable, the application is done further detailed explanation below in conjunction with accompanying drawing and embodiment.
Referring to Fig. 1, Fig. 1 is the schematic flow sheet of a kind of method for generating pulse of the application embodiment, and this method comprises:
S101 resolves the current Waveform Control instruction that obtains, and obtains the waveform instruction storage address that said current Waveform Control instruction is carried, and the memory address of next bar Waveform Control instruction.
Memory address according to the Waveform Control instruction obtains corresponding Waveform Control instruction; It is current Waveform Control instruction; Resolve said current Waveform Control instruction, obtain the memory address that current Waveform Control instructs corresponding waveform to instruct, and the memory address of next bar Waveform Control instruction.
Concrete, said Waveform Control instruction comprises three partial informations and is respectively: memory address, the cyclical information of the waveform instruction that this Waveform Control instruction is entrained, and cycle-index information, wherein:
When said cyclical information was circulation execution information, then the memory address of next bar Waveform Control instruction did, the memory address of current Waveform Control instruction adds 1.Said cycle-index information is that number of times is carried out in the circulation of Waveform Control instruction;
Concrete; Circulate for beginning such as the cyclical information in the instruction of i bar Waveform Control; Cyclical information in the instruction of n bar Waveform Control is for stopping circulation; Then all instructions that i+1 bar Waveform Control instructs n bar Waveform Control to instruct are carried out in circulation, cycle-index, the i.e. corresponding information of cycle-index in the i bar Waveform Control instruction.
When said cyclical information was carried out the information of Waveform Control instruction for not circulating, then said cycle-index information was specially the memory address of next bar Waveform Control instruction.
S102; Resolve waveform instruction according to the memory address acquisition of said waveform instruction; Obtain output waveform, simultaneously, according to next bar Waveform Control instruction of memory address acquisition of said next bar Waveform Control instruction; Return execution S101 as current Waveform Control instruction, all execute up to all Waveform Control instructions.
During practical implementation; Resolve the memory address that said current Waveform Control instructs resulting waveform to instruct; Be the address block address, comprise the initial address and the address block length of waveform instruction place storage area, memory cell can not directly utilize address block to carry out addressing; Event needs to become memory cell can directly carry out the addressing address of addressing this address block information analysis, and then obtains the waveform instruction according to this addressing address.
Resolve the instruction of said waveform, obtain output waveform, and time of continuing of this waveform, promptly obtain hoping the impulse waveform of exporting.
Meanwhile,,, return execution in step S101, all resolved up to all Waveform Control instructions as current Waveform Control instruction according to next bar Waveform Control instruction of memory address acquisition of next bar Waveform Control instruction.
Can know by foregoing; The obtaining of Waveform Control instruction, parsing is instructed with waveform and is obtained, resolve and demonstrate pipeline system; Can handle the instruction of many Waveform Control on this streamline simultaneously, stop up to the parsing Shu Zhiling that finishes, promptly all Waveform Control instructions have all been resolved.
Below with an instantiation explanation pipeline system resolving:
Obtain the instruction of article one Waveform Control,, resolve the memory address that the instruction of article one Waveform Control obtains the instruction of first waveform as current Waveform Control instruction, and the memory address of second Waveform Control instruction.
Memory address according to said first waveform instruction obtains the instruction of first waveform, and resolves this first waveform instruction, obtains output waveform.When obtaining and resolving said first waveform instruction,, carry out dissection process as current Waveform Control instruction according to the memory address acquisition second Waveform Control instruction of said second Waveform Control instruction.
In other words; The obtaining of second Waveform Control instruction, dissection process and first waveform instruct obtains, dissection process can be carried out simultaneously; The rest may be inferred, and the processing of instruction of many Waveform Control and waveform instruction then presents continuous productive process, and the pipeline system decoding is that the decode procedure with an instruction is divided into multistep, is undertaken by multi-level pmultistage circuit; Each grade circuit is only handled a step wherein, and multi-level pmultistage circuit is handled a plurality of instructions on the streamline simultaneously like this.Instruction decoded stream waterline in the present embodiment can be handled Waveform Control instruction and waveform instruction simultaneously; Thereby shortened the processing latency of every Waveform Control instruction; Make the dissection process time of an instruction shorten in the average clock cycle, see on the macroscopic view, shortened the time of output pulse waveform by a plurality of clock cycle; Therefore, speed and frequency that pulse produces have been improved.
Preferably; In the embodiment of the pairing method for generating pulse of Fig. 1; Waveform Control is instructed and dissection process is carried out in the waveform instruction for realization is obtained simultaneously; Can be in advance with the Waveform Control instruction storage at least one first storage area, with the waveform instruction storage at least one second storage area.
It will be appreciated by persons skilled in the art that storage area is a least unit of forming memory cell, promptly memory cell is made up of at least one storage area.Therefore, said at least one first storage area and said at least one second storage area can be formed one or more memory cell.
When being a plurality of memory cell; Can be that said first storage area is formed at least one memory cell; Said second storage area is formed at least one memory cell, can also be to include first storage area and two kinds of storage areas of second storage area in each memory cell.
Preferably; In method for generating pulse embodiment shown in Figure 1, Waveform Control is instructed and dissection process is carried out in the waveform instruction for realization is obtained simultaneously, and is all right; In advance with Waveform Control instruction and waveform instruction; Store into simultaneously in the storage area with a plurality of independently reading-writing port, the shared storage area of promptly a plurality of reading-writing port, but the read-write operation between a plurality of port is independent of each other;
It will be appreciated by persons skilled in the art that and to use a plurality of storage areas to store all Waveform Control instructions and waveform instruction with a plurality of independent reading-writing port.
Corresponding to top method embodiment, the application also provides a kind of pulse generating device, and referring to Fig. 2, this device comprises: memory cell 1, Waveform Control instruction decoder 2, waveform decoder 3.
Memory cell 1 is used for the storage area that stored waveform control command and waveform instruct, and comprises first reading-writing port and second reading write port.
Said memory cell 1 is sent to said Waveform Control instruction decoder 2 through first reading-writing port with current Waveform Control instruction and resolves; Obtain the memory address that said current Waveform Control instructs corresponding waveform to instruct, and the memory address of next bar waveform instruction;
Next bar Waveform Control instruction that said memory cell 1 will obtain according to the memory address that next bar Waveform Control that said Waveform Control instruction decoder 2 provides is instructed through first reading-writing port; As current Waveform Control instruction; Being sent to Waveform Control instruction decoder 2 resolves; And through the second reading write port; The waveform instruction that the memory address that will instruct according to the waveform that said Waveform Control instruction decoder 2 provides obtains is sent to waveform decoder 3 and resolves, and obtains output waveform.
During practical implementation, dissection process is carried out in the current Waveform Control instruction of 2 pairs of acquisitions of Waveform Control instruction decoder, obtains the waveform instruction storage address that said current Waveform Control instruction is carried, and the memory address of next bar Waveform Control instruction.
Said Waveform Control instruction comprises three partial informations, is respectively: memory address, the cyclical information of the waveform instruction that this Waveform Control instruction is entrained, and cycle-index information, wherein:
When said cyclical information was circulation execution information, then the memory address of next bar Waveform Control instruction did, the memory address of current Waveform Control instruction adds 1, and said cycle-index information is that number of times is carried out in the circulation of Waveform Control instruction;
Concrete; Circulate for beginning such as the cyclical information in the instruction of i bar Waveform Control; Cyclical information in the instruction of n bar Waveform Control is for stopping circulation; Then all instructions that i+1 bar Waveform Control instructs n bar Waveform Control to instruct are carried out in circulation, cycle-index, the i.e. corresponding information of cycle-index in the i bar Waveform Control instruction.
When said cyclical information was carried out the information of Waveform Control instruction for not circulating, then said cycle-index information was specially the memory address of next bar Waveform Control instruction.
Concrete; Said Waveform Control instruction decoder 2 is resolved said current Waveform Control instruction; Obtain the memory address of the waveform instruction that the instruction of current Waveform Control carries and the memory address of next bar Waveform Control instruction, be back to said memory cell 1, memory cell 1 is according to the memory address of said waveform instruction; Obtain the waveform instruction that current Waveform Control instruction comes into force, and this waveform instruction is sent to waveform decoder 3.Memory cell 1 next bar Waveform Control instruction that will obtain according to the memory address of said next bar Waveform Control instruction meanwhile is sent to Waveform Control instruction decoder 2 as current Waveform Control instruction and resolves.
Waveform decoder 3 is resolved the waveform instruction that receives, and obtains hoping the impulse waveform exported, and said waveform instruction mainly comprises: hope the waveform of output, and time of continuing of this waveform.
Because memory cell 1 can satisfy the instruction that addressing simultaneously obtains two kinds of functions; Be Waveform Control instruction and waveform instruction; Therefore, said Waveform Control instruction decoder 2 can carry out parse operation simultaneously with waveform decoder 3, is that example is elaborated with two Waveform Control instructions:
Waveform Control instruction decoder 2 is resolved article one Waveform Control instruction that obtains, and obtains the memory address of the waveform instruction that the instruction of article one Waveform Control carries, and the memory address of second Waveform Control instruction.
When the memory address that the waveform that carries according to the instruction of article one Waveform Control instructs is obtained the waveform instruction, according to the memory address acquisition second Waveform Control instruction of second Waveform Control instruction.
When the waveform that article one Waveform Control instruction that receives when waveform decoder 3 parsings comes into force instructed, the second Waveform Control instruction that Waveform Control instruction decoder 2 dissection process obtain like this, had been shortened the processing latency that the second Waveform Control is instructed.When many Waveform Control instructions, instruction decoder 2 can carry out decoding processing simultaneously with waveform decoder 3, demonstrates continuous productive process, has improved decoding efficiency.
Continuous productive process is that the decode procedure with an instruction is divided into multistep and carries out; Each grade circuit is only handled a step wherein, and multi-level pmultistage circuit is handled many instructions on the streamline simultaneously like this, an instruction of accomplishing in the cycle at a plurality of work clock before making; Can shorten in the average work clock cycle and accomplish; Shorten the used time of decoding, improved decoding efficiency, therefore, improved speed and frequency that pulse produces.
Preferably, referring to Fig. 2, said pulse generating device also comprises: microcontroller 4, and be used for data initialization, and control said memory cell 1, said Waveform Control instruction decoder 2, and the operating state of said waveform decoder 3.
Concrete, said data initialization is specially Waveform Control instruction and waveform instruction is stored in respectively in a plurality of storage areas, can obtain Waveform Control instruction and waveform instruction simultaneously.The said memory cell of this microcontroller 4 controls 1, Waveform Control instruction decoder 2; And waveform decoder 3 start working with out-of-work state; When needs promptly stop this pulse generating device, can quit work through microcontroller 4 control store unit 1, Waveform Control instruction decoder 2 and waveform decoder 3.
Preferably, referring to Fig. 3 a, the memory cell 1 among the embodiment of Fig. 2 correspondence can comprise: store the storage area 10 of Waveform Control instruction and waveform instruction simultaneously, and this storage area has independently first reading-writing port 11 and second reading write port 12.
It will be appreciated by persons skilled in the art that storage area is a least unit of forming memory cell, promptly memory cell can be made up of one or more storage areas.Therefore; The number of said storage area 10 can have a plurality of; Each storage area 10 all has two independently reading-writing port; I.e. first reading-writing port 11 and second reading write port 12 can obtain the instruction of two kinds of difference in functionalitys simultaneously through these two reading-writing port, promptly obtain the Waveform Control instruction respectively through first reading-writing port 11 and second reading write port 12 and instruct with waveform.
Preferably; Referring to Fig. 3 b; Among the pairing pulse generating device embodiment of Fig. 2, memory cell 1 can comprise: be used for first storage area 100 of stored waveform control command, its reading-writing port is first reading-writing port; Be used for second storage area 110 of stored waveform instruction, its reading-writing port is the second reading write port.
The pulse generating device that present embodiment provides in different storage regions, is about to the Waveform Control instruction storage with the instruction storage of difference in functionality in first storage area 100; Read and write through first reading-writing port; The waveform instruction storage is read and write through the second reading write port at second storage area 110, can obtain the instruction of difference in functionality simultaneously; Obtain hoping the waveform exported thereby be implemented in to resolve when resolving the Waveform Control instruction, thereby improved speed and speed that impulse waveform produces.
Preferably, referring to Fig. 3 b, the Waveform Control instruction decoder in the foregoing description specifically comprises: instruction decoder 21 and address decoder 22, wherein:
Said instruction decoder 21; Be used for the Waveform Control that obtains is instructed decoding processing, obtain waveform that said Waveform Control instruction comes into force and instruct the memory address at second storage area, line up to send to address decoder 22 through a buffering; Simultaneously; Also obtain the memory address of next bar Waveform Control instruction, and this memory address is back to the Waveform Control location of instruction, carry out the next round addressing operation.
Said address decoder 22 is used for said waveform instruction is carried out dissection process in the memory address of second storage area, obtains the memory address that this second storage area can directly be handled.
The Waveform Control instruction is after instruction decoder 21 instructs decoding processing; Obtain the memory address piece of waveform instruction in second storage area, still, storage area can not directly carry out addressing according to this address block; Must earlier this address block be resolved; Obtain the memory address that second storage area can directly carry out addressing operation, and then obtain corresponding waveform instruction, the impulse waveform that the waveform instruction of acquisition needs through output after the dissection process of waveform decoder again.
The number that it will be appreciated by persons skilled in the art that said memory cell can be one or more, and the application does not limit this.
For the convenience of describing, be divided into various unit with function when describing above the device and describe respectively.Certainly, when implementing the application, can in same or a plurality of softwares and/or hardware, realize the function of each unit.
Description through above execution mode can know, those skilled in the art can be well understood to the application and can realize by the mode that software adds essential general hardware platform.Based on such understanding; The part that the application's technical scheme contributes to prior art in essence in other words can be come out with the embodied of software product; This software product can be stored in the storage medium; Like ROM/RAM, magnetic disc, CD etc., comprise that some instructions are with so that computer or microcontroller apparatus are carried out the described method of some part of each embodiment of the application or embodiment.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and identical similar part is mutually referring to getting final product between each embodiment, and each embodiment stresses all is the difference with other embodiment.Especially, for device embodiment, because it is basically similar in appearance to method embodiment, so describe fairly simplely, relevant part gets final product referring to the part explanation of method embodiment.Device embodiment described above only is schematic; Wherein said unit as the separating component explanation can or can not be physically to separate also; The parts that show as the unit can be or can not be physical locations also; Promptly can be positioned at a place, perhaps also can be distributed on a plurality of NEs.Can realize the purpose of present embodiment scheme according to the needs selection some or all of module wherein of reality.Those of ordinary skills promptly can understand and implement under the situation of not paying creative work.
The above only is the application's a embodiment; Should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the application's principle; Can also make some improvement and retouching, these improvement and retouching also should be regarded as the application's protection range.