aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/fsm01/fsm_6s.vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-06-30 14:04:22 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-30 14:12:44 +0200
commitc9a1948c12ec5262db925811d32e6a5886172abc (patch)
tree5230f77663a15d69ee2f64ec052df3698ee57169 /testsuite/synth/fsm01/fsm_6s.vhdl
parent33884b2801f3b9cd52a0e6c20ee0d1079982c43d (diff)
downloadghdl-c9a1948c12ec5262db925811d32e6a5886172abc.tar.gz
ghdl-c9a1948c12ec5262db925811d32e6a5886172abc.tar.bz2
ghdl-c9a1948c12ec5262db925811d32e6a5886172abc.zip
testsuite/synth: add tests for previous commit.
Diffstat (limited to 'testsuite/synth/fsm01/fsm_6s.vhdl')
-rw-r--r--testsuite/synth/fsm01/fsm_6s.vhdl54
1 files changed, 54 insertions, 0 deletions
diff --git a/testsuite/synth/fsm01/fsm_6s.vhdl b/testsuite/synth/fsm01/fsm_6s.vhdl
new file mode 100644
index 000000000..1daf0a39f
--- /dev/null
+++ b/testsuite/synth/fsm01/fsm_6s.vhdl
@@ -0,0 +1,54 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity fsm_6s is
+ port (clk : std_logic;
+ rst : std_logic;
+ d : std_logic;
+ done : out std_logic);
+end fsm_6s;
+
+architecture behav of fsm_6s is
+ type state_t is (S0_1, S1_0, S2_0, S3_1, S4_0, S5_1);
+ signal s : state_t;
+begin
+ process (clk)
+ begin
+ if rising_edge(clk) then
+ if rst = '1' then
+ s <= S0_1;
+ done <= '0';
+ else
+ -- Reset by default
+ s <= S0_1;
+ done <= '0';
+ case s is
+ when S0_1 =>
+ if d = '1' then
+ s <= S1_0;
+ end if;
+ when S1_0 =>
+ if d = '0' then
+ s <= S2_0;
+ end if;
+ when S2_0 =>
+ if d = '0' then
+ s <= S3_1;
+ end if;
+ when S3_1 =>
+ if d = '1' then
+ s <= S4_0;
+ end if;
+ when S4_0 =>
+ if d = '0' then
+ s <= S5_1;
+ end if;
+ when S5_1 =>
+ if d = '1' then
+ done <= '1';
+ end if;
+ end case;
+ end if;
+ end if;
+ end process;
+end behav;