ameetgohil / signalflip-js

verilator testbench w/ Javascript using N-API
MIT License
18 stars 3 forks source link

Read Verilog pinlist #9

Open drom opened 5 years ago

drom commented 5 years ago

Do you plan to generate a wrapper for the arbitrary verilog module? I have started this pinlist reader library https://github.com/drom/verilog-pinlist It uses this Verilog parser https://github.com/tree-sitter/tree-sitter-verilog Will it be useful?

ameetgohil commented 5 years ago

yes, absolutely. right now, i'm using ben's script to get all the pins and generate the wrapper with templates

ameetgohil commented 5 years ago

@drom Is the pinslist reader library ready to use?

drom commented 5 years ago

I still fixing some bugs, but you can try using it. I have added instruction in the README.md file https://github.com/drom/verilog-pinlist

ameetgohil commented 5 years ago

Verilator generates a header file called Vtop.h with has signal width, direction, name which are easily extracted using regex. Here's the regex i used: /VL_([^\(]*)\(([^\,\)]*),([^\D]*),([^\D]*)/g This way i don't have to worry about parameters or defines b/c verilator figures all that out.
See https://github.com/ameetgohil/signalflip-js/blob/master/src/GenerateWrapper.js

drom commented 5 years ago

Could you create node bindings, that would wrap any verialted module and then discover pinlist dynamically?

ameetgohil commented 5 years ago

Yes, that's definitely feasible. I'll get on that this week