diff --git a/quad/ip_repo/pwm_recorder_1.0/get_simulation_result.tcl b/quad/ip_repo/pwm_recorder_1.0/get_simulation_result.tcl new file mode 100644 index 0000000000000000000000000000000000000000..6d73376cbb349e94c408dab5732f0ab8d983242b --- /dev/null +++ b/quad/ip_repo/pwm_recorder_1.0/get_simulation_result.tcl @@ -0,0 +1,6 @@ +#!/bin/bash +set signal [get_objects /*_tester/passing] +set fd [open "result.log" "w"] +run all +puts $fd [get_value $signal] +quit \ No newline at end of file diff --git a/quad/ip_repo/pwm_recorder_1.0/hdl/kernel_tester.vhd b/quad/ip_repo/pwm_recorder_1.0/hdl/kernel_tester.vhd index a9f79d2e362ba57a57e3e6511c46a9ab2ef73e5b..7b65c6cc996fdc9d39527cc9fa60b98b5a56d8de 100644 --- a/quad/ip_repo/pwm_recorder_1.0/hdl/kernel_tester.vhd +++ b/quad/ip_repo/pwm_recorder_1.0/hdl/kernel_tester.vhd @@ -53,6 +53,7 @@ architecture testbench of kernel_tester is signal count : std_logic_vector(31 downto 0); signal write : std_logic; signal done : std_logic := '0'; + signal passing : std_logic := '0'; begin UUT: pwm_rec @@ -67,6 +68,8 @@ begin variable period : integer; begin + passing <='1'; + reset_n <='0'; wait for 2*CLK_HPER; reset_n <='1'; @@ -78,7 +81,10 @@ begin wait for period*2*CLK_HPER; pwm <= '0'; wait until write='1'; - ASSERT count=std_logic_vector(to_unsigned(period, 32)) REPORT "Incorrect COUNT result" SEVERITY FAILURE; + if (count /= std_logic_vector(to_unsigned(period, 32))) then + REPORT "Incorrect COUNT result" SEVERITY FAILURE; + passing <='0'; + end if; period := 200; pwm <= '0'; @@ -87,8 +93,11 @@ begin wait for period*2*CLK_HPER; pwm <= '0'; wait until write='1'; - ASSERT count=std_logic_vector(to_unsigned(period, 32)) REPORT "Incorrect COUNT result" SEVERITY FAILURE; - + if (count /= std_logic_vector(to_unsigned(period, 32))) then + REPORT "Incorrect COUNT result" SEVERITY FAILURE; + passing <='0'; + end if; + period := 300; pwm <= '0'; wait for CLK_HPER*2*20; @@ -96,7 +105,10 @@ begin wait for period*2*CLK_HPER; pwm <= '0'; wait until write='1'; - ASSERT count=std_logic_vector(to_unsigned(period, 32)) REPORT "Incorrect COUNT result" SEVERITY FAILURE; + if (count /= std_logic_vector(to_unsigned(period, 32))) then + REPORT "Incorrect COUNT result" SEVERITY FAILURE; + passing <='0'; + end if; period := 400; pwm <= '0'; @@ -105,7 +117,10 @@ begin wait for period*2*CLK_HPER; pwm <= '0'; wait until write='1'; - ASSERT count=std_logic_vector(to_unsigned(period, 32)) REPORT "Incorrect COUNT result" SEVERITY FAILURE; + if (count /= std_logic_vector(to_unsigned(period, 32))) then + REPORT "Incorrect COUNT result" SEVERITY FAILURE; + passing <='0'; + end if; period := 10; pwm <= '0'; @@ -115,7 +130,10 @@ begin pwm <= '0'; for t in 0 to 100 loop wait for 2*CLK_HPER; - ASSERT write='0' REPORT "Glitch not Ignored" SEVERITY FAILURE; + if (write /= '0') then + REPORT "Glitch not Ignored" SEVERITY FAILURE; + passing <='0'; + end if; end loop; -- Run for 45, glitch for 10, then run for 45, expect a result of 100 @@ -130,12 +148,20 @@ begin wait for 45*2*CLK_HPER; pwm <= '0'; wait until write='1'; - ASSERT count=std_logic_vector(to_unsigned(period, 32)) REPORT "Incorrect COUNT result" SEVERITY FAILURE; + if (count /= std_logic_vector(to_unsigned(period, 32))) then + REPORT "Incorrect COUNT result" SEVERITY FAILURE; + passing <='0'; + end if; done <='1'; + + if (passing = '0') then + -- output test faulure? + end if; + wait; end process; - + clock_proc: process begin clk <= '0'; diff --git a/quad/ip_repo/pwm_recorder_1.0/kernel_test.prj b/quad/ip_repo/pwm_recorder_1.0/kernel_test.prj new file mode 100644 index 0000000000000000000000000000000000000000..82dec23a23523cf562dad93dc93f00c6a153417b --- /dev/null +++ b/quad/ip_repo/pwm_recorder_1.0/kernel_test.prj @@ -0,0 +1,2 @@ +vhdl work src/pwm_rec.vhd +vhdl work hdl/kernel_tester.vhd diff --git a/quad/ip_repo/pwm_recorder_1.0/kernel_test.sh b/quad/ip_repo/pwm_recorder_1.0/kernel_test.sh new file mode 100755 index 0000000000000000000000000000000000000000..f5f495bb1794b90cd3f167abf71482ea701c2ab4 --- /dev/null +++ b/quad/ip_repo/pwm_recorder_1.0/kernel_test.sh @@ -0,0 +1,4 @@ +#!/bin/bash +xelab --debug wave -prj kernel_test.prj -s run_kernel_test work.kernel_tester +xsim run_kernel_test -wdb pwm_record_kernel_test.wdb --t get_simulation_result.tcl +