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

Subversion Repositories ha1588

[/] [ha1588/] [trunk/] [rtl/] [top/] [ha1588.v] - Blame information for rev 39

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.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 18 edn_walter
`timescale 1ns/1ns
23
 
24 39 edn_walter
// TODO: add define to generate rtc only or tsu only.
25
 
26 18 edn_walter
module ha1588 (
27
  input         rst,clk,
28
  input         wr_in,rd_in,
29 21 edn_walter
  input  [ 7:0] addr_in,
30 18 edn_walter
  input  [31:0] data_in,
31
  output [31:0] data_out,
32
 
33 32 edn_walter
  input         rtc_clk,
34
  output [31:0] rtc_time_ptp_ns,
35
  output [47:0] rtc_time_ptp_sec,
36 18 edn_walter
 
37
  input       rx_gmii_clk,
38
  input       rx_gmii_ctrl,
39
  input [7:0] rx_gmii_data,
40 39 edn_walter
 
41 18 edn_walter
  input       tx_gmii_clk,
42
  input       tx_gmii_ctrl,
43
  input [7:0] tx_gmii_data
44
);
45
 
46
wire rtc_rst;
47
wire rtc_time_ld, rtc_period_ld, rtc_adj_ld;
48
wire [37:0] rtc_time_reg_ns;
49
wire [47:0] rtc_time_reg_sec;
50
wire [39:0] rtc_period;
51
wire [31:0] rtc_adj_ld_data;
52
wire [39:0] rtc_period_adj;
53
wire [37:0] rtc_time_reg_ns_val;
54
wire [47:0] rtc_time_reg_sec_val;
55 32 edn_walter
wire [79:0] rtc_time_ptp_val = {rtc_time_ptp_sec[47:0], rtc_time_ptp_ns[31:0]};
56 18 edn_walter
 
57
wire rx_q_rst, rx_q_clk;
58
wire rx_q_rd_en;
59 37 edn_walter
wire [  7:0] rx_q_stat;
60
wire [127:0] rx_q_data;
61 18 edn_walter
wire tx_q_rst, tx_q_clk;
62
wire tx_q_rd_en;
63 37 edn_walter
wire [  7:0] tx_q_stat;
64
wire [127:0] tx_q_data;
65 18 edn_walter
 
66
rgs u_rgs
67
(
68
  .rst(rst),
69
  .clk(clk),
70
  .wr_in(wr_in),
71
  .rd_in(rd_in),
72
  .addr_in(addr_in),
73
  .data_in(data_in),
74
  .data_out(data_out),
75
  .rtc_clk_in(rtc_clk),
76
  .rtc_rst_out(rtc_rst),
77
  .time_ld_out(rtc_time_ld),
78
  .time_reg_ns_out(rtc_time_reg_ns),
79
  .time_reg_sec_out(rtc_time_reg_sec),
80
  .period_ld_out(rtc_period_ld),
81
  .period_out(rtc_period),
82
  .adj_ld_out(rtc_adj_ld),
83
  .adj_ld_data_out(rtc_adj_ld_data),
84
  .period_adj_out(rtc_period_adj),
85 38 edn_walter
  .adj_ld_done_in(adj_ld_done),
86 18 edn_walter
  .time_reg_ns_in(rtc_time_reg_ns_val),
87
  .time_reg_sec_in(rtc_time_reg_sec_val),
88
  .rx_q_rst_out(rx_q_rst),
89
  .rx_q_rd_clk_out(rx_q_clk),
90
  .rx_q_rd_en_out(rx_q_rd_en),
91
  .rx_q_stat_in(rx_q_stat),
92
  .rx_q_data_in(rx_q_data),
93
  .tx_q_rst_out(tx_q_rst),
94
  .tx_q_rd_clk_out(tx_q_clk),
95
  .tx_q_rd_en_out(tx_q_rd_en),
96
  .tx_q_stat_in(tx_q_stat),
97
  .tx_q_data_in(tx_q_data)
98
);
99
 
100
rtc u_rtc
101
(
102
  .rst(rtc_rst),
103
  .clk(rtc_clk),
104
  .time_ld(rtc_time_ld),
105
  .time_reg_ns_in(rtc_time_reg_ns),
106
  .time_reg_sec_in(rtc_time_reg_sec),
107
  .period_ld(rtc_period_ld),
108
  .period_in(rtc_period),
109
  .adj_ld(rtc_adj_ld),
110
  .adj_ld_data(rtc_adj_ld_data),
111 38 edn_walter
  .adj_ld_done(adj_ld_done),
112 18 edn_walter
  .period_adj(rtc_period_adj),
113
  .time_reg_ns(rtc_time_reg_ns_val),
114 32 edn_walter
  .time_reg_sec(rtc_time_reg_sec_val),
115
  .time_ptp_ns(rtc_time_ptp_ns),
116
  .time_ptp_sec(rtc_time_ptp_sec)
117 18 edn_walter
);
118
 
119
tsu u_rx_tsu
120
(
121
  .rst(rst),
122
  .gmii_clk(rx_gmii_clk),
123
  .gmii_ctrl(rx_gmii_ctrl),
124
  .gmii_data(rx_gmii_data),
125
  .rtc_timer_clk(rtc_clk),
126 32 edn_walter
  .rtc_timer_in(rtc_time_ptp_val),
127 18 edn_walter
  .q_rst(rx_q_rst),
128
  .q_rd_clk(rx_q_clk),
129
  .q_rd_en(rx_q_rd_en),
130
  .q_rd_stat(rx_q_stat),
131
  .q_rd_data(rx_q_data)
132
);
133
 
134
tsu u_tx_tsu
135
(
136
  .rst(rst),
137
  .gmii_clk(tx_gmii_clk),
138
  .gmii_ctrl(tx_gmii_ctrl),
139
  .gmii_data(tx_gmii_data),
140
  .rtc_timer_clk(rtc_clk),
141 32 edn_walter
  .rtc_timer_in(rtc_time_ptp_val),
142 18 edn_walter
  .q_rst(tx_q_rst),
143
  .q_rd_clk(tx_q_clk),
144
  .q_rd_en(tx_q_rd_en),
145
  .q_rd_stat(tx_q_stat),
146
  .q_rd_data(tx_q_data)
147
);
148
 
149
endmodule

powered by: WebSVN 2.1.0

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