Sublime Forum

SystemVerilog

#1

The package for SystemVerilog syntax highlighting (and also UCF for xilinx constraint) is available for quite sometime now (in package control and at bitbucket.org/Clams/sublimesystemverilog) but I just added a new functionnality: you can now have the declaration of the signal under your cursor (or selected) display in the status bar.
This is extremely basic and can clearly have some issue (especially with port of non-ANSI style module) so if you have any problem please give me some feedback here with example that create issue.
Hopefully I’ll stay motivated to enhance this and add more feature to ease writing systemVerilog :smile:

1 Like

#2

I just posted this message: SystemVerilog language plugin bug (function names after ws)

…there’s a bug in the code (regex?) that detects functions. I tried to post an image on the original thread, however it appears the storage quota on this forum has been exceeded and image posting disallowed.

0 Likes

#3

I just did an update that should fix your issue, and I also added a basic support for typedef struct/enum highlight and symbol (plus a few more uvm type while I was at it :stuck_out_tongue:).
This seems to work reasonably well on my code: when some expression are split between line this make the syntax highlighting a whole more complex to handle and might add a lot of edge effect. Hopefully it is not worse than before :smile:
As i said in the other thread: do not hesitate to provide patch if you find some things not correctly highlighted, I’m happy to integrate them. And to be sure that I see your message please send a PM since I do not check the forum very often :wink:

0 Likes

#4

I found some motivation back for this plugin, so I added a simple feature that will generate the instantiation of a module from your project.
It’s very basic for the moment (and I’m not entirely happy with the performance to get the list of file …) but I plan to make this more configurable and with option for auto connection as well as auto declaration.
Feedback more than welcome :smile:

0 Likes

#5

Slowly but surely, more features are added (version 1.2.0, should be available in PackagControl): now some basic autocompletion for variable method of type array, string, mailbox, semaphore.
The function to display a variable type should also be more reliable, support more coding style and extract only the usefull information.

Next step: support autocompletion for user define type (struct/enum at first and later function/module IOs, class members/methods).

0 Likes

#6

I made another significant update around autocompletion and module instantiation:

  • Autocompletion now works with interface (providing list of signal of the interface). Also added a few uvm_ functions, system task and macro command
  • module instantiation: can now auto-declare signals (if not already exisiting) for automatic connection.

Since these features relies heavily on more or less complex regex I expect it to not work for everyone: if you find some coding style that are parsed properly you can use the issue tracker of BitBucket to provide me some examples.

0 Likes

#7

Motivation still high to develop this plugin: there is now an alignment feature for port declaration and module instantiation.
If anyone need more configurability for the alignment style, do not hesitate to ask here or on BitBucket issue tracker.
It is still far from the verilog mode of Emacs, but it’s getting there (at least for the feature I liked :stuck_out_tongue:).

0 Likes

#8

Very good plugin :smile:
Can you describe your workflow? What simulator do you use and how?
Internally there are lots of regexp, did you try pyparsing?

0 Likes

#9

Thanks :smile:

In term of workflow, i’m very limited by my work environment where i cannot run sublime in the same environment as the simulator (Questa). So i have some special plugin with one command that save all file, commit to a temporary branch (if not already in a tmp branch) and then push to a private repo accessible in the simulation environment …

I had a look at pyparsing, mainly with the idea of doing some linting (since i cannot use the output of my simulator to do it), but it feels like a lot of work to start having something working. So that’s why i over-abused regexp, it allows me to get features really quickly: i wonder what is the impact in term of performances compare to use a parser and build an AST. In term of parser i also had a look at pydsl which seems pretty interresting.

By the way i added a few new interresting features:

  • Expand/compress of .* in module instantiation ala emacs Autostar
  • smart always snippet (more configurable and with auto clock/reset name based on context)
  • Goto driver, when you want to know who is driving your signal (input of your module, output of an instance, an assign , …)
0 Likes

#10

Author of the pyparsing wrote grammar for verilog 95.
But the pyparsing module can be used just as object based regexp (easier to understand, make revisions).
Yeah, a full-fledged preprocessor and parser need a lot of time investment.
For performance issue, I think it should be cache for parsed files, with checking timestamp\sha.

Would be nice to see your usecases (wiki\screenshots).
Do you use any test\debug environment for your plugin?

0 Likes

#11

I plan to write some doc/example to demonstrate the different feature;)
For the testing of the plugin, unfortunately I do nothing, except use the plugin myself everyday ^^

0 Likes

#12

I finally found some time to document a bit more seriously the plugin: sv-doc.readthedocs.org/en/latest
I start to have a lot of feature, and many might go un-notice so hopefully this will help people use the plugin to its full capabilities.

I have also compiled the different video available in the docs into a youtube playlist: http://www.youtube.com/watch?v=(https://www.youtube.com/playlist?list=PLv7nwCTbMrd3obnLMeI07wrhciaPlsrgz)

By the way I continued to improve the alignement (now works on assignement, signal declaration, case list) autocompletion (auto-case, auto-modport, scope completion) and added some new feature like FSM template and displaying the hierarchy of a module (all its sub-module)

0 Likes

#13

That’s really cool! Thanks for your work :smiley:
Do you use any supplementary plugins?

0 Likes

#14

Very nice plugin; I’m using it daily. I wasn’t aware of the alignment feature, and have been using the excellent AlignTab plugin, but will look at your alignment features too.

Thanks!

0 Likes

#15

Thanks :smile: The alignment part is still not where I want it to be (ultimate goal: complete beautifier :stuck_out_tongue: ) but it’s slowly progressing: I recently added the indent part even though it does not handle properly all coding style …
Feedback on stuff that does not work or stuff you would like to see is more than welcome :wink:

0 Likes

#16

Hi,

Thanks for your great SystemVerilog package! I just want to know, I am remotely using questasim and I am using it in Batch mode. Every time that I want to compile my file I have to update the pervious version in the server and run make file. I know that there is build option in Sublime but I am not quite sure how to use it?

0 Likes

#17

The way to handle that is to have a remote script that you can execute through ssh (check stackoverflow.com/questions/3050 … te-machine) and in Sublime Text you create a new build System (Tool->Build System->New Build System). Just put the ssh command to execute the remote script in the shell_cmd, or better a script doing the ssh command plus the display of the result.

0 Likes

#18

mo_askar,
ssh session is the best choice, any new ideas you can add here
bitbucket.org/Clams/sublimesyst … n-modelsim

0 Likes

#19

Since i asked for a tooltip API and there is now one, I had to use it :stuck_out_tongue:
The show info command (F10 in the keybinding example) now use the tooltip by default. I use the color scheme to setup the color used in the tooltip (I looked at what Faceless did with his scopeHunter plugin).
I now need to use it for other stuff (like function for example), but this is already pretty useful :smile:

0 Likes

#20

I made a significant update:

  • alignment part has been reworked with the main functionality in a file that can be used as stand-alone, outside of ST3: it now properly indent many different styles, and alignement support also more cases.
  • For those using latest dev version, I start using the new syntax highlight. For the moment I only added the highlight of unmatched closing parenthesis/bracket and rework the highlight of typedef which should work a lot better.
  • The Find Instance function has been improved in term of performances and the result now works like the Find In files result where you can simply double click to navigate.

And for information I uploaded my color-scheme to the bitbucket download section: bitbucket.org/Clams/sublimesyst … t2.tmTheme

0 Likes