Question

In: Electrical Engineering

Can someone run this in vhdl and send me the output? acreenshot library IEEE; use IEEE.STD_LOGIC_1164.ALL;...

Can someone run this in vhdl and send me the output? acreenshot

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity VHDL_MOORE_FSM_Sequence_Detector is
port (
 clock: in std_logic; --- clock signal
 reset: in std_logic; -- reset input
 sequence_in: in std_logic; -- binary sequence input
 detector_out: out std_logic -- output of the VHDL sequence detector
);
end VHDL_MOORE_FSM_Sequence_Detector;

architecture Behavioral of VHDL_MOORE_FSM_Sequence_Detector is
type MOORE_FSM is (Zero, One, OneZero, OneZeroZero, OneZeroZeroOne);
signal current_state, next_state: MOORE_FSM;

begin
-- Sequential memory of the VHDL MOORE FSM Sequence Detector
process(clock,reset)
begin
 if(reset='1') then
  current_state <= Zero;
 elsif(rising_edge(clock)) then
  current_state <= next_state;
 end if;
end process;
-- Next state logic of the VHDL MOORE FSM Sequence Detector
-- Combinational logic
process(current_state,sequence_in)
begin
 case(current_state) is
 when Zero =>
  if(sequence_in='1') then
   -- "1"
   next_state <= One;
  else
   next_state <= Zero;
  end if;
 when One =>
  if(sequence_in='0') then
   -- "10"
   next_state <= OneZero;
  else
   next_state <= One;
  end if;  
 when OneZero => 
  if(sequence_in='0') then
   -- "100"
   next_state <= OneZeroZero;
  else
   next_state <= One;
  end if;  
 when OneZeroZero =>
  if(sequence_in='1') then
   -- "1001"
   next_state <= OneZeroZeroOne;
  else
   next_state <= Zero;
  end if; 
 when OneZeroZeroOne =>
  if(sequence_in='1') then
   next_state <= One;
  else
   next_state <= OneZero;
  end if;
 end case;
end process;
-- Output logic of the VHDL MOORE FSM Sequence Detector
process(current_state)
begin 
 case current_state is
 when Zero =>
  detector_out <= '0';
 when One =>
  detector_out <= '0'; 
 when OneZero => 
  detector_out <= '0'; 
 when OneZeroZero =>
  detector_out <= '0'; 
 when OneZeroZeroOne =>
  detector_out <= '1';
 end case;
end process;
end Behavioral;

TESTBENCH-

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
 
ENTITY tb_VHDL_Moore_FSM_Sequence_Detector IS
END tb_VHDL_Moore_FSM_Sequence_Detector;
 
ARCHITECTURE behavior OF tb_VHDL_Moore_FSM_Sequence_Detector IS 
 
    -- Component Declaration for the Moore FSM Sequence Detector in VHDL
 
    COMPONENT VHDL_MOORE_FSM_Sequence_Detector
    PORT(
         clock : IN  std_logic;
         reset : IN  std_logic;
         sequence_in : IN  std_logic;
         detector_out : OUT  std_logic
        );
    END COMPONENT;
    

   --Inputs
   signal clock : std_logic := '0';
   signal reset : std_logic := '0';
   signal sequence_in : std_logic := '0';

  --Outputs
   signal detector_out : std_logic;

   -- Clock period definitions
   constant clock_period : time := 10 ns;
 
BEGIN
 
 -- Instantiate the Moore FSM Sequence Detector in VHDL
   uut: VHDL_MOORE_FSM_Sequence_Detector PORT MAP (
          clock => clock,
          reset => reset,
          sequence_in => sequence_in,
          detector_out => detector_out
        );

   -- Clock process definitions
   clock_process :process
   begin
  clock <= '0';
  wait for clock_period/2;
  clock <= '1';
  wait for clock_period/2;
   end process;
 

   -- Stimulus process
   stim_proc: process
   begin  
      -- hold reset state for 100 ns.
  sequence_in <= '0';
  reset <= '1';
  -- Wait 100 ns for global reset to finish
  wait for 30 ns;
      reset <= '0';
  wait for 40 ns;
  sequence_in <= '1';
  wait for 10 ns;
  sequence_in <= '0';
  wait for 10 ns;
  sequence_in <= '1'; 
  wait for 20 ns;
  sequence_in <= '0'; 
  wait for 20 ns;
  sequence_in <= '1'; 
  wait for 20 ns;
  sequence_in <= '0'; 
      -- insert stimulus here 
      wait;
   end process;

END;

Solutions

Expert Solution

Simulated given vhdl code and attached code ,waveforms below:

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

