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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [UVC/] [hmc/] [sv/] [hmc_sr_if.sv] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 juko
/*
2
 *                              .--------------. .----------------. .------------.
3
 *                             | .------------. | .--------------. | .----------. |
4
 *                             | | ____  ____ | | | ____    ____ | | |   ______ | |
5
 *                             | ||_   ||   _|| | ||_   \  /   _|| | | .' ___  || |
6
 *       ___  _ __   ___ _ __  | |  | |__| |  | | |  |   \/   |  | | |/ .'   \_|| |
7
 *      / _ \| '_ \ / _ \ '_ \ | |  |  __  |  | | |  | |\  /| |  | | || |       | |
8
 *       (_) | |_) |  __/ | | || | _| |  | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
9
 *      \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
10
 *           | |               | |            | | |              | | |          | |
11
 *           |_|               | '------------' | '--------------' | '----------' |
12
 *                              '--------------' '----------------' '------------'
13
 *
14
 *  openHMC - An Open Source Hybrid Memory Cube Controller
15
 *  (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
16
 *  www.ziti.uni-heidelberg.de
17
 *  B6, 26
18
 *  68159 Mannheim
19
 *  Germany
20
 *
21
 *  Contact: openhmc@ziti.uni-heidelberg.de
22
 *  http://ra.ziti.uni-heidelberg.de/openhmc
23
 *
24
 *   This source file is free software: you can redistribute it and/or modify
25
 *   it under the terms of the GNU Lesser General Public License as published by
26
 *   the Free Software Foundation, either version 3 of the License, or
27
 *   (at your option) any later version.
28
 *
29
 *   This source file is distributed in the hope that it will be useful,
30
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
 *   GNU Lesser General Public License for more details.
33
 *
34
 *   You should have received a copy of the GNU Lesser General Public License
35
 *   along with this source file.  If not, see .
36
 *
37
 *
38
 */
39
//
40
//
41
// Short Range Hybrid Memory Cube Interface
42
//
43
//
44
 
45
`ifndef HMC_SR_IF_SV
46
`define HMC_SR_IF_SV
47
 
48
interface hmc_sr_if #(parameter NUM_LANES = 16) ();
49
 
50
        //--
51
        //-- interface signals
52
        //--
53
 
54
        logic REFCLKP; // Link Reference clock
55
        logic REFCLKN;
56
 
57
        logic [1:0] REFCLK_BOOT; // 00 -> 125 MHz, 01 -> 156.25 MHz, 10 -> 166.67 MHz
58
 
59
        logic P_RST_N;
60
 
61
        //-- Differential pairs
62
        logic [NUM_LANES - 1 : 0]       RXP;
63
        logic [NUM_LANES - 1 : 0]       RXN;
64
 
65
        logic [NUM_LANES - 1 : 0]       TXP;
66
        logic [NUM_LANES - 1 : 0]       TXN;
67
 
68
        logic RXPS; // Power-reduction input
69
        logic TXPS; // Power-reduction output
70
 
71
        logic FERR_N; // Fatal error indicator
72
 
73
        //--
74
        //-- Checking & Coverage
75
        //--
76
 
77
        time t_IS       = 10ns; //-- see the Spec
78
        time t_RST      = 20ns; //-- minimum reset time
79
 
80
        time t_PST = 80ns;
81
        time t_SS =  525ns; //-- since revision E
82
        time t_SME = 600ns;
83
        time t_SREF = 1us;//-- should be 1ms in the real system
84
 
85
        time reset_fall = 0;
86
        time RXPS_rise;
87
        time TXPS_rise;
88
        time reset_rise;
89
 
90
        time RXPS_fall;
91
        time TXPS_fall = 0;
92
 
93
 
94
        bit txp_z = 0;
95
        event wakeup;
96
        event sleep;
97
 
98
        covergroup rst_times_cg @ (posedge P_RST_N);
99
                option.per_instance = 1;
100
                RXPS_rise_BEFORE_P_RST_N : coverpoint $time() - RXPS_rise {
101
                        bins small_time[100] = {[1*t_IS+1:100*t_IS-1]};
102
                        bins huge_time = {[100*t_IS:$]};
103
                        illegal_bins illegal = {[0:t_IS]};
104
                }
105
                P_RST_N_length : coverpoint $time() - reset_fall {
106
                        bins small_time[100] = {[1*t_RST+1:100*t_RST-1]};
107
                        bins huge_time = {[100*t_RST:$]};
108
                        illegal_bins illegal = {[0:t_RST]};
109
                }
110
        endgroup
111
 
112
 
113
 
114
        covergroup sleep_times_cg @ (posedge RXPS);
115
                option.per_instance = 1;
116
                SLEEP_TIME      : coverpoint $time - RXPS_fall {
117
                        bins short_sleep[20] = {[2*t_SREF:20*t_SREF]};
118
                        bins long_sleep = {[21*t_SREF:$]};
119
                        illegal_bins illegal = {[0:t_SREF-1]};
120
                }
121
        endgroup
122
 
123
 
124
        covergroup prepare_sleep_cg @ (sleep);
