[go: up one dir, main page]

CN100470468C - Method for automatically converting high-order program language into hardware description language - Google Patents

Method for automatically converting high-order program language into hardware description language Download PDF

Info

Publication number
CN100470468C
CN100470468C CNB2006100049032A CN200610004903A CN100470468C CN 100470468 C CN100470468 C CN 100470468C CN B2006100049032 A CNB2006100049032 A CN B2006100049032A CN 200610004903 A CN200610004903 A CN 200610004903A CN 100470468 C CN100470468 C CN 100470468C
Authority
CN
China
Prior art keywords
diagram
hardware
description language
sub
hardware description
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
CNB2006100049032A
Other languages
Chinese (zh)
Other versions
CN101000541A (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.)
Datong University
Tatung Co Ltd
Original Assignee
Tatung 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 Tatung Co Ltd filed Critical Tatung Co Ltd
Priority to CNB2006100049032A priority Critical patent/CN100470468C/en
Publication of CN101000541A publication Critical patent/CN101000541A/en
Application granted granted Critical
Publication of CN100470468C publication Critical patent/CN100470468C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The invention relates to a method for automatically converting a high-level program language into a hardware description language, which can generate the corresponding hardware description language by converting functions described by the high-level program language through a three-stage conversion mechanism. In the first stage, the original program code of high-level program language is converted into extended active diagram, then the second stage converts the active diagram into hardware component diagram, and finally the third stage generates corresponding signal connection of VHDL component according to the on-line of the hardware component diagram, and outputs the entity and structure of VHDL to a file in character string mode to complete the whole conversion.

Description

将高阶程序语言自动转换成硬件描述语言的方法 Method for automatically converting high-level programming language into hardware description language

技术领域 technical field

本发明是关于一种高阶程序语言自动转换成硬件描述语言(VHDL)的方法,尤指一种经由将原始程序代码(source code)转换成延伸活动图(Extended Activity Diagram,EAD)、将延伸活动图转换成硬件组件图(Hardware Component Graph,HCG)及将硬件组件图转换为硬件描述语言等三阶段转换,而将高阶程序语言自动转换成硬件描述语言(VHDL)的方法。The invention relates to a method for automatically converting a high-level programming language into a hardware description language (VHDL), especially a method for converting an original program code (source code) into an extended activity diagram (Extended Activity Diagram, EAD). A method of converting the activity diagram into a hardware component graph (Hardware Component Graph, HCG) and converting the hardware component graph into a hardware description language, and automatically converting a high-level programming language into a hardware description language (VHDL).

背景技术 Background technique

传统的高阶程序语言(例如:Java、C、C++等)无法将原始码所描述的功能直接转换产生相对应的硬件描述语言(例如:VHDL)。由于传统的硬件描述语言(例如:VHDL)并不适合直接描述高阶程序语言的程序逻辑和执行流程,因此无法将高阶程序语言所描述的功能直接转换至相对应的硬件描述语言,而造成设计上的困扰。且由于高阶程序语言的种类繁多,所以尽管所设计程序功能相同,也会因为程序语言的特性而无法统一完整的执行流程,造成硬件组件设计上的困扰,因此,公知的方法无法将高阶程序语言所描述的功能直接转换成相对应的硬件描述语言,而有予以改进的必要。Traditional high-level programming languages (such as Java, C, C++, etc.) cannot directly convert the functions described in the source code into corresponding hardware description languages (such as VHDL). Since the traditional hardware description language (such as: VHDL) is not suitable for directly describing the program logic and execution flow of the high-level programming language, it is impossible to directly convert the functions described in the high-level programming language to the corresponding hardware description language, resulting in Design troubles. And because there are many kinds of high-level programming languages, even though the functions of the designed programs are the same, the complete execution process cannot be unified due to the characteristics of the programming languages, causing troubles in the design of hardware components. Therefore, known methods cannot combine high-level The functions described in the programming language are directly converted into the corresponding hardware description language, and there is a need for improvement.

发明内容 Contents of the invention

本发明的目的在于提供一种高阶程序语言自动转换成硬件描述语言的方法。The purpose of the present invention is to provide a method for automatically converting a high-level programming language into a hardware description language.

为实现上述目的。本发明提供的将高阶程序语言自动转换成硬件描述语言的方法,包括下列步骤:In order to achieve the above purpose. The method for automatically converting a high-level programming language into a hardware description language provided by the present invention comprises the following steps:

(A)读取一高阶程序语言的原始码;(A) reading the source code of a high-level programming language;

(B)将该高阶程序语言的原始码转换成一延伸活动图,其中,步骤(B)包括下列子步骤:(B) converting the source code of the high-level programming language into an extended activity diagram, wherein step (B) includes the following sub-steps:

(B1)读取一行高阶程序语言的原始码;(B1) read the source code of a line of high-level programming language;

(B2)如该读取的原始码不为一叙述指令时,将非叙述指令转换成相对应的子活动图,再执行步骤(B1);(B2) When the read source code is not a narrative instruction, convert the non-narrative instruction into a corresponding subactivity diagram, and then perform step (B1);

(B3)如该读取的原始码为一叙述指令时,且该叙述指令的前方有一叙述式时,将该叙述式转换成一子活动图;(B3) If the read source code is a narration command, and when there is a narration in front of the narration command, convert the narration into a sub-activity diagram;

(B4)产生一选择节点;(B4) generating a selection node;

(B5)产生二中介点,该二中介点连接该选择节点;(B5) generating two intermediary points, the two intermediary points connecting the selected node;

(B6)将叙述式转换成相对应的子活动图;(B6) Converting the narrative into corresponding sub-activity diagrams;

(B7)产生一合并节点以合并子活动图;(B7) generating a merge node to merge sub-activity diagrams;

(B8)连接该叙述式经由转换后所产生的子活动图至右中介点;(B8) Connect the sub-activity diagram generated by the conversion of the narrative to the right intermediate point;

(B9)连接该叙述式经由转换后所产生的子活动图至合并节点;以及(B9) connecting the sub-activity diagram generated by the transformation of the narrative to the merge node; and

(B10)判断是否仍有指令未转换成子活动图,若仍有,再执行步骤(B1),否则,输出一个完整的活动图;(B10) judging whether there is still an instruction that has not been converted into a sub-activity diagram, if there is still, perform step (B1), otherwise, output a complete activity diagram;

(C)将该延伸活动图转换成一硬件组件图;(C) converting the extended activity diagram into a hardware component diagram;

(D)将该硬件组件图转换成硬件描述语言;以及(D) converting the hardware component diagram into a hardware description language; and

(E)输出该硬件描述语言。(E) Outputting the hardware description language.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中该高阶程序语言为Java、C、或C++程序语言。The method for automatically converting a high-level programming language into a hardware description language, wherein the high-level programming language is Java, C, or C++ programming language.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中该延伸活动为代表一种流程控制图。In the method for automatically converting a high-level programming language into a hardware description language, the extended activity represents a flow control chart.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中该延伸活动图包括:开始(start)、结束(end)、中介点(curve point)、微运算(micro-operation)、分叉(fork)、连结(join)、选择(select)、合并(merge)共八种节点。The method for automatically converting a high-level programming language into a hardware description language, wherein the extended activity diagram includes: start (start), end (end), intermediate point (curve point), micro-operation (micro-operation), branch Fork (fork), link (join), selection (select), merge (merge) a total of eight kinds of nodes.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中该硬件组件图是以表示硬件组件与硬件组件之间的连接关系。In the method for automatically converting a high-level programming language into a hardware description language, the hardware component diagram is to represent hardware components and the connection relationship between hardware components.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中该硬件组件图包括:开始节点、结束节点及组件节点三种型态。In the method for automatically converting a high-level programming language into a hardware description language, the hardware component diagram includes three types: a start node, an end node and a component node.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中该硬件描述语言为VHDL或Verilog。The method for automatically converting a high-level programming language into a hardware description language, wherein the hardware description language is VHDL or Verilog.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中于步骤(A3)中,该叙述指令包括:for、while、do、if、switch指令。The method for automatically converting a high-level programming language into a hardware description language, wherein in step (A3), the narration instructions include: for, while, do, if, and switch instructions.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中步骤(C)包括下列子步骤:The method for automatically converting a high-level programming language into a hardware description language, wherein step (C) includes the following sub-steps:

