-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add support for verilator #67
Comments
I suppose the base_builder.py and ghdl.py would be a good starting point, would they? |
Yes, the tool independent logic should sit on I'll add verilator to the docker image so we can run all tests from there (generating the docker file needs some manual stuff still....) |
I add some initial code to detect verilator and its version. So far I was not successful, mainly due to my poor python skills. Do you have any suggestions for debugging the project? |
If you're running via The main test for the tools is done inside The way the tests have been setup is to have each tool's binary executable inside a specific directory (in the Docker container that'd be |
Do you suggest/have, beside the corresponding projects documentation, any tutorial for docker and tox? I am not acquainted with both, specially the latter. |
Not really, I usually look how other projects do things. The testing scripts should ideally be transparent, although there's no guide on that atm... HDL Checker testing is admittedly not the most straightforward. In summary:
Arguments passed to $ ./run_tests.sh -e py37-linux -- hdl_checker.tests.test_database --fail-fast -v
|-----------| A |---------------------------------------------|
tox args | arguments passed to .ci/scripts/run_tests.py
arg
separator And run tests defined in Because # Listing tox envs from within docker
$ ./run_tests.sh -l
py27-linux
py27-windows
py37-linux
py37-windows
# Equivalent to the above, but runs tox locally
$ tox -l
py27-linux
py27-windows
py37-linux
py37-windows Hope that helps! |
Thanks for the tips, I am making some progress here. I forked the project and I am working on a branch called |
I was able to get a basic parsing for verilator to work, but the results are not shown on neovim. The commit you can find here. Below the logging for the committed code:
I am running module simple_mux(
input [1:0] x,
input [4:0] y,
input [11:0] in,
input s,
output reg [1:0] m
);
this_is_an_error
reg bar;
// the line bellow introduces a warning
wire [7:0] foo = in[11:0] + 3'b1;
always @(x or y or s)
begin
if (s == 0)
m = y;
else
m = x;
bar <= foo;
end
always @(s)
begin
bar == 0;
end
endmodule: simple_mux The project configuration file: {
"sources": [
"/home/rnp/tmp/simple_mux/*.v",
],
} My neovim + coc configuration: "hdlchecker": {
"command": "hdl_checker",
"args": ["--lsp", "--log-level", "DEBUG"],
"filetypes": ["vhdl", "verilog", "systemverilog"]
} Version information:
|
First of all, sorry for the long time to get back on this. I tried cloning your repo and could not get it do reproduce this, I'm guessing not everything has been committed. By the log it seems that parsing the command's output is not matching anything. This line here says which command was run and its output (which looks alright), but after this there should be messages reporting the parsed reports.
The most helpful tool I found to get this right is https://regex101.com/ (make sure to select Python flavour, the default is PCRE, and to put the right flags). You can run the regex on sample text and make sure the groups are correct. After some fiddling, I got this regex that seems to work: _stdout_message_scanner = re.compile(
r"""
^%(?P<severity>((\w+\-\w+)|(\w+)))\:\s*
(?P<filename>[^:]+\.s?v):
(?P<line_number>\d+)\:\s*
(?P<error_message>.*)""",
flags=re.VERBOSE,
).finditer There's also other suggestions (as it seems your local copy is newer these might be out of date already)
If you prefer asking stuff on Gitter.im, I think it's easier to help in smaller things really. |
In fact, one file was not committed, my bad. I committed it here, it sets verilator as first builder to be used, you should be able to reproduce it now. The committed code is parsing and matching the warnings and error. I used the same web site (https://regex101.com/) to generate the regex, the only difference between what I committed is the last line, to match warnings as well. _stdout_message_scanner = re.compile(
r"""^\%(?P<severity>((\w+\-\w+)|(\w+)))\:
\s*(?P<filename>\w+\.(v|sv))\:
(?P<line_number>\d+)\:\s*
(?P<error_message>(.*\n.*\n.*)|(.*\n.*))""",
flags=re.VERBOSE,
).finditer What I could observe, is that verilator stops on the errors, once the are corrected it shows the warnings. The logging error messages are the matched contents from the regex. The problem is to pass this information (regex matching) correctly to neovim to show it to the user. So far I did not succeed, if I make any progress, I shall write it here.. Regarding your suggestions:
|
That's were I think the unit tests really help, they usually catch the small details that might be breaking (esp chasing which stderr log file is the latest one).
I saw somewhere you were using |
The unit tests are a great idea, thanks for pointing it out. I am gonna dive into it.
I would gladly help in this effort. :) Regarding the |
Following your suggestion, I started the playing with the unit tests, got 57% coverage according to Tox. I pushed these changes already. There is more to do for sure. 👍 However I noticed, the |
No description provided.
The text was updated successfully, but these errors were encountered: