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
  • 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...

  • 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...

  • I need a test bench code for this module in verilog. Verilog Code module part6 (А.В.us,G,E,L);...

    I need a test bench code for this module in verilog. Verilog Code module part6 (А.В.us,G,E,L); AlL ((Al --AI --op AIL (us) I-AIL input [2:0]A,B; input us; output G,E.I; reg G,E,L wire [2:0] A,B; always@(A or B) if (us 1)//unsigned mode begin しくーAB: //А is less G-A>B; //B is less 区-A-B; //logical (A equality end --oper AlL1 A[0] & -AIL E<-Ssigned(A) Ssigned(B); //logical equality opera AIL1I -AILI -operat else //signed mode begin しく=$signed(A)<$signed(B); //Ais less G-Ssigned(A)>Ssigned(B);: //B is less end...

  • 14. Design a cyclic counter that produces the binary sequence 0, 2, 3,1. o..if the control signal...

    14? 14. Design a cyclic counter that produces the binary sequence 0, 2, 3,1. o..if the control signal X is 0 but produces the binary sequence 0, 1,3,2.0, if the control signal X is1.Use D flip-flops. (a) Draw the state diagram; (6 points (b) Draw the input, present state-next state, excitation table: (6 points) (c) Derive the minimal SOP expressions for the D inputs of the flip-flops using K-maps. Draw the logic circuit realization of the counter, using only NAND...

  • I need help doing the code using Verilog modelsim Design a 32-bit register using the D...

    I need help doing the code using Verilog modelsim Design a 32-bit register using the D Flip-Flop from part (1) so that it has the following features: (a) The Register has these ports Outputs: Q[31:0] Inputs: D[31:0] CLK is the clock signal EN is a synchronous signal for enabling the register. When EN is asserted at the sensitive edge of the CLK, the input D is loaded into the register. RESET We will leave this input unconnected, but will define...

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