You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug was passed to me by someone else, but I am posting it as an issue so we can track it.
Currently pyHDLparser does not parse component declarations inside the architecture of an entity correctly. I have attached below a simple example of a VHDL file that recreates this bug.
library ieee;
use ieee.std_logic_1164.all;
entitythree_bit_adderisport (
a : instd_logic_vector(2downto0);
b : instd_logic_vector(2downto0);
cin : outstd_logic;
s : outstd_logic_vector(2downto0);
cout : outstd_logic
);
endentitythree_bit_adder;
architecturearchofthree_bit_adderiscomponentfull_adderisport (
x, y, ci: instd_logic;
q, co: outstd_logic
);
endcomponent;
signal c: std_logic_vector(3downto0);
begin
c(0) <= cin;
FA0: full_adderportmap(a => a(0), b => b(0), cin => c(0), cout => c(1));
FA1: full_adderportmap(a => a(1), b => b(1), cin => c(1), cout => c(2));
FA2: full_adderportmap(a => a(2), b => b(2), cin => c(2), cout => c(3));
cout <= c(3);
endarch;
I used the following python code to recreate the bugs.
VHDL entity: three_bit_adder
a (<class 'str'>), VhdlParameterType('std_logic_vector','(2 downto 0)') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
b (<class 'str'>), VhdlParameterType('std_logic_vector','(2 downto 0)') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
cin (<class 'str'>), VhdlParameterType('std_logic','') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
s (<class 'str'>), VhdlParameterType('std_logic_vector','(2 downto 0)') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
cout (<class 'str'>), VhdlParameterType('std_logic','') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
x (<class 'str'>), VhdlParameterType('std_logic','') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
y (<class 'str'>), VhdlParameterType('std_logic','') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
ci (<class 'str'>), VhdlParameterType('std_logic','') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
q (<class 'str'>), VhdlParameterType('std_logic','') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
co (<class 'str'>), VhdlParameterType('std_logic','') (<class 'hdlparse.vhdl_parser.VhdlParameterType'>)
There are two issues here:
The component declaration for the component full_adder is never recognized
The ports of the full_adder component are added to the ports of the entity
I believe the first issue is caused by an incorrect regex, which would only trigger on the syntax end three_bit_adder; but not end entity three_bit_adder;. I think this can be fixed like this:
This bug was passed to me by someone else, but I am posting it as an issue so we can track it.
Currently pyHDLparser does not parse component declarations inside the architecture of an entity correctly. I have attached below a simple example of a VHDL file that recreates this bug.
I used the following python code to recreate the bugs.
The output I would expect for this is as follows:
Instead the output is as follows:
There are two issues here:
full_adder
is never recognizedfull_adder
component are added to the ports of the entityI believe the first issue is caused by an incorrect regex, which would only trigger on the syntax
end three_bit_adder;
but notend entity three_bit_adder;
. I think this can be fixed like this:This changes the output to:
Which is more correct, but still misses the component declaration.
Adding the following token gives the expected output:
One outstanding question I have is whether there should be some way of indicating that the VHDL component is declared inside the architecture?
The text was updated successfully, but these errors were encountered: