Question

help me to finish the verilog code and test bench Part 2: Sequence Counter Design the...

help me to finish the verilog code and test bench

Part 2: Sequence Counter

Design the sequence counter using Xilinx Vivado. Consider the required number of D flip-flops(4). A sample VERILOG source file is as shown:

module Seq_COUNT(

    ??? clock,

    ??? wire [?:?] D,

    ??? ??? [?:?] out

    );

    always @ (??? ???)

    ???

        // 3 bit Sequence Given is 0 2 4 6 1 3 5 7

        out[N-1] <= some expression;

           ⁞

        out[0] <= some expression;

    ???

   

endmodule

The requisite test bench file mirrors the test bench file used for the shift register with the following changes:

    always #15 ? = ? ?; //invert the clock_t input using this period

    always #10 ? = ? ?; //invert the D_t[0] input using this period

             ⁞

    always #? ? = ? ?; //invert the D_t[N-1] input using the period that is //double the previous period

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

module Seq_COUNT(
input clock,
input wire [2:0] D,
output reg [2:0] out
);

always @(posedge clock)
begin
     out[0] <= !(D[0] ^ D[1] ^ D[2]);
     out[1] <= !D[0];
     out[2] <= D[1];
end

endmodule

module testbench;
reg        clock_t;
reg [2:0] D_t;
wire [2:0] out_t;

always
   #15 clock_t = !clock_t;

always
   #10 D_t[0] = !D_t[0];

always
   #20 D_t[1] = !D_t[1];

always
   #40 D_t[2] = !D_t[2];

// DUT instantiation
Seq_COUNT DUT0 (.clock(clock_t), .D(D_t), .out(out_t));


always @(posedge clock_t)
    $display("D = %b, OUT = %b", D_t, out_t);

initial begin
clock_t = 1'b0;
D_t = 3'd0;
#300 $finish;
end
endmodule


/************ OUTPUT OF PROGRAM **********
D = 001, OUT = xxx
D = 100, OUT = 000
D = 111, OUT = 010
D = 010, OUT = 100
D = 101, OUT = 110
D = 000, OUT = 001
D = 011, OUT = 011
D = 110, OUT = 101
D = 001, OUT = 111
D = 100, OUT = 000
*****************************************/

