forked from deoregaurav92/SystemVerilog_Coding_Practice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flipflop_test.sv
50 lines (41 loc) · 1.01 KB
/
flipflop_test.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
///////////////////////////////////////////////////////////////////////////
// (c) Copyright 2013 Cadence Design Systems, Inc. All Rights Reserved.
//
// File name : flipflop_test.sv
// Title : Flipflop Testbench Module
// Project : SystemVerilog Training
// Created : 2013-4-8
// Description : Defines the Flipflop testbench module
// Notes :
//
///////////////////////////////////////////////////////////////////////////
module testflop ();
timeunit 1ns;
timeprecision 100ps;
logic reset;
logic [7:0] qin,qout;
// ---- clock generator code begin------
`define PERIOD 10
logic clk = 1'b1;
always
#(`PERIOD/2)clk = ~clk;
// ---- clock generator code end------
flipflop DUV(.*);
int i;
//Adding a clocking block
default clocking cb @(posedge clk);
default input #1step output #4ns;
input qout;
output reset;
output qin;
endclocking
//Adding stimulus to drive clocking block
initial
begin
cb.reset <= 1'b1;
##3 cb.reset <= 1'b0;
for(i = 0; i <= 7; i++)
##1 cb.qin <= i;
$finish;
end
endmodule