Paebbels / pyVHDLParser

Streaming based VHDL parser.
https://paebbels.github.io/pyVHDLParser/
Other
78 stars 15 forks source link

Few problems. #6

Closed m-kru closed 2 years ago

m-kru commented 4 years ago

Today I have cloned the project and encountered few problems.

  1. You have added PyCharm .idea directory to the git, but it is not synced with the actual project. Namely the run configurations use Frontend.py whereas it should be FrontEnd.py.

  2. Step 2 (block parsing) fails. So far I have encountered 2 problems, but the source of both may be the same. Here are short snippets.

library ieee;
use ieee.std_logic_1164.all;

entity my_entity is
  port (
    i : in std_logic;
    o : out std_logic
  );
end entity my_entity;

architecture rtl of my_entity is

begin

  o <= i;

end architecture rtl;
library ieee;
use ieee.std_logic_1164.all;

entity my_entity is
  port (
    i : in std_logic;
    o : out std_logic
  );
end entity my_entity;

architecture rtl of my_entity is

  signal a, b : std_logic;

begin

  a <= i;
  b <= a;
  o <= b;

end architecture rtl;

You can run BlockStream configuration to recreate them.

Paebbels commented 4 years ago

Thanks for testing pyVHDLParser. The project is still in development (as v0.4.3 shows). Non the less a lot is working, but some parts still have bugs.

Bringing you code to work for pyVHDLParser v0.4.3. (This is just a workaround to get further for testing purposes.)

  1. Linebreak after subtype indication in a port declaration.

    Since adding a subparser for expressions that can be used with generic default values or port default values, the parser has a bug when no expression is used and the subtype indication is follows by certain types of whitespace (e.g. linebreaks).

    Problem:

    port (
     i : in std_logic
    );

    No Problem:

    port (
     i : in std_logic := '0'
    );

    or

    port (
     i : in std_logic);

    Workaround:

    entity my_entity is
     port (
       i : in std_logic;
       o : out std_logic);
    end entity my_entity;

    Now, the subtype indication is directly followed by a character, thus no linebreak.

    The error can be visualized with py -3 .\FrontEnd.py -d check-blockstreaming .\Example.vhdl. This generates a token stream and block stream and print it as a nested list. In addition, it checks the double-linked lists.
    Here is a screen of a similar example causing that linking-bug:
    image

  2. Assignments are not supported yet.
    Assignments in general are very hard to parse, because the need a very deep look ahead. It's planned to implement them, when some other annoying bugs have been fixed.


In general, I added lots of documentation in the last days. The latest addition is how to use the generators and iterators. I also added simple examples like finding all entities in a file.

At next, I should also add documentation for Frontend.py :).

Paebbels commented 3 years ago

The project has now >250 test cases and reaches circa 48% branch coverage. More tests are coming... While adding test cases some bugs where discovered and fixed.

This described example is currently a failing test.