Question

In: Electrical Engineering

Consider a secure communication channel where communication will start if the receiver detects the following sequence:...

Consider a secure communication channel where communication will start if the receiver detects the following sequence:

A=1, B=0 --> A=0, B=0 --> A=0, B=1

Draw a FSM state diagram with 2 inputs, first input (A), and second input (B), 1 output signal: correct sequence (Seq_detected). Create a Verilog code for this FSM and use the testbench to verify its correct operation.

Even just a state diagram would help. Thanks

Solutions

Expert Solution

We implement Moore State Machine for the intended sequence detector.

Its corresponding state diagram is shown below-

Here on the archs we represent inputs in format AB

//Verilog Code


module receiver (clock, A, B, Z);

input clock, A, B;
output reg Z;
parameter [1:0] S0 = 2'b00, S1 = 2'b01, S2 = 2'b10, S3 = 2'b11;
reg [1:0] current_state, next_state;

always @ (posedge clock)
   current_state <= next_state;

always @ (current_state or A or B)
begin
   case (current_state)
       2'b00 : begin
           Z <= 1'b0;
           if (A == 1'b1 && B == 1'b0)
               next_state <= S1;
           else
               next_state <= S0; end

       2'b01 : begin
           Z <= 1'b0;
           if (A == 1'b0 && B == 1'b0)
               next_state <= S2;
           else
               next_state <= S0; end

       2'b10 : begin
           Z <= 1'b0;
           if (A == 1'b0 && B == 1'b1)
               next_state <= S3;
           else
               next_state <= S0; end

       2'b11 : begin
           Z <= 1'b1;
           if (A == 1'b1 && B == 1'b0)
               next_state <= S1;
           else
               next_state <= S0; end

       default : next_state <= S0;
   endcase
end

endmodule

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Testbench

module tb_receiver;

reg clock, A, B;
wire Z;

receiver uut (clock, A, B, Z);

initial begin

   clock    <= 1'b0;
   A   <= 1'b0;
   B   <= 1'b0;

   #30;
   A   <= 1'b1;
   B   <= 1'b0;
  
   #10;
   A   <= 1'b0;
   B   <= 1'b0;

   #10;
   A   <= 1'b0;
   B   <= 1'b1;

   #20;
   A   <= 1'b1;
   B   <= 1'b1;
  
   #10;
   A   <= 1'b0;
   B   <= 1'b1;

   #10;
   A   <= 1'b1;
   B   <= 1'b0;  

end

always #5 clock = ~clock;

endmodule

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Simulated on ModelSim


Related Solutions

Explain various communication channels available between the sender and receiver? Further, elaborate how these communication channel...
Explain various communication channels available between the sender and receiver? Further, elaborate how these communication channel influence the message?
Consider a 1Mbps transmission channel. The clock at the receiver has a drift of 1 second...
Consider a 1Mbps transmission channel. The clock at the receiver has a drift of 1 second in one year. How long a sequence of bits(or frame)can be sent before the clock drift could cause a problem? Assume that the sender and receiver are synchronized at the beginning of each frame and that they cannot resynchronize during the frame .Also, assume that the receiver samples the received signal at the middle of each bit duration to detect if it is 0...
Consider the following discrete memoryless channel: Y = X + Z, where Pr{Z = 0} =...
Consider the following discrete memoryless channel: Y = X + Z, where Pr{Z = 0} = Pr{Z = a} = 1/2 and the alphabet for x is {0, 1}. Assume that Z is independent of X. a) Find the capacity of the channel in terms of a. b) Explain how capacity is affected by a in terms of signal-to-noise ratio (SNR).
A) The +1 start of transcription is at position 52 of the following sequence. If the...
A) The +1 start of transcription is at position 52 of the following sequence. If the top strand is the coding strand, and the bottom strand is the template strand, write out the transcribed RNA sequence. 5' TACCGAGAGAGGTTGACAAATGCCTAGATTGATGATTATA 3' 3' ATGGCTCTCTCCAACTGTTTACGGATCTAACTACTAATAT 5' 0000000001111111111122222222233333333334 1234567890123456789012345678901234567890 5' TAATTCGGATGAGAGGGTTCAGGACAAGCTTTAGCCCTAT 3' 3' ATTAAGCCTACTCTCCCAAGTCCTGTTCGAAATCGGGATA 5' 4444444445555555555666666666677777777778 1234567890123456789012345678901234567890 (Write the sequence of nucleotides from the start site to the end without spaces or any other characters, just a string of RNA nucleotides)
The following sequence is a portion of a eukaryotic promoter. The +1 coordinate (the transcription start...
The following sequence is a portion of a eukaryotic promoter. The +1 coordinate (the transcription start site) is indicated as the red/bold “g”. cggctcaataaaataacaggagtctataaaagcgtggggacagttcaggagggggctcgc TBP binds a cis-acting element within this sequence. What is the coordinate of the 5’ deoxynucleotide of this cis-acting element?
The following DNA sequence occurs at the start of a DNA strand: 3′—AATTGCAGATTCA—5′. Which of the...
The following DNA sequence occurs at the start of a DNA strand: 3′—AATTGCAGATTCA—5′. Which of the sequences below would most likely bind to this sequence to initiate DNA replication through the formation of RNA ? A.    5′—TTAACGTCTAAGT—3′ B.    3′—TTAACGTCTAAGT—5′ C.    3′—UUAACGUCUAAGU—5′ D.    5′—UUAACGUCUAAGU—3′
Start StatCrunch and make the following sequence selection: Applets -> Distribution demos. Next select "Binomial" and...
Start StatCrunch and make the following sequence selection: Applets -> Distribution demos. Next select "Binomial" and click "Compute!". In the resulting popup window experiment by using the sliders to assign approximately 0.5 to p and successively assign the values 20, 30 and 40 to n. Discuss what you see in the subsequently drawn Binomial Distribution defined by your specified values for n and p. What value on the x axis (horizontal axis) does the top of the hump of the...
Consider an infinite sequence of independent experiments, where in each experiment we take k balls, labeled...
Consider an infinite sequence of independent experiments, where in each experiment we take k balls, labeled 1 to k, and randomly place them into k slots, also labeled 1 to k, so that there is exactly one ball in each slot. For the nth experiment, let Xn be the number of balls whose label matches the slot label of the slot into which it is placed. So X1, X2, . . . is an infinite sequence of independent and identically...
Consider the following table of activities A through E in which A is the start node...
Consider the following table of activities A through E in which A is the start node and E is the stop node. Assume the project starts on Monday, May 4, 2020 and no work is done on weekends (Saturday and Sunday). All activities require the same resource. Assume no working-day holidays during the months of May and June—no Memorial Day holiday, for example. Activity Duration (days) Predecessor A 5 -- B 5 A C 10 A D 4 A E...
Design an open channel to convey 15 m3/sec. You must consider the following: Use two cross...
Design an open channel to convey 15 m3/sec. You must consider the following: Use two cross sectional arrangements including a rectangular and trapezoidal and only use the best hydraulic sections for both. this is all the information i have.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT