Giter VIP home page Giter VIP logo

sublimelinter-contrib-verilator's Introduction

SublimeLinter-contrib-verilator

Package Control PayPal

This linter plugin for SublimeLinter provides an interface to Verilator. Verilator is a open source HDL simulator and can be used as a linter with --lint-only option. For more information, you can see here, https://www.veripool.org/wiki/verilator Verilator is fast and easy to use to link with Sublime Text Editor on variable OS before runnning commercial simulaton and synthesis tools.

Prerequisite

  • SublimeLinter 4 installation - Guide from here
  • Verilator installation - Guide from here
  • Verilator pre-compiled Windows version - Verilator 5.020 with 3 MinGW libraries.
  • Verilator PATH settings - SublimeLinter-contrib-verilator uses verilator_bin or verilator_bin.exe instead of verilator. You have to add PATH environment variable for verilator_bin or verilator_bin.exe

Lint based on multiple files

Two options are added to support linting based on multiple files. If you set full paths, the original version of verilator can be used.

  • "use_multiple_source": true
  • "search_project_path": true

an example of settings in a sublime-project file:

    "sources":
    [
        "D:\\project\\srcs",
        "D:\\project\\working"
    ]

Screenshot

Image

Settings

In order to set arguments of Verilator or control lint message, Use SublimeLinter's user settings like the following.

{
    "no_column_highlights_line": true,
    "linters":
    {
        "verilator": {
            "lint_mode": "load_save",
            "styles" : [
                {
                    "types": ["warning"],
                    "mark_style": "squiggly_underline",
                    "icon": "Packages/SublimeLinter/gutter-themes/Default/cog.png"
                },
                {
                    "types": ["error"],
                    "mark_style": "fill",
                    "icon": "Packages/SublimeLinter/gutter-themes/Default/cog.png"
                }
            ],
            "args": [
                "--error-limit",
                "500",
                "--default-language",
                "1800-2017",
                "-Wall",
                "-Wno-WIDTHTRUNC",
                "-Wno-WIDTHEXPAND",
                "-Wno-INITIALDLY",
                "-Wno-UNDRIVEN",
                "-Wno-UNOPTFLAT",
                "-Wno-UNUSEDPARAM",
                "-Wno-SIDEEFFECT",
                "-Wno-PINCONNECTEMPTY",
                "-Wno-BLKSEQ",
            ],

            "verilator_version"  : 5,
            "use_multiple_source": false,
            "search_project_path": false,

            // to lint based on multiple files (searching external sources - the same directory or project path)
            //   "use_multiple_source": true,
            //   "search_project_path": true,
            //  example) example.sublime-project
            //       "sources": [ "D:\\project\\srcs", "D:\\project\\working" ]

            // windows subsystem for linux (wsl verilator_bin)
            "use_wsl": false,

            // additional option to filter file type
            "extension": [
                ".v", ".sv"
            ],
        }
    }
}

Key Map

'F1' : SublimeLinter Show All Errors
'Shift+F1' : SublimeLinter Lint This View

Troubleshooting

Turn on SublimeLinter's Debug Mode and Open the console of Sublime Text. You can check the communication status from SublimeLinter to Verilator. You can also add your own filter_errors messages by using them.

