OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [tb/] [tb_base.sv] - Blame information for rev 49

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2015 Authors and OPENCORES.ORG                 ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 2.1 of the License, or (at your option) any   ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27
 
28
`timescale 1ps/1ps
29
 
30
import tb_clk_pkg::*;
31
 
32
 
33
module
34
  tb_base
35
  #(
36
    parameter PERIOD = 0,
37
    parameter ASSERT_TIME = 0
38
  )
39
  (
40
    output      clock,
41
    output reg  reset
42
  );
43
 
44
  // --------------------------------------------------------------------
45
  //
46
  task assert_reset
47
  (
48
    input time reset_assert
49
  );
50
 
51
    reset = 1;
52
    $display( "-#- %16.t | %m | reset asserted!", $time );
53
 
54
    #reset_assert;
55
 
56
    reset = 0;
57
    $display( "-#- %16.t | %m | reset deasserted!", $time );
58
 
59
endtask
60
 
61
 
62
  // --------------------------------------------------------------------
63
  //
64
  task timeout_stop
65
  (
66
    input time timeout
67
  );
68
 
69
    $display("-#- %16.t | %m | timeout_stop at %t", $time, timeout);
70
 
71
    fork
72
      #(timeout) $stop;
73
    join_none
74
 
75
endtask
76
 
77
 
78
  // --------------------------------------------------------------------
79
  //
80
  tb_clk_class tb_clk_c;
81
  tb_clk_if tb_clk_driver();
82
  assign clock = tb_clk_driver.clk;
83
  time reset_assert = (PERIOD * 5) + (PERIOD / 3);
84
  logic init_done = 0;
85
 
86
  initial
87
    begin
88
 
89
      reset = 1;
90
 
91
      tb_clk_c = new( tb_clk_driver );
92
 
93
      if( PERIOD != 0 )
94
        tb_clk_c.init_basic_clock( PERIOD );
95
 
96
      if( ASSERT_TIME != 0 )
97
        assert_reset( ASSERT_TIME );
98
      else if( reset_assert != 0 )
99
        assert_reset( reset_assert );
100
 
101
      init_done = 1;
102
 
103
    end
104
endmodule
105
 
106
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.