博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vim + syntastic + verilator or iverilog
阅读量:6902 次
发布时间:2019-06-27

本文共 1735 字,大约阅读时间需要 5 分钟。

若文章有錯誤請留言指證

需要轉載請通知筆者

Introduction

讓你可以在vim裡可以使用功能,讓你在寫code時檢查看看有沒有語法上的錯誤或者可能潛在的錯誤


Install

linter

首先要先安裝linter有兩種選擇: Icarus Verilog或是verilator,看你偏好哪一種

我是經由homebrew安裝:

$brew install verilator$brew install iverilog

syntastic

syntastic我是使用vundle安裝,你也可以透過其他package manager安裝.請參考

透過vundle安裝(這裡我是透過vundle安裝syntastic,如果不會使用vundle,請參考)

Plugin 'scrooloose/syntastic'

vimrc加上以下幾行, 以下是參考syntastic官方的設定

set statusline+=%#warningmsg#set statusline+=%{SyntasticStatuslineFlag()}set statusline+=%*let g:syntastic_always_populate_loc_list = 1let g:syntastic_auto_loc_list = 1let g:syntastic_check_on_open = 1let g:syntastic_check_on_wq = 0

設置lintor:verilatoriverilog我都設定了,兩個都有則會一起檢查,若是第一個掛了它會自動找第二個,如果你只想使用其中一種,留著你要的那一個即可

let g:syntastic_verilog_checkers = ['verilator','iverilog']

Use

完成之後可以用:SyntasticInfo查看是否有配置完成

这里写图片描述

接下來就可以使用:SyntasticCheck開啟語法檢查功能啦

syntastic好像也有提供在:w時提供檢查的功能


Some problem

syntastic會根據filetype去開啟不同語言的linter

可以用:set filetype?看看是不是verilog

有些人會使用的套件來讓verilog產生語法高亮,filetype則會是verilog_systemverilog,此時syntastic則不會支持

目前我的解法是在verilog_systemverilog套件裡判斷副檔名的地方更改.

本來是長這樣:

au! BufNewFile,BufRead *.v,*.vh,*.vp,*.sv,*.svi,*.svh,*.svp setfiletype verilog_systemverilog

為了同時使用syntastic verilog_systemverilog的語法高亮,我的做法是將.v檔案當成普通的verilog並讓syntastic只支持.v,我將上面改成:

au! BufNewFile,BufRead *.vh,*.vp,*.sv,*.svi,*.svh,*.svp setfiletype verilog_systemverilogau! BufNewFile,BufRead *.v setfiletype verilog_systemverilog.verilog

也就是讓.v檔案同時有兩種filetype, .v檔案之外都當成verilog_systemverilog.


Summary

簡單來說你可以用一樣的方法去設定其他語言的linter

可以分成以下step:

1. 安裝語言相對應的linter2. 安裝syntastic(如果本來就有可以跳此步驟)3. 查看syntastic官方文件,看syntastic有沒有支持你的linter4. 根據syntastic官方文件去設定你的linter

step3syntastic所支持的


Reference

  1. [VIM插件: SYNTASTIC[语法检查]](

  2. [[資工雜筆] 建置 vim + syntastic + eslint + gcclint](

转载地址:http://ozvdl.baihongyu.com/

你可能感兴趣的文章
如何成为“10倍效率”开发者
查看>>
IE和FF 常见问题
查看>>
smarty常见问题n
查看>>
C#开发的高性能EXCEL导入、导出工具DataPie(支持MSSQL、ORACLE、ACCESS,附源码下载地址)...
查看>>
40幅极具创意的街头墙绘艺术作品欣赏(上篇)
查看>>
matlab gui 命令大全
查看>>
PTC FlexPLM rfa 接口自动创建产品规格
查看>>
转 使用JavaScript和DOM动态创建表格
查看>>
myeclipse安装svn插件的多种方式
查看>>
usb键鼠标驱动分析
查看>>
Ecshop安装过程中的的问题:cls_image::gd_version()和不支持JPEG
查看>>
ArcPad 10 的安装部署
查看>>
android dialog加载中动画效果
查看>>
Android SQLite 事务处理
查看>>
Ruby环境配置
查看>>
JDBCTemplate基础学习
查看>>
UVA - 10714 Ants
查看>>
EF框架step by step(6)—处理实体complex属性
查看>>
Codeforces Round #345 (Div. 1) A - Watchmen 容斥
查看>>
在storyboard中的静态UITableView中拖入 UISearchBar and Search Display Controller出现的奇怪问题...
查看>>