SlideShare a Scribd company logo
solution of question no.6
input
Present state
Next state
output
0
S0
S0
0
1
S0
S1
0
0
S1
S2
0
1
S1
S1
0
0
S2
S3
0
1
S2
S1
0
0
S3
S0
0
1
S3
S4
0
0
S4
S2
1
1
S4
S1
1
library ieee;
use IEEE.std_logic_1164.all;
entity moore is
port (clk : in std_logic;
reset : in std_logic;
input : in std_logic;
output : out std_logic
);
end moore;
architecture behavioral of moore is
type state_type is (s0,s1,s2,s3,s4); --type of state machine.
signal current_s,next_s: state_type; --current and next state declaration.
begin
process (clk,reset)
begin
if (reset='1') then
current_s <= s0; --default state on reset.
elsif (rising_edge(clk)) then
current_s <= next_s; --state change.
end if;
end process;
--state machine process.
process (current_s,input)
begin
case current_s is
when s0 => --when current state is "s0"
if(input ='0') then
output <= '0';
next_s <= s0;
else
output <= '0';
next_s <= s1;
end if;
when s1 =>; --when current state is "s1"
if(input ='0') then
output <= '0';
next_s <= s2;
else
output <= '0';
next_s <= s1;
end if;
when s2 => --when current state is "s2"
if(input ='0') then
output <= '0';
next_s <= s3;
else
output <= '0';
next_s <= s1;
end if;
when s3 => --when current state is "s3"
if(input ='0') then
output <= '1';
next_s <= s0;
else
output <= '0';
next_s <= s4;
end if;
when s4 => --when current state is "s4"
if(input ='0') then
output <= '1';
next_s <= s2;
else
output <= '1';
next_s <= s1;
end if;
end case;
end process;
end behavioral;
solution of question no.7
input
Present state
Next state
output
0
S0
S1
0
1
S0
S0
0
0
S1
S1
0
1
S1
S2
0
0
S2
S3
0
1
S2
S0
0
0
S3
S1
0
1
S3
S2
1
library ieee;
use IEEE.std_logic_1164.all;
entity mealy is
port (clk : in std_logic;
reset : in std_logic;
input : in std_logic;
output : out std_logic
);
end mealy;
architecture behavioral of moore is
type state_type is (s0,s1,s2,s3); --type of state machine.
signal current_s,next_s: state_type; --current and next state declaration.
begin
process (clk,reset)
begin
if (reset='1') then
current_s <= s0; --default state on reset.
elsif (rising_edge(clk)) then
current_s <= next_s; --state change.
end if;
end process;
--state machine process.
process (current_s,input)
begin
case current_s is
when s0 => --when current state is "s0"
if(input ='0') then
output <= '0';
next_s <= s1;
else
output <= '0';
next_s <= s0;
end if;
when s1 =>; --when current state is "s1"
if(input ='0') then
output <= '0';
next_s <= s1;
else
output <= '0';
next_s <= s2;
end if;
when s2 => --when current state is "s2"
if(input ='0') then
output <= '0';
next_s <= s3;
else
output <= '0';
next_s <= s1;
end if;
when s3 => --when current state is "s3"
if(input ='0') then
output <= '0';
next_s <= s1;
else
output <= '1';
next_s <= s2;
end if;
end case;
end process;
end behavioral;
input
Present state
Next state
output
0
S0
S0
0
1
S0
S1
0
0
S1
S2
0
1
S1
S1
0
0
S2
S3
0
1
S2
S1
0
0
S3
S0
0
1
S3
S4
0
0
S4
S2
1
1
S4
S1
1
Solution
solution of question no.6
input
Present state
Next state
output
0
S0
S0
0
1
S0
S1
0
0
S1
S2
0
1
S1
S1
0
0
S2
S3
0
1
S2
S1
0
0
S3
S0
0
1
S3
S4
0
0
S4
S2
1
1
S4
S1
1
library ieee;
use IEEE.std_logic_1164.all;
entity moore is
port (clk : in std_logic;
reset : in std_logic;
input : in std_logic;
output : out std_logic
);
end moore;
architecture behavioral of moore is
type state_type is (s0,s1,s2,s3,s4); --type of state machine.
signal current_s,next_s: state_type; --current and next state declaration.
begin
process (clk,reset)
begin
if (reset='1') then
current_s <= s0; --default state on reset.
elsif (rising_edge(clk)) then
current_s <= next_s; --state change.
end if;
end process;
--state machine process.
process (current_s,input)
begin
case current_s is
when s0 => --when current state is "s0"
if(input ='0') then
output <= '0';
next_s <= s0;
else
output <= '0';
next_s <= s1;
end if;
when s1 =>; --when current state is "s1"
if(input ='0') then
output <= '0';
next_s <= s2;
else
output <= '0';
next_s <= s1;
end if;
when s2 => --when current state is "s2"
if(input ='0') then
output <= '0';
next_s <= s3;
else
output <= '0';
next_s <= s1;
end if;
when s3 => --when current state is "s3"
if(input ='0') then
output <= '1';
next_s <= s0;
else
output <= '0';
next_s <= s4;
end if;
when s4 => --when current state is "s4"
if(input ='0') then
output <= '1';
next_s <= s2;
else
output <= '1';
next_s <= s1;
end if;
end case;
end process;
end behavioral;
solution of question no.7
input
Present state
Next state
output
0
S0
S1
0
1
S0
S0
0
0
S1
S1
0
1
S1
S2
0
0
S2
S3
0
1
S2
S0
0
0
S3
S1
0
1
S3
S2
1
library ieee;
use IEEE.std_logic_1164.all;
entity mealy is
port (clk : in std_logic;
reset : in std_logic;
input : in std_logic;
output : out std_logic
);
end mealy;
architecture behavioral of moore is
type state_type is (s0,s1,s2,s3); --type of state machine.
signal current_s,next_s: state_type; --current and next state declaration.
begin
process (clk,reset)
begin
if (reset='1') then
current_s <= s0; --default state on reset.
elsif (rising_edge(clk)) then
current_s <= next_s; --state change.
end if;
end process;
--state machine process.
process (current_s,input)
begin
case current_s is
when s0 => --when current state is "s0"
if(input ='0') then
output <= '0';
next_s <= s1;
else
output <= '0';
next_s <= s0;
end if;
when s1 =>; --when current state is "s1"
if(input ='0') then
output <= '0';
next_s <= s1;
else
output <= '0';
next_s <= s2;
end if;
when s2 => --when current state is "s2"
if(input ='0') then
output <= '0';
next_s <= s3;
else
output <= '0';
next_s <= s1;
end if;
when s3 => --when current state is "s3"
if(input ='0') then
output <= '0';
next_s <= s1;
else
output <= '1';
next_s <= s2;
end if;
end case;
end process;
end behavioral;
input
Present state
Next state
output
0
S0
S0
0
1
S0
S1
0
0
S1
S2
0
1
S1
S1
0
0
S2
S3
0
1
S2
S1
0
0
S3
S0
0
1
S3
S4
0
0
S4
S2
1
1
S4
S1
1

More Related Content

PDF
Sequence detector for "111"
PDF
Sequence detector for "111"
PPT
lec7.ppt
PPT
lec7.ppt
PPTX
ECE448_lecture7_ASM_VHDL.pptx
PPTX
ECE448_lecture7_ASM_VHDL.pptx
PPTX
Bcd counter with mode control & parallel load capability
PPTX
Bcd counter with mode control & parallel load capability
Sequence detector for "111"
Sequence detector for "111"
lec7.ppt
lec7.ppt
ECE448_lecture7_ASM_VHDL.pptx
ECE448_lecture7_ASM_VHDL.pptx
Bcd counter with mode control & parallel load capability
Bcd counter with mode control & parallel load capability

Similar to solution of question no.6inputPresent stateNext stateoutput.pdf (20)

PPT
FSMThe Finite State Machine is an ab.ppt
PPT
FSMThe Finite State Machine is an ab.ppt
PPTX
Digital Electronics Unit_3.pptx
PPTX
Digital Electronics Unit_3.pptx
DOCX
vhdll.docx
DOCX
vhdll.docx
DOCX
DOCX
PPTX
J - K & MASTERSLAVE FLIPFLOPS
PPTX
J - K & MASTERSLAVE FLIPFLOPS
PPTX
Flip flops
PPTX
Flip flops
PPTX
Latches and flip flops
PPTX
Latches and flip flops
PDF
07 seq logicii-ix2
PDF
07 seq logicii-ix2
PPTX
Very high speed HDL Presentation FOR KIET.pptx
PPTX
Very high speed HDL Presentation FOR KIET.pptx
PPTX
Sequential circuits
PPTX
Sequential circuits
FSMThe Finite State Machine is an ab.ppt
FSMThe Finite State Machine is an ab.ppt
Digital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptx
vhdll.docx
vhdll.docx
J - K & MASTERSLAVE FLIPFLOPS
J - K & MASTERSLAVE FLIPFLOPS
Flip flops
Flip flops
Latches and flip flops
Latches and flip flops
07 seq logicii-ix2
07 seq logicii-ix2
Very high speed HDL Presentation FOR KIET.pptx
Very high speed HDL Presentation FOR KIET.pptx
Sequential circuits
Sequential circuits
Ad

More from aptind (20)

PDF
ssian chemist, Dmitri Mendeleev is often consider.pdf
PDF
moles of HCl = 0.1106 x 10 millimoles = 1.106 mil.pdf
PDF
               CLOUD COMPUTING -----------------------------------.pdf
PDF
You cannot.SolutionYou cannot..pdf
PDF
ViVi is universally available on Unix systems. It has been around.pdf
PDF
Waterfall methodThe model consists of various phases based on the.pdf
PDF
Hi, I am unable to understand the terminology in .pdf
PDF
The main function of cerebellum is to control the motor movements. H.pdf
PDF
Starting with Main.java, where I tested everythingimport College..pdf
PDF
Sexual reproduction has played the most crucial role in evolution of.pdf
PDF
package com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdf
PDF
And is option DIf variable interest rate decrease , asset value wi.pdf
PDF
import java.util.Scanner;public class Factorial { method usi.pdf
PDF
Hi please find my code.import java.util.HashMap;import java.util.pdf
PDF
Given below is the code for the question. Since the test files (ment.pdf
PDF
Cisco Systems, Inc Acquisition Integration for manufacturing at.pdf
PDF
As we understand, when soil particles binds to each other more stron.pdf
PDF
Amount deposited (base amount) = 2000Rate of interest = 5Amount.pdf
PDF
24. Accomodation - n. Ability of lens to chhange shape diminishes as.pdf
PDF
1.They trade away higher fecundity for future reproduction.2.Resou.pdf
ssian chemist, Dmitri Mendeleev is often consider.pdf
moles of HCl = 0.1106 x 10 millimoles = 1.106 mil.pdf
               CLOUD COMPUTING -----------------------------------.pdf
You cannot.SolutionYou cannot..pdf
ViVi is universally available on Unix systems. It has been around.pdf
Waterfall methodThe model consists of various phases based on the.pdf
Hi, I am unable to understand the terminology in .pdf
The main function of cerebellum is to control the motor movements. H.pdf
Starting with Main.java, where I tested everythingimport College..pdf
Sexual reproduction has played the most crucial role in evolution of.pdf
package com.java2novice.ds.linkedlist;import java.util.NoSuchEleme.pdf
And is option DIf variable interest rate decrease , asset value wi.pdf
import java.util.Scanner;public class Factorial { method usi.pdf
Hi please find my code.import java.util.HashMap;import java.util.pdf
Given below is the code for the question. Since the test files (ment.pdf
Cisco Systems, Inc Acquisition Integration for manufacturing at.pdf
As we understand, when soil particles binds to each other more stron.pdf
Amount deposited (base amount) = 2000Rate of interest = 5Amount.pdf
24. Accomodation - n. Ability of lens to chhange shape diminishes as.pdf
1.They trade away higher fecundity for future reproduction.2.Resou.pdf
Ad

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Classroom Observation Tools for Teachers
PPTX
Presentation on HIE in infants and its manifestations
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Institutional Correction lecture only . . .
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Final Presentation General Medicine 03-08-2024.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
Microbial disease of the cardiovascular and lymphatic systems
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Classroom Observation Tools for Teachers
Presentation on HIE in infants and its manifestations
VCE English Exam - Section C Student Revision Booklet
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Pharma ospi slides which help in ospi learning
O5-L3 Freight Transport Ops (International) V1.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
O7-L3 Supply Chain Operations - ICLT Program
Anesthesia in Laparoscopic Surgery in India
Chinmaya Tiranga quiz Grand Finale.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Institutional Correction lecture only . . .
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Final Presentation General Medicine 03-08-2024.pptx

solution of question no.6inputPresent stateNext stateoutput.pdf

  • 1. solution of question no.6 input Present state Next state output 0 S0 S0 0 1 S0 S1 0 0 S1 S2 0 1 S1 S1 0 0 S2 S3 0 1 S2 S1 0 0 S3 S0 0 1 S3
  • 2. S4 0 0 S4 S2 1 1 S4 S1 1 library ieee; use IEEE.std_logic_1164.all; entity moore is port (clk : in std_logic; reset : in std_logic; input : in std_logic; output : out std_logic ); end moore; architecture behavioral of moore is type state_type is (s0,s1,s2,s3,s4); --type of state machine. signal current_s,next_s: state_type; --current and next state declaration. begin process (clk,reset) begin if (reset='1') then current_s <= s0; --default state on reset. elsif (rising_edge(clk)) then current_s <= next_s; --state change. end if; end process;
  • 3. --state machine process. process (current_s,input) begin case current_s is when s0 => --when current state is "s0" if(input ='0') then output <= '0'; next_s <= s0; else output <= '0'; next_s <= s1; end if; when s1 =>; --when current state is "s1" if(input ='0') then output <= '0'; next_s <= s2; else output <= '0'; next_s <= s1; end if; when s2 => --when current state is "s2" if(input ='0') then output <= '0'; next_s <= s3; else output <= '0'; next_s <= s1; end if; when s3 => --when current state is "s3" if(input ='0') then output <= '1';
  • 4. next_s <= s0; else output <= '0'; next_s <= s4; end if; when s4 => --when current state is "s4" if(input ='0') then output <= '1'; next_s <= s2; else output <= '1'; next_s <= s1; end if; end case; end process; end behavioral; solution of question no.7 input Present state Next state output 0 S0 S1 0 1 S0 S0 0 0 S1 S1 0 1
  • 5. S1 S2 0 0 S2 S3 0 1 S2 S0 0 0 S3 S1 0 1 S3 S2 1 library ieee; use IEEE.std_logic_1164.all; entity mealy is port (clk : in std_logic; reset : in std_logic; input : in std_logic; output : out std_logic ); end mealy; architecture behavioral of moore is type state_type is (s0,s1,s2,s3); --type of state machine. signal current_s,next_s: state_type; --current and next state declaration. begin
  • 6. process (clk,reset) begin if (reset='1') then current_s <= s0; --default state on reset. elsif (rising_edge(clk)) then current_s <= next_s; --state change. end if; end process; --state machine process. process (current_s,input) begin case current_s is when s0 => --when current state is "s0" if(input ='0') then output <= '0'; next_s <= s1; else output <= '0'; next_s <= s0; end if; when s1 =>; --when current state is "s1" if(input ='0') then output <= '0'; next_s <= s1; else output <= '0'; next_s <= s2; end if; when s2 => --when current state is "s2" if(input ='0') then output <= '0'; next_s <= s3;
  • 7. else output <= '0'; next_s <= s1; end if; when s3 => --when current state is "s3" if(input ='0') then output <= '0'; next_s <= s1; else output <= '1'; next_s <= s2; end if; end case; end process; end behavioral; input Present state Next state output 0 S0 S0 0 1 S0 S1 0 0 S1 S2 0
  • 10. 1 S4 S1 1 library ieee; use IEEE.std_logic_1164.all; entity moore is port (clk : in std_logic; reset : in std_logic; input : in std_logic; output : out std_logic ); end moore; architecture behavioral of moore is type state_type is (s0,s1,s2,s3,s4); --type of state machine. signal current_s,next_s: state_type; --current and next state declaration. begin process (clk,reset) begin if (reset='1') then current_s <= s0; --default state on reset. elsif (rising_edge(clk)) then current_s <= next_s; --state change. end if; end process; --state machine process. process (current_s,input) begin case current_s is when s0 => --when current state is "s0"
  • 11. if(input ='0') then output <= '0'; next_s <= s0; else output <= '0'; next_s <= s1; end if; when s1 =>; --when current state is "s1" if(input ='0') then output <= '0'; next_s <= s2; else output <= '0'; next_s <= s1; end if; when s2 => --when current state is "s2" if(input ='0') then output <= '0'; next_s <= s3; else output <= '0'; next_s <= s1; end if; when s3 => --when current state is "s3" if(input ='0') then output <= '1'; next_s <= s0; else output <= '0'; next_s <= s4; end if; when s4 => --when current state is "s4"
  • 12. if(input ='0') then output <= '1'; next_s <= s2; else output <= '1'; next_s <= s1; end if; end case; end process; end behavioral; solution of question no.7 input Present state Next state output 0 S0 S1 0 1 S0 S0 0 0 S1 S1 0 1 S1 S2 0 0 S2 S3
  • 13. 0 1 S2 S0 0 0 S3 S1 0 1 S3 S2 1 library ieee; use IEEE.std_logic_1164.all; entity mealy is port (clk : in std_logic; reset : in std_logic; input : in std_logic; output : out std_logic ); end mealy; architecture behavioral of moore is type state_type is (s0,s1,s2,s3); --type of state machine. signal current_s,next_s: state_type; --current and next state declaration. begin process (clk,reset) begin if (reset='1') then current_s <= s0; --default state on reset. elsif (rising_edge(clk)) then
  • 14. current_s <= next_s; --state change. end if; end process; --state machine process. process (current_s,input) begin case current_s is when s0 => --when current state is "s0" if(input ='0') then output <= '0'; next_s <= s1; else output <= '0'; next_s <= s0; end if; when s1 =>; --when current state is "s1" if(input ='0') then output <= '0'; next_s <= s1; else output <= '0'; next_s <= s2; end if; when s2 => --when current state is "s2" if(input ='0') then output <= '0'; next_s <= s3; else output <= '0'; next_s <= s1; end if;
  • 15. when s3 => --when current state is "s3" if(input ='0') then output <= '0'; next_s <= s1; else output <= '1'; next_s <= s2; end if; end case; end process; end behavioral; input Present state Next state output 0 S0 S0 0 1 S0 S1 0 0 S1 S2 0 1 S1 S1 0 0 S2