1 #-----------------------------------------------------------------------------
 
   2 # Copyright (C) 2014 iZsh <izsh at fail0verflow.com>
 
   4 # This code is licensed to you under the terms of the GNU GPL, version 2 or,
 
   5 # at your option, any later version. See the LICENSE.txt file for the text of
 
   7 #-----------------------------------------------------------------------------
 
  12         tb_lp20khz_1MSa_iir_filter.v \
 
  13         tb_min_max_tracker.v \
 
  16 TBS = $(TB_SOURCES:.v=.vvp)
 
  19         pcf7931_write1byte_1MSA_data \
 
  20         pcf7931_read_1MSA_data
 
  25         iverilog -I .. -o $@ $<
 
  28         rm -rf *.vvp $(TEST_OUTDIR)
 
  30 tests: tb_lp20khz_1MSa_iir_filter tb_min_max_tracker tb_lf_edge_detect
 
  32 tb_lp20khz_1MSa_iir_filter: tb_lp20khz_1MSa_iir_filter.vvp | test_dir
 
  33         @printf "Testing $@\n"
 
  34         @for d in $(TB_DATA); do \
 
  35                 $(call run_test,$@.vvp,$$d,in); \
 
  36                 $(call check_golden,$$d,filtered); \
 
  38         rm -f $(TEST_OUTDIR)/data.*
 
  40 tb_min_max_tracker: tb_min_max_tracker.vvp | test_dir
 
  41         @printf "Testing $@\n"
 
  42         @for d in $(TB_DATA); do \
 
  43                 $(call run_test,$@.vvp,$$d,in filtered.gold); \
 
  44                 $(call check_golden,$$d,min); \
 
  45                 $(call check_golden,$$d,max); \
 
  47         rm -f $(TEST_OUTDIR)/data.*
 
  49 tb_lf_edge_detect: tb_lf_edge_detect.vvp | test_dir
 
  50         @printf "Testing $@\n"
 
  51         @for d in $(TB_DATA); do \
 
  52                 $(call run_test,$@.vvp,$$d,in filtered.gold); \
 
  53                 $(call check_golden,$$d,min); \
 
  54                 $(call check_golden,$$d,max); \
 
  55                 $(call check_golden,$$d,state); \
 
  56                 $(call check_golden,$$d,toggle); \
 
  57                 $(call check_golden,$$d,high); \
 
  58                 $(call check_golden,$$d,highz); \
 
  59                 $(call check_golden,$$d,lowz); \
 
  60                 $(call check_golden,$$d,low); \
 
  62         rm -f $(TEST_OUTDIR)/data.*
 
  65         @if [ ! -d $(TEST_OUTDIR) ] ; then mkdir $(TEST_OUTDIR) ; fi
 
  70 # $(2) = extension to check
 
  72         printf "        Checking $(1).$(2)... "; \
 
  73         mv $(TEST_OUTDIR)/data.$(2) $(TEST_OUTDIR)/$(1).$(2); \
 
  74         if cmp -s tb_data/$(1).$(2).gold $(TEST_OUTDIR)/$(1).$(2); then \
 
  81 # $(2) = data basename
 
  82 # $(3) = data extensions to copy
 
  84         env echo "    With $(2)... "; \
 
  85         cp tb_data/$(2).time $(TEST_OUTDIR); \
 
  86         for e in $(3); do cp tb_data/$(2).$$e $(TEST_OUTDIR)/data.$$e; done; \