(C1)读取该延伸活动图中的一子活动图,且当该延伸活动图的子活动图均已被读取时,执行步骤(C5);(C1) read a sub-activity diagram in the extended activity diagram, and when all the sub-activity diagrams in the extended activity diagram have been read, perform step (C5);

(C2)当判断该读取的子活动图的所属的型态为分叉、连结、或合并其中的一时,直接转换成相对应的硬件组件图,并执行步骤(C1);(C2) When it is judged that the type of the read sub-activity diagram is one of fork, link, or merge, directly convert it into a corresponding hardware component diagram, and execute step (C1);

(C3)当判断该读取的子活动图为微运算型态时,将该微运算子活动图进行语法分析转换,并将微运算子活动图转换成相对应的硬件组件图,再执行步骤(C1);(C3) When it is judged that the read sub-activity diagram is a micro-operation type, perform syntax analysis conversion on the micro-operation sub-activity diagram, and convert the micro-operation sub-activity diagram into a corresponding hardware component diagram, and then perform the steps (C1);

(C4)当判断该读取的子活动图为选择型态时,对该等硬件组件图上的输出端上的标记进行分析后,再进行语法分析转换,并该选择子活动图转换成硬件组件图后,再执行步骤(C1);以及(C4) When it is judged that the read sub-activity diagram is a selection type, after analyzing the marks on the output terminals on the hardware component diagrams, then perform syntax analysis and conversion, and convert the selection sub-activity diagram into hardware After the component diagram, step (C1) is performed; and

(C5)连接该等硬件组件图的输入端及输出端,输出完整的硬件组件图。(C5) Connecting the input and output ends of the hardware component diagrams to output a complete hardware component diagram.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中步骤(D)包括下列子步骤:The method for automatically converting a high-level programming language into a hardware description language, wherein step (D) includes the following sub-steps:

(D1)读取一硬件组件图,其中该硬件组件图包括有复数个子硬件组件图,将该硬件组件图转换至一修正硬件组件图,以执行硬件描述语言转换;(D1) reading a hardware component diagram, wherein the hardware component diagram includes a plurality of sub-hardware component diagrams, converting the hardware component diagram into a modified hardware component diagram to perform hardware description language conversion;

(D2)找出该硬件组件图的一起始节点,以得到相对应的子硬件组件图;(D2) finding a starting node of the hardware component graph to obtain a corresponding sub-hardware component graph;

(D3)分析该起始节点的信息,以加入输入及输出的组件,以产生硬件描述语言的实体,直到所有起始节点均分析完成;(D3) analyzing the information of the start node to add input and output components to generate hardware description language entities until all start nodes are analyzed;

(D4)判断该硬件组件图中节点的型别,产生相对应的硬件描述语言对象,并将相关信息写入硬件描述语言的架构中;(D4) judging the type of the node in the hardware component diagram, generating a corresponding hardware description language object, and writing the relevant information into the architecture of the hardware description language;

(D5)根据该硬件组件图的联机,产生相对应硬件描述语言组件的讯号连接;以及(D5) According to the connection of the hardware component diagram, generate the signal connection of the corresponding hardware description language component; and

(D6)以字符串方式将硬件描述语言的实体和架构输出至一档案。(D6) Outputting the entity and structure of the hardware description language to a file in the form of character strings.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中于步骤(C4)中,是使用组件叫用方式,以产生相对应的硬件描述语言对象。In the method for automatically converting a high-level programming language into a hardware description language, in step (C4), a component calling method is used to generate a corresponding hardware description language object.

所述的将高阶程序语言自动转换成硬件描述语言的方法,其中于步骤(C1)中,还包含将该硬件组件图转换至一修正硬件组件图,俾执行硬件描述语言转换。The method for automatically converting a high-level programming language into a hardware description language, wherein in step (C1), further includes converting the hardware component diagram into a revised hardware component diagram, so as to perform the hardware description language conversion.

本发明的高阶程序语言(例如:Java、C、C++)自动转换成硬件描述语言(VHDL)的方法可由三个阶段的转换机制,而将高阶程序语言所描述的功能直接转换至相对应的硬件描述语言,其不受限于高阶程序语言的种类,并可统一完整的执行流程,而不会造成硬件组件设计上的困扰。The method that the high-level programming language (for example: Java, C, C ++) of the present invention is automatically converted into the hardware description language (VHDL) can be by the conversion mechanism of three stages, and the function described in the high-level programming language is directly converted into the corresponding It is not limited to the type of high-level programming language, and can unify the complete execution process without causing troubles in the design of hardware components.

附图说明 Description of drawings

图1为本发明一较佳实施例的高阶程序语言直接转换成硬件描述语言的三阶段转换流程。FIG. 1 is a three-stage conversion process of directly converting a high-level programming language into a hardware description language in a preferred embodiment of the present invention.

图2为本发明一较佳实施例的UML中所定义的活动图。Fig. 2 is an activity diagram defined in UML of a preferred embodiment of the present invention.

图3为本发明一较佳实施例的EAD中所定义的活动图。Fig. 3 is an activity diagram defined in the EAD of a preferred embodiment of the present invention.

图4为本发明一较佳实施例的原始码转换成EAD的转换流程。FIG. 4 is a flow chart of converting source code into EAD in a preferred embodiment of the present invention.

图5为本发明一较佳实施例的原始码转换成EAD的完整的转换流程。Fig. 5 is a complete conversion process of converting source code into EAD in a preferred embodiment of the present invention.

图6A为本发明一较佳实施例的JAVA程序。FIG. 6A is a JAVA program of a preferred embodiment of the present invention.

图6B为本发明一较佳实施例的JAVA程序对应的EAD。FIG. 6B is an EAD corresponding to a JAVA program in a preferred embodiment of the present invention.

图7A为本发明一较佳实施例的开始节点图。FIG. 7A is a start node diagram of a preferred embodiment of the present invention.

图7B为本发明一较佳实施例的结束节点图。Fig. 7B is an end node diagram of a preferred embodiment of the present invention.

图7C为本发明一较佳实施例的组件节点图。FIG. 7C is a component node diagram of a preferred embodiment of the present invention.

图7D为本发明一较佳实施例的控制路径节点。FIG. 7D is a control path node of a preferred embodiment of the present invention.

图7E为本发明一较佳实施例的数据路径节点。FIG. 7E is a data path node of a preferred embodiment of the present invention.

图8为本发明一较佳实施例的EAD转换成与硬件组件的流程图。FIG. 8 is a flowchart of EAD conversion and hardware components according to a preferred embodiment of the present invention.

图9为本发明一较佳实施例的EAD所对应的HCG图。Fig. 9 is a graph of HCG corresponding to EAD in a preferred embodiment of the present invention.

图10为本发明一较佳实施例的硬件组件图(HCG)转换成VHDL硬件描述语言的流程图。FIG. 10 is a flow chart of converting the hardware component graph (HCG) into VHDL hardware description language in a preferred embodiment of the present invention.

图11为本发明一较佳实施例的Java加法器的示意图。FIG. 11 is a schematic diagram of a Java adder in a preferred embodiment of the present invention.

图12为本发明一较佳实施例的Java加法器对应的硬件组件图的示意图。FIG. 12 is a schematic diagram of a hardware component diagram corresponding to a Java adder in a preferred embodiment of the present invention.

图13、14、15、16、17为本发明一较佳实施例的的硬件组件图修正过程的的示意图。13 , 14 , 15 , 16 , and 17 are schematic diagrams of the modification process of the hardware component diagram in a preferred embodiment of the present invention.

图18、19、20、21、22、23、24、25为本发明一较佳实施例的硬件组件图转换成VHDL程序代码的示意图。18 , 19 , 20 , 21 , 22 , 23 , 24 , and 25 are schematic diagrams of converting the hardware component diagrams of a preferred embodiment of the present invention into VHDL program codes.

具体实施方式 Detailed ways

由于传统的方法无法直接将高阶程序语言直接转换成硬件描述语言,因此,本发明提出一种三阶段转换方法,如图1所示,将高阶程序语言(例如:Java、C、C++)所描述的功能经由原始程序代码转换成延伸活动图(Source code→EAD)、延伸活动图转换成硬件组件图(EAD→HCG)、及硬件组件图转换为硬件描述语言(HCG→VHDL)三个阶段的转换,而将高阶程序语言自动转成硬件描述语言。如图1所示,在第一个阶段(Sourcecode→EAD)中,首先读取一高阶程序语言的原始码(步骤S101),将高阶程序语言的原始程序代码转换成一延伸活动图(步骤S102),接着,进入第二阶段(EAD→HCG),将延伸活动图转换成一硬件组件图(步骤S103),最后,进行第三阶段(HCG→VHDL),根据硬件组件图的联机,产生相对应的硬件描述语言(VHDL组件的讯号连接)(步骤S104),并以字符串方式将VHDL的实体和架构输出至一档案,产生相对应的硬件描述语言(例如:VHDL程序代码)(步骤S105)。Because traditional methods cannot directly convert high-level programming languages into hardware description languages, the present invention proposes a three-stage conversion method. As shown in Figure 1, high-level programming languages (such as: Java, C, C++) The described function is converted into an extended activity diagram (Source code→EAD), an extended activity diagram is converted into a hardware component diagram (EAD→HCG), and a hardware component diagram is converted into a hardware description language (HCG→VHDL) through the original program code. Stage conversion, and the high-level programming language is automatically converted into a hardware description language. As shown in Figure 1, in the first stage (Sourcecode→EAD), first read the source code of a high-level programming language (step S101), and convert the original program code of the high-level programming language into an extended activity diagram (step S102), then, enter the second stage (EAD → HCG), convert the extended activity diagram into a hardware component diagram (step S103), and finally, carry out the third stage (HCG → VHDL), according to the connection of the hardware component diagram, generate the corresponding Corresponding hardware description language (signal connection of VHDL components) (step S104), and export the entity and structure of VHDL to a file in character string mode, generate corresponding hardware description language (for example: VHDL program code) (step S105 ).

如上所述,在第一阶段中,必须先将高阶程序语言的原始程序代码转换成一个中间格式一活动图(Activity Diagram,AD),AD是一种流程的描述图,请参阅图2所示为UML(Unified Modeling Language,UML)中所定义的活动图,其包含有五种组件图:Action state、fork、join、select及merge,在本发明中,为了要保留一些程序所需的信息,因此,必须修改部分AD的组件,所使用的活动图称为延伸活动图(Extended activity diagram,EAD),请参阅图3所示。As mentioned above, in the first stage, the original program code of the high-level programming language must be converted into an intermediate format—Activity Diagram (AD), AD is a description diagram of a process, please refer to Figure 2 Shown as the activity diagram defined in UML (Unified Modeling Language, UML), it contains five kinds of component diagrams: Action state, fork, join, select and merge, in the present invention, in order to keep the required information of some programs , therefore, some components of AD must be modified, and the activity diagram used is called Extended activity diagram (EAD), as shown in Figure 3.

如图3所示,EAD是一种用以将高级语言的原始码转换成相对应的流程的控制图,其由复数个节点(node)所组成,由不同节点组合以构成子活动图(sub-graph),每一个子活动图中各自包含了起始、执行及结束等三个部分。在本实施例中,定义了多种不同的节点。以下逐一介绍各种不同的节点:As shown in Figure 3, EAD is a control graph used to convert the source code of a high-level language into a corresponding process, which is composed of a plurality of nodes (node), and different nodes are combined to form a sub-activity graph (sub -graph), each sub-activity graph contains three parts: start, execution and end. In this embodiment, a variety of different nodes are defined. The various nodes are described one by one below:

1.开始(start)节点:表示一个子活动图的开端;1. Start (start) node: indicates the beginning of a sub-activity graph;

2.结束(end)节点:表示一个子活动图的结束;2. End (end) node: indicates the end of a sub-activity graph;

3.中介点(curve point)节点:表示两个有方向性的连接线(edge)的连接,对于执行没有实际的影响,通常用于方便转换过程的暂时性用途;3. Intermediate point (curve point) node: It represents the connection of two directional connection lines (edge), which has no actual impact on execution, and is usually used for temporary purposes to facilitate the conversion process;

4.微运算(micro-operation)节点:表示表示一个叙述(expressionstatement)或表示法(expression)的处理;4. Micro-operation node: represents the processing of an expression statement or expression;

5.分叉(fork)节点:表示平行执行;5. Fork node: means parallel execution;

6.连结(join)节点:表示只有当所有的微运算都到达时,才有输出讯号的发出;6. Join node: It means that only when all the micro-operations arrive, the output signal will be issued;

7.选择(select)节点:表示在译码后,会选择发出一个适当的输出讯号;以及7. Select node: indicates that after decoding, an appropriate output signal will be selected and sent; and

8.合并(merge)节点:表示将输入讯号加以合并后输出。8. Merge (merge) node: Indicates that the input signals are combined and then output.

上述每一节点视为一对象,于该对象中会记录两种数据型态以代表连接自己的节点(In-Node)及自己将和其它相连的节点(Out-Node),其节点型态会随语法而改变,在解析每一段语法时,均会产生相对应的子活动图,并记录该子活动图的In-Node及Out-Node以供其它子活动图连接使用。依照此连接方式,每一段语法中子活动图的产生亦使用相同的方式。将每一个子活动图相连后,即可产生将程序原始码转换成相对应的活动图,以可视化的方式呈现原始码的程序逻辑和执行流程。Each of the above nodes is regarded as an object, and two data types are recorded in the object to represent the node (In-Node) connected to itself and the node (Out-Node) to be connected to itself, and the node type will be Changes with the grammar, when parsing each piece of grammar, a corresponding sub-activity diagram will be generated, and the In-Node and Out-Node of the sub-activity diagram will be recorded for the connection of other sub-activity diagrams. According to this connection method, the generation of sub-activity diagrams in each syntax also uses the same method. After connecting each sub-activity diagram, the program source code can be converted into a corresponding activity diagram, and the program logic and execution flow of the source code can be presented in a visual way.

图4显示将高阶程序语言自动转换成延伸活动图的流程。如图4所示,以JAVA程序语言为例,以将JAVA程序实作转换成延伸活动图。其利用JavaCC(Java Compiler Compiler,JavaCC)所定义的Java标准语法规格为基础(使用JDK(Java Development Kit)1.5),在JavaCC的grammar file中加入一段Java程序,而产生一个修改过的Java语法档案。而JavaCC则依据这个Java语法档案来产生Java解析器(Java Parser)类别以及Java解析器所需要使用到的其它类别,而这个产生出来的Java解析器类别能够提供从Java原始码转换为相对应EAD的功能。在本实施例中,将Java解析器类别整合于一计算机辅助电路设计软件中,使软件具有转换Java原始码至EAD的功能,接着,将完整的Java原始码传入Java Parser中,Java Parser会依照程序中不同的标记(token),对应在语法文件中新产生EAD的指令,然后将EAD图形转换出来。Figure 4 shows the flow of automatic conversion of high-level programming language into extended activity diagrams. As shown in FIG. 4 , the JAVA program language is taken as an example to convert the JAVA program implementation into an extended activity diagram. It uses the Java standard grammar specification defined by JavaCC (Java Compiler Compiler, JavaCC) as the basis (using JDK (Java Development Kit) 1.5), and adds a Java program to the grammar file of JavaCC to generate a modified Java grammar file . And JavaCC generates the Java Parser (Java Parser) category and other categories that the Java Parser needs to use based on the Java grammar file, and the generated Java Parser category can provide conversion from Java source code to the corresponding EAD function. In this embodiment, the Java parser category is integrated in a computer-aided circuit design software, so that the software has the function of converting the Java source code to EAD, and then, the complete Java source code is imported into the Java Parser, and the Java Parser will According to different tokens in the program, corresponding to the newly generated EAD instructions in the grammar file, and then convert the EAD graphics.

本发明提出一个完整的转换流程,请参阅图5所示,当要将原始码自动转换成相对应的延伸活动图时,首先,读取一行高阶程序语言(high levellanguage)的原始码(步骤S501),接着,判断原始码的型态是否为一叙述指令(statement instruction)(步骤S502),在本实施例中,叙述指令包括:for、while、do、if、switch指令。当原始码的型态不为上述叙述指令中的其中任一个指令时,将此非叙述指令直接转换成相对应的子活动图(步骤S503),再重新读取下一行高阶程序语言的原始码(步骤S501)。The present invention proposes a complete conversion process, as shown in Figure 5, when the original code is automatically converted into a corresponding extended activity diagram, at first, read the original code of a line of high level language (step S501), then, determine whether the type of the source code is a statement instruction (step S502), in this embodiment, the statement instruction includes: for, while, do, if, switch instructions. When the type of the source code is not any of the above-mentioned narration instructions, the non-narration instruction is directly converted into a corresponding sub-activity diagram (step S503), and then the original code of the next line of high-level programming language is read again. code (step S501).

当步骤S502判断出原始码为一叙述指令时,需再判断条件表达式的前方是否有一叙述式(statement)(步骤S504),若有叙述式于条件表达式前方,先将叙述式转换成相对应的子活动图(sub-graph)(步骤S505)。When step S502 judges that the original code is a narrative instruction, it is necessary to judge whether there is a narrative formula (statement) in front of the conditional expression (step S504). Corresponding sub-graph (step S505).

若无叙述式于条件表达式前方,则直接产生一选择节点(selectnode)(步骤S506);接着,产生二中介点(curve point)(步骤S507),该二中介点连接至选择节点;然后,再将叙述式转换成相对应的子活动图(步骤S508),之后,产生一合并节点(merge node)以合并子活动图(步骤S509);再连接该叙述式经由转换后所产生的子活动图至右中介点(步骤S510),连接该叙述式经由转换后所产生的子活动图至合并节点(步骤S511),最后,再判断是否仍有指令仍未转换成子活动图(步骤S512),若仍有,则回到步骤S501以重新读取下一行高阶程序语言的原始码,若已无指令需转换,则输出一个完整EAD(步骤S513)。If there is no statement in front of the conditional expression, then directly generate a selection node (selectnode) (step S506); then, generate two intermediate points (curve point) (step S507), these two intermediate points are connected to the selection node; then, Then convert the narrative into a corresponding sub-activity diagram (step S508), and then generate a merge node (merge node) to merge the sub-activity diagrams (step S509); then connect the sub-activity generated by the conversion of the narrative Figure to the right intermediate point (step S510), connect the sub-activity diagram generated by the narrative formula to the merge node (step S511), and finally, judge whether there are still instructions that have not been converted into sub-activity diagrams (step S512), If there is still, then return to step S501 to re-read the source code of the next line of high-level programming language, if there is no instruction to be converted, then output a complete EAD (step S513).

经由上述步骤,将一段完整的JAVA程序语言转换成相对应的EAD,以可视化方式呈现原始码的程序逻辑和执行流程。请参阅图6所示,图6A为利用If Statement及所撰写的程序,依据上述的转换流程和规则,可转换成相对应的EAD,如图6B所示。除此之外,相同的程序利用上述的转换流程和规则,亦可转换成相对应的EAD。由于JAVA程序语法的不同,因此所产生的EAD也不相同。Through the above steps, a complete piece of JAVA programming language is converted into the corresponding EAD, and the program logic and execution flow of the original code are presented in a visual way. Please refer to Figure 6. Figure 6A is the program written by using the If Statement. According to the above-mentioned conversion process and rules, it can be converted into the corresponding EAD, as shown in Figure 6B. In addition, the same program can also be converted into the corresponding EAD by using the above-mentioned conversion process and rules. Due to the different syntax of JAVA programs, the resulting EADs are also different.

经由上述转换后,完成了第一阶段的转换,接着,进行第二阶段的转换,以将延伸活动图转换成硬件组件图(HCG),以HCG表示高阶程序语言与硬件之间的关系。After the above conversion, the first phase of conversion is completed, and then the second phase of conversion is performed to convert the extended activity diagram into a hardware component diagram (HCG), and HCG is used to represent the relationship between the high-level programming language and the hardware.

请参阅图7A~7C所示的硬件组件图的图形规格图,HCG共分成三种型态:Please refer to the graphic specifications of the hardware component diagrams shown in Figures 7A to 7C. HCGs are divided into three types:

1.开始节点(start node):如图7A所示,开始节点记录了JAVA程序的class name、method name、parameter、local variable、global variable、returntype;其定义如下:1. Start node (start node): as shown in Figure 7A, the start node records the class name, method name, parameter, local variable, global variable, returntype of the JAVA program; its definition is as follows:

i.方法(method)的信息,包含方法的名称及其修饰子(modifier);i. Method (method) information, including the name of the method and its modifier (modifier);

ii.回传值的信息,包含其型态、位大小及回传值名称;ii. Information about the return value, including its type, bit size and name of the return value;

iii.参数(parameter)的信息,包含其型态、位大小及参数名称;iii. Parameter information, including its type, bit size and parameter name;

iv.区域变量(local variable)的信息,包含型态、位大小及区域变量名称。iv. Local variable information, including type, bit size and local variable name.

2.结束节点(end node):如图7B所示,结束节点表示方法(method)已结束,并标示出欲传回的变量;其中,结束节点的内容为欲回传的变量名称,若不回传任何变量,则关键词为VOID。2. End node: As shown in Figure 7B, the end node indicates that the method (method) has ended, and marks the variable to be returned; where the content of the end node is the name of the variable to be returned, if not Returns any variable, the keyword is VOID.

3.组件节点(component node):如图7C所示,组件节点标示出register、fork、adder....等硬件组件,而节点与节点间以一有方向线连接并标示出从起始对象的某一输出端口(output port)连接至目标对象的某一输入端口(input port)。3. Component node (component node): As shown in Figure 7C, the component node marks the hardware components such as register, fork, adder..., and the nodes are connected with a directional line and marked from the starting object An output port of the target object is connected to an input port of the target object.

组件节点又可再细分成两个主要的部分:The component node can be subdivided into two main parts:

(1)控制路径模块(Control path module),参阅图7D所示,其包括:(1) Control path module (Control path module), refer to shown in Figure 7D, it comprises:

■串行式组件(Q-element)表示其对应的硬件在执行时须依序执行;■Serial component (Q-element) indicates that its corresponding hardware must be executed sequentially during execution;

■并列式组件(Fork-element)表示对应的硬件执行时平行执行;■ Parallel component (Fork-element) means that the corresponding hardware is executed in parallel;

■同步组件(Join-element)表示对应的硬件在相关运算都到达时,才有输出讯号的发出;■Synchronous component (Join-element) indicates that the corresponding hardware will only send out output signals when all relevant operations are completed;

■条件分支组件(Decoder-element)表示对应的硬件在译码后,会选择发出一个适当的输出讯号;■The conditional branch component (Decoder-element) indicates that the corresponding hardware will choose to send an appropriate output signal after decoding;

■合并组件(Merge element)表示对应的硬件将输入讯号加以合并后输出;■Merge element means that the corresponding hardware will combine the input signals and output them;

(2)数据路径模块(Data path module),参阅图7E所示,其包括:(2) Data path module (Data path module), referring to shown in Figure 7E, it comprises:

■运算逻辑单元(ALU):AND-element、OR-element、XOR-element、ADD-element、SUB-element、MUL-element、DIV-element;■ Operational logic unit (ALU): AND-element, OR-element, XOR-element, ADD-element, SUB-element, MUL-element, DIV-element;

■缓存器:register-element;■Register: register-element;

■多功器及解多功器:RMUXDEMUX-element、WMUXDEMUX-element;■Multiplexer and demultiplexer: RMUXDEMUX-element, WMUXDEMUX-element;

■常数(Constants):constant-element。■Constants: constant-element.

其中,组件节点的内容表示法分为下述两项:Among them, the content representation of the component node is divided into the following two items:

(1)缓存器、常数等需label来区别的表示法为:(1) Registers, constants, etc. need to be distinguished by labels:

组件名称__变量名称(Component name_variable name);Component name__variable name (Component name_variable name);

(2)MICROOP、CMP、MERGE等不需label来区别的表示法为:(2) The representations of MICROOP, CMP, MERGE, etc. that do not need to be distinguished by labels are:

组件名称(Component name);Component name;

而节点之间联机的表示法为:The representation of the connection between nodes is:

起始点的输出端→目标点的输入端;The output terminal of the starting point → the input terminal of the target point;

利用上述的硬件组件图的图形规格图,可将EAD转换成与硬件组件较有关联的硬件组件图。The EAD can be converted into a hardware component diagram that is more relevant to the hardware component by using the graphic specification diagram of the above hardware component diagram.

图8显示延伸活动图(EAD)转换成与硬件组件(HCG)的流程图,首先,读取该延伸活动图中的一子活动图(步骤S801),接着,判断该读取的子活动图的所属的型态(步骤S802),当该读取的子活动图的型态为分叉(fork)、连结(join)、或合并(merge)其中之一时,直接转换成相对应的硬件组件图(步骤S803),之后,再重新读取该延伸活动图中的一子活动图,直到所有的子活动图均已被读取且转换成时相对应的硬件组件图为止。Fig. 8 shows the flow chart of extending activity diagram (EAD) conversion into and hardware component (HCG), at first, read a subactivity diagram (step S801) in this extension activity diagram, then, judge the subactivity diagram of this reading The type of the sub-activity diagram (step S802), when the type of the read sub-activity diagram is one of fork, join, or merge, it is directly converted into the corresponding hardware component diagram (step S803 ), after that, re-read a sub-activity diagram in the extended activity diagram until all the sub-activity diagrams have been read and converted into corresponding hardware component diagrams.

当步骤S802判断该读取的子活动图为微运算(micro-operation)型态时,将对微运算子活动图进行语法分析转换(步骤S804),再将选择子活动图转换成相对应的硬件组件图后(步骤S806),重新读取该活动图中的一子活动图,直到所有的子活动图均已被读取且转换成时相对应的硬件组件图为止。When step S802 judges that the sub-activity diagram read is a micro-operation (micro-operation) type, the micro-operation sub-activity diagram will be parsed and converted (step S804), and then the selected sub-activity diagram will be converted into a corresponding After the hardware component diagram (step S806 ), reread a subactivity diagram in the activity diagram until all the subactivity diagrams have been read and converted into corresponding hardware component diagrams.

当步骤S802判断该读取的子活动图为选择(select)型态时,先对该等硬件组件图上的输出端上的标记(label)进行分析(步骤S805),之后,对选择子活动图进行语法分析转换(步骤S804),再将选择子活动图转换成相对应的硬件组件图(步骤S806),直到所有的子活动图均已被读取且转换成相对应的硬件组件图(步骤S807)后,产生连接线连接该等硬件组件图的输入端及输出端(步骤S808),最后,即可输出完整的硬件组件图(步骤S809)。When step S802 judges that the sub-activity diagram of this reading is a selection (select) type, earlier the mark (label) on the output terminals on such hardware component diagrams is analyzed (step S805), after that, select sub-activity Carry out grammatical analysis and conversion (step S804) to the figure, and then convert the selected subactivity diagram into a corresponding hardware component diagram (step S806), until all subactivity diagrams have been read and converted into corresponding hardware component diagrams ( After step S807), connecting lines are generated to connect the input and output ends of the hardware component diagrams (step S808), and finally, the complete hardware component diagram can be output (step S809).

经由上述步骤,一个完整的EAD转换成相对应的的硬件组件图(HCG)(如图9所示),其中,最上面的节点为开始节点(Start Node),开始节点分别纪录JAVA程序中的class信息和method信息;图9中最下方的节点为结束节点(end node),结束节点表示此method已结束并要求传回值;图9中其余的节点则分别标示出register、micro-operation、fork及adder等硬件组件,而节点与节点之间以一有方向性的连接线标示,从起始对象的一outputport连接到目标对象的一input port。Through the above steps, a complete EAD is converted into a corresponding hardware component graph (HCG) (as shown in Figure 9), wherein the top node is the start node (Start Node), and the start node records the JAVA program respectively. class information and method information; the bottom node in Figure 9 is the end node (end node), which indicates that the method has ended and requires a return value; the rest of the nodes in Figure 9 are marked register, micro-operation, Hardware components such as fork and adder, and nodes are marked with a directional connection line, connecting an output port of the starting object to an input port of the target object.

经由上述转换后,完成了第二阶段的转换,接着,进行第三阶段的转换,将根据硬件组件图的联机,产生相对应的VHDL组件的讯号连接,并以字符串方式将VHDL的实体和架构输出至一档案,完成整个转换。After the above conversion, the second stage of conversion is completed, and then, the third stage of conversion will be performed to generate the corresponding signal connection of the VHDL component according to the connection of the hardware component diagram, and the VHDL entity and The schema is exported to a file, completing the entire conversion.

图10是本发明硬件组件图(HCG)转换成VHDL硬件描述语言的流程图。首先,读取一硬件组件图(HCG)(步骤S1001),其中该硬件组件图(HCG)包括有复数个子硬件组件图。接着,修正硬件组件图(步骤S1003),由于硬件组件图(HCG)与实际的硬件组件之间没有任何关连,故无法直接将硬件组件图(HCG)转换成VHDL硬件描述语言。故需先修正硬件组件图(HCG),以让修正后的硬件组件图(HCG)中的组件可与VHDL硬件描述语言的组件对应。Fig. 10 is a flowchart of converting the hardware component graph (HCG) into VHDL hardware description language according to the present invention. Firstly, read a hardware component graph (HCG) (step S1001), wherein the hardware component graph (HCG) includes a plurality of sub-hardware component graphs. Next, modify the hardware component diagram (step S1003), because there is no relationship between the hardware component diagram (HCG) and the actual hardware components, so the hardware component diagram (HCG) cannot be directly converted into VHDL hardware description language. Therefore, the hardware component diagram (HCG) needs to be revised first, so that the components in the revised hardware component diagram (HCG) can correspond to the components of the VHDL hardware description language.

