2020年5月13日 星期三

Verilog D Flip-Flop

Verilog D Flip-Flop 



module D_FF (clk,D,Q);
input clk,D;
output reg Q;
always@(posedge clk)
begin
Q=D;
end
endmodule


`timescale 100ns/1ns
module tb;

reg clk,D;
wire Q;

always #10 clk = ~clk;

D_FF UUT(clk,D,Q);
 initial begin
    // 1. Initialize testbench variables
clk=1'b0; D=1'b0;
   
    // 2. 
    repeat (2) @ (posedge clk);
    D <= 1;
    repeat (3) @ (posedge clk);

    // 3.  
    D <=0; 
    repeat(2) @ (posedge clk);
    D <= 1;

    // 4.  
    repeat (5) @ (posedge clk);
    $stop;
 
  end

endmodule

沒有留言:

張貼留言

  清除項目編譯快取 執行 flutter clean 重新取得套件依賴 執行 flutter pub get 完整重新編譯並執行 flutter run 1. 新增專案套件 (pubspec.yaml) 在 Flutter 專案根目錄下的 pubspec.yaml 中,新增 ...