Add a comment
Know the answer?
Add Answer to:
help me to finish the verilog code and test bench Part 2: Sequence Counter Design the...
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
  • I need help writing the Verilog Design code for this test bench. I have to calculate...

    I need help writing the Verilog Design code for this test bench. I have to calculate the dot product of two 8-bit vectors a and b. I have listed the test bench below: // Code your testbench here module test_VVM; wire [3:0] value; wire done; reg clk, rst; reg [7:0] a, b; initial begin a = 8'b11011101; b = 8'b11010111;    clk = 1'd0;   //at time 0    rst = 1'd0; //at time 0    rst = #2 1'd1; //at...

  • Write a test bench to thoroughly test the Verilog module dff_fe_asyn_h. below is the module ddff_fe_asyn_h.code...

    Write a test bench to thoroughly test the Verilog module dff_fe_asyn_h. below is the module ddff_fe_asyn_h.code Simulate the circuit using ISim and analyze the resulting waveform. Take full screenshots of all Verilog source codes and the resulting simulation waveform to be included in the lab report. Include explanation of the waveform and how you can conclude that the D flip flop implemented in step 9 is correct in the lab report. Verilog Code for dff_fe_asyn_h is mentioned below:- //DFF module...

  • Verilog code help Counter is a sequential circuit. A digital circuit which is used for a...

    Verilog code help Counter is a sequential circuit. A digital circuit which is used for a counting events (usually clock pulses) is known counter. Counter is most clear application of the usage of flip-flops. It is a group of flip-flops with a clock signal applied. Consider the following 4 bits up counter 1. Write mixed behavioral/ structural Verilog code for this counter (HA and Counter structural, D FF behavioral) 2. Write Verilog test bench for this this counter then run...

  • Verilog code help Counter is a sequential circuit. A digital circuit which is used for a counting events (usually clock pulses) is known counter. Counter is most clear application of the usage of...

    Verilog code help Counter is a sequential circuit. A digital circuit which is used for a counting events (usually clock pulses) is known counter. Counter is most clear application of the usage of flip-flops. It is a group of flip-flops with a clock signal applied. Consider the following 4 bits up counter 1. Write mixed behavioral/ structural Verilog code for this counter (HA and Counter structural, D FF behavioral) 2. Write Verilog test bench for this this counter then run...

  • 5.28 The Verilog code in Figure P5.9 represents a 3-bit linear-feedback shift register (LFSR) This type...

    5.28 The Verilog code in Figure P5.9 represents a 3-bit linear-feedback shift register (LFSR) This type of circuit generates a counting sequence of pseudo-random numbers that repeats after 2" - 1 clock cycles, where n is the number of flip-flops in the LFSR. Synthesize a circuit to implement the LFSR in a chip. Draw a diagram of the circuit. Simulate the circuit's behavior by loading the pattern 001 into the LFSR and then enabling the register to count. What is...

  • Write a test bench to thoroughly test the Verilog module dff_fe_asyn_h. below is the module ddff_fe_asyn_h.code...

    Write a test bench to thoroughly test the Verilog module dff_fe_asyn_h. below is the module ddff_fe_asyn_h.code Simulate the circuit using ISim and analyze the resulting waveform. Verilog Code for dff_fe_asyn_h is mentioned below:- //DFF module with asynchronous active high reset with negative edge trigger with clock module dff_fe_asyn_h ( input clock, // Clock Input input reset, // Reset Input input data_in, // Input Data output reg data_out // Output Data ); always @ (negedge clock or posedge reset) // triggers...

  • I need the following in verilog. Attached is also the test bench. CODE // Design a...

    I need the following in verilog. Attached is also the test bench. CODE // Design a circuit that divides a 4-bit signed binary number (in) // by 3 to produce a 3-bit signed binary number (out). Note that // integer division rounds toward zero for both positive and negative // numbers (e.g., -5/3 is -1). module sdiv3(out, in); output [2:0] out; input [3:0]   in; endmodule // sdiv3 TEST BENCH module test; // these are inputs to "circuit under test" reg...

  • VERILOG CODE Design a new Verilog module to define a 4-bit counter algorithmically using behavioral modeling....

    VERILOG CODE Design a new Verilog module to define a 4-bit counter algorithmically using behavioral modeling. This time we no longer need T FlipFlop submodule. The 4-bit counter can be directly implemented using a 4-bit register variable and adding 1 to its value as follows: input Clock, Clear, Enable; output reg [3:0] Q; always @ (posedge Clock or negedge Clear) if (~Clear) Q <= 0; else if (Enable) Q <= Q + 1'b1;

  • Up-Down counter with enable using JK flip-flops: Design, construct and test a 2-bit counter that counts up or down.

    Up-Down counter with enable using JK flip-flops: Design, construct and test a 2-bit counter that counts up or down. An enable input E determines whether the counter is on or off. If E = 0, the counter is disabled and remains in the present count even though clock pulses are applied to the flip-flops. If E= 1, the counter in enabled and a second input, x, determines the count direction. If x= 1, the circuit counts up with the sequence...

  • WRITE THE CODE IN VERILOG: Instead of using Registers, USE D FLIP FLOPS and a clock....

    WRITE THE CODE IN VERILOG: Instead of using Registers, USE D FLIP FLOPS and a clock. Include the logic for a reset A sequential circuit with three D flip-flops A, B, and C, a trigger x, and an output z1, and zo. On this state machine diagram, the label of the states are in the order of (ABC), the transition is the one bit x, and the output is under the forward slash. x/z1zo. The start state is 001 0/01...

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