Sequential logic D Flip Flop 正反器 Behavioral Modeling (& Test Bench)
//數位IC設計入門-Verilog
//Sequential logic D Flip Flop 正反器 Behavioral Modeling (& Test Bench)
//File Name:D_FF.v
module D_FlipFlop (clock, D, Q);
input clock, D;
output Q;
reg Q;
always@(posedge clock)
begin
Q = D;
end
endmodule
// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps
module Test_bench;
//module D_FlipFlop (clock, D, Q);
//input clock, D;
//output Q;
// Inputs
reg D=0, clock=0;
// Outputs
wire Q;
// Instantiate the Unit Under Test (UUT)
// DD_FlipFlop (clock, D, Q);
D_FlipFlop UUT (clock, D, Q);
initial begin
$monitor(clock, D, Q);
// Initialize Inputs
//#20 select[3:0]=4'd0 ; a=8'd0 ; b=8'd0;
forever #25 D=~D;
end
always #10 clock = ~clock;
initial
begin
#100; // 模擬終止時間 100 ns
$stop;
end
endmodule
沒有留言:
張貼留言