Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module FF_8bits (input clk, en, reset, input [7:0] D, output reg [7:0] Q);
- always @ (posedge clk or posedge reset)
- if (reset)
- Q <= 8'b0;
- else if (en)
- Q <= D;
- endmodule
- module tb();
- reg clk, en, reset;
- reg [7:0] D;
- wire [7:0] Q;
- FF_8bits DUT(clk, en, reset, D, Q);
- initial begin
- $dumpfile("timing.vcd");
- $dumpvars(0, tb);
- end
- initial
- #100 $finish;
- always
- #5 clk = ~clk;
- initial begin
- clk = 0; en = 0; reset = 0; D = 8'b01010001;
- #22
- reset = 1;
- #2
- reset = 0;
- #16
- en = 1;
- #10
- D = 8'b11001100;
- #20
- D = 8'b10101010;
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement