diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-06-30 13:46:08 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-06-30 13:46:08 +0200 |
commit | 181165f90d7ab05cff1c2bc5894d0143f03d3634 (patch) | |
tree | bb27972df2886504ba7b9d426b39c4840c2a077a /testsuite/synth/fsm01/tb_fsm_2s.vhdl | |
parent | 10b2f5a4012ae368dfcf49628281e34674f913d7 (diff) | |
download | ghdl-181165f90d7ab05cff1c2bc5894d0143f03d3634.tar.gz ghdl-181165f90d7ab05cff1c2bc5894d0143f03d3634.tar.bz2 ghdl-181165f90d7ab05cff1c2bc5894d0143f03d3634.zip |
testsuite/synth: add a test for previous commit.
Diffstat (limited to 'testsuite/synth/fsm01/tb_fsm_2s.vhdl')
-rw-r--r-- | testsuite/synth/fsm01/tb_fsm_2s.vhdl | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/synth/fsm01/tb_fsm_2s.vhdl b/testsuite/synth/fsm01/tb_fsm_2s.vhdl new file mode 100644 index 000000000..d647db5c9 --- /dev/null +++ b/testsuite/synth/fsm01/tb_fsm_2s.vhdl @@ -0,0 +1,44 @@ +entity tb_fsm_2s is +end tb_fsm_2s; + +library ieee; +use ieee.std_logic_1164.all; + +architecture behav of tb_fsm_2s is + signal clk : std_logic; + signal rst : std_logic; + signal din : std_logic; + signal done : std_logic; +begin + dut: entity work.fsm_2s + port map ( + done => done, + d => din, + clk => clk, + rst => rst); + + process + constant dat : std_logic_vector := b"10010"; + constant res : std_logic_vector := b"01001"; + procedure pulse is + begin + clk <= '0'; + wait for 1 ns; + clk <= '1'; + wait for 1 ns; + end pulse; + begin + rst <= '1'; + din <= '0'; + pulse; + assert done = '0' severity failure; + -- Test the whole sequence. + rst <= '0'; + for i in dat'range loop + din <= dat (i); + pulse; + assert done = res(i) severity failure; + end loop; + wait; + end process; +end behav; |