Add local HLS dev setup: clangd, pragma highlighting + linting, local C-sim
This commit is contained in:
43
Practicals/hlsdev/nvim/after/syntax/cpp.vim
Normal file
43
Practicals/hlsdev/nvim/after/syntax/cpp.vim
Normal file
@@ -0,0 +1,43 @@
|
||||
" ===========================================================================
|
||||
" HLS pragma highlighting for Vitis HLS (EMBS)
|
||||
" ---------------------------------------------------------------------------
|
||||
" Vim's stock C/C++ syntax files treat the whole "#pragma HLS ..." line as one
|
||||
" anonymous preprocessor directive, so the pragma name and its options are
|
||||
" invisible. These rules give them their own highlight groups.
|
||||
"
|
||||
" Loaded automatically when this directory is on 'runtimepath' (see the
|
||||
" hlsdev README). Safe to source twice.
|
||||
" ===========================================================================
|
||||
|
||||
if !exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
if b:current_syntax !=# 'cpp' && b:current_syntax !=# 'c'
|
||||
finish
|
||||
endif
|
||||
|
||||
" The pragma line as a whole, so options inside it can be picked out.
|
||||
syntax region hlsPragma
|
||||
\ start=/#\s*pragma\s\+HLS\>/
|
||||
\ end="$"
|
||||
\ keepend
|
||||
\ contains=hlsPragmaName,hlsPragmaOption,hlsPragmaValue,hlsPragmaMode
|
||||
|
||||
" The pragma name: PIPELINE, UNROLL, ARRAY_PARTITION, INTERFACE, ...
|
||||
syntax match hlsPragmaName /\<HLS\>\s\+\zs[A-Z][A-Z_]*/ contained
|
||||
|
||||
" Option keys: variable=, II=, type=, port=, bundle=
|
||||
syntax match hlsPragmaOption /\<\w\+\ze\s*=/ contained
|
||||
|
||||
" Option values: complete, 2, in_words, AXILiteS
|
||||
syntax match hlsPragmaValue /=\s*\zs[^ ]\+/ contained
|
||||
|
||||
" INTERFACE modes are positional, so they have no "mode=" in front of them:
|
||||
" #pragma HLS INTERFACE s_axilite port=return bundle=ctrl
|
||||
syntax match hlsPragmaMode /\<\%(ap_none\|ap_vld\|ap_ack\|ap_hs\|ap_ovld\|ap_fifo\|ap_memory\|ap_bram\|bram\|ap_ctrl_none\|ap_ctrl_hs\|ap_ctrl_chain\|m_axi\|s_axilite\|axis\|s_axis\|m_axis\|ap_stable\|ap_bus\)\>/ contained
|
||||
|
||||
highlight default link hlsPragma PreProc
|
||||
highlight default link hlsPragmaName Statement
|
||||
highlight default link hlsPragmaOption Identifier
|
||||
highlight default link hlsPragmaValue Constant
|
||||
highlight default link hlsPragmaMode Constant
|
||||
Reference in New Issue
Block a user