125
                option.per_instance = 1;
126
                PREPARE_SLEEP_TIME : coverpoint TXPS_fall - RXPS_fall {
127
                        bins short_sleep                = {[0                           :t_PST]};
128
                        bins waiting_t_sme[3]   = {[t_PST                       :3*t_SS]};
129
                        illegal_bins illegal    = {[t_PST+ 3*t_SS+1:$]};
130
                }
131
                SWITCH_TO_Z : coverpoint $time - TXPS_fall {
132
                        bins short = {[0:t_SME/2]};
133
                        bins long = {[t_SME/2 + 1: t_SME]};
134
                        illegal_bins illegal = {[t_SME+1:$]};
135
                }
136
        endgroup
137
 
138
 
139
        covergroup prepare_wakeup_cg @ (wakeup);
140
                option.per_instance = 1;
141
                PREPARE_WAKEUP_TIME : coverpoint TXPS_rise - RXPS_rise {
142
                        bins short_sleep                = {[0                           :t_PST]};
143
                        bins waiting_t_sme[3]   = {[t_PST                       :3*t_SS]};
144
                        illegal_bins illegal    = {[t_PST+ 3*t_SS+1:$]};
145
                }
146
                SWITCH_FROM_Z : coverpoint $time - TXPS_rise {
147
                        bins short = {[0:t_SME/2]};
148
                        bins long = {[t_SME/2 + 1: t_SME]};
149
                        illegal_bins illegal = {[t_SME+1:$]};
150
                }
151
 
152
        endgroup
153
 
154
 
155
        rst_times_cg rst_times = new();
156
        sleep_times_cg sleep_times = new();
157
        prepare_sleep_cg prepare_sleep = new();
158
        prepare_wakeup_cg prepare_wakeup = new();
159
 
160
        //always @(posedge RXPS) begin
161
        //      if(P_RST_N == 0)
162
        //              RXPS_rise <= $time();
163
        //end
164
 
165
        always @(posedge P_RST_N) begin
166
                reset_rise <= $time();
167
        end
168
 
169
        always @(negedge P_RST_N) begin
170
                reset_fall <= $time();
171
        end
172
 
173
        always @(negedge RXPS) begin
174
                        RXPS_fall <= $time();
175
        end
176
        always @(negedge TXPS) begin
177
                        TXPS_fall = $time();
178
                        //->sleep;
179
        end
180
 
181
        always @(TXP) begin
182
                if (TXP === {NUM_LANES{1'bz}})begin
183
                        ->sleep;
184
                        txp_z = 1;
185
                end
186
                else begin
187
                        if (RXPS_rise >0) begin
188
                                if (txp_z == 1)begin
189
                                        ->wakeup;
190
                                end
191
                                txp_z = 0;
192
                        end
193
                end
194
        end
195
 
196
        always @(posedge RXPS) begin
197
                        RXPS_rise <= $time();
198
        end
199
        always @(posedge TXPS) begin
200
                        TXPS_rise = $time();
201
        end
202
 
203
        //-- reset checks
204
        chk_RXPS_before_P_RST_N : assert property (
205
                @(posedge REFCLKP)
206
                $rose(P_RST_N) |=> (reset_rise >= RXPS_rise + t_IS)
207
                );
208
 
209
        chk_P_RST_N_length : assert property (
210
                @(posedge REFCLKP)
211
                $rose(P_RST_N) |=> (t_RST <= reset_rise - reset_fall)
212
                );
213
 
214
 
215
        chk_Lanes_HIGH_Z_during_P_RST_N_P : assert property (
216
                @(posedge REFCLKP)
217
                        !P_RST_N |-> (TXP === { NUM_LANES{1'bZ}})
218
                );
219
        chk_Lanes_HIGH_Z_during_P_RST_N_N : assert property (
220
                @(posedge REFCLKP)
221
                        !P_RST_N |-> (TXN === { NUM_LANES{1'bZ}})
222
                );
223
 
224
 
225
 
226
        //-- sleep mode checks --//
227
 
228
        //-- txps falling edge within t_PST + 3* t_SME after rxps falling edge
229
        chk_TXPS_fall_after_RXPS : assert property (
230
                @(posedge REFCLKP)
231
                        $fell(TXPS) |->(t_PST+ 3* t_SME >= TXPS_fall - RXPS_fall)
232
                );
233
 
234
        chk_TXPS_rise_after_RXPS : assert property (
235
                @(posedge REFCLKP)
236
                        $rose(TXPS) |->((t_PST+ 3* t_SME >= TXPS_rise - RXPS_rise)|| RXPS_rise <= reset_rise)
237
                );
238
 
239
                chk_sleep_mode_min_duration : assert property (
240
                @(posedge REFCLKP) disable iff (!P_RST_N)
241
                        $rose(RXPS)  |->(t_SREF <= RXPS_rise - RXPS_fall)
242
                );
243
 
244
endinterface : hmc_sr_if
245
 
246
`endif // HMC_SR_IF_SV
247
 

powered by: WebSVN 2.1.0

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