Một số ví dụ về D FLIP FLOP dùng verilog.

upload_2016-6-3_19-38-19.png
 
  • Like
Reactions: nguyenhonghai1997bg
Verilog cho D FLIP FLOP tích cực ở sườn âm có reset.
Mã:
`timescale 1ns / 1ps

////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:   19:33:12 06/03/2016
// Design Name:   flop
// Module Name:   C:/Users/kimlu/Downloads/New folder/flop/DFF_TB.v
// Project Name:  flop
// Target Device: 
// Tool versions: 
// Description:
//
// Verilog Test Fixture created by ISE for module: flop
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////

module DFF_TB;

    // Inputs
    reg clk;
    reg d;
    reg reset;
    // Outputs
    wire q;

    // Instantiate the Unit Under Test (UUT)
    flop uut (
        .clk(clk),
        .d(d),
        reset(reset),   
        .q(q)
    );

      initial begin
        reset = 1'b0;
        clk =1'b1;
        D =1'b1;
        #5 reset = 1'b1;
        #7 reset = 1'b0;
    end
   
    always #5 clk= ~clk;
    always #10 d = ~d;

    end
     
endmodule