本实施例是以图11的一Java加法器为例进行说明,图12是该Java加法器对应的硬件组件图(HCG)。首先,通过类别信息(class info)及硬件组件图(HCG),找出对应于硬件组件图(HCG)中的公开方法(public method),并把公开方法(public method)部分从方法开始节点(method start node)接一条线连接到类别开始节点(class start node)。该连接在线的标签为”method_namereq4p”,以表示这个公开方法(public method)会有对应的硬件接口上的一个名称为method_nameReq4p的输入讯号。该输入讯号会接到方法开始节点(method start node)的一个名称为req4p的埠。并且从类别开始节点(classstart node)接一条线连接到方法开始节点(method start node)。该连接在线的标签为”ack4p method_name”,表示最后会从方法开始节点(method startnode)的ack4p埠连接一条线到硬件接口上的一个名称为method_nameAck4p的输出讯号(如图13所示)。This embodiment is described by taking a Java adder in FIG. 11 as an example, and FIG. 12 is a hardware component diagram (HCG) corresponding to the Java adder. First, find out the public method (public method) corresponding to the hardware component diagram (HCG) through the class information (class info) and the hardware component diagram (HCG), and put the public method (public method) part from the method start node ( method start node) and a line to the class start node. The connection line is labeled "method_namereq4p" to indicate that this public method will have an input signal named method_nameReq4p on the corresponding hardware interface. The input signal will be connected to a port named req4p of the method start node. And connect a line from the class start node to the method start node. The label of the connection line is "ack4p method_name", which means that a line will be connected from the ack4p port of the method start node (method startnode) to an output signal named method_nameAck4p on the hardware interface (as shown in Figure 13).

由于每个回传(return)会把一个数据传出去,并把结束讯号传回给开始节点(start node),所以遇到一判断式时,为有不同回传值的情形。此时,则需合并多个回传节点(merge multiple return node)。其先把所有要回传的值(return value)放入一个缓存器(register)中,此缓存器(register)命名为”retMethod_name”,再用合并组件(Merge element)把讯号线接到一个结束节点(end node),其标签名称为”return retMethod_name。由于结束节点(end node)仅代表流程上的结束,在硬件中并不代表任何意义,而且在异步系统中执行结束意味着会有一回传讯号(acknowledgement)传回,因此再为把结束节点(end node)去掉并接回至方法开始节点(method start node)(如图14所示)。Since each return will send a piece of data, and send the end signal back to the start node, so when encountering a judgment expression, it is the case that there are different return values. In this case, it is necessary to merge multiple return nodes. It first puts all the values to be returned (return value) into a register (register), and the register (register) is named "retMethod_name", and then uses the merge component (Merge element) to connect the signal line to an end Node (end node), its label name is "return retMethod_name. Since the end node (end node) only represents the end of the process, it does not mean anything in hardware, and the end of execution in an asynchronous system means that there will be a return message The acknowledgment is sent back, so the end node (end node) is removed and connected back to the method start node (method start node) (as shown in Figure 14).

通过类别信息(class info)及硬件组件图(HCG),可知对应于硬件组件图(HCG)的哪些参数(parameter)和回传值(return value)是公开(public)的。把公开的参数(parameter)和回传值(retum value)接到类别开始节点(class startnode),表示这些节点会有对应的硬件接口可供外部讯号输出入。在参数的部份会接一条输入讯号从类别开始节点(class start node)到参数的缓存器节点(register node),其标签为”parameter_name w”,表示数据从硬件接口输入到缓存器中。并会从参数的缓存器节点(register node)接一条讯号线到硬件接口,其卷标为”ack4p parameter_name”表示从缓存器回传一确认(acknowledgment)讯号到硬件接口。而回传值(return value)则从方法开始节点(method start node)接一条线到回传值的缓存器节点(register node)。但因其输出的埠与接到类别开始节点(class start node)的埠相同,所以必须用一并列节点(fork node)把接到类别开始节点(class start node)的线分到回传缓存器节点(return register node)。而回传缓存器节点(retum register node)还会接一条线到类别开始节点(class start node)代表回传值得输出,其标签为”qretMethod_name”(如图15所示)。Through the class information (class info) and the hardware component graph (HCG), it can be known which parameters (parameter) and return value (return value) corresponding to the hardware component graph (HCG) are public. Connect the public parameters (parameter) and return value (retum value) to the class start node (class startnode), which means that these nodes will have corresponding hardware interfaces for external signal input and output. In the parameter part, an input signal will be connected from the class start node (class start node) to the parameter register node (register node), and its label is "parameter_name w", indicating that the data is input into the register from the hardware interface. And a signal line will be connected from the parameter register node to the hardware interface, and its volume label is "ack4p parameter_name", indicating that an acknowledgment signal is returned from the register to the hardware interface. The return value (return value) connects a line from the method start node (method start node) to the register node of the return value. But because the output port is the same as the port connected to the class start node, a fork node must be used to split the line connected to the class start node to the return buffer Node (return register node). The return register node (retum register node) will also connect a line to the class start node (class start node) to represent the output of the return value, and its label is "qretMethod_name" (as shown in Figure 15).

从类别信息(class info)收集其方法信息(class info),以及由硬件组件图(HCG)中收集其输出/输入连接线(in/out edges),以产生方法呼叫信息(method call info.)。再利用方法呼叫信息(method call info.)把硬件组件图(HCG)中连接到方法呼叫节点(method call node)的连接线改成连接到方法开始节点(method start node)来表示方法呼叫(method call)。在处理联机时必须加上多功器及解多功器来控制输出入(如图16所示)。在硬件组件图(HCG)中常常出现多个缓存器。但同样卷标的缓存器其实指的是同一个缓存器,因此需要合并这些意义相同的缓存器,以形成如图17所示的修正硬件组件图(modified HCG)。Collect its method information (class info) from the class information (class info), and collect its output/input connection lines (in/out edges) from the hardware component diagram (HCG) to generate method call information (method call info.) . Then use the method call information (method call info.) to change the connection line connected to the method call node (method call node) in the hardware component diagram (HCG) to connect to the method start node (method start node) to represent the method call (method call). It is necessary to add a multiplexer and demultiplexer to control the input and output (as shown in Figure 16) when processing the connection. Multiple registers often appear in a hardware component diagram (HCG). However, registers with the same label actually refer to the same register, so these registers with the same meaning need to be merged to form a modified HCG as shown in FIG. 17 .

请再参阅图10所示,经过步骤S1001后,执行修正硬件组件图(步骤S1003)后,找出该硬件组件图的一起始节点(StartNode)(步骤S1005),以得到相对应的子硬件组件图。步骤S1005中的起始节点(StartNode)是指方法开始节点(method start node)。此时,由于修正硬件组件图(modified HCG)已可与VHDL硬件描述语言对象一一对应,故由方法开始节点(method startnode)开始转换成VHDL硬件描述语言对象。Please refer to Fig. 10 again, after step S1001, after executing the revised hardware component diagram (step S1003), find out a starting node (StartNode) of the hardware component diagram (step S1005), to obtain the corresponding sub-hardware component picture. The start node (StartNode) in step S1005 refers to the method start node (method start node). At this time, since the modified HCG can correspond to the VHDL hardware description language object one by one, the method start node (method startnode) starts to convert into the VHDL hardware description language object.

步骤S1007分析该方法开始节点(method start node)的信息,俾加入输入及输出的组件,产生硬件描述语言的实体(entity),直到所有起始节点(Start Node)均分析完成。Step S1007 analyzes the information of the method start node (method start node), so as to add input and output components, and generate hardware description language entities (entities), until all start nodes (Start Node) are analyzed.

请一并参考图18~25,图18~25是依据本实施例中图9的硬件组件图所转换出的VHDL程序代码。于图18~25中,实体(entity)的名称即为方法开始节点(method start node),并且将方法开始节点(method start node)中的连接现转换为实体(entity)中的输出/及输入埠。Please refer to FIGS. 18-25 together. FIGS. 18-25 are VHDL program codes converted according to the hardware component diagram in FIG. 9 in this embodiment. In Figures 18-25, the name of the entity (entity) is the method start node (method start node), and the connection in the method start node (method start node) is now converted into the output/input of the entity (entity) port.

