context.vim
context.vim copied to clipboard
Feature request: Support verilog language
It would be awesome to add support for verilog language!
Thanks!
Can you share an example file and what you would expect as a context? Thanks!
Sure! Thanks for offering!
So, verilog (or its more recent version, aka SystemVerilog) is a huge language! Doing something that covers even 50% of the language would be not an straightforward task! For this reason I guess what I'd like to get here is something that covers a painful use case for me: navigating HUGE verilog netlist files. I make a distinction here with using netlist word, as this is a special flavour of verilog (called structural verilog), which does look a bit different from the higher-level behavioral verilog.
Example of structural verilog here.
https://github.com/chenfengrugao/nlviewer/blob/master/test.v
Example of behavioral verilog here.
https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md#basic-template
As you can see they look quite different. The behavioral looks a lot like many other C or Java based languages. Its main difference is that it does not use braces but begin/else to separate code that go into conditions. Maybe adding suport for this would be easy for you?
However, as I said earlier, support for behavioral verilog is not the main thing I am looking for. A painful use case for me is having to navigate HUGE (~GB) files of structrural verilog. Imagine, like in the example that you have a
module xor4 (a , b , c);
input [3:0] a ;
input [3:0] b ;
output [3:0] c ;
module_name instance_name (
.A2 ( b[0] ), // these are "port connections", I am declaring a huge instance of module_name called instance_name
.A1 ( a[0] ),
.Y ( c[0] )
...
... // <--cursor is here
// 200 lines of ports
) ;
XOR U1 (.A2 ( b[1] ) , .A1 ( a[1] ) , .Y ( c[1] ) ) ;
XOR U2 (.A2 ( b[2] ) , .A1 ( a[2] ) , .Y ( c[2] ) ) ;
XOR U3 (.A2 ( b[3] ) , .A1 ( a[3] ) , .Y ( c[3] ) ) ;
endmodule
othermodule
...
otherendmodule
If the cursor was to be there on the code , I would expect to see that I am on vim
xor4.instance_name
I think this should be easy enough?
thanks, please let me know any question you might have !