CN102662630B - Code generation method - Google Patents

Code generation method Download PDF

Info

Publication number
CN102662630B
CN102662630B CN201210123079.8A CN201210123079A CN102662630B CN 102662630 B CN102662630 B CN 102662630B CN 201210123079 A CN201210123079 A CN 201210123079A CN 102662630 B CN102662630 B CN 102662630B
Authority
CN
China
Prior art keywords
signal
template
parasites fauna
bit wide
statement
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201210123079.8A
Other languages
Chinese (zh)
Other versions
CN102662630A (en
Inventor
李志俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
RISING MICRO ELECTRONICS CO Ltd
Original Assignee
RISING MICRO ELECTRONICS CO Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by RISING MICRO ELECTRONICS CO Ltd filed Critical RISING MICRO ELECTRONICS CO Ltd
Priority to CN201210123079.8A priority Critical patent/CN102662630B/en
Publication of CN102662630A publication Critical patent/CN102662630A/en
Application granted granted Critical
Publication of CN102662630B publication Critical patent/CN102662630B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a code generation method which is used for generating instruction decoder codes. The code generation method can automatically generate the instruction decoder codes according to register block files output by a user, and the user only needs to generate the register block files formed by statements. Compared with the instruction decoder codes output by the user manually, the code generation method simplifies user operation, reduces work load of the user, and shortens work period. In addition, due to the fact that the register block files comprise less statements, probability of error occurred when the register block filers is generated by the user is low, and error caused by human reasons cannot occur in the process of instruction decoder codes generated automatically according to the register block files. Compared with an existing manual input instruction decoder code way, the code generation method can lowers probability of error of the codes.

Description

A kind of code generating method
Technical field
The invention belongs to Design of Digital Circuit technical field, particularly relate to a kind of code generating method.
Background technology
In the design of chip, need to control the operation of whole chip and the running status of inquiry chip by command decoder.At special IC (Application Specific Integrated Circuit, ASIC), in design, the design of command decoder is by hardware program language verilog or Very High Speed Integrated Circuit (VHSIC) hardware description language (VHDL) codes implement.
At present, mainly based on the manual input completing command decoder code.
But, the signal of command decoder is a lot, and in the process of design command decoder, there will be the change of instruction increase and decrease and putting position, when occurring that a large amount of instruction increase and decrease, putting position will complete the amendment of existing code again by hand when changing, this causes, and the process of whole manual completion code input is very loaded down with trivial details, workload large, the work period is very long.
Summary of the invention
In view of this, the object of the present invention is to provide a kind of code generating method, can automatically generate command decoder code according to the Parasites Fauna file of user's input, to simplify user's design operation, reduce user's design efforts would, to shorten the work period.
For achieving the above object, the invention provides following technical scheme:
A kind of code generating method, for generating command decoder code, described method comprises:
Step S1: the Parasites Fauna file receiving user's input;
Step S2: obtain Parasites Fauna title according to the first preset rules in described Parasites Fauna file;
Step S3: call the first template prestored, utilizes the Parasites Fauna identifier in described first template of described Parasites Fauna title replacement, obtains first code section;
Step S4: call the first templates statement prestored, utilize the Parasites Fauna identifier in described first templates statement of described Parasites Fauna title replacement, obtain the first statement, described first statement is inserted the first position in the second template prestored, obtain second code section;
Step S5: obtain the command signal corresponding with described Parasites Fauna title according to the second preset rules in described Parasites Fauna file, and determine the type of each command signal;
Step S6: utilize described each command signal to process the 4th template prestored, obtains forth generation code section, specifically comprises:
When described command signal is write signal, determine bit wide and the Parasites Fauna bit wide of a described write signal; Call the 3rd template prestored, utilize the signal identifiers in described described 3rd template of write signal replacement, utilize the Parasites Fauna identifier in described 3rd template of described Parasites Fauna title replacement, utilize the bit wide of a described write signal to replace the signal bit wide identifier in described 3rd template, the Parasites Fauna bit wide identifier utilized in described 3rd template of described Parasites Fauna bit wide replacement, acquisition third generation code section; Described third generation code section is inserted the end of the 4th current template; First prefix and the second prefix are added respectively to the character string be made up of described write signal and bit wide thereof, generates two command signals, described two command signals are inserted the signal list of described current 4th template;
When described command signal is read signal, determine the bit wide of a described read signal; Call the second templates statement prestored, the signal identifiers in described second templates statement of read signal replacement described in utilizing, the bit wide of the described read signal of utilization replace the signal bit wide identifier in described second templates statement, obtain the second statement; Described second statement is inserted the end of the 4th current template; 3rd prefix is added to the character string be made up of described read signal and bit wide thereof, generates new command signal, described new command signal is inserted the signal list of current 4th template;
When described command signal is register signal, determine the bit wide of described register signal; Call the 3rd templates statement prestored, utilize the signal identifiers in described 3rd templates statement of described register signal replacement, utilize the bit wide of described register signal to replace the signal bit wide identifier of described 3rd templates statement, obtain the 3rd statement; Described 3rd statement is inserted the end of the 4th current template; The character string be made up of described register signal and bit wide thereof is inserted the signal list of current 4th template;
Step S7: the end of described first code section and second code section being inserted successively described forth generation code section, forms command decoder code.
Preferably, in the above-mentioned methods, described command signal has the signal identification distinguishing its type; Accordingly, the type of each command signal is determined according to the signal identification of described command signal.
Preferably, in the above-mentioned methods, the signal identification of described read signal is prefix r_, and the signal identification of described write signal is prefix w_.
As can be seen here, state in disclosed code generating method on the invention, the Parasites Fauna file that can export according to user generates command decoder code automatically, user only need generate the Parasites Fauna file be made up of declarative statement, compared with the manual output order decoder code of user, simplify user operation, reduce the workload of user, and then shorten the work period; In addition, the statement comprised due to Parasites Fauna file is less, it is lower that user generates the probability made a mistake in Parasites Fauna file processes, and can not make a mistake because of artificial origin according to the process that Parasites Fauna file generates command decoder code automatically, therefore, compared with the existing manual mode inputting command decoder code, code generating method disclosed by the invention can reduce the probability that code makes a mistake.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the process flow diagram of a kind of code generating method disclosed by the invention.
Embodiment
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
The invention discloses a kind of code generating method, can automatically generate command decoder code according to the Parasites Fauna file of user's input, user operation can be simplified, reduce amount of user effort, shorten the work period.
See the process flow diagram that Fig. 1, Fig. 1 are a kind of code generating method disclosed by the invention.Comprise:
Step S1: the Parasites Fauna file receiving user's input.
User collects various required command signal, and be divided into multiple Parasites Fauna according to the function of command signal and figure place, be each Parasites Fauna name, the bit wide listing each command signal in the signal list of this Parasites Fauna, the bit wide determining this Parasites Fauna and signal list afterwards, generate Parasites Fauna file.This Parasites Fauna file comprises Parasites Fauna title, command signal, the bit wide of Parasites Fauna and the bit wide of each command signal, is write by hardware program language verilog.Wherein command signal comprises a read signal, a write signal and Parasites Fauna signal.
The code of a Parasites Fauna file is as follows:
`define bit_TEMP{w_T_en, r_T_result [7:0], T_offset [6:0] } // defined instruction signal
`define wr_TEMP{/* wdata [15], * // * wdata [14:8], */wdata [6:0] } // defined instruction correspondence read-write position
Step S2: obtain Parasites Fauna title according to the first preset rules in described Parasites Fauna file.
Parasites Fauna file is write in strict accordance with verilog grammer, therefore after acquisition Parasites Fauna file, just can determine Parasites Fauna title.Concrete, this first preset rules can be: in the command signal definition statement in Parasites Fauna file, and being positioned at the character string after the first preset keyword is Parasites Fauna title.Such as, the character string be positioned in command signal definition statement in Parasites Fauna file after key word " define bit_ " is Parasites Fauna title, or the character string be positioned in the command signal definition statement in Parasites Fauna file after key word " bit_ " is Parasites Fauna title, and the present invention does not limit the first preset keyword.Certainly, the first preset rules also can be: in the command signal definition statement in Parasites Fauna file, and the character string between the second preset keyword and the 3rd preset keyword is Parasites Fauna title.Such as, " character string between { " is Parasites Fauna title to be positioned at key word " bit_ " and key word in command signal definition statement in Parasites Fauna file, or the character string be positioned in the command signal definition statement in Parasites Fauna file between key word " define bit_ " and key word " { w_ " is Parasites Fauna title, the present invention does not limit the second preset keyword and the 3rd preset keyword.
Step S3: call the first template prestored, utilizes Parasites Fauna title to replace Parasites Fauna identifier in the first template, obtains first code section.
The first template is previously stored with in the present invention.The Parasites Fauna title related in this first template replaces by Parasites Fauna identifier.
The code of the first template is as follows:
In the present embodiment, using D as the Parasites Fauna identifier in the first template, in certain specific implementation process, be not limited to this.In step S3, the Parasites Fauna title obtained in step S2 is utilized to replace Parasites Fauna identifier D in the first template.
Step S4: call the first templates statement prestored, utilizes Parasites Fauna title to replace Parasites Fauna identifier in the first templates statement, obtains the first statement, the first statement is inserted the first position in the second current template, obtain second code section.
Be previously stored with the first templates statement in the present invention, the Parasites Fauna title related in this statement all replaces with Parasites Fauna identifier.
The code of the first templates statement is as follows:
`addr_D:rdata<=D;
In the present embodiment, using D as the Parasites Fauna identifier in the first templates statement, in certain specific implementation process, this is not limited to.The Parasites Fauna identifier D utilizing the Parasites Fauna title obtained in step S2 to replace in the first templates statement can obtain the first statement.
Be previously stored with the second template in the present invention, the code of this second template is as follows:
Wherein, the first position in the second template refers to the position be positioned at before key word " default ".First statement is inserted the first position in the second template, before inserting key word " default " by the first statement, obtains second code section.
Step S5: obtain the command signal corresponding with Parasites Fauna title according to the second preset rules in Parasites Fauna file, and determine the type of each command signal.
Command signal in Parasites Fauna file comprises a read signal, a write signal and register signal.Generate user in the process of Parasites Fauna file, different signal identifications can be added for dissimilar command signal, distinguish the type of each command signal with this.Such as: different prefixes or suffix can be added respectively for read-only signal, a write signal and register signal.In enforcement, can be that a write signal adds prefix w_ as signal identification, for only read signal adds prefix r_ as signal identification, and not for register signal adds signal identification.
Now, in the command signal definition statement of Parasites Fauna file, the character string be positioned between symbol " { " and symbol " } ", being separated by symbol ", " contains command signal.In command signal definition statement, extract the character string separated by symbol ", ", judge whether each character string with the addition of signal identification afterwards, can command signal be obtained after the corresponding signal identification of deletion and bit wide.The type of each command signal is distinguished by its signal identification.
Step S6: utilize each command signal to process the 4th current template, obtains forth generation code section.
The processing procedure that dissimilar command signal is corresponding different, is described below respectively.
One, when command signal is write signal
Determine bit wide and the Parasites Fauna bit wide of a write signal.
Generate user in the process of Parasites Fauna file, define the bit wide of each command signal in command signal definition statement, the rear side of each command signal is the bit wide of each command signal with the character string that symbol " [" starts, with symbol "] " terminates; In the definition statement of instruction correspondence read-write position, define Parasites Fauna bit wide, the bit wide of Parasites Fauna is the character string terminated with first symbol " [" starts, with first symbol "] " in the definition statement of instruction correspondence read-write position.
Call the 3rd template prestored, utilize write signal to replace signal identifiers in the 3rd template, utilize Parasites Fauna title to replace Parasites Fauna identifier in the 3rd template, utilize the bit wide of a write signal to replace signal bit wide identifier in the 3rd template, utilize Parasites Fauna bit wide to replace Parasites Fauna bit wide identifier in the 3rd template, obtain third generation code section.
Be previously stored with the 3rd template in the present invention, the code of the 3rd template is as follows:
In the 3rd template, E is signal identifiers, and D is Parasites Fauna identifier, and G is signal bit wide identifier, and F is Parasites Fauna bit wide identifier.The aforementioned established data of each identifier is replaced, third generation code section can be obtained.
Third generation code section is inserted the end of the 4th current template.
Be previously stored with the 4th template in the present invention, the code of the 4th template is as follows:
`include " define.v " // introducing define.v file
module cmd_decoder();
input clk,rst_n;
Add the first prefix and the second prefix respectively to by the character string that only write signal and corresponding bit wide thereof form, generate two new command signals, these two new command signals are inserted the signal list of current 4th template.This first prefix is wr_w_ ", the second prefix is " wdata_w_ ".
Two, when command signal is read signal
Determine the bit wide of a read signal.
Call the second templates statement prestored, utilize a read signal to replace signal identifiers in the second templates statement, utilize the bit wide of a read signal to replace signal bit wide identifier in the second templates statement, obtain the second statement.
The present invention is previously stored with the second templates statement, and concrete code is as follows:
inputG r_A;
Wherein, A is signal identifiers, and G is signal bit wide identifier.Utilize a read signal to replace A, utilize the bit wide of a read signal to replace G, the second statement can be obtained.
Second statement is inserted the end of the 4th current template.
Add the 3rd prefix to by the character string that only read signal and bit wide thereof form, generate new command signal, new command signal is inserted the signal list of current 4th template.3rd prefix is " r_ ".
Three, when command signal is register signal
Determine the bit wide of register signal.
Call the 3rd templates statement prestored, utilize the signal identifiers in register signal replacement the 3rd templates statement, utilize the bit wide of register signal to replace the signal bit wide identifier of the 3rd templates statement, obtain the 3rd statement.
The specific code of the 3rd templates statement is:
regGA;
Wherein, A is signal identifiers, and G is signal bit wide identifier.Utilize register signal to replace A, utilize the bit wide of register signal to replace G, the 3rd statement can be obtained.
3rd statement is inserted the end of the 4th current template.
The character string be made up of Parasites Fauna signal and bit wide thereof is inserted the signal list of current 4th template.
Step S7: the end of first code section and second code section being inserted successively forth generation code section, forms command decoder code.
When only comprising a Parasites Fauna in the Parasites Fauna file of user's input, after execution step S1 ~ S6, directly first code section and second code section are inserted successively the end of forth generation code section.
When comprising multiple Parasites Fauna in the Parasites Fauna file of user's input, after execution step S6, judge whether that whole Parasites Fauna all generates respective code further; When judged result shows to still have Parasites Fauna not generate respective code, repeated execution of steps S2 ~ S6, obtain the first code section for this Parasites Fauna, and upgrade second code section and forth generation code section, judge whether that whole Parasites Fauna all generates respective code afterwards; (N number of first code section, a second code section and a forth generation code section is defined when judged result shows that whole Parasites Fauna all generates respective code, wherein N is the quantity of the Parasites Fauna comprised in Parasites Fauna file), perform step S7, concrete, successively the first code section of each Parasites Fauna and second code section are inserted the end of forth generation code section, form command decoder code.
Be described below in conjunction with specific embodiment.
Each Parasites Fauna is 16bits, command signal T_en, T_result [7:0] and T_offset [6:0] and temperature correlation, just forms a temperature register group.Wherein, T_en is enable signal, for starting a temperature analog to digital conversion, is the signal outputting to analog to digital converter concerning command decoder, is only write signal, represents by w_ prefix; The testing result that T_result [7:0] is temperature analog to digital converter, be input signal concerning command decoder, i.e. a read signal, represents by r_ prefix; T_offset is the shift value of user configured temperature analog to digital converter, for the treatment of the systematic error of temperature sensor, is register signal concerning command decoder.Temperature register group is defined as address 1.Therefore Parasites Fauna file is:
`define bit_TEMP { w_T_en, r_T_result [7:0], T_offset [6:0] } // defined instruction signal
`define wr_TEMP/* wdata [15] * // * wdata [14:8] */, and wdata [6:0] } // defined instruction correspondence read-write position
The process generating command decoder code comprises:
One, Parasites Fauna ff key word `define bit_ is read in, by the key word " `define bit_ " in the command signal definition statement " `define bit_TEMP{w_T_en; r_T_result [7:0]; T_offset [6:0] } " in Parasites Fauna file, learn that the name of this Parasites Fauna is TEMP, D TEMP in first template is replaced, obtains first code section:
Two, by the first templates statement " `addr_D:rdata <=D; " in D replace with TEMP, obtain the first statement, and the first statement be inserted in first position in the second template, before being namely inserted into key word " default ", obtain second code section:
Three, in command signal definition statement in Parasites Fauna file " `define bit_TEMP{w_T_en, r_T_result [7:0], T_offset [6:0] } ", with ", " for separator obtains by the first character string separated as w_T_en.
This character string comprises prefix w_, and represent that the command signal that this character string comprises is a write signal, this character string is removed prefix w_ and obtains a write signal T_en, the bit wide of a write signal T_en is empty.Afterwards, must generate for only write signal T_en and write logical pulse, wire wr_w_T_en=wr & wr_addr==`addr_TEMP; Wire wdata_w_T_en=wdata [15], and wr_w_T_en, wdata_w_T_en be classified as the port signal of output and send into signal list, detailed process is as follows:
A) the signal identifiers E in write signal T_en replacement the 3rd template is utilized, utilize the Parasites Fauna identifier D in Parasites Fauna title TEMP replacement the 3rd template, bit wide due to only write signal T_en is empty, so the signal bit wide identifier G in the 3rd template is empty, afterwards, at instruction correspondence read-write position definition statement " `define wr_TEMP{/* wdata [15], * // * wdata [14:8], */wdata [6:0] } " in, determine that " [" starts with first symbol, with first symbol "] " character string that terminates, utilize the signal bit wide identifier F in this character string replacement the 3rd template, obtain third generation code section.Afterwards, this third generation code section is inserted the end of current 4th template.
It should be noted that, the 4th current template is the 4th template prestored.
B) the first prefix " wr_w_ " and the second prefix " wdata_w_ " are added respectively to only write signal T_en, generate two new command signal wr_w_T_en and wdata_w_T_en, afterwards two new command signals are inserted the signal list of current 4th template, insert the symbol ") in current 4th template by two new command signals " front.
It should be noted that the 4th current template that relates in b) operation, is no longer the 4th template prestored, but aforementioned inserted third generation code section after the 4th new template that formed.
After performing a) and b) operating, the code of current 4th template is:
Certainly, perform also first can perform b) operation in implementation process after and a) operate.Now, performing the 4th current template related to when b) operating is the 4th template prestored, and to perform the 4th current template related to when a) operating be no longer the 4th template prestored, but the 4th new template of formation after signal list performs update.In implementation process, a) operation and b) execution sequence that operates can select arbitrarily, after execution two operation, all can obtain above-mentioned code segment.
Four, in command signal definition statement in Parasites Fauna file " `define bit_TEMP{w_T_en; r_T_result [7:0]; T_offset [6:0] } ", be r_T_result [7:0] with ", " for separator obtains by second character string separated.
This character string comprises prefix r, and represent that the command signal that this character string comprises is a read signal, this character string is removed prefix r and bit wide, and to obtain a read signal T_result, the bit wide of this read signal T_result is [7:0].
C) the second templates statement " inputG r_A is called; "; a utilization read signal T_result replaces the signal identifiers A in the second templates statement; the bit wide [7:0] of a utilization read signal T_result replaces the signal bit wide identifier G in the second templates statement, namely generates the second statement " input [7:0] r_T_result; ".Afterwards, this second statement is inserted the end of current 4th template.
It should be noted that, the 4th current template is the 4th template of carrying out aforementioned a) operation and obtaining after b) operating.
D) the 3rd prefix " r_ " is added to by the character string " T_result [7:0] " that only read signal T_result and bit wide thereof form, generate new command signal " r_T_result [7:0] ", this new command signal is inserted signal list, inserts the symbol ") in current 4th template by " r_T_result [7:0] " " front.
It should be noted that, the 4th current template d) related in operation, is the 4th template obtained after carrying out c) operation.
Execution c) operation and d) operation after, the code of current 4th template is:
Certainly, perform also first can perform d) operation in implementation process after and c) operate.
Command signal definition statement five, in Parasites Fauna file " `define bit_TEMP{w_T_en; r_T_result [7:0]; T_offset [6:0] } " in, be T_offset [6:0] with the 3rd character string that ", " obtains by separating for separator.
This character string does not comprise prefix, represents that the command signal that this character string comprises is register signal, and this character string is removed bit wide, and to obtain register signal T_offset, the bit wide of this register signal T_offset is [6:0].
E) the 3rd templates statement " regG A is called; "; utilize register signal T_offset to replace signal identifiers A in the 3rd templates statement; to utilize the bit wide of register signal T_offset [6:0] to replace signal bit wide identifier G in the 3rd templates statement, namely generate the 3rd statement " reg [6:0] T_offset; ".Afterwards, the 3rd statement is inserted the end of current 4th template.
It should be noted that, the 4th current template carries out aforementioned the 4th template a) operating, b) operate c) operation and obtain after d) operating.
F) character string be made up of register signal T_offset and bit wide thereof " T_offset [6:0] " is inserted signal list, inserts the symbol ") in current 4th template by " T_offset [6:0] " " front.
It should be noted that, the 4th current template f) related in operation, is the 4th template obtained after carrying out e) operation.
Execution e) operation and f) operation after, the code of current 4th template is:
Certainly, perform also first can perform f) operation in implementation process after and e) operate.The Parasites Fauna defined in Parasites Fauna file due to user only comprises three command signals, and therefore, the 4th current template obtained after performing aforesaid operations is forth generation code section.
Six, first code section and second code section are inserted respectively the end (insert the end of forth generation code section by first code section, again second code section is inserted the end of first code section afterwards) of forth generation code section, generate command decoder code.
State in disclosed code generating method on the invention, the Parasites Fauna file that can export according to user generates command decoder code automatically, user only need generate the Parasites Fauna file be only made up of two declarative statement, compared with the manual output order decoder code of user, simplify user operation, reduce the workload of user, and then shorten the work period; In addition, the statement comprised due to Parasites Fauna file is less, it is lower that user generates the probability made a mistake in Parasites Fauna file processes, and can not make a mistake because of artificial origin according to the process that Parasites Fauna file generates command decoder code automatically, therefore, compared with the existing manual mode inputting command decoder code, code generating method disclosed by the invention can reduce the probability that code makes a mistake.
In this instructions, each embodiment adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar portion mutually see.
To the above-mentioned explanation of the disclosed embodiments, professional and technical personnel in the field are realized or uses the present invention.To be apparent for those skilled in the art to the multiple amendment of these embodiments, General Principle as defined herein can without departing from the spirit or scope of the present invention, realize in other embodiments.Therefore, the present invention can not be restricted to these embodiments shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.