步骤S1009在于判断该硬件组件图中节点(node)的型别,产生相对应的硬件描述语言(VHDL)对象,并将相关信息写入硬件描述语言的架构(Architecture)中。其中,使用组件叫用(component instantiation)方式,以产生相对应的硬件描述语言(VHDL)对象。Step S1009 is to determine the type of the node (node) in the hardware component diagram, generate a corresponding hardware description language (VHDL) object, and write related information into the architecture (Architecture) of the hardware description language. Wherein, a component instantiation method is used to generate a corresponding hardware description language (VHDL) object.

步骤S1011根据修正硬件组件图的联机,产生相对应硬件描述语言(VHDL)组件的讯号连接。于步骤S1013中,以字符串方式将硬件描述语言(VHDL)的实体(entity)和架构(Architecture)输出如图18~25所示的一档案。其中,该修正硬件组件图能与VHDL组件一一对应的,如此即可轻易地转换成VHDL程序代码。可避免硬件组件图(HCG)无法转换成正确的VHDL程序代码的问题。Step S1011 generates signal connections corresponding to hardware description language (VHDL) components according to the connection of the revised hardware component diagram. In step S1013 , output the entity (entity) and architecture (Architecture) of the hardware description language (VHDL) in a character string as shown in FIGS. 18-25 . Wherein, the revised hardware component diagram can be in one-to-one correspondence with the VHDL component, so that it can be easily converted into VHDL program code. The problem that the hardware component diagram (HCG) cannot be converted into correct VHDL program code can be avoided.

经由上述步骤,可在第三个阶段中将一个完整的HCG转换成相对应的硬件描述语言。Through the above steps, a complete HCG can be converted into a corresponding hardware description language in the third stage.

由以上说明可知,本发明的高阶程序语言(例如:Java、C、C++)自动转换成硬件描述语言(VHDL)的方法可由三个阶段的转换机制,而将高阶程序语言所描述的功能直接转换至相对应的硬件描述语言,其不受限于高阶程序语言的种类,并可统一完整的执行流程,而不会造成硬件组件设计上的困扰。As can be seen from the above description, the method for automatically converting the high-level programming language (for example: Java, C, C++) of the present invention into a hardware description language (VHDL) can be converted into a function described in the high-level programming language by a three-stage conversion mechanism. It is directly converted to the corresponding hardware description language, which is not limited to the type of high-level programming language, and can unify the complete execution process without causing troubles in the design of hardware components.

上述实施例仅是为了方便说明而举例而已,本发明所主张的权利要求范围自应以申请专利范围所述为准,而非仅限于上述实施例。The above-mentioned embodiments are only examples for convenience of description, and the scope of the claims claimed in the present invention should be based on the scope of the patent application, rather than limited to the above-mentioned embodiments.

Claims (12)

1、一种将高阶程序语言自动转换成硬件描述语言的方法,包括下列步骤:1. A method for automatically converting a high-level programming language into a hardware description language, comprising the following steps: (A)读取一高阶程序语言的原始码;(A) read the source code of a high-level programming language; (B)将该高阶程序语言的原始码转换成一延伸活动图,其中,步骤(B)包括下列子步骤:(B) converting the source code of the high-level programming language into an extended activity diagram, wherein step (B) includes the following sub-steps: (B1)读取一行高阶程序语言的原始码;(B1) read the source code of a line of high-level programming language; (B2)如该读取的原始码不为一叙述指令时,将非叙述指令转换成相对应的子活动图,再执行步骤(B1);(B2) When the read source code is not a narrative instruction, convert the non-narrative instruction into a corresponding subactivity diagram, and then perform step (B1); (B3)如该读取的原始码为一叙述指令时,且该叙述指令的前方有一叙述式时,将该叙述式转换成一子活动图;(B3) If the read source code is a narration command, and when there is a narration in front of the narration command, convert the narration into a sub-activity diagram; (B4)产生一选择节点;(B4) generating a selection node; (B5)产生二中介点,该二中介点连接该选择节点;(B5) generating two intermediary points, the two intermediary points connecting the selected node; (B6)将叙述式转换成相对应的子活动图;(B6) Converting the narrative into corresponding sub-activity diagrams; (B7)产生一合并节点以合并子活动图;(B7) generating a merge node to merge sub-activity diagrams; (B8)连接该叙述式经由转换后所产生的子活动图至右中介点;(B8) Connect the sub-activity diagram generated by the conversion of the narrative to the right intermediate point; (B9)连接该叙述式经由转换后所产生的子活动图至合并节点;以及(B9) connecting the sub-activity diagram generated by the transformation of the narrative to the merge node; and (B10)判断是否仍有指令未转换成子活动图,若仍有,再执行步骤(B1),否则,输出一个完整的活动图;(B10) judging whether there is still an instruction that has not been converted into a sub-activity diagram, if there is still, perform step (B1), otherwise, output a complete activity diagram; (C)将该延伸活动图转换成一硬件组件图;(C) converting the extended activity diagram into a hardware component diagram; (D)将该硬件组件图转换成硬件描述语言;以及(D) converting the hardware component diagram into a hardware description language; and (E)输出该硬件描述语言。(E) Outputting the hardware description language. 2、如权利要求1所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中该高阶程序语言为Java、C、或C++程序语言。2. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 1, wherein the high-level programming language is Java, C, or C++ programming language. 3、如权利要求1所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中该延伸活动为代表一种流程控制图。3. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 1, wherein the extended activity represents a flow control graph. 4、如权利要求1所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中该延伸活动图包括:开始(start)、结束(end)、中介点(curve point)、微运算(micro-operation)、分叉(fork)、连结(join)、选择(select)、合并(merge)共八种节点。4. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 1, wherein the extended activity diagram includes: start (start), end (end), intermediate point (curve point) , micro-operation (micro-operation), fork (fork), link (join), selection (select), merge (merge) a total of eight types of nodes. 5、如权利要求1所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中该硬件组件图是以表示硬件组件与硬件组件之间的连接关系。5. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 1, wherein the hardware component diagram is used to represent the connection relationship between hardware components and hardware components. 6、如权利要求5所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中该硬件组件图包括:开始节点、结束节点及组件节点三种型态。6. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 5, wherein the hardware component diagram includes three types: a start node, an end node and a component node. 7、如权利要求1所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中该硬件描述语言为VHDL或Verilog。7. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 1, wherein the hardware description language is VHDL or Verilog. 8、如权利要求1所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中于步骤(A3)中,该叙述指令包括:for、while、do、if、switch指令。8. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 1, wherein in step (A3), the narration instructions include: for, while, do, if, switch instructions . 9、如权利要求1所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中步骤(C)包括下列子步骤:9. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 1, wherein step (C) comprises the following sub-steps: (C1)读取该延伸活动图中的一子活动图,且当该延伸活动图的子活动图均已被读取时,执行步骤(C5);(C1) read a sub-activity diagram in the extended activity diagram, and when all the sub-activity diagrams in the extended activity diagram have been read, perform step (C5); (C2)当判断该读取的子活动图的所属的型态为分叉、连结、或合并其中的一时,直接转换成相对应的硬件组件图,并执行步骤(C1);(C2) When it is judged that the type of the read sub-activity diagram is one of fork, connection, or merging, it is directly converted into a corresponding hardware component diagram, and step (C1) is executed; (C3)当判断该读取的子活动图为微运算型态时,将该微运算子活动图进行语法分析转换,并将微运算子活动图转换成相对应的硬件组件图,再执行步骤(C1);(C3) When it is judged that the read sub-activity diagram is a micro-operation type, perform syntax analysis conversion on the micro-operation sub-activity diagram, and convert the micro-operation sub-activity diagram into a corresponding hardware component diagram, and then perform the steps (C1); (C4)当判断该读取的子活动图为选择型态时,对该等硬件组件图上的输出端上的标记进行分析后,再进行语法分析转换,并该选择子活动图转换成硬件组件图后,再执行步骤(C1);以及(C4) When it is judged that the read sub-activity diagram is a selection type, after analyzing the marks on the output terminals on the hardware component diagrams, then perform syntax analysis and conversion, and convert the selection sub-activity diagram into hardware After the component diagram, step (C1) is performed; and (C5)连接该等硬件组件图的输入端及输出端,输出完整的硬件组件图。(C5) Connecting the input and output ends of the hardware component diagrams to output a complete hardware component diagram. 10、如权利要求1所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中步骤(D)包括下列子步骤:10. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 1, wherein step (D) comprises the following sub-steps: (D1)读取一硬件组件图,其中该硬件组件图包括有复数个子硬件组件图,将该硬件组件图转换至一修正硬件组件图,以执行硬件描述语言转换;(D1) reading a hardware component diagram, wherein the hardware component diagram includes a plurality of sub-hardware component diagrams, converting the hardware component diagram into a modified hardware component diagram to perform hardware description language conversion; (D2)找出该硬件组件图的一起始节点,以得到相对应的子硬件组件图;(D2) finding a starting node of the hardware component graph to obtain a corresponding sub-hardware component graph; (D3)分析该起始节点的信息,以加入输入及输出的组件,以产生硬件描述语言的实体,直到所有起始节点均分析完成;(D3) analyzing the information of the start node to add input and output components to generate hardware description language entities until all start nodes are analyzed; (D4)判断该硬件组件图中节点的型别,产生相对应的硬件描述语言对象,并将相关信息写入硬件描述语言的架构中;(D4) judging the type of the node in the hardware component diagram, generating a corresponding hardware description language object, and writing the relevant information into the architecture of the hardware description language; (D5)根据该硬件组件图的联机,产生相对应硬件描述语言组件的讯号连接;以及(D5) According to the connection of the hardware component diagram, generate the signal connection of the corresponding hardware description language component; and (D6)以字符串方式将硬件描述语言的实体和架构输出至一档案。(D6) Outputting the entity and structure of the hardware description language to a file in the form of character strings. 11.如权利要求10所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中于步骤(C4)中,是使用组件叫用方式,以产生相对应的硬件描述语言对象。11. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 10, wherein in the step (C4), the component is called to generate a corresponding hardware description language object. 12.如权利要求10所述的将高阶程序语言自动转换成硬件描述语言的方法,其特征在于,其中于步骤(C1)中,还包含将该硬件组件图转换至一修正硬件组件图,以执行硬件描述语言转换。12. The method for automatically converting a high-level programming language into a hardware description language as claimed in claim 10, wherein in step (C1), further comprising converting the hardware component diagram into a modified hardware component diagram, to perform hardware description language translation.
CNB2006100049032A 2006-01-11 2006-01-11 Method for automatically converting high-order program language into hardware description language Expired - Fee Related CN100470468C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100049032A CN100470468C (en) 2006-01-11 2006-01-11 Method for automatically converting high-order program language into hardware description language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100049032A CN100470468C (en) 2006-01-11 2006-01-11 Method for automatically converting high-order program language into hardware description language

