From f9f0002babb98fe751f3b71ef009a79e60057f06 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 21 May 2020 17:28:37 +0200 Subject: testsuite/synth: add a test for previous commit. --- testsuite/synth/sns01/add03.vhdl | 19 +++++++++++++++++++ testsuite/synth/sns01/tb_add03.vhdl | 24 ++++++++++++++++++++++++ testsuite/synth/sns01/testsuite.sh | 2 ++ 3 files changed, 45 insertions(+) create mode 100644 testsuite/synth/sns01/add03.vhdl create mode 100644 testsuite/synth/sns01/tb_add03.vhdl (limited to 'testsuite') diff --git a/testsuite/synth/sns01/add03.vhdl b/testsuite/synth/sns01/add03.vhdl new file mode 100644 index 000000000..16546bd0d --- /dev/null +++ b/testsuite/synth/sns01/add03.vhdl @@ -0,0 +1,19 @@ +LIBRARY ieee; +USE ieee.std_logic_1164.all; + +entity add03 is + port ( + a, b : std_logic_vector(8 DOWNTO 0); + borrow : std_logic; + res : out std_logic_vector(8 DOWNTO 0)); +end add03; + +LIBRARY ieee; +USE ieee.std_logic_arith.all; + +architecture behav of add03 is + signal t : signed(8 DOWNTO 0); +begin + t <= signed(a) - signed(b) - borrow; + res <= std_logic_vector(t); +end behav; diff --git a/testsuite/synth/sns01/tb_add03.vhdl b/testsuite/synth/sns01/tb_add03.vhdl new file mode 100644 index 000000000..7bc68ea8a --- /dev/null +++ b/testsuite/synth/sns01/tb_add03.vhdl @@ -0,0 +1,24 @@ +entity tb_add03 is +end tb_add03; + +library ieee; +use ieee.std_logic_1164.all; + +architecture behav of tb_add03 is + signal a, b : std_logic_vector(8 DOWNTO 0); + signal borrow : std_logic; + signal res : std_logic_vector(8 DOWNTO 0); +begin + dut: entity work.add03 + port map (a, b, borrow, res); + + process + begin + a <= b"00000_0100"; + b <= b"00000_0001"; + borrow <= '0'; + wait for 1 ns; + assert res = b"00000_0011" severity failure; + wait; + end process; +end behav; diff --git a/testsuite/synth/sns01/testsuite.sh b/testsuite/synth/sns01/testsuite.sh index d9cb4503a..a93cc4530 100755 --- a/testsuite/synth/sns01/testsuite.sh +++ b/testsuite/synth/sns01/testsuite.sh @@ -15,4 +15,6 @@ done synth_analyze sns02 clean +synth_tb add03 + echo "Test successful" -- cgit v1.2.3