-
Notifications
You must be signed in to change notification settings - Fork 141
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
SystemVerilog Support #391
Comments
@woolseyj, apio is base on yosys, nextpnr and the other open sources tools. Do they support System Verilog? If not, I suggest to file this feature request yes. If yes, please provide informaiton on what apio should do differently (e.g. different flags when invoking yosys or nextpnr). |
@zapta To my understanding, SystemVerilog support can be added by using the The OSS CAD Suite that APIO installs does not support that plugin. I have tried the following
I will try to update the OSS CAD Suite in APIO and see if I can get an example with SystemVerilog to work |
@gmsanchez, the dev version of Apio installs all the files from the yosys oss package but I still get the same error as you. The yosys hq version we use for apio dev is below. Can you install it directly from there and see if you can make system verilog to work. IRRC, it contains a script that you need to run first to set the env variables on your system. Once we will know how to run SV with the yosys hq package we will know how to replicate it with apio. https://github.com/YosysHQ/oss-cad-suite-build/releases/tag/2024-08-02 |
@zapta thanks for the quick response. I was able to create an example that works on my EDU-CIAA FPGA You can check https://github.com/gmsanchez/edu-ciaa-fpga-verilog/tree/main/01-leds-sv In there you can find a file named I downloaded OSS CAD Suite from https://github.com/YosysHQ/oss-cad-suite-build/releases/tag/2024-12-10, which comes with |
Tracks. I will give it a try.
…On Tue, Dec 10, 2024 at 10:57 AM Guido Sanchez ***@***.***> wrote:
@zapta <https://github.com/zapta> thanks for the quick response. I was
able to create an example that works on my EDU-CIAA FPGA
You can check
https://github.com/gmsanchez/edu-ciaa-fpga-verilog/tree/main/01-leds-sv
In there you can find a file named Info.md that has the list of commands
I used to get the leds.sv file running on the FPGA.
I downloaded OSS CAD Suite from
https://github.com/YosysHQ/oss-cad-suite-build/releases/tag/2024-12-10,
which comes with Yosys 0.47+211 (git sha1 b0708a38b, clang++ 18.1.8 -fPIC
-O3)
—
Reply to this email directly, view it on GitHub
<#391 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQVMQOQLG54CZYBJSQU2VL2E42Q5AVCNFSM6AAAAABMKDW53CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZSGYZDGMRUGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I was able to reproduce your success with the oss 2024-12-10 version. We
will upgrade the dev oss package to 2024-12-10 and will go from there.
…On Tue, Dec 10, 2024 at 11:22 AM Tal Dayan ***@***.***> wrote:
Tracks. I will give it a try.
On Tue, Dec 10, 2024 at 10:57 AM Guido Sanchez ***@***.***>
wrote:
> @zapta <https://github.com/zapta> thanks for the quick response. I was
> able to create an example that works on my EDU-CIAA FPGA
>
> You can check
> https://github.com/gmsanchez/edu-ciaa-fpga-verilog/tree/main/01-leds-sv
>
> In there you can find a file named Info.md that has the list of commands
> I used to get the leds.sv file running on the FPGA.
>
> I downloaded OSS CAD Suite from
> https://github.com/YosysHQ/oss-cad-suite-build/releases/tag/2024-12-10,
> which comes with Yosys 0.47+211 (git sha1 b0708a38b, clang++ 18.1.8
> -fPIC -O3)
>
> —
> Reply to this email directly, view it on GitHub
> <#391 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAQVMQOQLG54CZYBJSQU2VL2E42Q5AVCNFSM6AAAAABMKDW53CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZSGYZDGMRUGE>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
That's great! Thanks! I used those commands just because they are based on the workflow I had before using APIO. I know that maybe nowadays nextpnr is preferred over arachne-pnr. Let me know if you need some help with something. |
… system verilog support per FPGAwars/apio#391 (comment)
@gmsanchez, I sent a PR for the new apio's dev oss-cad-suite package using the latest yosysHQ's package. Also tried it with a local new package, took apio build commands and use them as are but replacing leds.v instead of leds.sv (this is with the new dev apio which is slightly different from the prod apio). Results below. A question, with Yosys, can a project has a mix of verilog and system verilog files or do they need to be of same type? What about the testbenches, can they also be a mix of .s and .sv? My shell script test.sh:
Execution log:
|
@zapta awesome work! It seems that everything is working properly. I will try those commands as soon as I have the FPGA with me again. To my understanding, SystemVerilog is a super set of Verilog and because of that, it should be backwards compatible with Verilog. In practice, I have never used SystemVerilog until yesterday, so I really don't know the answer. My intuition says that if you use SystemVerilog, then you could use a mix of SystemVerilog and Verilog files. But I am not 100% sure. |
Do you use apio prod or dev?
If you want to use dev it is relatively easy. Get a copy of the apio
repository (via zip download or git clone) and then
pip uninstall apio # delete the prod apio
cd <root-directory-of-the-repo>
pip install -e .
To test you can run
apio system -i
…On Wed, Dec 11, 2024 at 3:42 AM Guido Sanchez ***@***.***> wrote:
@zapta <https://github.com/zapta> awesome work! It seems that everything
is working properly. I will try those commands as soon as I have the FPGA
with me again.
To my understanding, SystemVerilog is a super set of Verilog and because
of that, it should be backwards compatible with Verilog.
In practice, I have never used SystemVerilog until yesterday, so I really
don't know the answer. My intuition says that if you use SystemVerilog,
then you could use a mix of SystemVerilog and Verilog files. But I am not
100% sure.
—
Reply to this email directly, view it on GitHub
<#391 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQVMQIV253B42Y4PFN2DPD2FAQLZAVCNFSM6AAAAABMKDW53CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZVGY4TKMRSG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I have always used apio prod and always downloaded it using pip. I will do that in order to use apio dev and check these features out. Is there anything particular you would like me to test? |
@zapta I have modified some code on You can check gmsanchez@cfe6b31 |
@gmsanchez, @zapta, thank you both for working on this. |
Thanks @gmsanchez. that's good news. I am working now on a large change that touch numerous files so will add this change (with tests, etc) after that. Can you send a pull request with a test example that includes sv source and testbench files? This will help with the testing. Try to use in the sv file features that are beyond verilog and would fail if used in a .v file. Extra points if you add two examples, one for the alhambra-ii (ICE40) and one for the ColorLight (ecp5) https://github.com/FPGAwars/apio/tree/develop/test-examples/TB |
@zapta I have added an example for the EDU-CIAA-FPGA, it is a simple 1-bit AND gate and is available here gmsanchez@e138c5b The module uses Running In order to make If you think there is a better way to change the way |
Will the -g2012 work also with existing verilog projects or is it something
that we need to control on/off?
…On Tue, Dec 17, 2024 at 12:14 PM Guido Sanchez ***@***.***> wrote:
@zapta <https://github.com/zapta> I have added an example for the
EDU-CIAA-FPGA, it is a simple 1-bit AND gate and is available here
***@***.***
<gmsanchez@e138c5b>
The module uses logic when defining the input and output ports instead of
wire. That change should make it fail if it is used in a .v file
Running apio build works, but failed while running apio sim and1_tb.sv.
In order to make apio sim and1_tb.sv work, I had to change the way
iverilog is called by adding -g2012, you can see that here gmsanchez@
ccafb13
<gmsanchez@ccafb13>
If you think there is a better way to change the way iverilog is called
instead of hard-coding the parameter that way, let's fix that first. Would
that be OK?
—
Reply to this email directly, view it on GitHub
<#391 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQVMQKAQ4YRV5QDR5C2JN32GCAZLAVCNFSM6AAAAABMKDW53CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBZGUZDANBQGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
From the
So I think that that flag is something that should be turned on/off depending if there are I also created a D_FlipFlop example to test if the |
Does this mean that .sv and .v files can't be mixed in the same project?
I am working now on making apio.ini a required file so we can add there
controls but it would be nice if we can mix .v and .sv files (I am not a
verilog expert so don't know if this is common or useful).
…On Tue, Dec 17, 2024 at 12:34 PM Guido Sanchez ***@***.***> wrote:
From the iverilog man page https://linux.die.net/man/1/iverilog:
-g1995|-g2001|-g2001-noconfig|-g2005
Select the Verilog language generation to support in the compiler. This
selects between IEEE1364-1995, IEEE1364-2001, or IEEE1364-2005. Normally,
Icarus Verilog defaults to the latest known generation of the language.
This flag is most useful to restrict the language to a set supported by
tools of specific generations, for compatibility with other tools.
So I think that that flag is something that should be turned on/off
depending if there are .sv files in the project directory. At least for
now that approach seems safer and less prone to break stuff that is
programmed using only Verilog.
I also created a D_FlipFlop example to test if the always_ff primitive
works. So far, all good. You can check that here ***@***.***
<gmsanchez@b21ed1e>
—
Reply to this email directly, view it on GitHub
<#391 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQVMQJ3UNKKNROE6UWJO5T2GCDGDAVCNFSM6AAAAABMKDW53CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBZGU3DMMBZG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
From what I understand, SystemVerilog is a super-set of Verilog. So, if we use a SystemVerilog enabled toolchain we could mix .sv and .v files. That being said, I really don't know how mature is the SystemVerilog support in the programs that are being used. For example, if I am not mistaken, SystemVerilog support for the OSS CAD Suite was added on november 15, 2024. Check this out https://github.com/YosysHQ/oss-cad-suite-build/commits/main/ SystemVerilog support was added by adding the Because of this, I think that the most conservative thing would be some of the following:
I am also no expert in the field. I have been using the EDU-CIAA-FPGA with |
Hi @gmsanchez, the two policy items you suggested sound good, safe, and feasible. |
@zapta that is great! Is there any way I can help with that? Just let me know |
Hi @gmsanchez, I was able to reproduce your success but
|
Hi! I got it working by running these commands inside the
Let me know if that works for you |
Hi @gmsanchez, when I use the slang options I get graph failues with a few of the apio examples. For example, the one below BTW, I think that 'SB_RGBA_DRV' module is defined in the yosys library Any suggestions? Ideally we will have a graph command line that will work for both .v and .sv files. If it's a yosys issue you can ask them directly.
|
I have asked about that issue here: YosysHQ/oss-cad-suite-build#133 In the meantime I will try to figure this out Thanks! |
Thanks! It helps a lot.
…On Wed, Dec 18, 2024 at 11:29 AM Guido Sanchez ***@***.***> wrote:
I have asked about that issue here: YosysHQ/oss-cad-suite-build#133
<YosysHQ/oss-cad-suite-build#133>
In the meantime I will try to figure this out
Thanks!
—
Reply to this email directly, view it on GitHub
<#391 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQVMQPE3OETBTNGLLZ4YCL2GHEJ5AVCNFSM6AAAAABMKDW53CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJSGEYTAMBXGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
… On Wed, Dec 18, 2024 at 11:53 AM Tal Dayan ***@***.***> wrote:
Thanks! It helps a lot.
On Wed, Dec 18, 2024 at 11:29 AM Guido Sanchez ***@***.***>
wrote:
> I have asked about that issue here: YosysHQ/oss-cad-suite-build#133
> <YosysHQ/oss-cad-suite-build#133>
>
> In the meantime I will try to figure this out
>
> Thanks!
>
> —
> Reply to this email directly, view it on GitHub
> <#391 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAQVMQPE3OETBTNGLLZ4YCL2GHEJ5AVCNFSM6AAAAABMKDW53CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJSGEYTAMBXGI>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
That's what I also think about mixing .sv and .v files. What I am not sure about is the level of maturity of each of the tools implied in the process. It seems that Verilog is very much supported by the toolchain while SystemVerilog support seems to be a work in progress. |
Let's see if we can figure out the apio graph issue, If not we can block it for projects with .sv with a proper error message. |
It seems that the error we are getting is because of the way You can check YosysHQ/oss-cad-suite-build#133 It doesn't fail earlier because when we execute
if you remove the
|
Thanks @gmsanchez. Do we have any lead for possible solution? Also, can you create an example that demonstrate this issue so we can use for testing. https://github.com/FPGAwars/apio/tree/develop/test-examples/TB/edu-ciaa-fpga |
APIO is a great utility and I use it frequently for testing my Verilog designs.
Are there any plans to support SystemVerilog?
The text was updated successfully, but these errors were encountered: