Code Monkey home page Code Monkey logo

Comments (8)

Paebbels avatar Paebbels commented on June 30, 2024 1

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

`include some/file.vhdl

it's covered by the standard and not illegal syntax.


/cc @umarcor

from vhdlproc.

nobodywasishere avatar nobodywasishere commented on June 30, 2024

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!

from vhdlproc.

nobodywasishere avatar nobodywasishere commented on June 30, 2024

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.

from vhdlproc.

Paebbels avatar Paebbels commented on June 30, 2024

It looks like:

`define LABEL           -   Define LABEL for `ifdef and `ifndef

`define LABEL STRING    -   Replace LABEL by STRING, can be multiple words
                            Will replace ignoring single quotes and attributes ('', ')
                            Will not replace within double quotes ("")

`rand LABEL FORMAT      -   Replace LABEL by generated random characters
                            according to FORMAT. FORMAT has an alphabet
                            for radix and a digit number for generating,
                            The radix character can be set by 'B'(bin),
                            'D'(dec), 'H'(hex) and 'A'(alphabet)

are not supported anymore?
(According to the README on the rewrite branch.)

from vhdlproc.

nobodywasishere avatar nobodywasishere commented on June 30, 2024

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

`include some/file.vhdl

it's covered by the standard and not illegal syntax.

/cc @ umarcor

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!

It looks like:

...

are not supported anymore?
(According to the README on the rewrite branch.)

`define was originally meant for defining labels that were to replace parts of the VHDL code, though this could probably be added back (without the ability to replace parts of the actual code, only for conditional compilation). `rand is almost useless with conditional compilation only, hence why it was removed.

from vhdlproc.

Paebbels avatar Paebbels commented on June 30, 2024

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 vpp as in VHDL/Verilog Pre-Processor.


/cc @umarcor

from vhdlproc.

nobodywasishere avatar nobodywasishere commented on June 30, 2024

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.

vpp as a name has already been taken actually (see here and here, the latter actually being the project I forked to create this one, two rewrites ago). I changed the name after it moved away from the original source code.

from vhdlproc.

nobodywasishere avatar nobodywasishere commented on June 30, 2024

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!

from vhdlproc.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.