Post 9: Multi-File Editing and Comparison in Vi

When debugging RTL or constraint files, comparing multiple files directly in Vi saves time.

1. Opening Multiple Files

vi file1.v file2.v

Use :n → move to next file

Use :N → move to previous file

2. Split Views for Side-by-Side Editing

:vs file2.v      # Vertical split  

:sp file2.v      # Horizontal split

Navigate between splits:

Ctrl + w → then → h / j / k / l

💡 Example:

Compare design_top.v and design_constraints.sdc to verify timing signals.

3. Comparing Files with vimdiff

vimdiff rtl_old.v rtl_new.v

Differences are color-highlighted

Use ]c / [c to jump between changes

Use do (diff obtain) to copy from other file

💡 Example:

Check signal-name mismatches between rtl.v and rtl_rev.v.

4. Merge & Save

After edits:

:wqa    # Save all and quit

Why it matters:

Multi-file editing in Vi helps engineers quickly spot mismatched signals, missing constraints, or unintended logic changes — essential for RTL reviews and ECU validation.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top