-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using tool directives with '`' instead of '#' #2
Comments
I've made substantial updates to VHDLproc recently, including changing the default directive character to '`', and rewriting it in Python from scratch. Overall I think it's much easier to modify and work with than before. This could fit in with what's being discussed in your link, except I would have to add a lot more functionality for conditional analysis per the LRM. Currently this really only supports C-style preprocessor directives that are on their own line (or indented with spaces), and doesn't support macros with parameters or ifs with conditionals. I'll have to do more research into this. Thank you! |
I've rewritten VHDLproc from scratch on a new branch here. Overall this is a much better implementation of a preprocessor than what I had before. It also matches up with (what I know about) the VHDL 2019 conditional analysis spec (except for `include, which isn't in said spec). I'd be interested in your thoughts on this. As this is also now implemented as a Python class with a CLI wrapper, other programs should be able to leverage the class directly as well. |
This sounds very good. Tool directives are like attributes. The LRM defines a syntax and some pre-existing directives, but there is a big open space for vendor/tool freedom. The LRM also limits the uncontrolled creation of special characters and start sequences in comments by adding a designated syntax for vendor extensions. Moreover it keeps comments clean and avoids pragmas. So if you want to have your own extensions like
it's covered by the standard and not illegal syntax. /cc @umarcor |
It looks like:
are not supported anymore? |
Unfortunately I don't have access to the VHDL-2019 LRM (as I don't feel like dropping $$$ for a fun side project) so I've only been able to go off the site you originally linked (unless some of this stuff is in the 2008 LRM and I just missed it - which is possible as I'm still working my way through it). This is good to know, thank you!
|
Did you know, Verilog uses also backtick for tool directives? They have not defined such if...then...else structures, but we could invent a Verilog like syntax pretty easy. It would be possible to call your tool /cc @umarcor |
As far as I know Verilog does have predefined preprocessor directives, though I think they call them compiler directives. See here. I know Yosys supports them already. It would be pretty easy just to have a switch to swap out the VHDL directive syntax for Verilog, but some of the compiler directives for Verilog seem like they should be handled by the 'compiler' instead.
|
I just officially released v2.0, which supports VHDL-2019 directives. It's also now on pypi. I do consider this issue 'resolved' now, so I'm going to close it, but we can keep discussions going here. Thank you for the support! |
The VHDL standard (IEEE Std. 1076-20**) has tool directives in clause 24. You could use the '`' character instead of '#' and be compliant with the VHDL standard. Moreover, in IEEE Std 1076-2019, a new feature called conditional analysis was added. See Clause 24.2 for more details.
This is the an EBNF based summary:
![image](https://user-images.githubusercontent.com/956109/100703299-85a80900-33a3-11eb-9566-acaf95963316.png)
More details can be found here: http://www.eda-twiki.org/cgi-bin/view.cgi/P1076/LCS2016_061
The text was updated successfully, but these errors were encountered: