Question

We want to design a circuit that takes as input a serial bit stream and outputs a l whenever the sequence “111” occurs. Ove

0 0
Add a comment Improve this question Transcribed image text
Answer #1

3.1)

3.2) System Verilog code:-

module sequence_detector(in,clk,reset,y);
input in,clk,reset;
output y;
reg y;
reg [1:0] r,n;
parameter s0=2'b00,s1=2'b01,s2=2'b10;
always @(posedge clk or posedge reset)
if (reset)
r<= s0;

else
r<= n;
always @(r or in)
if (r ==s0 && in==0) n =s0;
else if (r ==s0 && in==1) n = s1;
else if (r ==s1 && in==0) n = s0;
else if (r ==s1 && in==1) n =s2;
else if (r ==s2 && in==0) n =s0;
else if (r ==s2 && in==1) n =s2;
always @(r or in)
if (r ==s2 && in==1) y=1;
else y=0;
endmodule

(Note: code is written in software , so it is errorfree).

Add a comment
Know the answer?
Add Answer to:
We want to design a circuit that takes as input a serial bit stream and outputs...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT