Question

In: Electrical Engineering

Using behavioral VHDL, design a Mealy-type finite state machine that detects input test vector that contains...

Using behavioral VHDL, design a Mealy-type finite state machine that detects input test vector that contains the sequence of ‘100’. If the sequence ‘100’ is detected, the output Z should go high. The input is to be named W, the output is to be named Z, a Clock input is to be used and an active low reset signal (Resetn) should asynchronously reset the machine. a) Draw the Mealy-type state diagram for the FSM. b) Write the VHDL code to implement the FSM.

Solutions

Expert Solution

- VHDL code for above required MEALY state diagram

--standard logic library declaration
library IEEE;
use IEEE.std_logic_1164.all;

--entity declaration for Mealy machine
entity VHDL_MEALY_FSM is
port (
clock: in std_logic; --- clock signal
resetn: in std_logic; -- reset input
W: in std_logic; -- binary sequence input
Z: out std_logic -- output of the VHDL sequence detector
);
end VHDL_MEALY_FSM;

--architecture behavioral model of Mealy state machine
architecture Behavioral of VHDL_MEALY_FSM is

--state definitions
type state is (A,B,C);

--internal signal declartions for states
signal current_state, next_state: state;

begin
-- Sequential present state logic of the VHDL Mealy FSM
process(clock,resetn)
begin
if(resetn='0') then
current_state <= A; -- upon reset initial state assumed as A
elsif(rising_edge(clock)) then
current_state <= next_state;
end if;
end process;

-- Next state logic of the VHDL Mealy FSM
-- Combinational logic
process(current_state,W)
begin
case(current_state) is
when A =>
if(W ='1') then
next_state <= B; Z <= '0';
else
next_state <= A; Z <= '0';
end if;
when B =>
if(W ='1') then
next_state <= B; Z <= '0';
else
next_state <= C; Z <= '0';
end if;
when C =>
if(W ='1') then
next_state <= B; Z <= '0';
else
next_state <= A; Z <= '1';
end if;

  
end case;
end process;



end Behavioral;

-- testbench

-- Code your testbench
library IEEE;
use IEEE.std_logic_1164.all;

--entity declaration for testbench
entity test_FSM is
end test_FSM;

--architecture body declaration for testbench
architecture behavioral of test_FSM is

--component declaartion for FSM
component VHDL_MEALY_FSM is
Port (
clock: in std_logic; --- clock signal
resetn: in std_logic; -- reset input
W: in std_logic; -- binary sequence input
Z: out std_logic -- output of the VHDL sequence detector
);
end component;

--internal signal declarations
signal clock: std_logic;
signal resetn: std_logic;
signal W: std_logic;
signal Z: std_logic;

begin
--instantiate DUT fsm
DUT: VHDL_MEALY_FSM port map ( clock => clock ,
resetn => resetn ,
W => W,
Z => Z );

--clock process
clk_process:process
begin
clock <= '1';
wait for 5 ns;
clock <= '0';
wait for 5 ns;
end process;


--input stimuus process
stim_proc:process
begin
W <= '0'; resetn <= '1';
wait for 10 ns;
W <= '1'; resetn <= '0';
wait for 10 ns;
W <= '0'; resetn <= '1';
wait for 10 ns;
W <= '0'; resetn <= '0';
wait for 10 ns;
W <= '1'; resetn <= '1';
wait for 10 ns;
W <= '0'; resetn <= '1';
wait for 10 ns;
W <= '0'; resetn <= '1';
wait for 10 ns;
W <= '1'; resetn <= '1';
wait for 10 ns;
W <= '0'; resetn <= '1';
wait for 10 ns;
W <= '1'; resetn <= '1';
wait for 10 ns;
W <= '1'; resetn <= '1';
wait for 10 ns;
W <= '0'; resetn <= '1';
wait for 10 ns;
W <= '0'; resetn <= '1';
wait for 10 ns;
W <= '1'; resetn <= '1';
wait;


end process;

end behavioral;

-- simulated waveforms


Related Solutions

Design B: Using behavioral VHDL, design a Mealy-type finite state machine that detects input test vector...
Design B: Using behavioral VHDL, design a Mealy-type finite state machine that detects input test vector that contains the sequence of ‘10’. If the sequence ‘10’ is detected, the output Z should go high. The input is to be named W, the output is to be named Z, a Clock input is to be used and an active low reset signal (Resetn) should asynchronously reset the machine. a) Draw the Mealy-type state diagram for the FSM. b) Write the VHDL...
Using behavioral VHDL, design a Moore-type finite state machine that detects input test vector that contains...
Using behavioral VHDL, design a Moore-type finite state machine that detects input test vector that contains the sequence of ‘100’. If the sequence ‘100’ is detected, the output Z should go high. The input is to be named W, the output is to be named Z, a Clock input is to be used and an active low reset signal (Resetn) should asynchronously reset the machine. a) Draw the Moore-type model state diagram for the FSM. b) Write the VHDL code...
Write a VHDL mealy state machine that detects the pattern 01110 in a stream of bits....
Write a VHDL mealy state machine that detects the pattern 01110 in a stream of bits. The machine should have three inputs; in, clk, reset. The output of the machine goes high whenever the pattern is detected.
1. Design a sequence detector, a Mealy finite state machine to detect the serial bit sequence...
1. Design a sequence detector, a Mealy finite state machine to detect the serial bit sequence 1101, where the most significant bit (MSB) comes first and the least significant bit comes last. A) Draw the state diagram B) Draw the state table C) The circuit is to be implemented using JK flip-flops and combinational logic circuit. Derive the Boolean expression necessary for this implementation. D) Sketch the circuit diagram for your design. This should show all the flipflops, logic gates...
Design a mealy machine that generates the output Z=1 when it detects an even number of...
Design a mealy machine that generates the output Z=1 when it detects an even number of 1s and odd number of zeros. Draw the state table and circuit diagram for it with D flipflops. Example of input is 00101 Example of output is 10011
Write the Verilog code and test bench for the following circuits: - Mealy State machine design...
Write the Verilog code and test bench for the following circuits: - Mealy State machine design for a Serial Adder Circuit - Moore State Machine design for a Serial Adder Circuit
Design a Mealy state diagram for a sequence detector that has a single input and a...
Design a Mealy state diagram for a sequence detector that has a single input and a single output. The output is to be “1” unless the input has been “0” for four consecutive clock pulses or “1” for three consecutive pulses. Implement your design using D flip-flops and any logic gates. Assume non-overlapping input sequences are to be detected.
Write a VHDL code to implement a Finite State Machine that with an 8 bit sequence...
Write a VHDL code to implement a Finite State Machine that with an 8 bit sequence input (can be any sequence, but lets say it is 11001000), determine how many states there are as well; so if the input sequence is correct it will show the number 1 in a 7 segment display, otherwise it will be 0 in the same 7 segment display. If the input sequence is incorrect, start from the beginning.
write sample code in VHDL Design and implementation of Pressetable ripple counter using behavioral style of...
write sample code in VHDL Design and implementation of Pressetable ripple counter using behavioral style of modeling by using pic74196
Consider a finite state machine with a control input called mode. When mode = 0, the...
Consider a finite state machine with a control input called mode. When mode = 0, the machine operates as a mod-3 down counter, where the outputs are the count values. When mode = 1, the machine's output progresses through the last 4 digits of your WCU ID (1133) number (1 digit per clock cycle). Complete each of the steps which follow. (a) Draw the state diagram for this machine. (b) Write RTL Verilog code which implements this design. Submit your...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT