A kind of register access methods based on robotization RAL and system
Technical field
The present invention relates to chip register access technique field, is specifically a kind of register access methods based on robotization RAL (Register Abstraction Layer, register level of abstraction) and system.
Background technology
Along with IP (the Internet Protocol of global communication technology, Internet protocol) change process deepens continuously, the application demand of bag process class chip is increasing, the agreement that bag process is relevant also increases thereupon, and then make the test of wrapping process class chip increasingly sophisticated, when packet processing chip is tested, need the design of packet processing chip through too much taking turns, exploitation and checking.
In the driving exploitation and functional level proof procedure of chip, need the accessing operation repeatedly carrying out register.At present, the driving performance history of chip and functional level proof procedure have the following disadvantages respectively:
For driving exploitation, because the driving development scheme of chip is generally manual exploitation, when there is the Change In Design of hardware, software in register, can cause driving in performance history needs manually to carry out repeatedly software revision, and then make whole convergence process occur a large amount of repeatable operation, reduce development efficiency.
For chip functions level verification, because testing example design relies on the access of register, when the Change In Design of hardware, software appears in register, what can cause test case repeats revision and then the problem causing verification efficiency low.
Summary of the invention
The object of the invention is the deficiency in order to overcome above-mentioned background technology, a kind of register access methods based on robotization RAL and system are provided, the present invention can complete the access of register based on the automatic generation of register level of abstraction RAL, effectively improve the efficiency of chip development and checking.
For reaching above object, the invention provides a kind of register access methods based on robotization RAL, comprising the following steps:
S1: according to the form of regulation, creating some description document for describing register, proceeding to S2;
S2: utilize wscript.exe description document to be converted automatically to C file needed for access, proceed to S3;
S3: the register name of accessing as required, list item name and domain name, finds the corresponding domain information of register, the domain information of list item in the C file that conversion generates; Carry out the reading of corresponding thresholding according to the domain information found or change operation.
On the basis of technique scheme, the type of description document described in S1 comprises txt document, doc document and excel form; The content of described description document comprises fileinfo, register information and list item information:
The height bit position, address that described fileinfo comprises filename, file takies;
The domain information that described register information comprises register name, register offset address, register take number of words, register description and register; Wherein, the height bit position, address that the domain information of register comprises domain name, the side-play amount of place, territory word, territory take, read-only write instruction, territory description, territory default value;
Described list item information comprises list item name, entry number, entry take number of words, list item offset address, list item describe and the domain information of list item; Wherein, the height bit position, address that the domain information of list item comprises domain name, the side-play amount of place, territory word, territory take, read-write instruction, territory describe.
On the basis of technique scheme, S2 specifically comprises the following steps:
S201: specify the input path of description document and the outgoing route after changing C file; Obtain all description document under input path, proceed to S202;
S202: utilize wscript.exe to read each description document successively, the information of reading is preserved according to certain data structure, proceeds to S203;
S203: according to the template style of the information of preserving in S202 and required C file, under the outgoing route of specifying, conversion generates corresponding C file automatically, and S2 all terminates, and proceeds to S3.
On the basis of technique scheme, in S202, read each description document, the information of reading preserved according to certain data structure, specifically comprises the following steps:
During each reading description document, for the description document read defines a file class object, file class object is kept in a file list;
Read the key word instruction in description document line by line, when reading FileName, being expressed as fileinfo, fileinfo being kept at inside file class object; When reading RegMem/Register, then be expressed as list item/register information, for list item class object/register class object that list item/register definitions is corresponding, list item class object/register class object is formed corresponding list item list/ register list, and is kept in file class object; When reading MemRegFields/Fields, then be expressed as the domain information of the domain information/register of list item, for list item domain information class object/register field information class object that the domain information definition of the domain information/register of list item is corresponding, list item domain information class object/register field information class object is formed corresponding list item domain information list/ register field information list, and be kept in corresponding list item class object/register class object.
On the basis of technique scheme, C file corresponding described in S203 comprises following 9 files: allenum.h file, memacc.h file, memregs.h file, intenum.h file, allfields.h file, regs.c file, mems.c file, switch_xx.c file and fields.c file;
Allenum.h file is used for: define register name, list item name, domain name, conducts interviews to register or list item by calling this definition;
Memacc.h file is used for: the read-write operation defining the territory of each list item;
Memregs.h file is used for: the read-write operation defining all registers;
Intenum.h file is used for: definition register information search index, list item information search index;
Allfields.h file is used for: state the territory pointer of all registers, list item;
Regs.c file is used for: preserve all register informations, comprise the filename of description document belonging to register, register take number of words, register offset address, the territory number of register, the territory pointer of register, default value;
Mems.c file is used for: preserve all list item information, comprises the filename of description document belonging to the entry minimum index of list item, entry largest index, list item, list item offset address, list item entry address saltus step number of words, the territory number of list item, the territory pointer of list item;
Switch_xx.c file is used for: driving definition chip being carried out to register level of abstraction RAL, and the described content of definition that drives comprises list item corresponding to chip type, chip title, chip corresponding register transfer layer RTL version, register that chip is corresponding, chip and initialization value;
Fields.c file is used for: the domain information that save register, list item are corresponding, the domain information of each register, the domain information of list item are all preserved with the form of Array for structural body ARRAY, and the height bit position, address that each domain information comprises domain name, the side-play amount of place, territory word, territory take, read-write instruction.
On the basis of technique scheme, S3 specifically comprises the following steps:
S301: the register name of accessing as required, list item name, judges corresponding register, whether list item exists, if so, proceed to S302; Otherwise directly return error message, terminate;
S302: search corresponding all domain informations of register, all domain informations of list item in the C file that conversion generates, proceed to S303;
S303: according to the domain name that will access, judges in all domain informations of described register, whether there is the domain information corresponding with domain name respectively in all domain informations of described list item, if so, proceed to S304; Otherwise return error message, terminate;
S304: obtain corresponding domain information, and carry out the reading of corresponding thresholding according to the domain information of this correspondence or change operation.
On the basis of technique scheme, wscript.exe described in S2 adopts Tool Command Language TCL, and TCL is a kind of based on the indicative command language of character string.
The present invention also provides a kind of register access system based on robotization RAL realizing said method, comprises description document creation module, C file transform module and domain information operational module;
Described description document creation module is used for: according to the form of regulation, create some description document for describing register, sends switching signal to C file transform module;
Described C file transform module is used for: after receiving switching signal, utilizes wscript.exe description document to be converted automatically to C file needed for access, to domain information operational module transmit operation signal;
Described domain information operational module is used for: after receiving operation signal, the register name of accessing as required, list item name and domain name, in the C file that conversion generates, find the corresponding domain information of register, the domain information of list item; Carry out the reading of corresponding thresholding according to the domain information found or change operation.
On the basis of technique scheme, described C file transform module comprises file acquisition submodule, document analysis submodule and C file generated submodule;
Described file acquisition submodule is used for: specify the input path of description document and the outgoing route after changing C file; Obtain all description document under input path, send analytic signal to document analysis submodule;
Described document analysis submodule is used for: after receiving analytic signal, utilizes wscript.exe to read each description document successively, the information of reading is preserved according to certain data structure, sends file generated signal to C file generated submodule;
Described C file generated submodule is used for: after receiving file generated signal, and according to the template style of the information of preserving in document analysis submodule and required C file, under the outgoing route of specifying, conversion generates corresponding C file automatically.
On the basis of technique scheme, described domain information operational module comprise judge submodule, search submodule, domain information judges submodule and domain information process submodule;
Described judgement submodule is used for: the register name of accessing as required, list item name, judges corresponding register, whether list item exist, and if so, sends search signal to searching submodule; Otherwise directly return error message, terminate;
Described search submodule for: receive after searching signal, in the C file that conversion generates, search corresponding all domain informations of register, all domain informations of list item, judge that submodule transmission judges signal to domain information;
Described domain information judges that submodule is used for: receive after judging signal, according to the domain name that will access, judge in all domain informations of described register, whether there is the domain information corresponding with domain name respectively, if so, to domain information process submodule transmission processing signal in all domain informations of described list item; Otherwise return error message, terminate;
Described domain information process submodule is used for: after receiving processing signals, obtains corresponding domain information, and carries out the reading of corresponding thresholding according to the domain information of this correspondence or change operation.
Beneficial effect of the present invention is:
(1) the present invention utilizes wscript.exe description document to be converted automatically to C file needed for access, thus realize automatically generating RAL (register level of abstraction), register name, list item name and domain name that system is accessed as required, search the domain information of the domain information of corresponding register, list item in the C file automatically generated after, can operate corresponding thresholding, thus realize the access of register.
Therefore, when utilizing this method to carry out the access of register, do not need the specifying information being concerned about register or list item, when register or list item have renewal (as the change of height bit position, newly-increased territory etc. that address amendment, territory take), as long as register name, list item name, domain name do not change, just without the need to carrying out any amendment to code, only need upgrade the C file of the abstract middle generation of register, and then effectively can improve the efficiency of chip development and checking.
(2) the present invention is applicable to driving exploitation and the proof procedure of all kinds of chip, and the scope of application is relatively wider, and reusability is higher.
Accompanying drawing explanation
Fig. 1 is the process flow diagram based on the register access methods of robotization RAL in the embodiment of the present invention;
Fig. 2 is the process flow diagram of the concrete steps of S2 in the embodiment of the present invention;
Fig. 3 is the schematic diagram of the data structure of preserving resolving information in the embodiment of the present invention;
Fig. 4 is the process flow diagram of the concrete steps of S3 in the embodiment of the present invention.
Embodiment
Below in conjunction with drawings and the specific embodiments, the present invention is described in further detail.
Shown in Figure 1, the embodiment of the present invention provides a kind of register access methods based on robotization RAL, comprises the following steps:
S1: according to the form of regulation, creating some description document for describing register, proceeding to S2.
The type of this description document comprises txt document, doc document and excel form; The content of this description document comprises fileinfo, register information and list item information:
The height bit position, address that fileinfo comprises filename, file takies;
The domain information that register information comprises register name, register offset address, register take number of words, register description and register; Wherein, the height bit position, address that the domain information of register comprises domain name, the side-play amount of place, territory word, territory take, read-only write instruction, territory description, territory default value;
List item information comprises list item name, entry number, entry take number of words, list item offset address, list item describe and the domain information of list item; Wherein, the height bit position, address that the domain information of list item comprises domain name, the side-play amount of place, territory word, territory take, read-write instruction, territory describe.
In addition, in same description document, register name can not be identical with list item name, but domain name can be identical; In different description document, register name, list item name, domain name all can be identical.
S2: utilize wscript.exe description document to be converted automatically to C file needed for access, thus realize the automatic generation of RAL (register level of abstraction), proceed to S3.
Described wscript.exe adopts TCL (Tool Command Language, Tool Command Language) wscript.exe, and TCL is a kind of based on the indicative command language of character string.
When description document being converted automatically to the C file needed for access, the description document all description document of conversion, the description document changing certain form or conversion can being selected to specify based on user's request.
Shown in Figure 2, during practical operation, S2 specifically comprises the following steps:
S201: obtain description document: specify the input path of description document and the outgoing route after changing C file; Obtain all description document under input path, proceed to S202.
S202: mathematics expression file: utilize wscript.exe to read each description document successively, carries out preserving (as shown in Figure 3) according to certain data structure by the information of reading, proceeds to S203.
S203: generate C file: according to the template style of the information of preserving in S202 and required C file, conversion generates corresponding C file automatically under the outgoing route of specifying, and S2 all terminates, and proceeds to S3.
S3: the register name of accessing as required, list item name and domain name, finds the corresponding domain information of register, the domain information of list item in the C file that conversion generates; Carry out the reading of corresponding thresholding according to the domain information found or change operation.
Shown in Figure 4, during practical operation, S3 specifically comprises the following steps:
S301: the register name of accessing as required, list item name, judges corresponding register, whether list item exists, if so, proceed to S302; Otherwise directly return error message, terminate.
S302: search corresponding all domain informations of register, all domain informations of list item in the C file that conversion generates, proceed to S303.
S303: according to the domain name that will access, judges in all domain informations of described register, whether there is the domain information corresponding with domain name respectively in all domain informations of described list item, if so, proceed to S304; Otherwise return error message, terminate.
S304: obtain corresponding domain information, and carry out the reading of corresponding thresholding according to the domain information of this correspondence or change operation.
Each description document is read in S202, the information of reading is preserved according to certain data structure, specifically comprise the following steps: during each reading description document, for the description document read defines a file class (class, similar to C++, a kind of instantiation with same alike result or function) object, file class object is kept in a file list (list is the ordered set be made up of specific explanation element a pile in TCL) (information of corresponding description document can be accessed by file class object name);
Read the key word instruction in description document line by line, when reading FileName, being expressed as fileinfo, fileinfo being kept at inside file class object; When reading RegMem/Register, then be expressed as list item/register information, for list item class object/register class object that list item/register definitions is corresponding, list item class object/register class object is formed corresponding list item list/ register list, and is kept in file class object; When reading MemRegFields/Fields, then be expressed as the domain information of the domain information/register of list item, for list item domain information class object/register field information class object that the domain information definition of the domain information/register of list item is corresponding, list item domain information class object/register field information class object is formed corresponding list item domain information list/ register field information list, and be kept in corresponding list item class object/register class object.
C file corresponding described in S203 comprises following 9 files: allenum.h file, memacc.h file, memregs.h file, intenum.h file, allfields.h file, regs.c file, mems.c file, switch_xx.c file and fields.c file;
Allenum.h file is used for: define register name, list item name, domain name, conducts interviews to register or list item by calling this definition;
Memacc.h file is used for: the read-write operation defining the territory of each list item;
Memregs.h file is used for: the read-write operation defining all registers;
Intenum.h file is used for: definition register information search index, list item information search index;
Allfields.h file is used for: state the territory pointer of all registers, list item;
Regs.c file is used for: preserve all register informations, comprise the filename of description document belonging to register, register take number of words, register offset address (description document base address+register offset address=register address), the territory number of register, the territory pointer (domain information that register can be found corresponding based on the territory pointer of register) of register, default value.
Mems.c file is used for: preserve all list item information, comprise the filename of description document belonging to the entry minimum index of list item, entry largest index, list item, list item offset address, list item entry address saltus step number of words (description document base address+list item offset address+entry index * entry address saltus step number of words, namely for this reason the corresponding bar destination address of list item), the territory number of list item, the territory pointer (domain information that list item can be found corresponding based on the territory pointer of list item) of list item.
Switch_xx.c file is used for: carry out RAL to chip and drive definition, the content of this driving definition comprises list item corresponding to chip type, chip title, corresponding RTL (Register-Transport-layer, the register transfer layer) version of chip, register that chip is corresponding, chip and initialization value.
Fields.c file is used for: the domain information that save register, list item are corresponding, the domain information of each register, the domain information of list item are all preserved with the form of Array for structural body ARRAY, and the height bit position, address that each domain information comprises domain name, the side-play amount of place, territory word, territory take, read-write instruction.
The present invention also provides a kind of register access system based on robotization RAL realizing said method, comprises description document creation module, C file transform module and domain information operational module.
Description document creation module is used for: according to the form of regulation, create some description document for describing register, sends switching signal to C file transform module.
C file transform module is used for: after receiving switching signal, utilizes wscript.exe description document to be converted automatically to C file needed for access, to domain information operational module transmit operation signal.
Wherein, C file transform module comprises file acquisition submodule, document analysis submodule and C file generated submodule;
File acquisition submodule is used for: specify the input path of description document and the outgoing route after changing C file; Obtain all description document under input path, send analytic signal to document analysis submodule;
Document analysis submodule is used for: after receiving analytic signal, utilizes wscript.exe to read each description document successively, the information of reading is preserved according to certain data structure, sends file generated signal to C file generated submodule;
C file generated submodule is used for: after receiving file generated signal, and according to the template style of the information of preserving in document analysis submodule and required C file, under the outgoing route of specifying, conversion generates corresponding C file automatically.
Domain information operational module is used for: after receiving operation signal, the register name of accessing as required, list item name and domain name, in the C file that conversion generates, find the corresponding domain information of register, the domain information of list item; Carry out the reading of corresponding thresholding according to the domain information found or change operation.
Wherein, domain information operational module comprise judge submodule, search submodule, domain information judges submodule and domain information process submodule;
Judge that submodule is used for: the register name of accessing as required, list item name, judge corresponding register, whether list item exist, if so, send search signal to searching submodule; Otherwise directly return error message, terminate;
Search submodule for: receive after searching signal, in the C file that conversion generates, search corresponding all domain informations of register, all domain informations of list item, judge that submodule transmission judges signal to domain information;
Domain information judges that submodule is used for: receive after judging signal, according to the domain name that will access, judge in all domain informations of described register, whether there is the domain information corresponding with domain name respectively, if so, to domain information process submodule transmission processing signal in all domain informations of described list item; Otherwise return error message, terminate;
Domain information process submodule is used for: after receiving processing signals, obtains corresponding domain information, and carries out the reading of corresponding thresholding according to the domain information of this correspondence or change operation.
The present invention is not limited to above-mentioned embodiment, and for those skilled in the art, under the premise without departing from the principles of the invention, can also make some improvements and modifications, these improvements and modifications are also considered as within protection scope of the present invention.The content be not described in detail in this instructions belongs to the known prior art of professional and technical personnel in the field.