|
V
|
|
ASIC/FPGA Design and Verification Out Source Services
How to use highlight feature of vim for debug.
-
Today I manged to find the cause of failure, which I tried to debug for a few days.
To analyse the problem, I had printed debug messages from a few units: BFM, monitor and others.
-
The problem was that:
- The messages are mixed with many other messages of the same unit but from different instances all together in the very same simulation log file.
- The messages are intermixed with other ones, because each one of them happens in a different time.
-
A step by step procedure, on this page, suggests a nice way to fully take advantage of vim highlight feature to facilitate a complex debug case.
- Decide which are the messages, that you want to extract into separate debug log file. The new generated debug log file will be a sub-block of the entire simulation log.
Than create a one-line-script, based on the command grep -e, to extract the messages:
#!/bin/bash
grep -e "TXUART RX_AGENT MON: crd U_DEC" -e "TXUART RX_AGENT MON: los_fsm" -e "TXUART RX_AGENT MON: sync_status TXUART.rx" -e "TXUART RX_AGENT MON: kword_err" spc.elog
- Next teach vim to color your debug log file. I use red for errors. I color green for okay messages such as in synchronization ones . And I use orange or yellow for start to move out of synchronization state messages.
Some examples, first for vim color syntax, follow:
syntax match kword_err /kword_err/
hi kword_err guibg=red3 guifg=beige
syntax match kerrT /kerr=T/
hi kerrT guibg=red3 guifg=beige
syntax match sync_state_a /STATE_A/
hi sync_state_a guibg=white guifg=green
syntax match sync_state_bd /STATE_[B-D]/
hi sync_state_bd guibg=beige guifg=orange
syntax match sync_state_e /STATE_E/
hi sync_state_e guibg=white guifg=red
syntax match sync_lost /SYNC_LOST/
hi sync_lost guibg=white guifg=#992020
- If you use this debug rules frequently, as in my case, add it to .[g]vimrc file, to allow automatic coloring launch, based on file suffix (.elog in this case):
au BufRead,BufNewFile *.elog so ~/Junk/UART_DIR/queue.vim
au BufRead,BufNewFile nc*.log so ~/Junk/UART_DIR/queue.vim

-
Below is a nice syntax set of rules to color a specman elog file.
Red for errors, green for pass okay cases, orange for warnings and
kinds of blue color for
some progress messages:
syntax match end_no_err /0 DUT errors/
hi end_no_err guibg=green guifg=blue
syntax match end_no_war /0 DUT warnings/
hi end_no_war guibg=green guifg=blue
syntax match end_some_war /[0-9]*[^0] DUT warnings/
hi end_some_war guibg=orange guifg=blue
syntax match end_some_err /[^0] DUT errors/
hi end_some_err guibg=red guifg=blue
syntax match end_some_err_2 /[^0]0 DUT errors/
hi end_some_err_2 guibg=red guifg=blue
syntax match end_normal /Normal stop/
hi end_normal guibg=green guifg=blue
syntax match fin_msg_1 /FINISH_TEST[ a-zA-Z_0-9]*/
hi fin_msg_1 guibg=blue guifg=white
syntax match any_war /[Ww][Aa][Rr][Nn][Ii][Nn][Gg]/
hi any_war guibg=orange guifg=brown
syntax match sbd_1 /SCOREBOARD/
hi sbd_1 guibg=lightblue guifg=black
syntax match sbd_exp /Expected: [0-9a-fA-F]*/
hi sbd_exp guibg=lightblue guifg=black
syntax match sbd_col /Collected: [0-9a-fA-F]*/
hi sbd_col guibg=lightblue guifg=black
syntax match sbd_just /Justified as dropped: [0-9a-fA-F]*/
hi sbd_just guibg=lightblue guifg=yellow
syntax match sbd_main /[A-Za-z0-9_ \s\t]*main_scoreboard/
hi sbd_main guibg=lightblue guifg=orange
syntax match obj_1 /TEST.*objection/
hi obj_1 guibg=lightblue guifg=brown
syntax match csr_acc /CSR access/
hi csr_acc guibg=lightblue guifg=black
syntax match phase_1 /[A-Z0-9_]* phase [a-z0-9_]*/
hi phase_1 guibg=yellow guifg=brown
syntax match seed /test .seed=.*[0-9]*/
hi seed guibg=yellow guifg=brown
syntax match enabled /[A-Za-z0-9_]*[ \s\t]*enabled/
hi enabled guibg=yellow guifg=green
-
To highlight a pattern between multiple lines:
/^Error\_.\{-}\.\.\.
In this example, the first line starts with
Error and
on the last line at end we have
"...".
Contact me now at: |
|
... |
|
I would be happy to offer my services. Call ASAP !
|
Search This Site
Feedback This Site
new pages on this site
|
|