Publications (2)

Publication Number Publication Date
CN101000541A CN101000541A (en) 2007-07-18
CN100470468C true CN100470468C (en) 2009-03-18

Family

ID=38692530

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100049032A Expired - Fee Related CN100470468C (en) 2006-01-11 2006-01-11 Method for automatically converting high-order program language into hardware description language

Country Status (1)

Country Link
CN (1) CN100470468C (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092588A (en) * 2011-11-01 2013-05-08 镇江华扬信息科技有限公司 Object-oriented VHDL (Vhsic Hardware Description Language) based language implementation method
CN103412783A (en) * 2013-08-27 2013-11-27 杭州友声科技有限公司 Method for converting script codes into user flow diagram based on business logic layer
CN110109658B (en) * 2019-04-17 2022-08-23 首都师范大学 ROS code generator based on formalized model and code generation method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6226776B1 (en) * 1997-09-16 2001-05-01 Synetry Corporation System for converting hardware designs in high-level programming language to hardware implementations
US6564354B1 (en) * 2000-06-01 2003-05-13 Hewlett Packard Development Company, L.P. Method for translating conditional expressions from a non-verilog hardware description language to verilog hardware description language while preserving structure suitable for logic synthesis
CN1422406A (en) * 2000-02-24 2003-06-04 斯坦利·M·海杜克 Digital implementation with parallel sequencer
WO2004017232A2 (en) * 2002-08-16 2004-02-26 Coware, Inc. Method and apparatus for translating to a hardware description language from an architecture description language
CN1656447A (en) * 2002-05-23 2005-08-17 阿尔卡特公司 A software development tool that guarantees the link between a UML model and its implementation in a CORBA environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6226776B1 (en) * 1997-09-16 2001-05-01 Synetry Corporation System for converting hardware designs in high-level programming language to hardware implementations
CN1422406A (en) * 2000-02-24 2003-06-04 斯坦利·M·海杜克 Digital implementation with parallel sequencer
US6564354B1 (en) * 2000-06-01 2003-05-13 Hewlett Packard Development Company, L.P. Method for translating conditional expressions from a non-verilog hardware description language to verilog hardware description language while preserving structure suitable for logic synthesis
CN1656447A (en) * 2002-05-23 2005-08-17 阿尔卡特公司 A software development tool that guarantees the link between a UML model and its implementation in a CORBA environment
WO2004017232A2 (en) * 2002-08-16 2004-02-26 Coware, Inc. Method and apparatus for translating to a hardware description language from an architecture description language

Also Published As

Publication number Publication date
CN101000541A (en) 2007-07-18

Similar Documents

Publication Publication Date Title
US20070157132A1 (en) Process of automatically translating a high level programming language into a hardware description language
US6536031B2 (en) Method for generating behavior model description of circuit and apparatus for logic verification
JP2002024029A (en) Compiler, compiling method and computer readable recording medium with compile program recorded thereon
CN102480467B (en) A kind of SOC software and hardware cooperating simulation verification method of communications protocol Network Based
CN114756219B (en) FPGA hardware construction language implementation system based on C++
CN114077430A (en) Interface generation method, device, electronic device and storage medium
JP2003016122A (en) Logic circuit design method
CN100470468C (en) Method for automatically converting high-order program language into hardware description language
CN101329628B (en) Method and device for managing variable point
CN103049602B (en) Based on model-driven engineering, AADL assembly is transformed into Interface Automata model method
US20070169054A1 (en) Process of automatically translating a high level programming language into an extended activity diagram
JP5233355B2 (en) Property generation system and property verification system
JP4607958B2 (en) Processor and program conversion apparatus
CN118468771A (en) Chip problem locating method, device and related equipment
CN100442224C (en) Method for converting hardware element diagram into hardware description language
US7493584B1 (en) Methods and apparatus for selective comment assertion
Meloni et al. Tywaves: A typed waveform viewer for Chisel
JP2007183902A (en) Automatic conversion method of extended activity diagram (ead) into hardware component graph (hcg)
CN100424639C (en) Method for automatically converting extended activity diagram into hardware element diagram
WO2009101934A1 (en) System for verifying lsi design, method for verifying lsi design, and program therefor
US7430727B2 (en) Hardware component graph to hardware description language translation method
Kell The mythical matched modules: overcoming the tyranny of inflexible software construction
JP5233354B2 (en) Property verification system, property verification method, and program
CN101000540A (en) A Method of Converting Functions of High-Level Languages to Hardware Component Diagrams
JP2007316794A (en) Skeleton generation device and its method

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
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20090717

Address after: Taiwan, Taipei, China

Co-patentee after: Datong University

Patentee after: Tatung Company

Address before: Taipei City, Taiwan, China

Patentee before: Datong Co., Ltd.

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

Granted publication date: 20090318

Termination date: 20130111