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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [rtl/] [include/] [hmc_field_functions.h] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 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 <http://www.gnu.org/licenses/>.
36
 *
37
 *
38
 *  File name: hmc_field_functions.h
39
 *
40
 */
41
 
42
//------------------------------------------------------------------------HMC HEADER FIELDS
43
 
44
 function [5:0] cmd;
45
    input [127:0] flit;
46
 
47
    begin
48
        cmd = flit[5:0];
49
    end
50
 endfunction
51
 
52
 function [5:0] num_requested_flits;
53
    input [127:0] flit;
54
 
55
    begin
56
        num_requested_flits = flit[2:0] + 2;    //+1 for the encoding
57
    end
58
 endfunction
59
 
60
 function [2:0] flow_cmd;
61
    input [127:0] flit;
62
 
63
    begin
64
        flow_cmd = flit[2:0];
65
    end
66
 endfunction
67
 
68
 function [2:0] cmd_type;
69
    input [127:0] flit;
70
 
71
    begin
72
        cmd_type = flit[5:3];
73
    end
74
 endfunction
75
 
76 15 juko
 function is_req_flow;
77 11 juko
    input [127:0] flit;
78
    begin
79 15 juko
        //according to spec it should check for bits [5:2]. However, all regular requests have bit 3,4 or 5 set so we reduce logic by checking only these
80
        if(flit[5:3]) begin
81
            is_req_flow = 0;
82 11 juko
        end else begin
83 15 juko
            is_req_flow = 1;
84 11 juko
        end
85
    end
86
 endfunction
87
 
88 15 juko
 function is_rsp_flow;
89
    input [127:0] flit;
90
    begin
91
        //according to spec it should check for bits [5:2]. However, all responses have bit 5 set so we reduce logic by only checking this single bit
92
        if(flit[5]) begin
93
            is_rsp_flow = 0;
94
        end else begin
95
            is_rsp_flow = 1;
96
        end
97
    end
98
 endfunction
99
 
100
  function lng_dln_equal;
101
    input [127:0] flit;
102
    begin
103
        if(!(lng(flit)^dln(flit))) begin
104
            lng_dln_equal = 1;
105
        end else begin
106
            lng_dln_equal = 0;
107
        end
108
    end
109
 endfunction
110
 
111 11 juko
 function irtry_start_retry_flag;
112
    input [127:0] flit;
113
 
114
    begin
115
        irtry_start_retry_flag = flit[64+8];
116
    end
117
 endfunction
118
 
119
 function irtry_clear_error_flag;
120
    input [127:0] flit;
121
 
122
    begin
123
        irtry_clear_error_flag = flit[64+8+1];
124
    end
125
 endfunction
126
 
127
 function [3:0] lng;
128
    input [127:0] flit;
129
 
130
    begin
131
        lng = flit[10:7];
132
    end
133
 endfunction
134
 
135
 
136
 function [3:0] dln;
137
    input [127:0]   flit;
138
 
139
    begin
140
        dln = flit[14:11];
141
    end
142
 endfunction
143
 
144
 
145
 function [8:0] tag;
146
    input [127:0] flit;
147
 
148
    begin
149
        tag = flit[23:15];
150
    end
151
 endfunction
152
 
153
 function [57:24] adrs;
154
    input [127:0] flit;
155
 
156
    begin
157
        adrs = flit[57:24];
158
    end
159
 endfunction
160
 
161
 function [2:0] cub;
162
    input [127:0] flit;
163
 
164
    begin
165
        cub = flit[63:61];
166
    end
167
 endfunction
168
 
169
//------------------------------------------------------------------------HMC TAIL FIELDS
170
 
171
 function [7:0] rrp;
172
    input [127:0]   flit;
173
 
174
    begin
175
        rrp = flit[64+7:64];
176
    end
177
 endfunction
178
 
179
 function [7:0] frp;
180
    input [127:0]   flit;
181
 
182
    begin
183
        frp = flit[64+15:64+8];
184
    end
185
 endfunction
186
 
187
 function [2:0] seq;
188
        input [127:0]   flit;
189
 
190
        begin
191
                seq = flit[64+18:64+16];
192
        end
193
 endfunction
194
 
195
 function [6:0] errstat;
196
        input [127:0]   flit;
197
 
198
        begin
199
                errstat = flit[64+26:64+20];
200
        end
201
 endfunction
202
 
203
 function [4:0] rtc;
204
        input [127:0]   flit;
205
 
206
        begin
207
                rtc = flit[64+31:64+27];
208
        end
209
 endfunction
210
 
211
 function [31:0] crc;
212
    input [127:0]   flit;
213
 
214
    begin
215
        crc = flit[127:128-32];
216
    end
217
 endfunction
218
 
219
 
220
 
221
 

powered by: WebSVN 2.1.0

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