SlideShare a Scribd company logo
1 of 3
Download to read offline
1) Write modules for the following state elements
a) Gated RS-latch (Structural)
b) Negative edge-triggered JK Flip-Flop (Behavioral)
c) Negative edge-triggered D-Flip-Flop with asynchronous reset and synchronous enable
(Behavioral)
d) A positive edge-triggered D-Flip-Flop implemented structurally in the Master-Slave pattern
using D-latches (each D-latch, Behaviorally implemented).
2) Write a single testbench that goes through sufficient input patterns to showcase the behavioral
differences of the above using the following paradigms. Assume that the R and K inputs of
elements a. and b. are the same, as are the J and S inputs. Similarly, assume that the D input is
the same for c. and d. Write a testbench that instantiates state elements a. through d. and tests
them in parallel, driving their outputs to its outputs.
Testbench paradigms:
a) Clock generation via
reg clkSlow; reg clkFast;
always
#7 clkSlow = ~clkSlow;
always
#2 clkFast = ~clkFast;
b) Use a behavioral unconditional modulo up-counter with reset to keep track of time:
reg [7:0] count; always@(posedge clkFast) begin
if (reset)
count <= 8’h00;
else
count <= count +8’h01;
end
c) Use clkSlow as the clock for all clocked/gated logic elements from task 1. Use the counter
driven by clkFast and comparators to force events to happen at a specific time in the test case or
directly connect bits of count to inputs.
Solution
1)Gated RS-latch (Structural):
module rslatch(
input clk,S,R,
output Q,Q_not
);
wire top1, bot1, Qback, notQback;
nand G1(top1,S, clk );
nand G2(bot1,clk, R );
nand G3(Qback,top1, notQback );
nand G4(notQback,Qback, bot1 );
assign Q = Qback;
assign Q_not = notQback;
endmodule
b)Negative edge-triggered JK Flip-Flop (Behavioral):
module jkff(
input J,K,CLK,
output Q,Q_not
);
reg Q;
reg Q_not;
always @(negedge clk)
if(J == 1 && K == 0)
begin
Q = 1;
Q_not=0;
end
Negative edge-triggered D-Flip-Flop with asynchronous reset and synchronous enable:
else if(J == 0 && K == 1)
begin
Q = 0;
Q_not =1;
end
else if(J == 1 && K == 1)
begin
Q = ~Q;
Q_not = ~Q_not;
end
else
begin
Q = Q ;
Q_not = Q_not;
end
endmodule
c)Negative edge-triggered D-Flip-Flop withasynchronousreset and synchronous enable
module d_ff(
input clk,rst,en,d,
output Q,Q_not
);
always@(negedge clk,posedge rst )
begin
if ((!rst_n)&en)
q <= 1'b0;
else
q <= d;
end
endmodule

More Related Content

Similar to 1) Write modules for the following state elementsa) Gated RS-latch.pdf

Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECERamesh Naik Bhukya
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilogvenravi10
 
System verilog assertions
System verilog assertionsSystem verilog assertions
System verilog assertionsHARINATH REDDY
 
Digital System Design-Switchlevel and Behavioural Modeling
Digital System Design-Switchlevel and Behavioural ModelingDigital System Design-Switchlevel and Behavioural Modeling
Digital System Design-Switchlevel and Behavioural ModelingIndira Priyadarshini
 
Unit 2 - Single Purpose Processors
Unit 2 - Single Purpose ProcessorsUnit 2 - Single Purpose Processors
Unit 2 - Single Purpose ProcessorsButtaRajasekhar2
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manualSanthosh Poralu
 
Verilog Lecture4 2014
Verilog Lecture4 2014Verilog Lecture4 2014
Verilog Lecture4 2014Béo Tú
 
VLSI Design Final Project - 32 bit ALU
VLSI Design Final Project - 32 bit ALUVLSI Design Final Project - 32 bit ALU
VLSI Design Final Project - 32 bit ALUSachin Kumar Asokan
 
Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical fileArchita Misra
 
TLA+ and PlusCal / An engineer's perspective
TLA+ and PlusCal / An engineer's perspectiveTLA+ and PlusCal / An engineer's perspective
TLA+ and PlusCal / An engineer's perspectiveTorao Takami
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfsagar414433
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfsagar414433
 
Sequential logic circuit
Sequential logic circuitSequential logic circuit
Sequential logic circuitAswiniT3
 
Vlsi ii project presentation
Vlsi ii project presentationVlsi ii project presentation
Vlsi ii project presentationRedwan Islam
 

Similar to 1) Write modules for the following state elementsa) Gated RS-latch.pdf (20)

Uart
UartUart
Uart
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilog
 
