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

Subversion Repositories ha1588

[/] [ha1588/] [trunk/] [sim/] [top/] [ha1588_tb.v] - Blame information for rev 54

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

Line No. Rev Author Line
1 34 edn_walter
/*
2 38 edn_walter
 * ha1588_tb.v
3 34 edn_walter
 *
4 37 edn_walter
 * Copyright (c) 2012, BABY&HW. All rights reserved.
5 34 edn_walter
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA 02110-1301  USA
20
 */
21
 
22 21 edn_walter
`timescale 1ns/1ns
23
 
24
module ha1588_tb ();
25
 
26 54 edn_walter
parameter giga_mode = 1'b1;
27
 
28 21 edn_walter
reg up_clk;
29
wire up_wr, up_rd;
30
wire [ 7:0] up_addr;
31
wire [31:0] up_data_wr, up_data_rd;
32
initial begin
33
             up_clk = 1'b0;
34
  forever #5 up_clk = !up_clk;
35
end
36
 
37
reg rtc_clk;
38
initial begin
39
             rtc_clk = 1'b0;
40
  forever #4 rtc_clk = !rtc_clk;
41
end
42
 
43
reg rst;
44
initial begin
45
      rst = 1'b1;
46
  #10 rst = 1'b0;
47
end
48
 
49 24 edn_walter
wire        rx_gmii_clk;
50
wire        rx_gmii_ctrl;
51
wire [ 7:0] rx_gmii_data;
52
wire        tx_gmii_clk;
53
wire        tx_gmii_ctrl;
54
wire [ 7:0] tx_gmii_data;
55
 
56
gmii_rx_bfm NIC_DRV_RX_BFM (
57
  .gmii_rxclk(rx_gmii_clk),
58
  .gmii_rxctrl(rx_gmii_ctrl),
59
  .gmii_rxdata(rx_gmii_data)
60
);
61 54 edn_walter
defparam NIC_DRV_RX_BFM.giga_mode = giga_mode;
62 24 edn_walter
 
63
gmii_tx_bfm NIC_DRV_TX_BFM (
64
  .gmii_txclk(tx_gmii_clk),
65
  .gmii_txctrl(tx_gmii_ctrl),
66
  .gmii_txdata(tx_gmii_data)
67
);
68 54 edn_walter
defparam NIC_DRV_TX_BFM.giga_mode = giga_mode;
69 24 edn_walter
 
70 21 edn_walter
ptp_drv_bfm_sv PTP_DRV_BFM (
71
  .up_clk(up_clk),
72
  .up_wr(up_wr),
73
  .up_rd(up_rd),
74
  .up_addr(up_addr),
75
  .up_data_wr(up_data_wr),
76
  .up_data_rd(up_data_rd)
77
);
78
 
79 24 edn_walter
ha1588 PTP_HA_DUT (
80 21 edn_walter
  .rst(rst),
81
  .clk(up_clk),
82
  .wr_in(up_wr),
83
  .rd_in(up_rd),
84
  .addr_in(up_addr),
85
  .data_in(up_data_wr),
86
  .data_out(up_data_rd),
87
 
88
  .rtc_clk(rtc_clk),
89 32 edn_walter
  .rtc_time_ptp_ns(),
90
  .rtc_time_ptp_sec(),
91 21 edn_walter
 
92 24 edn_walter
  .rx_gmii_clk(rx_gmii_clk),
93
  .rx_gmii_ctrl(rx_gmii_ctrl),
94
  .rx_gmii_data(rx_gmii_data),
95 54 edn_walter
  .rx_giga_mode(giga_mode),
96 24 edn_walter
  .tx_gmii_clk(tx_gmii_clk),
97
  .tx_gmii_ctrl(tx_gmii_ctrl),
98 54 edn_walter
  .tx_gmii_data(tx_gmii_data),
99
  .tx_giga_mode(giga_mode)
100 21 edn_walter
);
101
 
102
initial begin
103 54 edn_walter
    ha1588_tb.PTP_DRV_BFM.up_start = 1;
104
    #100000000 $stop;
105 21 edn_walter
end
106
 
107
endmodule

powered by: WebSVN 2.1.0

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