Research Article

vMAGIC—Automatic Code Generation for VHDL

Algorithm 2

VHDL output of the example Java program. The indentation and the notation of keywords is governed by the String Template file and can be changed to fit the developers needs.
1ENTITY test IS
2PORT(
3din:IN STD_LOGIC_VECTOR(7DOWNTO 0);
4dout: OUT STD_LOGIC_VECTOR(7DOWNTO 0);
5LRESET_N:IN std_logic ;
6clk:IN std_logic
7);
8END;
9
10ARCHITECTURE behOF testIS
11COMPONENT testIS
12PORT(
13din :INSTD_LOGIC_VECTOR(7DOWNTO 0);
14dout:OUT STD_LOGIC_VECTOR(7DOWNTO 0)
15);
16END COMPONENT;
17SIGNAL din_int:STD_LOGIC_VECTOR(7DOWNTO 0);
18SIGNAL dout_int:STD_LOGIC_VECTOR(7DOWNTO 0);
19BEGIN
20inst: test
21PORT MAP (
22din => din_int,
23dout => dout_int
24     );
25regp_din:PROCESS  (clk,LRESET_N)
26BEGIN
27IF LRESET_N='0'THEN
28din_int <= "00000000";
29ELSIF clk ' eventAND clk = '1' THEN
30din_int <=din ;
31END IF;
32END PROCESS;
33regp_dout:PROCESS (clk, LRESET_N)
34BEGIN
35IF LRESET_N ='0'THEN
36dout2 <= "00000000";
37ELSIF clk'eventAND clk='1'THEN
38dout <= dout_int;
39END IF;
40END PROCESS;
41END;