Commit 543b4590 by Zachary Snow

streamline iverilog test wrapper

parent a6111e20
module top; module top;
endmodule
module dump;
initial begin initial begin
$display("A 3"); $display("A 3");
$display("B 3"); $display("B 3");
......
module top; module top;
endmodule
module dump;
initial begin initial begin
// generated by running a commercial simulator // generated by running a commercial simulator
$display("m_def 0 00000000000000000000000000000001 1"); $display("m_def 0 00000000000000000000000000000001 1");
......
...@@ -83,4 +83,5 @@ module Example; ...@@ -83,4 +83,5 @@ module Example;
end end
endmodule endmodule
module top; module top;
Example e();
endmodule endmodule
...@@ -60,4 +60,5 @@ module Example; ...@@ -60,4 +60,5 @@ module Example;
end end
endmodule endmodule
module top; module top;
Example e();
endmodule endmodule
...@@ -17,6 +17,7 @@ simulate() { ...@@ -17,6 +17,7 @@ simulate() {
sim_top=$3 sim_top=$3
shift 3 shift 3
# compile the files # compile the files
sim_vcd_tmp=$SHUNIT_TMPDIR/simvcdtmp
sim_prog=$SHUNIT_TMPDIR/simprog.exe sim_prog=$SHUNIT_TMPDIR/simprog.exe
iv_output=`iverilog \ iv_output=`iverilog \
-Wall \ -Wall \
...@@ -24,23 +25,17 @@ simulate() { ...@@ -24,23 +25,17 @@ simulate() {
-Wno-portbind \ -Wno-portbind \
-o $sim_prog \ -o $sim_prog \
-g2005 \ -g2005 \
-DTEST_VCD="\"$sim_vcd\"" \ -DTEST_VCD="\"$sim_vcd_tmp\"" \
-DTEST_TOP=$sim_top \ -DTEST_TOP=$sim_top \
$SCRIPT_DIR/tb_dumper.v \ $SCRIPT_DIR/tb_dumper.v \
"$@" 2>&1` "$@" 2>&1`
assertTrue "iverilog on $1 failed" $? assertTrue "iverilog on $1 failed" $?
if [ -n "$iv_output" ]; then assertNull "iverilog emitted warnings:\n$iv_output" "$iv_output"
assertNull "iverilog emitted warnings:" "$iv_output"
echo "$iv_output"
fi
# run the simulation # run the simulation
$sim_prog > $sim_log.temp $sim_prog > $sim_log
assertTrue "simulating $1 failed" $? assertTrue "simulating $1 failed" $?
assertExists $sim_vcd
# remove the date from the VCD # remove the date from the VCD
sed -i.orig -e "1,3d" $sim_vcd sed -e "1,3d" < $sim_vcd_tmp > $sim_vcd
# remove extraneous log lines
cat $sim_log.temp | grep -v "VCD info: dumpfile" > $sim_log
} }
assertConverts() { assertConverts() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment