SlideShare une entreprise Scribd logo
1  sur  2
Télécharger pour lire hors ligne
Can someone please help me with the Verilog code of this problem? I'm lost.
Thank you An FSM is defined by the following state-assigned table. Write Verilog code for this
FSM, and simulate.
Solution
find the verilog code as below:
module FSM(w,clk,state,z) //module definition and FSM is the name of module
input w,clk; //input to FSM
output z; //output to FSM
output [1:0] state //putput state 2 bit vector
reg z; //reg to store output
reg [1:0] state //reg to stote state
parameter S0 = 2'b00 ; //parameter to define state that is y2y1
parameter S1 = 2'b01;
parameter S2 = 2'b10;
parameter S3 = 2'b11;
initial begin state = S0; z=0; end //initialize state machine with state = S0 and output z=0
//next state depends on input and present state
always @(negedge clk)
case (state)
S0 : if(w==0) state = S2 // if input w = 0 next state is 10 that is S2
elseif(w==1) state = S3 //if input =1 next state is 11 that is S3
S1 : if(w==0) state = S1 // if input w = 0 next state is 01 that is S1
elseif(w==1) state = S0 //if input =1 next state is 00 that is S0
S2 : if(w==0) state = S3 // if input w = 0 next state is 11 that is S3
elseif(w==1) state = S0 //if input =1 next state is 00 that is S0
S3 : if(w==0) state = S2 // if input w = 0 next state is 10 that is S2
elseif(w==1) state = S1 //if input =1 next state is 01 that is S1
endcase
//output
alwyas @(state or w)
case (state)
S0 : if(w==0) z=0;
elseif(w==1) z=0;
S1: if(w==0) z=0;
elseif(w==1) z=0;
S2 : if(w==0) z=0;
elseif(w==1) z=0;
S2 : if(w==0) z=0;
elseif(w==1) z=0;
S2 : if(w==0) z=0;
elseif(w==1) z=0;
S3 : if(w==0) z=1;
elseif(w==1) z=1;
endcase
endmodule

Contenu connexe

Plus de Amansupan

Case Project 12-2 Devising an AD DS Design with RODC, AD RMS, and A.pdf
Case Project 12-2 Devising an AD DS Design with RODC, AD RMS, and A.pdfCase Project 12-2 Devising an AD DS Design with RODC, AD RMS, and A.pdf
Case Project 12-2 Devising an AD DS Design with RODC, AD RMS, and A.pdfAmansupan
 
Case can be found at following linkColonial Broadcasting Company - .pdf
Case can be found at following linkColonial Broadcasting Company - .pdfCase can be found at following linkColonial Broadcasting Company - .pdf
Case can be found at following linkColonial Broadcasting Company - .pdfAmansupan
 
Can u use the definition of convergence to prove that (5n+17)(2n) c.pdf
Can u use the definition of convergence to prove that (5n+17)(2n) c.pdfCan u use the definition of convergence to prove that (5n+17)(2n) c.pdf
Can u use the definition of convergence to prove that (5n+17)(2n) c.pdfAmansupan
 
can u make more sentence I do not want to read. I need expain abou.pdf
can u make more sentence I do not want to read. I need expain abou.pdfcan u make more sentence I do not want to read. I need expain abou.pdf
can u make more sentence I do not want to read. I need expain abou.pdfAmansupan
 
can u help me or should u kall miSolution .pdf
can u help me or should u kall miSolution                     .pdfcan u help me or should u kall miSolution                     .pdf
can u help me or should u kall miSolution .pdfAmansupan
 
Can the Fed Prevent U.S. RecessionsSolutionThe Federal Reserv.pdf
Can the Fed Prevent U.S. RecessionsSolutionThe Federal Reserv.pdfCan the Fed Prevent U.S. RecessionsSolutionThe Federal Reserv.pdf
Can the Fed Prevent U.S. RecessionsSolutionThe Federal Reserv.pdfAmansupan
 
Can SS ever have a value less than zeroSolutionNo, they can n.pdf
Can SS ever have a value less than zeroSolutionNo, they can n.pdfCan SS ever have a value less than zeroSolutionNo, they can n.pdf
Can SS ever have a value less than zeroSolutionNo, they can n.pdfAmansupan
 
Can someone show me how to prove this I can easily use a DFA bu.pdf
Can someone show me how to prove this I can easily use a DFA bu.pdfCan someone show me how to prove this I can easily use a DFA bu.pdf
Can someone show me how to prove this I can easily use a DFA bu.pdfAmansupan
 
Can someone please help me with this question. Suppose that Xn, n = .pdf
Can someone please help me with this question. Suppose that Xn, n = .pdfCan someone please help me with this question. Suppose that Xn, n = .pdf
Can someone please help me with this question. Suppose that Xn, n = .pdfAmansupan
 
Can someone please guide me through this homework problem I will ra.pdf
Can someone please guide me through this homework problem I will ra.pdfCan someone please guide me through this homework problem I will ra.pdf
Can someone please guide me through this homework problem I will ra.pdfAmansupan
 
Can someone explain to me where the 850 came fromThe U.S. investm.pdf
Can someone explain to me where the 850 came fromThe U.S. investm.pdfCan someone explain to me where the 850 came fromThe U.S. investm.pdf
Can someone explain to me where the 850 came fromThe U.S. investm.pdfAmansupan
 
Can someone help me with this code When I run it, it stops after th.pdf
Can someone help me with this code When I run it, it stops after th.pdfCan someone help me with this code When I run it, it stops after th.pdf
Can someone help me with this code When I run it, it stops after th.pdfAmansupan
 
Can someone explain this whole problem to me in detailed steps I un.pdf
Can someone explain this whole problem to me in detailed steps I un.pdfCan someone explain this whole problem to me in detailed steps I un.pdf
Can someone explain this whole problem to me in detailed steps I un.pdfAmansupan
 
Can someone please explain the gauss theorem on the field of complex.pdf
Can someone please explain the gauss theorem on the field of complex.pdfCan someone please explain the gauss theorem on the field of complex.pdf
Can someone please explain the gauss theorem on the field of complex.pdfAmansupan
 
Can someone please explain these to me Let T R 3 rightarrow R 4 be .pdf
Can someone please explain these to me Let T R 3 rightarrow R 4 be .pdfCan someone please explain these to me Let T R 3 rightarrow R 4 be .pdf
Can someone please explain these to me Let T R 3 rightarrow R 4 be .pdfAmansupan
 
Can someone please explain what a Poisson Process is and what its .pdf
Can someone please explain what a Poisson Process is and what its .pdfCan someone please explain what a Poisson Process is and what its .pdf
Can someone please explain what a Poisson Process is and what its .pdfAmansupan
 
Can you solve these questions please with clear explanation Describe.pdf
Can you solve these questions please with clear explanation Describe.pdfCan you solve these questions please with clear explanation Describe.pdf
Can you solve these questions please with clear explanation Describe.pdfAmansupan
 
Can you write an essay of 350 words about the history of bitumen..pdf
Can you write an essay of 350 words about the history of bitumen..pdfCan you write an essay of 350 words about the history of bitumen..pdf
Can you write an essay of 350 words about the history of bitumen..pdfAmansupan
 
Can you write a report about steel.In your report you need to includ.pdf
Can you write a report about steel.In your report you need to includ.pdfCan you write a report about steel.In your report you need to includ.pdf
Can you write a report about steel.In your report you need to includ.pdfAmansupan
 
Can someone please help my solve the differential equationI tried.pdf
Can someone please help my solve the differential equationI tried.pdfCan someone please help my solve the differential equationI tried.pdf
Can someone please help my solve the differential equationI tried.pdfAmansupan
 

Plus de Amansupan (20)

Case Project 12-2 Devising an AD DS Design with RODC, AD RMS, and A.pdf
Case Project 12-2 Devising an AD DS Design with RODC, AD RMS, and A.pdfCase Project 12-2 Devising an AD DS Design with RODC, AD RMS, and A.pdf
Case Project 12-2 Devising an AD DS Design with RODC, AD RMS, and A.pdf
 
Case can be found at following linkColonial Broadcasting Company - .pdf
Case can be found at following linkColonial Broadcasting Company - .pdfCase can be found at following linkColonial Broadcasting Company - .pdf
Case can be found at following linkColonial Broadcasting Company - .pdf
 
Can u use the definition of convergence to prove that (5n+17)(2n) c.pdf
Can u use the definition of convergence to prove that (5n+17)(2n) c.pdfCan u use the definition of convergence to prove that (5n+17)(2n) c.pdf
Can u use the definition of convergence to prove that (5n+17)(2n) c.pdf
 
can u make more sentence I do not want to read. I need expain abou.pdf
can u make more sentence I do not want to read. I need expain abou.pdfcan u make more sentence I do not want to read. I need expain abou.pdf
can u make more sentence I do not want to read. I need expain abou.pdf
 
can u help me or should u kall miSolution .pdf
can u help me or should u kall miSolution                     .pdfcan u help me or should u kall miSolution                     .pdf
can u help me or should u kall miSolution .pdf
 
Can the Fed Prevent U.S. RecessionsSolutionThe Federal Reserv.pdf
Can the Fed Prevent U.S. RecessionsSolutionThe Federal Reserv.pdfCan the Fed Prevent U.S. RecessionsSolutionThe Federal Reserv.pdf
Can the Fed Prevent U.S. RecessionsSolutionThe Federal Reserv.pdf
 
Can SS ever have a value less than zeroSolutionNo, they can n.pdf
Can SS ever have a value less than zeroSolutionNo, they can n.pdfCan SS ever have a value less than zeroSolutionNo, they can n.pdf
Can SS ever have a value less than zeroSolutionNo, they can n.pdf
 
Can someone show me how to prove this I can easily use a DFA bu.pdf
Can someone show me how to prove this I can easily use a DFA bu.pdfCan someone show me how to prove this I can easily use a DFA bu.pdf
Can someone show me how to prove this I can easily use a DFA bu.pdf
 
Can someone please help me with this question. Suppose that Xn, n = .pdf
Can someone please help me with this question. Suppose that Xn, n = .pdfCan someone please help me with this question. Suppose that Xn, n = .pdf
Can someone please help me with this question. Suppose that Xn, n = .pdf
 
Can someone please guide me through this homework problem I will ra.pdf
Can someone please guide me through this homework problem I will ra.pdfCan someone please guide me through this homework problem I will ra.pdf
Can someone please guide me through this homework problem I will ra.pdf
 
Can someone explain to me where the 850 came fromThe U.S. investm.pdf
Can someone explain to me where the 850 came fromThe U.S. investm.pdfCan someone explain to me where the 850 came fromThe U.S. investm.pdf
Can someone explain to me where the 850 came fromThe U.S. investm.pdf
 
Can someone help me with this code When I run it, it stops after th.pdf
Can someone help me with this code When I run it, it stops after th.pdfCan someone help me with this code When I run it, it stops after th.pdf
Can someone help me with this code When I run it, it stops after th.pdf
 
Can someone explain this whole problem to me in detailed steps I un.pdf
Can someone explain this whole problem to me in detailed steps I un.pdfCan someone explain this whole problem to me in detailed steps I un.pdf
Can someone explain this whole problem to me in detailed steps I un.pdf
 
Can someone please explain the gauss theorem on the field of complex.pdf
Can someone please explain the gauss theorem on the field of complex.pdfCan someone please explain the gauss theorem on the field of complex.pdf
Can someone please explain the gauss theorem on the field of complex.pdf
 
Can someone please explain these to me Let T R 3 rightarrow R 4 be .pdf
Can someone please explain these to me Let T R 3 rightarrow R 4 be .pdfCan someone please explain these to me Let T R 3 rightarrow R 4 be .pdf
Can someone please explain these to me Let T R 3 rightarrow R 4 be .pdf
 
Can someone please explain what a Poisson Process is and what its .pdf
Can someone please explain what a Poisson Process is and what its .pdfCan someone please explain what a Poisson Process is and what its .pdf
Can someone please explain what a Poisson Process is and what its .pdf
 
Can you solve these questions please with clear explanation Describe.pdf
Can you solve these questions please with clear explanation Describe.pdfCan you solve these questions please with clear explanation Describe.pdf
Can you solve these questions please with clear explanation Describe.pdf
 
Can you write an essay of 350 words about the history of bitumen..pdf
Can you write an essay of 350 words about the history of bitumen..pdfCan you write an essay of 350 words about the history of bitumen..pdf
Can you write an essay of 350 words about the history of bitumen..pdf
 
Can you write a report about steel.In your report you need to includ.pdf
Can you write a report about steel.In your report you need to includ.pdfCan you write a report about steel.In your report you need to includ.pdf
Can you write a report about steel.In your report you need to includ.pdf
 
Can someone please help my solve the differential equationI tried.pdf
Can someone please help my solve the differential equationI tried.pdfCan someone please help my solve the differential equationI tried.pdf
Can someone please help my solve the differential equationI tried.pdf
 

Dernier

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Dernier (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Can someone please help me with the Verilog code of this problem I.pdf

  • 1. Can someone please help me with the Verilog code of this problem? I'm lost. Thank you An FSM is defined by the following state-assigned table. Write Verilog code for this FSM, and simulate. Solution find the verilog code as below: module FSM(w,clk,state,z) //module definition and FSM is the name of module input w,clk; //input to FSM output z; //output to FSM output [1:0] state //putput state 2 bit vector reg z; //reg to store output reg [1:0] state //reg to stote state parameter S0 = 2'b00 ; //parameter to define state that is y2y1 parameter S1 = 2'b01; parameter S2 = 2'b10; parameter S3 = 2'b11; initial begin state = S0; z=0; end //initialize state machine with state = S0 and output z=0 //next state depends on input and present state always @(negedge clk) case (state) S0 : if(w==0) state = S2 // if input w = 0 next state is 10 that is S2 elseif(w==1) state = S3 //if input =1 next state is 11 that is S3 S1 : if(w==0) state = S1 // if input w = 0 next state is 01 that is S1 elseif(w==1) state = S0 //if input =1 next state is 00 that is S0 S2 : if(w==0) state = S3 // if input w = 0 next state is 11 that is S3 elseif(w==1) state = S0 //if input =1 next state is 00 that is S0 S3 : if(w==0) state = S2 // if input w = 0 next state is 10 that is S2 elseif(w==1) state = S1 //if input =1 next state is 01 that is S1 endcase //output alwyas @(state or w) case (state) S0 : if(w==0) z=0; elseif(w==1) z=0;
  • 2. S1: if(w==0) z=0; elseif(w==1) z=0; S2 : if(w==0) z=0; elseif(w==1) z=0; S2 : if(w==0) z=0; elseif(w==1) z=0; S2 : if(w==0) z=0; elseif(w==1) z=0; S3 : if(w==0) z=1; elseif(w==1) z=1; endcase endmodule