fix(tb): fix Vivado 2019.2 compatibility and add run_tb.sh
- Replace -include_dirs . with -i . (Vivado 2019.2 syntax)
- Add --timescale 1ns/1ps to all xelab commands
- Add LD_PRELOAD comment for ncurses compatibility
- Add run_tb.sh convenience script
Usage: ./run_tb.sh mod_add
./run_tb.sh --list
- Update spec with Vivado 2019.2 compatibility notes
This commit is contained in:
@@ -144,26 +144,54 @@ d00d00
|
||||
|
||||
Width `W` must evenly contain all packed fields. Use padding bits to align to hex-char boundaries (multiples of 4 bits).
|
||||
|
||||
## Running Testbenches
|
||||
|
||||
### Quick Run
|
||||
```bash
|
||||
# List available modules
|
||||
./run_tb.sh --list
|
||||
|
||||
# Run a specific module
|
||||
./run_tb.sh mod_add
|
||||
```
|
||||
|
||||
### Manual Run
|
||||
```bash
|
||||
source /opt/Xilinx/Vivado/2019.2/settings64.sh
|
||||
export LD_PRELOAD=/usr/lib64/libtinfo.so.5 # required for Vivado 2019.2 on modern Linux
|
||||
cd ~/Dev/mlkem
|
||||
vivado -mode batch -source sync_rtl/mod_add/TB/xsim_run.tcl
|
||||
```
|
||||
|
||||
### Vivado 2019.2 Compatibility Notes
|
||||
- **Include flag**: Use `-i .` (not `-include_dirs .` — that's Vivado 2020+)
|
||||
- **ncurses fix**: `export LD_PRELOAD=/usr/lib64/libtinfo.so.5` resolves `_nc_tiparm` symbol error from bundled LLVM 3.1
|
||||
- **Timescale**: Always pass `--timescale 1ns/1ps` to `xelab` (RTL modules may lack `timescale directives)
|
||||
|
||||
## xsim_run.tcl
|
||||
|
||||
```tcl
|
||||
# NOTE: On some systems, you may need:
|
||||
# export LD_PRELOAD=/usr/lib64/libtinfo.so.5
|
||||
|
||||
# Compile RTL dependencies (order matters for submodule hierarchy)
|
||||
xvlog -sv -include_dirs . <rtl_dir>/<submodule>.v
|
||||
xvlog -sv -include_dirs . <rtl_dir>/<dut>.v
|
||||
xvlog -sv -i . <rtl_dir>/<submodule>.v
|
||||
xvlog -sv -i . <rtl_dir>/<dut>.v
|
||||
|
||||
# Compile testbench
|
||||
xvlog -sv <tb_dir>/tb_<module>_xsim.v
|
||||
|
||||
# Elaborate
|
||||
xelab tb_<module>_xsim -s <snapshot>
|
||||
xelab tb_<module>_xsim -s <snapshot> --timescale 1ns/1ps
|
||||
|
||||
# Run
|
||||
xsim <snapshot> -R
|
||||
```
|
||||
|
||||
### CRITICAL: Include Directories
|
||||
- If ANY compiled file uses `` `include "sync_rtl/common/defines.vh" `` (or any relative include), add `-include_dirs .` to ALL `xvlog` invocations in that TCL
|
||||
- This ensures Vivado resolves paths relative to the project root
|
||||
- If ANY compiled file uses `` `include "sync_rtl/common/defines.vh" `` (or any relative include), add `-i .` to ALL `xvlog` invocations in that TCL
|
||||
- **Vivado 2019.2**: Use `-i .` (single dash)
|
||||
- **Vivado 2020+**: Use `-include_dirs .` (single or double dash)
|
||||
|
||||
## gen_vectors.py
|
||||
|
||||
|
||||
Reference in New Issue
Block a user