Claims (3)

1. a code generating method, is characterized in that, for generating command decoder code, described method comprises:
Step S1: the Parasites Fauna file receiving user's input, described Parasites Fauna file comprises: the bit wide of Parasites Fauna title, command signal, Parasites Fauna and the bit wide of each command signal;
Step S2: obtain Parasites Fauna title according to the first preset rules in described Parasites Fauna file;
Step S3: call the first template prestored, utilizes the Parasites Fauna identifier in described first template of described Parasites Fauna title replacement, obtains first code section;
Step S4: call the first templates statement prestored, utilize the Parasites Fauna identifier in described first templates statement of described Parasites Fauna title replacement, obtain the first statement, described first statement is inserted the first position in the second current template, obtain second code section;
Step S5: obtain the command signal corresponding with described Parasites Fauna title according to the second preset rules in described Parasites Fauna file, and determine the type of each command signal;
Step S6: utilize described each command signal to process the 4th current template, obtains forth generation code section, specifically comprises:
When described command signal is write signal, determine bit wide and the Parasites Fauna bit wide of a described write signal; Call the 3rd template prestored, utilize the signal identifiers in described described 3rd template of write signal replacement, utilize the Parasites Fauna identifier in described 3rd template of described Parasites Fauna title replacement, utilize the bit wide of a described write signal to replace the signal bit wide identifier in described 3rd template, the Parasites Fauna bit wide identifier utilized in described 3rd template of described Parasites Fauna bit wide replacement, acquisition third generation code section; Described third generation code section is inserted the end of the 4th current template; First prefix and the second prefix are added respectively to the character string be made up of described write signal and bit wide thereof, generates two new write signals, described two new write signals are inserted the signal list of described current 4th template;
When described command signal is read signal, determine the bit wide of a described read signal; Call the second templates statement prestored, the signal identifiers in described second templates statement of read signal replacement described in utilizing, the bit wide of the described read signal of utilization replace the signal bit wide identifier in described second templates statement, obtain the second statement; Described second statement is inserted the end of the 4th current template; 3rd prefix is added to the character string be made up of described read signal and bit wide thereof, generates a new read signal, a described read signal is newly inserted the signal list of current 4th template;
When described command signal is register signal, determine the bit wide of described register signal; Call the 3rd templates statement prestored, utilize the signal identifiers in described 3rd templates statement of described register signal replacement, utilize the bit wide of described register signal to replace the signal bit wide identifier of described 3rd templates statement, obtain the 3rd statement; Described 3rd statement is inserted the end of the 4th current template; The character string be made up of described register signal and bit wide thereof is inserted the signal list of current 4th template;
Step S7: the end of described first code section and second code section being inserted successively described forth generation code section, forms command decoder code;
Wherein, the code of described first template is:
The code of described first templates statement is:
`addr_D:rdata<=D;
The code of described second template is:
Described primary importance refers to the position be arranged in before the key word " default " of described second template;
The code of described 3rd template is:
output wr_w_E;
outputG wdata_w_E;
wire wr_w_E=wr&wr_addr==`addr_D;
wireG wdata_w_E=wdataF;
Described second templates statement is:
inputG r_A;
Described 3rd templates statement is:
regG A;
The code of described 4th template is:
`include"define.v"
module cmd_decoder();
input clk,rst_n;
Wherein, E is signal identifiers, and D is Parasites Fauna identifier, and F is Parasites Fauna bit wide identifier, and A is signal identifiers, and G is signal bit wide identifier.
2. method according to claim 1, is characterized in that, described command signal has the signal identification distinguishing its type; Accordingly, the type of each command signal is determined according to the signal identification of described command signal.
3. method according to claim 2, is characterized in that, the signal identification of described read signal is prefix r_, and the signal identification of described write signal is prefix w_.
CN201210123079.8A 2012-04-24 2012-04-24 Code generation method Expired - Fee Related CN102662630B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210123079.8A CN102662630B (en) 2012-04-24 2012-04-24 Code generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210123079.8A CN102662630B (en) 2012-04-24 2012-04-24 Code generation method

Publications (2)

Publication Number Publication Date
CN102662630A CN102662630A (en) 2012-09-12
CN102662630B true CN102662630B (en) 2015-07-08

Family

ID=46772131

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210123079.8A Expired - Fee Related CN102662630B (en) 2012-04-24 2012-04-24 Code generation method

Country Status (1)

Country Link
CN (1) CN102662630B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104360861A (en) * 2014-11-19 2015-02-18 成都实景信息技术有限公司 Software code compiling system
CN107168864A (en) * 2016-03-08 2017-09-15 上海大唐移动通信设备有限公司 Code stream generation method and device
CN108829395A (en) * 2018-06-19 2018-11-16 中国电子科技集团公司第四十研究所 A kind of signal-oriented driver code automatic generation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5835771A (en) * 1995-06-07 1998-11-10 Rogue Wave Software, Inc. Method and apparatus for generating inline code using template metaprograms
CN101114226A (en) * 2007-08-28 2008-01-30 北京中企开源信息技术有限公司 Code automatically generating device based on model component, system and method
CN101651683A (en) * 2009-08-28 2010-02-17 重庆重邮东电通信技术有限公司 Method for generating analysis source code of signaling message

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5835771A (en) * 1995-06-07 1998-11-10 Rogue Wave Software, Inc. Method and apparatus for generating inline code using template metaprograms
CN101114226A (en) * 2007-08-28 2008-01-30 北京中企开源信息技术有限公司 Code automatically generating device based on model component, system and method
CN101651683A (en) * 2009-08-28 2010-02-17 重庆重邮东电通信技术有限公司 Method for generating analysis source code of signaling message

Also Published As

Publication number Publication date
CN102662630A (en) 2012-09-12

Similar Documents

Publication Publication Date Title
CN103377259B (en) A kind of multi-pattern match method and apparatus
CN100454257C (en) Embedded system
CN100373388C (en) Method for fast generating logical circuit
CN101145157B (en) XML format embedded type apparatus characteristic information analysis method
CN105955887B (en) A kind of generation method and system of test data
CN104991863A (en) Method for automatically generating testing case on basis of function block diagram testing module
CN102662630B (en) Code generation method
CN103259718A (en) Flow table conversion method and device
US8947272B2 (en) Decoding encoded data
CN105262644B (en) A kind of universal test system and test method based on protocol configuration
CN106528123A (en) SoC (System on a Chip) startup method and device based on eFuse module
JP4856432B2 (en) Methods, systems, and computer programs for modifying a multi-node tree structure (methods for automatically modifying a tree structure)
CN106776275B (en) A kind of testing process automatic generation method based on Packet Multiplexing
CN105446843A (en) SOC chip function test system and method
US7949509B2 (en) Method and tool for generating simulation case for IC device
CN103117748B (en) The method and system in a kind of BWT implementation method, suffix sorted
CN104331401A (en) Translation method and translation system
CN102014023A (en) VB Script based automatic testing method of network equipment products
US8626688B2 (en) Pattern matching device and method using non-deterministic finite automaton
JP5265318B2 (en) Logic verification device
CN103902514A (en) Word format extracting and reutilizing method
CN113127408A (en) Data conversion method and device
CN105786751B (en) A kind of USB-PD PHY circuit implementation method
CN103530479A (en) Partial testability design system and method for electronic design interchange format (EDIF) netlist-class circuits and based on Perl
CN108806797A (en) A kind of processing method and system of medical data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee
CP02 Change in the address of a patent holder

Address after: 510630 Guangdong city of Guangzhou province Panyu District Xiaoguwei Street West Outer Ring Road, room 629, 601-609 hall, Guangdong University of Technology, 100

Patentee after: Rising Micro Electronics Co., Ltd.

Address before: Five mountain Wushan Square C620-641 room 510630 Guangdong science and technology city of Guangzhou province Tianhe District

Patentee before: Rising Micro Electronics Co., Ltd.

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150708

Termination date: 20210424

CF01 Termination of patent right due to non-payment of annual fee