entity VHDL_MOORE_FSM_Sequence_Detector is

port (

clock: in std_logic; --- clock signal

reset: in std_logic; -- reset input

sequence_in: in std_logic; -- binary sequence input

detector_out: out std_logic -- output of the VHDL sequence detector

);

end VHDL_MOORE_FSM_Sequence_Detector;

architecture Behavioral of VHDL_MOORE_FSM_Sequence_Detector is

type MOORE_FSM is (Zero, One, OneZero, OneZeroZero, OneZeroZeroOne);

signal current_state, next_state: MOORE_FSM;

begin

-- Sequential memory of the VHDL MOORE FSM Sequence Detector

process(clock,reset)

begin

if(reset='1') then

current_state <= Zero;

elsif(rising_edge(clock)) then

current_state <= next_state;

end if;

end process;

-- Next state logic of the VHDL MOORE FSM Sequence Detector

-- Combinational logic

process(current_state,sequence_in)

begin

case(current_state) is

when Zero =>

if(sequence_in='1') then

-- "1"

next_state <= One;

else

next_state <= Zero;

end if;

when One =>

if(sequence_in='0') then

-- "10"

next_state <= OneZero;

else

next_state <= One;

end if;  

when OneZero =>

if(sequence_in='0') then

-- "100"

next_state <= OneZeroZero;

else

next_state <= One;

end if;  

when OneZeroZero =>

if(sequence_in='1') then

-- "1001"

next_state <= OneZeroZeroOne;

else

next_state <= Zero;

end if;

when OneZeroZeroOne =>

if(sequence_in='1') then

next_state <= One;

else

next_state <= OneZero;

end if;

end case;

end process;

-- Output logic of the VHDL MOORE FSM Sequence Detector

process(current_state)

begin

case current_state is

when Zero =>

detector_out <= '0';

when One =>

detector_out <= '0';

when OneZero =>

detector_out <= '0';

when OneZeroZero =>

detector_out <= '0';

when OneZeroZeroOne =>

detector_out <= '1';

end case;

end process;

end Behavioral;

-- TESTBENCH

LIBRARY ieee;

USE ieee.std_logic_1164.ALL;

ENTITY tb_VHDL_Moore_FSM_Sequence_Detector IS

END tb_VHDL_Moore_FSM_Sequence_Detector;

ARCHITECTURE behavior OF tb_VHDL_Moore_FSM_Sequence_Detector IS

-- Component Declaration for the Moore FSM Sequence Detector in VHDL

COMPONENT VHDL_MOORE_FSM_Sequence_Detector

PORT(

clock : IN std_logic;

reset : IN std_logic;

sequence_in : IN std_logic;

detector_out : OUT std_logic

);

END COMPONENT;

  

--Inputs

signal clock : std_logic := '0';

signal reset : std_logic := '0';

signal sequence_in : std_logic := '0';

--Outputs

signal detector_out : std_logic;

-- Clock period definitions

constant clock_period : time := 10 ns;

BEGIN

-- Instantiate the Moore FSM Sequence Detector in VHDL

uut: VHDL_MOORE_FSM_Sequence_Detector PORT MAP (

clock => clock,

reset => reset,

sequence_in => sequence_in,

detector_out => detector_out

);

-- Clock process definitions

clock_process :process

begin

clock <= '0';

wait for clock_period/2;

clock <= '1';

wait for clock_period/2;

end process;

-- Stimulus process

stim_proc: process

begin  

-- hold reset state for 100 ns.

sequence_in <= '0';

reset <= '1';

-- Wait 100 ns for global reset to finish

wait for 30 ns;

reset <= '0';

wait for 40 ns;

sequence_in <= '1';

wait for 10 ns;

sequence_in <= '0';

wait for 10 ns;

sequence_in <= '1';

wait for 20 ns;

sequence_in <= '0';

wait for 20 ns;

sequence_in <= '1';

wait for 20 ns;

sequence_in <= '0';

-- insert stimulus here

wait;

end process;

END;


Related Solutions

CAN SOMEONE RUN THIS WITH VHDL AND SEND ME THE OUTPUT? LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY...
CAN SOMEONE RUN THIS WITH VHDL AND SEND ME THE OUTPUT? LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY LFSR8 IS PORT (Clk, Rst: IN std_logic; output: OUT std_logic_vector (7 DOWNTO 0)); END LFSR8; ARCHITECTURE LFSR8_beh OF LFSR8 IS SIGNAL Currstate, Nextstate: std_logic_vector (7 DOWNTO 0); SIGNAL feedback: std_logic; BEGIN StateReg: PROCESS (Clk,Rst) BEGIN IF (Rst = '1') THEN Currstate <= (0 => '1', OTHERS =>'0'); ELSIF (Clk = '1' AND Clk'EVENT) THEN Currstate <= Nextstate; END IF; END PROCESS; feedback <= Currstate(4)...
LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY Vendingvhdl IS PORT( Clk                            : IN  &
LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY Vendingvhdl IS PORT( Clk                            : IN        STD_LOGIC; Change                    : OUT    STD_LOGIC_VECTOR(1 downto 0); Inputs                      : IN        STD_LOGIC_VECTOR(1 downto 0); output                     : OUT    STD_LOGIC); END Vendingvhdl; ARCHITECTURE vending of Vendingvhdl IS                               TYPE STATE_TYPE IS (empty, fivecent, tencent, ready);                               SIGNAL current_state, next_state   : STATE_TYPE; BEGIN Combinational LOGIC COMBINE: PROCESS (inputs) BEGIN                               CASE current_state IS                                              When empty =>                                                             IF inputs = “00” THEN                                                                                           next_state <= empty;                                                                                           output <= ‘0’;                                                                                           change...
VHDL Code will not run simulation. What is the problem with my code?? --VHDL Code library...
VHDL Code will not run simulation. What is the problem with my code?? --VHDL Code library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.NUMERIC_STD.ALL; entity DataMemory16Bits is Port ( Address_DM : in STD_LOGIC_VECTOR(15 downto 0); Data_In_DM : in STD_LOGIC_VECTOR(15 downto 0); Clock : in STD_LOGIC; We_DM : in STD_LOGIC; Re_DM : in STD_LOGIC; Data_Out_DM : out STD_LOGIC_VECTOR(15 downto 0)); end DataMemory16Bits; architecture Behavioral of DataMemory16Bits is Type DataMemory16Bits is array(0 to 31) of STD_LOGIC_VECTOR(15 downto 0); signal memory: DataMemory16Bits; begin process...
Simulate this code in ISE Simulator (ISim) and screenshot the simulation library IEEE; use IEEE.STD_LOGIC_1164.ALL; use...
Simulate this code in ISE Simulator (ISim) and screenshot the simulation library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity multiplexer is Port (     din:in STD_LOGIC_VECTOR (7 downto 0);    sel:in STD_LOGIC_VECTOR (2 downto 0);    dout : out STD_LOGIC); end multiplexer; architecture Behavioral of multiplexer is begin     process (din,sel)     begin       case sel is            when "000"=> dout <= din(7);            when "001"=> dout <= din(6);            when "010"=> dout <= din(5);            when "011"=>...
Can someone verify for me that I'm doing this correctly? For data analysis, part b: All...
Can someone verify for me that I'm doing this correctly? For data analysis, part b: All S2O32- is consumed at the end of the reaction. Therefore, the moles of S2O32- consumed can be calculated using the equation below. (moles S2O32-)consumed = Mstock x (Vstock) My instructor states "The stock sodium thiosulfate (S2O3) is 0.01M 0.01M x 0.010 L = 0.0001moles S2O3" So I did the rest of this accordingly (below), and it differs a lot from what's on this website....
Please can someone explain this to me. I am stuck at the last two questions Use...
Please can someone explain this to me. I am stuck at the last two questions Use the following information to calculate your answers to questions 10 through 14. Test scores of 10 individuals before and after a training program are shown below. Note: despite the sample size, assume that the sampling distribution of T+ can still be approximated by a normal distribution. Individual Score After the Program Score Before the Program 1 57 59 2 62 57 3 60 60...
can someone make me a shopping cart for me ? i need to make a shopping...
can someone make me a shopping cart for me ? i need to make a shopping cart ,but i have no idea about how to do this i have made 3 line of items , this is one of the pruduct line line 1 ------------------------------------- <!DOCTYPE html> <html lang="en"> <head> <style> .div1 { border: 2px outset red; background-color: lightblue; text-align: center; } </style> </head> <!-- body --> <body style="background-color:silver; "class="main-layout position_head"> <!-- loader --> </li> </ul> </section> </nav> </section> </header>...
Can someone give me an example an non example of coefficient?
Can someone give me an example an non example of coefficient?
Can someone give me a list of conditions for a market to be efficient
Can someone give me a list of conditions for a market to be efficient
can someone explain to me the problems that can arise in the world of aggregate capacity...
can someone explain to me the problems that can arise in the world of aggregate capacity planning and how we solve it ??? ( I need a length and easy to read answer with examples )
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT