*Sketch correct,Both Decoder and MUX should be 1X2,If it's not possible then nothing change.*
Sketch Design Description:
First a CLK(50 MHZ) into a Frequency divider divide it down to (1 HZ)
And then output (1 HZ) to drive the Designated Number "870107" Moore Machine
For the 4 bit counter,When Moore Machine finished counting "870107" the 4 bit counter count 1, like Moore : 8>7>0>1>0>7
4 bit : 0>0>0>0>0>1
1>1>1>1>1>2
2>2>2>2>2>3
... etc
As for the decoder is for scanning 2 seven segment display then output as Selectors for MUX decide which one count first
Then finally display it on Seven Segment Display.
after search for some reference about Moore in VHDL,I'm still stuck. I'm hoping someone can help me fill-in the missing pieces of my code and to fit into the sketch.
Sincerely Appreciate.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.NUMERIC_STD.ALL;
entity M6B is
Port ( clk : in STD_LOGIC;
x : in STD_LOGIC;
rst : in STD_LOGIC;
--z : out STD_LOGIC_VECTOR (6 downto 0);
AN : out STD_LOGIC_VECTOR (1 downto 0);
ledout : out STD_LOGIC_VECTOR (6 downto 0));
end M6B;
architecture Behavioral of M6B is
type state_type is (s0,s1,s2,s3,s4,s5);
signal state : state_type;
signal ledbcd : std_logic_vector (3 downto 0);
signal ledonc : std_logic_vector (1 downto 0);
signal osc : STD_LOGIC_VECTOR (24 downto 0);
signal refresh_counter: STD_LOGIC_VECTOR (16 downto 0);
signal oscen : std_logic;
signal dispn : std_logic_vector (6 downto 0);
begin
process (clk,rst)
begin
if rst = '1' then
state <= s0;
elsif (rising_edge(clk)) then
case state is
when s0 =>
if x = '0' then
state <= s1;
else
state <= s0;
end if;
when s1 =>
if x = '0' then
state <= s2;
else
state <= s1;
end if;
when s2 =>
if x = '0' then
state <= s3;
else
state <= s2;
end if;
when s3 =>
if x = '0' then
state <= s4;
else
state <= s3;
end if;
when s4 =>
if x = '0' then
state <= s5;
else
state <= s4;
end if;
when s5 =>
if x = '0' then
state <= s0;
else
state <= s4;
end if;
end case;
end if;
end process;
process (state)
begin
case state is
when s0 =>
AN <= "10";
ledout <= "0000000";
when s1 =>
AN <= "10";
ledout <= "0000111";
when s2 =>
AN <= "10";
ledout <= "0000000";
when s3 =>
AN <= "10";
ledout <= "1001111";
when s4 =>
AN <= "10";
ledout <= "0000000";
when s5 =>
AN <= "10";
ledout <= "0000111";
end case;
end process;
end Behavioral;
Question
jygcm
Greetings.
I just started out VHDL not long ago,and not quite familiar with Moore FSM.
So I was trying to write this Moore FSM code as shown in Picture of my initial sketch(Link to imgur,safe to click).
after search for some reference about Moore in VHDL,I'm still stuck.
I'm hoping someone can help me fill-in the missing pieces of my code and to fit into the sketch.
Sincerely Appreciate.
Link to comment
Share on other sites
15 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.