amiq-consulting / amiq_blog

Code snippets from articles published on www.amiq.com/consulting/blog
Apache License 2.0
34 stars 32 forks source link

Translated your SV/DPI-C example to Nim #2

Closed kaushalmodi closed 5 years ago

kaushalmodi commented 5 years ago

Hello,

I have been recently interested in using Nim as a foreign language to interface with SV.

In my experiments, it had turned out to be a much more pleasant language to work with than C.

I ended up on your blog during my DPI-C research, and I took up a task to translate the C functions in the example to Nim.

I ended up with libdpi.nim which replaces both dpi_c_ex.c and dpi_c_misc.h.


You can look in my nim-systemverilog-dpic repo for many more Nim/DPI-C/SV examples.

amiq-consulting commented 5 years ago

Hello,

This sounds interesting, especially given Nim is quite exotic in the SystemVerilog/RTL simulation world :) Can you add the comment as a comment to the article on the blog?

Can you also specify on which simulators you have tried it?

kaushalmodi commented 5 years ago

especially given Nim is quite exotic in the SystemVerilog/RTL simulation world :)

I am trying to change that :)

I recently presented about Nim/SV interface at CDNLive Silicon Valley 2019. You can download the slides from its proceedings.

Can you also specify on which simulators you have tried it?

We use only Cadence Xcelium. So I have tried this only on Xcelium 18.03-s06. Note though that the referenced libdpi.nim works without any modifications to the SV files in your repo (I just renamed and re-indented them, and added end labels to my preference).


Can you add the comment as a comment to the article on the blog?

I'll do that. Thanks.


Btw I possibly found few bugs in the C code during this translation process:

amiq-consulting commented 5 years ago

Hi, Kaushal.

Thank you for the comment and for pinpointing those possible bugs. We will have a look at them.

Is it possible from your side to post the CDNLive presentation on your GitHub account or somewhere else? We're planning to recommend your presentation in our monthly Recommended Articles blog but we need a pointer to your presentation.

Thank you. Best regards, Aurelian

kaushalmodi commented 5 years ago

Hello Aurelian,

Thank you for the comment and for pinpointing those possible bugs. We will have a look at them.

Thanks.

Also, thanks for picking my slides for your Recommended Articles! :) I have uploaded my slides to https://www.slideshare.net/KaushalModi4/nim-and-dpic-and-systemverilog.

amiq-consulting commented 5 years ago

Hi, Kaushal.

Thank you for reporting those 3 issues. https://github.com/kaushalmodi/nim-systemverilog-dpic/blob/8d7a1f8d899d8467c25e6291f25b66ed4825873d/amiq_dpi_c_examples/libdpi.nim#L17-L21 https://github.com/kaushalmodi/nim-systemverilog-dpic/blob/8d7a1f8d899d8467c25e6291f25b66ed4825873d/amiq_dpi_c_examples/libdpi.nim#L34-L37 https://github.com/kaushalmodi/nim-systemverilog-dpic/blob/8d7a1f8d899d8467c25e6291f25b66ed4825873d/amiq_dpi_c_examples/libdpi.nim#L63-L74

They were mainly number representation and print problems. They should be fixed now.

Thank you! Best regards, Aurelian