MikePopoloski / slang

SystemVerilog compiler and language services
MIT License
558 stars 122 forks source link

Support for legacy protection pre-processor directives #1032

Closed rahultadak closed 4 days ago

rahultadak commented 1 week ago

Based on issue #612 and my experience with v6.0, slang doesn't seem to support older code protection directives described below:

`protect
...
`endprotect

After encrypting source code tagged as above it is turned into:

`protected
... <base64 blob>...
`endprotected

Is. it possible to add support for these kinds of protected blocks so that usage of slang on IPs written with the older methods are still supported?

MikePopoloski commented 1 week ago

Is there documentation anywhere about how these directives work exactly? They aren't covered in the LRM -- are they literally identical to the corresponding pragma directives?

rahultadak commented 1 week ago

That is a good question. I've not actually created protected code using this, but I've seen protected code failing compile with slang. I could probably recreate this and put in a log here.

In the meantime, this is the closest I've found to a description on how this might work.

https://redirect.cs.umbc.edu/portal/help/VHDL/verilog/compiler_directives.html

rahultadak commented 1 week ago

Without going into too much detail, I have something like this in a file:

`protected
...
...
`endprotected

Trying to run it with slang like this:

$ slang file.svp

file.svp:line:1: error: unknown macro or compiler directive '`protected'
`protected
^

I removed the details of the files and line numbers.

sequencer commented 1 week ago

We also encountered this under the SNPS VIP flow.

jcurtiss8086 commented 1 week ago

While I'm not saying Slang shouldn't support this, as customers you should also contact SNPS and ask them to deliver LRM compliant code. i.e. they should be using `pragma protect, not `protected. Avery VIPs do this properly.

MikePopoloski commented 4 days ago

Added in 2daa108eede929b7e5fabe8b2e09402898627f04