System verilog assertions
System verilog assertionsSystem verilog assertions
System verilog assertions
 
Digital System Design-Switchlevel and Behavioural Modeling
Digital System Design-Switchlevel and Behavioural ModelingDigital System Design-Switchlevel and Behavioural Modeling
Digital System Design-Switchlevel and Behavioural Modeling
 
Unit 2 - Single Purpose Processors
Unit 2 - Single Purpose ProcessorsUnit 2 - Single Purpose Processors
Unit 2 - Single Purpose Processors
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manual
 
Verilog Lecture4 2014
Verilog Lecture4 2014Verilog Lecture4 2014
Verilog Lecture4 2014
 
verilog ppt .pdf
verilog ppt .pdfverilog ppt .pdf
verilog ppt .pdf
 
07 sequential verilog
07 sequential verilog07 sequential verilog
07 sequential verilog
 
VLSI Design Final Project - 32 bit ALU
VLSI Design Final Project - 32 bit ALUVLSI Design Final Project - 32 bit ALU
VLSI Design Final Project - 32 bit ALU
 
Verilog_Examples (1).pdf
Verilog_Examples (1).pdfVerilog_Examples (1).pdf
Verilog_Examples (1).pdf
 
Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical file
 
TLA+ and PlusCal / An engineer's perspective
TLA+ and PlusCal / An engineer's perspectiveTLA+ and PlusCal / An engineer's perspective
TLA+ and PlusCal / An engineer's perspective
 
Verilog Cheat sheet-2 (1).pdf
Verilog Cheat sheet-2 (1).pdfVerilog Cheat sheet-2 (1).pdf
Verilog Cheat sheet-2 (1).pdf
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
 
Sequential logic circuit
Sequential logic circuitSequential logic circuit
Sequential logic circuit
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 
Vlsi ii project presentation
Vlsi ii project presentationVlsi ii project presentation
Vlsi ii project presentation
 

More from akstextilekovai

1. 9 students were randomly selected at NPU and the following data w.pdf
1. 9 students were randomly selected at NPU and the following data w.pdf1. 9 students were randomly selected at NPU and the following data w.pdf
1. 9 students were randomly selected at NPU and the following data w.pdfakstextilekovai
 
1. (TCO E) Which of the following is not a passive activityOwning.pdf
1. (TCO E) Which of the following is not a passive activityOwning.pdf1. (TCO E) Which of the following is not a passive activityOwning.pdf
1. (TCO E) Which of the following is not a passive activityOwning.pdfakstextilekovai
 
1. (TCO 1) The type of budget that is prepared for the expected cap.pdf
1.  (TCO 1) The type of budget that is prepared for the expected cap.pdf1.  (TCO 1) The type of budget that is prepared for the expected cap.pdf
1. (TCO 1) The type of budget that is prepared for the expected cap.pdfakstextilekovai
 
1-How can I use my time in school to increase my personalSolutio.pdf
1-How can I use my time in school to increase my personalSolutio.pdf1-How can I use my time in school to increase my personalSolutio.pdf
1-How can I use my time in school to increase my personalSolutio.pdfakstextilekovai
 
1-1 Discussion Ethics and the Financial ManagerIn this module, yo.pdf
1-1 Discussion Ethics and the Financial ManagerIn this module, yo.pdf1-1 Discussion Ethics and the Financial ManagerIn this module, yo.pdf
1-1 Discussion Ethics and the Financial ManagerIn this module, yo.pdfakstextilekovai
 
1- Which of the following is not true about attitudes There are.pdf
1- Which of the following is not true about attitudes There are.pdf1- Which of the following is not true about attitudes There are.pdf
1- Which of the following is not true about attitudes There are.pdfakstextilekovai
 
1- What is the effective semiannual interest rate of a loan that is .pdf
1- What is the effective semiannual interest rate of a loan that is .pdf1- What is the effective semiannual interest rate of a loan that is .pdf
1- What is the effective semiannual interest rate of a loan that is .pdfakstextilekovai
 
1)Express the following statements concerning the three events A,.pdf
1)Express the following statements concerning the three events   A,.pdf1)Express the following statements concerning the three events   A,.pdf
1)Express the following statements concerning the three events A,.pdfakstextilekovai
 
1)2)3) Digitally encode a UNIPOLAR 0 to 5V signal using the 3-bi.pdf
1)2)3) Digitally encode a UNIPOLAR 0 to 5V signal using the 3-bi.pdf1)2)3) Digitally encode a UNIPOLAR 0 to 5V signal using the 3-bi.pdf
1)2)3) Digitally encode a UNIPOLAR 0 to 5V signal using the 3-bi.pdfakstextilekovai
 
1)When a statistically siggnficant ____ effect has only two levels, .pdf
1)When a statistically siggnficant ____ effect has only two levels, .pdf1)When a statistically siggnficant ____ effect has only two levels, .pdf
1)When a statistically siggnficant ____ effect has only two levels, .pdfakstextilekovai
 
1)The repeated-measures analysis of variance can be viewed as a two-.pdf
1)The repeated-measures analysis of variance can be viewed as a two-.pdf1)The repeated-measures analysis of variance can be viewed as a two-.pdf
1)The repeated-measures analysis of variance can be viewed as a two-.pdfakstextilekovai
 
1)Evaluate the expression.170P12)Evaluate the expression.7P0.pdf
1)Evaluate the expression.170P12)Evaluate the expression.7P0.pdf1)Evaluate the expression.170P12)Evaluate the expression.7P0.pdf
1)Evaluate the expression.170P12)Evaluate the expression.7P0.pdfakstextilekovai
 
1)According to Smith, social harmony comes from economic exchanges i.pdf
1)According to Smith, social harmony comes from economic exchanges i.pdf1)According to Smith, social harmony comes from economic exchanges i.pdf
1)According to Smith, social harmony comes from economic exchanges i.pdfakstextilekovai
 
1) What are four general phases of the working capital cycle2) Wh.pdf
1) What are four general phases of the working capital cycle2) Wh.pdf1) What are four general phases of the working capital cycle2) Wh.pdf
1) What are four general phases of the working capital cycle2) Wh.pdfakstextilekovai
 
1) What is the supplementary record that a company creates and maint.pdf
1) What is the supplementary record that a company creates and maint.pdf1) What is the supplementary record that a company creates and maint.pdf
1) What is the supplementary record that a company creates and maint.pdfakstextilekovai
 
1) When someone is on trial for suspicion of committing a crime, the.pdf
1) When someone is on trial for suspicion of committing a crime, the.pdf1) When someone is on trial for suspicion of committing a crime, the.pdf
1) When someone is on trial for suspicion of committing a crime, the.pdfakstextilekovai
 

More from akstextilekovai (16)

1. 9 students were randomly selected at NPU and the following data w.pdf
1. 9 students were randomly selected at NPU and the following data w.pdf1. 9 students were randomly selected at NPU and the following data w.pdf
1. 9 students were randomly selected at NPU and the following data w.pdf
 
1. (TCO E) Which of the following is not a passive activityOwning.pdf
1. (TCO E) Which of the following is not a passive activityOwning.pdf1. (TCO E) Which of the following is not a passive activityOwning.pdf
1. (TCO E) Which of the following is not a passive activityOwning.pdf
 
1. (TCO 1) The type of budget that is prepared for the expected cap.pdf
1.  (TCO 1) The type of budget that is prepared for the expected cap.pdf1.  (TCO 1) The type of budget that is prepared for the expected cap.pdf
1. (TCO 1) The type of budget that is prepared for the expected cap.pdf
 
1-How can I use my time in school to increase my personalSolutio.pdf
1-How can I use my time in school to increase my personalSolutio.pdf1-How can I use my time in school to increase my personalSolutio.pdf
1-How can I use my time in school to increase my personalSolutio.pdf
 
1-1 Discussion Ethics and the Financial ManagerIn this module, yo.pdf
1-1 Discussion Ethics and the Financial ManagerIn this module, yo.pdf1-1 Discussion Ethics and the Financial ManagerIn this module, yo.pdf
1-1 Discussion Ethics and the Financial ManagerIn this module, yo.pdf
 
1- Which of the following is not true about attitudes There are.pdf
1- Which of the following is not true about attitudes There are.pdf1- Which of the following is not true about attitudes There are.pdf
1- Which of the following is not true about attitudes There are.pdf
 
1- What is the effective semiannual interest rate of a loan that is .pdf
1- What is the effective semiannual interest rate of a loan that is .pdf1- What is the effective semiannual interest rate of a loan that is .pdf
1- What is the effective semiannual interest rate of a loan that is .pdf
 
1)Express the following statements concerning the three events A,.pdf
1)Express the following statements concerning the three events   A,.pdf1)Express the following statements concerning the three events   A,.pdf
1)Express the following statements concerning the three events A,.pdf
 
1)2)3) Digitally encode a UNIPOLAR 0 to 5V signal using the 3-bi.pdf
1)2)3) Digitally encode a UNIPOLAR 0 to 5V signal using the 3-bi.pdf1)2)3) Digitally encode a UNIPOLAR 0 to 5V signal using the 3-bi.pdf
1)2)3) Digitally encode a UNIPOLAR 0 to 5V signal using the 3-bi.pdf
 
1)When a statistically siggnficant ____ effect has only two levels, .pdf
1)When a statistically siggnficant ____ effect has only two levels, .pdf1)When a statistically siggnficant ____ effect has only two levels, .pdf
1)When a statistically siggnficant ____ effect has only two levels, .pdf
 
1)The repeated-measures analysis of variance can be viewed as a two-.pdf
1)The repeated-measures analysis of variance can be viewed as a two-.pdf1)The repeated-measures analysis of variance can be viewed as a two-.pdf
1)The repeated-measures analysis of variance can be viewed as a two-.pdf
 
1)Evaluate the expression.170P12)Evaluate the expression.7P0.pdf
1)Evaluate the expression.170P12)Evaluate the expression.7P0.pdf1)Evaluate the expression.170P12)Evaluate the expression.7P0.pdf
1)Evaluate the expression.170P12)Evaluate the expression.7P0.pdf
 
1)According to Smith, social harmony comes from economic exchanges i.pdf
1)According to Smith, social harmony comes from economic exchanges i.pdf1)According to Smith, social harmony comes from economic exchanges i.pdf
1)According to Smith, social harmony comes from economic exchanges i.pdf
 
1) What are four general phases of the working capital cycle2) Wh.pdf
1) What are four general phases of the working capital cycle2) Wh.pdf1) What are four general phases of the working capital cycle2) Wh.pdf
1) What are four general phases of the working capital cycle2) Wh.pdf
 
1) What is the supplementary record that a company creates and maint.pdf
1) What is the supplementary record that a company creates and maint.pdf1) What is the supplementary record that a company creates and maint.pdf
1) What is the supplementary record that a company creates and maint.pdf
 
1) When someone is on trial for suspicion of committing a crime, the.pdf
1) When someone is on trial for suspicion of committing a crime, the.pdf1) When someone is on trial for suspicion of committing a crime, the.pdf
1) When someone is on trial for suspicion of committing a crime, the.pdf
 

Recently uploaded

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
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
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Recently uploaded (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
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...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

1) Write modules for the following state elementsa) Gated RS-latch.pdf

  • 1. 1) Write modules for the following state elements a) Gated RS-latch (Structural) b) Negative edge-triggered JK Flip-Flop (Behavioral) c) Negative edge-triggered D-Flip-Flop with asynchronous reset and synchronous enable (Behavioral) d) A positive edge-triggered D-Flip-Flop implemented structurally in the Master-Slave pattern using D-latches (each D-latch, Behaviorally implemented). 2) Write a single testbench that goes through sufficient input patterns to showcase the behavioral differences of the above using the following paradigms. Assume that the R and K inputs of elements a. and b. are the same, as are the J and S inputs. Similarly, assume that the D input is the same for c. and d. Write a testbench that instantiates state elements a. through d. and tests them in parallel, driving their outputs to its outputs. Testbench paradigms: a) Clock generation via reg clkSlow; reg clkFast; always #7 clkSlow = ~clkSlow; always #2 clkFast = ~clkFast; b) Use a behavioral unconditional modulo up-counter with reset to keep track of time: reg [7:0] count; always@(posedge clkFast) begin if (reset) count <= 8’h00; else count <= count +8’h01; end c) Use clkSlow as the clock for all clocked/gated logic elements from task 1. Use the counter driven by clkFast and comparators to force events to happen at a specific time in the test case or directly connect bits of count to inputs. Solution 1)Gated RS-latch (Structural): module rslatch( input clk,S,R,
  • 2. output Q,Q_not ); wire top1, bot1, Qback, notQback; nand G1(top1,S, clk ); nand G2(bot1,clk, R ); nand G3(Qback,top1, notQback ); nand G4(notQback,Qback, bot1 ); assign Q = Qback; assign Q_not = notQback; endmodule b)Negative edge-triggered JK Flip-Flop (Behavioral): module jkff( input J,K,CLK, output Q,Q_not ); reg Q; reg Q_not; always @(negedge clk) if(J == 1 && K == 0) begin Q = 1; Q_not=0; end Negative edge-triggered D-Flip-Flop with asynchronous reset and synchronous enable: else if(J == 0 && K == 1) begin Q = 0; Q_not =1; end else if(J == 1 && K == 1) begin Q = ~Q; Q_not = ~Q_not; end else begin
  • 3. Q = Q ; Q_not = Q_not; end endmodule c)Negative edge-triggered D-Flip-Flop withasynchronousreset and synchronous enable module d_ff( input clk,rst,en,d, output Q,Q_not ); always@(negedge clk,posedge rst ) begin if ((!rst_n)&en) q <= 1'b0; else q <= d; end endmodule