From 4308f7d966c617423e6e194a449d51083d9d0334 Mon Sep 17 00:00:00 2001 From: tmeissner Date: Thu, 28 May 2020 20:02:31 +0200 Subject: [PATCH] Add simulation of the PSL examples, fixes #1 --- sim/Makefile | 24 ++++++++++++++++++++++++ sim/template.vhd | 24 ++++++++++++++++++++++++ sim/tests.mk | 25 +++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 sim/Makefile create mode 100644 sim/template.vhd create mode 100644 sim/tests.mk diff --git a/sim/Makefile b/sim/Makefile new file mode 100644 index 0000000..c14de31 --- /dev/null +++ b/sim/Makefile @@ -0,0 +1,24 @@ +include tests.mk + +VHD_STD := 08 + +.PHONY: all clean + +.SECONDARY: + + +all: ${psl_tests} + +%: ../src/%.vhd ../src/pkg.vhd ../src/sequencer.vhd ../src/hex_sequencer.vhd work/%/testbench.vhd + ghdl -a --std=$(VHD_STD) --workdir=work/$@ ../src/pkg.vhd ../src/sequencer.vhd ../src/hex_sequencer.vhd + ghdl -a --std=$(VHD_STD) --workdir=work/$@ ../src/$@.vhd + ghdl -a --std=$(VHD_STD) --workdir=work/$@ work/$@/testbench.vhd + ghdl -e --std=$(VHD_STD) --workdir=work/$@ -o work/$@/tb_$@ tb_$@ + cd work/$@; ghdl -r --std=$(VHD_STD) tb_$@ --wave=$@.ghw --psl-report=$@_psl_coverage.json --stop-time=50ns + +work/%/testbench.vhd: template.vhd + mkdir -p work; mkdir -p $(dir $@) + sed 's/__DUT__/$(subst /,,$(subst work,,$(dir $@)))/g' $< > $@ + +clean: + rm -rf work diff --git a/sim/template.vhd b/sim/template.vhd new file mode 100644 index 0000000..6d64f47 --- /dev/null +++ b/sim/template.vhd @@ -0,0 +1,24 @@ +library ieee; + use ieee.std_logic_1164.all; + + +entity tb___DUT__ is +end entity tb___DUT__; + + +architecture sim of tb___DUT__ is + + signal clk : std_logic := '1'; + signal cycle : natural := 0; + +begin + + + clk <= not clk after 1 ns; + + cycle <= cycle + 1 when rising_edge(clk); + + DUT : entity work.__DUT__(psl) port map (clk); + + +end architecture sim; diff --git a/sim/tests.mk b/sim/tests.mk new file mode 100644 index 0000000..7fab8b7 --- /dev/null +++ b/sim/tests.mk @@ -0,0 +1,25 @@ +psl_tests := \ +psl_always \ +psl_logical_implication \ +psl_never \ +psl_next \ +psl_next_3 \ +psl_next_a \ +psl_next_e \ +psl_next_event \ +psl_next_event_4 \ +psl_next_event_e \ +psl_next_event_a \ +psl_until \ +psl_before \ +psl_eventually \ +psl_sere \ +psl_sere_overlapping_suffix_impl \ +psl_sere_non_overlapping_suffix_impl \ +psl_sere_consecutive_repetition \ +psl_sere_non_consecutive_repeat_repetition \ +psl_sere_non_consecutive_goto_repetition \ +psl_cover \ +psl_sere_within \ +psl_sere_or \ +psl_sere_len_matching_and \ No newline at end of file