hdlConvertor icon indicating copy to clipboard operation
hdlConvertor copied to clipboard

SystemVerilog import package - doesn't seem to do anything?

Open flemish4 opened this issue 4 years ago • 8 comments

Hi, I'm trying to use hdlConvertor to discover all the files I need in my file list. (If someone has already done this please let me know :) )

So far I'm checking the error messages for missing includes directories and I'm looking for hdlAst._structural.HdlCompInst to get modules which are needed. Then I'm exploring the hierarchy and checking each module file found. This seems to work well.

The one thing that is missing is where there is an 'import something_pkg::*; this doesn't appear in the parsed object at all. Then on lines where it is used there is just a double colon operator.

At no point does it realize that a file is missing. Is this expected behaviour?

Thanks

flemish4 avatar Jan 26 '21 12:01 flemish4

There was a missing conversion, it should be fixed now. https://github.com/Nic30/hdlConvertor/commit/1cd4910ae1df8e15732760647f30797e87f9662e#diff-d524652fb3a0f07012fd10ec301daeaea5e2ea5fc6125431a4d9f38e962073a5

https://github.com/Nic30/hdlConvertorAst/commit/ceaa80f202e639423400e9dad2423eb4e25c871d

Nic30 avatar Jan 26 '21 17:01 Nic30

Wow that was quick! Thanks for the fix, I'll check it asap.

flemish4 avatar Jan 26 '21 17:01 flemish4

That looks to work well thanks, I can now extract the packages that are used. It has revealed one more issue though - it seems that package declarations are not yet supported, is this planned? "Source_textParser.visitDescription.package_declaration Conversion to Python object not implemented"

I have nested packages so this looks like the last hurdle to full file list generation :)

flemish4 avatar Jan 27 '21 17:01 flemish4

I guess contribution are welcome.

Basically : implement antlr visitePackage_declaration method and other visit* method relevant for your application in cpp. Fill structure with data you want to collect and make it available into python world. Implement unit test could help to preserve feature over tool change.

https://github.com/Nic30/hdlConvertor/commit/1cd4910ae1df8e15732760647f30797e87f9662e commit could be a useful source of inspiration.

Thomasb81 avatar Jan 27 '21 18:01 Thomasb81

Thanks for the pointers, I'll see what I can do

On Wed, 27 Jan 2021, 18:59 Thomasb81, [email protected] wrote:

I guess contribution are welcome.

Basically : implement antlr visitePackage_declaration method and other visit* method relevant for your application in cpp. Fill structure with data you want to collect and make it available into python world. Implement unit test could help to preserve feature over tool change.

1cd4910 https://github.com/Nic30/hdlConvertor/commit/1cd4910ae1df8e15732760647f30797e87f9662e commit could be a useful source of inspiration.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Nic30/hdlConvertor/issues/149#issuecomment-768501920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3AOH2IFKX7L45Y3KZZ53TS4BPBNANCNFSM4WTLVFDQ .

flemish4 avatar Jan 27 '21 19:01 flemish4

Is there a list of what is currently implemented vs not?

On Wed, 27 Jan 2021, 19:03 William Chandler, [email protected] wrote:

Thanks for the pointers, I'll see what I can do

On Wed, 27 Jan 2021, 18:59 Thomasb81, [email protected] wrote:

I guess contribution are welcome.

Basically : implement antlr visitePackage_declaration method and other visit* method relevant for your application in cpp. Fill structure with data you want to collect and make it available into python world. Implement unit test could help to preserve feature over tool change.

1cd4910 https://github.com/Nic30/hdlConvertor/commit/1cd4910ae1df8e15732760647f30797e87f9662e commit could be a useful source of inspiration.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Nic30/hdlConvertor/issues/149#issuecomment-768501920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3AOH2IFKX7L45Y3KZZ53TS4BPBNANCNFSM4WTLVFDQ .

flemish4 avatar Jan 27 '21 19:01 flemish4

I don't think so. That's why the tool can emit such message : "Source_textParser.visitDescription.package_declaration Conversion to Python object not implemented" at some place to point the limitation.

Thomasb81 avatar Jan 27 '21 19:01 Thomasb81

All things which are not converted to python yet are marked with NotImplementedLogger::print https://github.com/Nic30/hdlConvertor/blob/06fbd10227a0242cdd727f6cba3cc4aec8ee6f03/src/svConvertor/source_textParser.cpp#L92

The problem is that the verilog/vhdl/systemverilog contains ridiculous amount of deprecated things. Most of the things were implemented on demand. Adding new things is simple, but we prefer to simplify HDL syntax obscurities so we do not need to deal with them later.

If you do not like it you can use antlr grammars or c++ directly, but remember that there is a reason for this conversion and that is to remove a bloat and obscurities and you will have to deal with this obscurities if you use "base SV parser".

If you can help it would be nice.

Nic30 avatar Jan 27 '21 19:01 Nic30