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

Subversion Repositories ha1588

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

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 41 edn_walter
wire rtc_time_ld, rtc_period_ld, rtc_adj_ld, adj_ld_done;
48 18 edn_walter
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 43 edn_walter
wire [  7:0] rx_q_ptp_msgid_mask;
60 37 edn_walter
wire [  7:0] rx_q_stat;
61
wire [127:0] rx_q_data;
62 18 edn_walter
wire tx_q_rst, tx_q_clk;
63
wire tx_q_rd_en;
64 43 edn_walter
wire [  7:0] tx_q_ptp_msgid_mask;
65 37 edn_walter
wire [  7:0] tx_q_stat;
66
wire [127:0] tx_q_data;
67 18 edn_walter
 
68
rgs u_rgs
69
(
70
  .rst(rst),
71
  .clk(clk),
72
  .wr_in(wr_in),
73
  .rd_in(rd_in),
74
  .addr_in(addr_in),
75
  .data_in(data_in),
76
  .data_out(data_out),
77
  .rtc_clk_in(rtc_clk),
78
  .rtc_rst_out(rtc_rst),
79
  .time_ld_out(rtc_time_ld),
80
  .time_reg_ns_out(rtc_time_reg_ns),
81
  .time_reg_sec_out(rtc_time_reg_sec),
82
  .period_ld_out(rtc_period_ld),
83
  .period_out(rtc_period),
84
  .adj_ld_out(rtc_adj_ld),
85
  .adj_ld_data_out(rtc_adj_ld_data),
86
  .period_adj_out(rtc_period_adj),
87 38 edn_walter
  .adj_ld_done_in(adj_ld_done),
88 18 edn_walter
  .time_reg_ns_in(rtc_time_reg_ns_val),
89
  .time_reg_sec_in(rtc_time_reg_sec_val),
90
  .rx_q_rst_out(rx_q_rst),
91
  .rx_q_rd_clk_out(rx_q_clk),
92
  .rx_q_rd_en_out(rx_q_rd_en),
93 43 edn_walter
  .rx_q_ptp_msgid_mask_out(rx_q_ptp_msgid_mask),
94 18 edn_walter
  .rx_q_stat_in(rx_q_stat),
95
  .rx_q_data_in(rx_q_data),
96
  .tx_q_rst_out(tx_q_rst),
97
  .tx_q_rd_clk_out(tx_q_clk),
98
  .tx_q_rd_en_out(tx_q_rd_en),
99 43 edn_walter
  .tx_q_ptp_msgid_mask_out(tx_q_ptp_msgid_mask),
100 18 edn_walter
  .tx_q_stat_in(tx_q_stat),
101
  .tx_q_data_in(tx_q_data)
102
);
103
 
104
rtc u_rtc
105
(
106
  .rst(rtc_rst),
107
  .clk(rtc_clk),
108
  .time_ld(rtc_time_ld),
109
  .time_reg_ns_in(rtc_time_reg_ns),
110
  .time_reg_sec_in(rtc_time_reg_sec),
111
  .period_ld(rtc_period_ld),
112
  .period_in(rtc_period),
113
  .adj_ld(rtc_adj_ld),
114
  .adj_ld_data(rtc_adj_ld_data),
115 38 edn_walter
  .adj_ld_done(adj_ld_done),
116 18 edn_walter
  .period_adj(rtc_period_adj),
117
  .time_reg_ns(rtc_time_reg_ns_val),
118 32 edn_walter
  .time_reg_sec(rtc_time_reg_sec_val),
119
  .time_ptp_ns(rtc_time_ptp_ns),
120
  .time_ptp_sec(rtc_time_ptp_sec)
121 18 edn_walter
);
122
 
123
tsu u_rx_tsu
124
(
125
  .rst(rst),
126
  .gmii_clk(rx_gmii_clk),
127
  .gmii_ctrl(rx_gmii_ctrl),
128
  .gmii_data(rx_gmii_data),
129 43 edn_walter
  .ptp_msgid_mask(rx_q_ptp_msgid_mask),
130 18 edn_walter
  .rtc_timer_clk(rtc_clk),
131 32 edn_walter
  .rtc_timer_in(rtc_time_ptp_val),
132 18 edn_walter
  .q_rst(rx_q_rst),
133
  .q_rd_clk(rx_q_clk),
134
  .q_rd_en(rx_q_rd_en),
135
  .q_rd_stat(rx_q_stat),
136
  .q_rd_data(rx_q_data)
137
);
138
 
139
tsu u_tx_tsu
140
(
141
  .rst(rst),
142
  .gmii_clk(tx_gmii_clk),
143
  .gmii_ctrl(tx_gmii_ctrl),
144
  .gmii_data(tx_gmii_data),
145 43 edn_walter
  .ptp_msgid_mask(tx_q_ptp_msgid_mask),
146 18 edn_walter
  .rtc_timer_clk(rtc_clk),
147 32 edn_walter
  .rtc_timer_in(rtc_time_ptp_val),
148 18 edn_walter
  .q_rst(tx_q_rst),
149
  .q_rd_clk(tx_q_clk),
150
  .q_rd_en(tx_q_rd_en),
151
  .q_rd_stat(tx_q_stat),
152
  .q_rd_data(tx_q_data)
153
);
154
 
155
endmodule

powered by: WebSVN 2.1.0

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