SublimeLinter: verilator: shift_reg.v ['D:\\Program\\verilator-3.902\\verilator_bin.exe', '--lint-only', ...
SublimeLinter: verilator output:
%Warning-LITENDIAN: c:/users/shift_reg.v:14: Little bit endian vector: MSB < LSB of bit range: 0:7
%Warning-LITENDIAN: Use "/* verilator lint_off LITENDIAN */" and lint_on around source to disable this message.
%Error: Exiting due to 1 warning(s)

Donate

Doate Image
Thank you for donating. It is helpful to continue to improve the plug-in.

Credits

Thanks to SublimeLinter Team and Veripool Organization.

Issues

When you have an issue, tell me through https://github.com/poucotm/SublimeLinter-contrib-verilator/issues, or send me an e-mail [email protected]

sublimelinter-contrib-verilator's People

Contributors

poucotm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sublimelinter-contrib-verilator's Issues

always give WIDTH warning when instantiation

the warning is as below:
the verilator regard every port as 8192 bit width,

verilator: warning
WIDTH - Input port connection 'clk' expects 8192 bits on the pin connection, but pin connection's VARREF 'clk' generates 1 bits.

image

verilator output changed

4.028
%Error: delay.sv:18: syntax error, unexpected else
    else
    ^~~~
%Error: Exiting due to 1 error(s)

4.030
%Error: delay.sv:18: syntax error, unexpected else
    else
    ^~~~
%Error: Exiting due to 1 error(s)

4.032
%Error: delay.sv:18:5: syntax error, unexpected else
   18 |     else
      |     ^~~~
%Error: Exiting due to 1 error(s)

Since release 4.032, the output format has changed. Please add a fix.

Always show 'verilator(erred)' on the sublime text statusbar

I've compiled verilator_bin.exe on Windows7, 64bit, it seems the verilator doesn't work. It always and only show at statusbar 'verilator(erred)', and no any tooltip messages show when editing the HDL code.

My linters settings as below:

// SublimeLinter Settings - User
{
"paths": {
"linux": [],
"osx": [],
"windows": "D:\verilator\bin"
},

"linters": {
    // The name of the linter you installed
      "verilator": {
      "@disable": false,

      "args": [
          "--error-limit",
          "500",
          "--default-language",
          "1800-2012",
          "--bbox-sys",
          "--bbox-unsup",
          "-Wall",
          "-Wno-DECLFILENAME",
          "-Wno-IGNINC",
          "-Wno-IGNMOD",
          "-Wno-IGNDEF",
          "-Wno-IGNUNUSED",
          "-Wno-WIDTH",
          "-Wno-CASEX",
          "-Wno-STMTDLY"
      ],
      "excludes": [],
      "extension": [
          ".v", ".sv"
      ],
  }
},

}

Proposed configuration does not output linting

I was following the steps proposed in the README with standard Verilator v4.200 (downloaded from Brew on MacOS and Ubuntu via apt-get).

After configuring SublimeLinter settings I tried to compile a Verilog file, but I was constantly getting:

verilator: no output

In the Sublime console I could see that the Verilator_bin command was being run.

Turns out the some of the args are not valid for Verilator. Specifically, it complained about:

"-Wno-IGNINC",
"-Wno-IGNDEF",
"-Wno-INPUTPINEMPTY",
"-Wno-OUTPUTPINEMPTY"

After removing them, I got it to work fine.

Two of them are specified as "optional", yet included in basic configuration.

It would be nice to remove them in Settings section in README and define all of them as optional for "modified" version.

Extension does not work with `search_project_path` set to `true`.

Here's the error on console:

SublimeLinter: ERROR: Unhandled exception:
Traceback (most recent call last):
  File "/home/yoojer/.config/sublime-text/Installed Packages/SublimeLinter.sublime-package/lint/backend.py", line 157, in execute_lint_task
    errors = linter.lint(code, view_has_changed)
  File "/home/yoojer/.config/sublime-text/Installed Packages/SublimeLinter-contrib-verilator.sublime-package/linter.py", line 86, in lint
    return super(Verilator, self).lint(code, view_has_changed)
  File "/home/yoojer/.config/sublime-text/Installed Packages/SublimeLinter.sublime-package/lint/linter.py", line 1163, in lint
    output = self.run(cmd, code)
  File "/home/yoojer/.config/sublime-text/Installed Packages/SublimeLinter.sublime-package/lint/linter.py", line 1568, in run
    return self.tmpfile(cmd, code)
  File "/home/yoojer/.config/sublime-text/Installed Packages/SublimeLinter-contrib-verilator.sublime-package/linter.py", line 165, in tmpfile
    for path in prjsrc:
TypeError: 'NoneType' object is not iterable

search_project_path is Window's Specific

On OSX, I see that -I arguments aren't being passed to Verilator when search_project_path and use_multiple_sources are True since the appending to cmd only occurs if the platform is windows.

Had to do some hacking to get multi-file linting to work for OSX (Manually add -I args in sublime-settings)

        "use_multiple_source": true,
        "search_project_path": true,

           `for path in prjsrc:
                    if sublime.platform() == 'windows':
                        if wslopt:
                            path = '/mnt/' + re.sub(':', '', path)
                        path = '-I' + re.sub(re.compile(r'\\'), '/', path)
                        cmd.append(path)`

Verilator PATH settings

Where is verilator_bin?Should I rename verilator?How to add PATH environment variable for verilator_bin in Windows10?Sorry,can you go into more detail?

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.