1. Field of the Invention
The invention relates to a process of automatically translating an extended activity diagram (EAD) into a hardware component graph (HCG) and, more particularly, to a process of translating an EAD, which represents an executing flow of a program, into a HCG, which indicates a connection relation between hardware components.
2. Description of Related Art
Typically hardware description languages such as VHDL, Verilog cannot directly describe the programming logic and executing flow of a high-level programming language. Accordingly, the high-level programming language is translated into an activity diagram (AD) defined in a unified modeling language (UML). The AD is a flow description diagram and can represent the programming logic and executing flow of a high-level programming language. However, the AD is not associated with physical hardware components and cannot be translated directly into a hardware description language. Accordingly, the known process cannot translate a high-level programming language directly into a corresponding HDL.
Therefore, it is desirable to provide an improved method to mitigate and/or obviate the aforementioned problems.
An object of the invention is to provide a process of automatically translating an extended activity diagram (EAD) into a hardware component graph (HCG), which can translate the EAD into the HCG to thereby benefit subsequent simulation and translation to VHDL.
Another object of the invention is to provide a process of automatically translating an extended activity diagram (EAD) into a hardware component graph (HCG), which can use the HCG to indicate a connection relation between hardware components.
To achieve the objects, the invention is to provide a process of automatically translating an extended activity diagram (EAD) into a hardware component graph (HCG). The EAD consists of plural subgraphs. The process includes: (A) reading a subgraph of the EAD, and executing step (E) when all subgraphs of the EAD is read; (B) directly translating the subgraph of the EAD into a corresponding HCG when the subgraph of the EAD is determined to be a fork, join or merge type, and executing (A); (C) performing a syntax analysis and translation on the subgraph of the EAD when the subgraph of the EAD is determined to be a micro-operation type to thus obtain the corresponding HCG, and executing (A); (D) performing a label analysis first and then a syntax analysis and translation on output ports of obtained corresponding HCGs when the subgraph of the EAD is determined to be a select type, translating the subgraph of the EAD determined to be the select type into the corresponding HCG, and executing step (A); and (E) linking all participant input and output ports between the corresponding HCGs to output a complete HCG.
In the process of automatically translating an extended activity diagram (EAD) into a hardware component graph (HCG), the EAD includes eight nodes of start, end, curve point, micro-operation, fork, join, select and merge.
In the process of automatically translating an extended activity diagram (EAD) into a hardware component graph (HCG), the HCG includes three types of start node, end node and component node.
In the process of automatically translating an extended activity diagram (EAD) into a hardware component graph (HCG), the EAD, a flow control graph, is obtained by modifying an activity diagram defined in a unified modeling language (UML).
Other objects, advantages, and novel features of the invention will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.
Since the prior process cannot translate a high level programming language directly into a hardware description language (HDL) such as VHDL and Verilog, the high level programming language, such as Java, C, C++, is first translated into a temporal format called activity diagram (AD) when a user desires to translate the high level programming language into the HDL. An AD is a flow description graph to represent the programming logic and executing flow of a high level programming language, which, in fact, is not associated with physical hardware components. Accordingly, the AD is translated into a hardware component graph (HCG) that is more associated with physical hardware components, such that a corresponding HDL is generated according to the HCG in order to describe the high level programming language.
In this embodiment, an AD defined in a unified modeling language (UML) is partially modified. The modified AD is referred to as an extended AD (EAD), which is a flow control graph capable of translating source codes coded by a high level programming language into corresponding flows. A complete EAD consists of plural subgraphs, and each subgraph consists of different nodes. In this embodiment, referring to an EAD specification shown in
1. a start node to indicate a start of a subgraph;
2. an end node to indicate an end of the subgraph;
3. a curve point node to indicate two directional edges for providing a convenience in a translation process, which have no practical affection on an operation;
4. a micro-operation node to indicate a statement or expression processing;
5. a fork node to indicate a parallel operation;
6. a join node to indicate that an output signal is sent only when the outputs of all micro-operations are collected;
7. a select node to indicate selecting an appropriate output signal after decoding; and
8. a merge node to indicate merging all input signals into an output signal to output.
Each node is regarded as an object. A corresponding EAD translated from the source codes is generated by linking each subgraph, which can present the programming logic and executing flow of the source codes in a visualization form.
As cited, the specification used in all subgraphs of the invention is described.
In this embodiment, a complete EAD is translated into a corresponding HCG to indicate a relation between a high level programming language and hardware. As shown in
1. The start node shown in
iv. “L” indicates the information of a local variable, including local variable type, bit size and local variable name.
2. The end node shown in
3. The component nodes shown in
In this embodiment, the component nodes can be further grouped into two part, control path modules and data path modules.
(1) As shown in
(2) As shown in
In addition, the content of the component node can be represented as follows.
(1) The registers and the constants, which require labels to separate, can be expressed as:
Component name_variable name.
(2) The micro-operation (MICROOP), compare-element (CMP), the merge-element (MERGE) and the like, which do not require labels, can be expressed directly as:
Component name.
In addition, the directional edge between the nodes can be expressed as:
source node output port→target node input port.
Example 1: as shown in
Example 2: as shown in
Example 3: as shown in
Example 4: as shown in
As cited, upon the HCG specification, the EAD can be converted into the corresponding HCG that is more associated with hardware components.
When a micro-operation type is determined in step S402, a syntax analysis and translation is performed on the subgraph read, i.e., the micro-operation subgraph (step S404), and accordingly the micro-operation subgraph is translated into a corresponding HCG (step S406). Subsequently, a next subgraph of the EAD is read and translated into a corresponding HCG repeatedly until all subgraphs of the EAD are complete.
When a select type is determined in step S402, the labels on the output ports of obtained corresponding HCGs are analyzed (step S405), and a syntax analysis and translation is performed on the subgraph read, i.e., the select subgraph (step S404). Accordingly, the select subgraph is translated into a corresponding HCG (step S406). Subsequently, a next subgraph of the EAD is read and translated into a corresponding HCG repeatedly until all subgraphs of the EAD are complete (step S40). When all subgraphs of the EAD are complete, edges between input and output ports of all obtained HCGs are generated (step S408) to form a complete HCG, and the complete HCG is output (step S409).
An example is given in a Java program for accumulation as follows.
In the example, the Java program is translated into a corresponding EAD shown in
As cited, the process can automatically translate the various source codes of high level programming languages, such as Java, C, C++, etc., into the respective EADs, which are further translated into the respective HCGs that are more associated with hardware components. Thus, the respective hardware description languages (HDL) are generated according to the HCGs to thereby describe the respective high level programming languages.
After the aforementioned translation, the Java program can be translated into a corresponding HCG (as shown in
Although the present invention has been explained in relation to its preferred embodiment, it is to be understood that many other possible modifications and variations can be made without departing from the spirit and scope of the invention as hereinafter claimed.
Number | Date | Country | Kind |
---|---|---|---|
094147592 | Dec 2005 | TW | national |