Skip to content

Instantly share code, notes, and snippets.

@ouyen
Created April 22, 2023 04:45
Show Gist options
  • Save ouyen/eaf6c6a952a5f423ec68c3a689d02aff to your computer and use it in GitHub Desktop.
Save ouyen/eaf6c6a952a5f423ec68c3a689d02aff to your computer and use it in GitHub Desktop.
#!/bin/bash
# 更改 tb_single_cycle.v 文件中的 TEST_TYPE 宏定义
sed -i "5s/define TEST_TYPE [0-9]/define TEST_TYPE $1/" tb/tb_single_cycle.v
iverilog -o wave tb/tb_single_cycle.v
vvp -n wave -lxt2
ram_file=ram$1.txt
ref_file=test_codes/$1_*/ref_results/ram_ref.txt
diff $ram_file $ref_file > diff.log
cat diff.log
# 判断 diff 文件是否为空
if [ -s diff.log ]; then
# 如果不为空,则执行 xxx 命令
/mnt/c/Users/qwq/scoop/shims/gtkwave.exe wave.vcd
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment