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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [altera_work/] [spw_fifo_ulight/] [ulight_fifo/] [synthesis/] [submodules/] [altera_merlin_burst_adapter.sv] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 32 redbear
// (C) 2001-2017 Intel Corporation. All rights reserved.
2
// Your use of Intel Corporation's design tools, logic functions and other
3
// software and tools, and its AMPP partner logic functions, and any output
4 40 redbear
// files from any of the foregoing (including device programming or simulation
5 32 redbear
// files), and any associated documentation or information are expressly subject
6
// to the terms and conditions of the Intel Program License Subscription
7 40 redbear
// Agreement, Intel FPGA IP License Agreement, or other applicable
8 32 redbear
// license agreement, including, without limitation, that your use is for the
9
// sole purpose of programming logic devices manufactured by Intel and sold by
10
// Intel or its authorized distributors.  Please refer to the applicable
11
// agreement for further details.
12
 
13
 
14
`timescale 1 ns / 1 ns
15
 
16
// -----------------------------------------------------
17
// Top level for the burst adapter. This selects the
18
// implementation for the adapter, based on the
19
// parameterization.
20
// -----------------------------------------------------
21
module altera_merlin_burst_adapter
22
#(
23
    parameter
24
    // Indicates the implementation to instantiate:
25
    //    "13.1" means the slow, inexpensive generic burst converter.
26
    //    "new" means the fast, expensive per-burst converter.
27
    ADAPTER_VERSION             = "13.1",
28
 
29
    // Indicates if this adapter needs to support read bursts
30
    // (almost always true).
31
    COMPRESSED_READ_SUPPORT     = 1,
32
 
33
    // Standard Merlin packet parameters that indicate
34
    // field position within the packet
35
    PKT_BEGIN_BURST             = 81,
36
    PKT_ADDR_H                  = 79,
37
    PKT_ADDR_L                  = 48,
38
    PKT_BYTE_CNT_H              = 5,
39
    PKT_BYTE_CNT_L              = 0,
40
    PKT_BURSTWRAP_H             = 11,
41
    PKT_BURSTWRAP_L             = 6,
42
    PKT_TRANS_COMPRESSED_READ   = 14,
43
    PKT_TRANS_WRITE             = 13,
44
    PKT_TRANS_READ              = 12,
45
    PKT_BYTEEN_H                = 83,
46
    PKT_BYTEEN_L                = 80,
47
    PKT_BURST_TYPE_H            = 88,
48
    PKT_BURST_TYPE_L            = 87,
49
    PKT_BURST_SIZE_H            = 86,
50
    PKT_BURST_SIZE_L            = 84,
51
    ST_DATA_W                   = 89,
52
    ST_CHANNEL_W                = 8,
53
 
54
    // Component-specific parameters. Explained
55
    // in the implementation levels
56
    IN_NARROW_SIZE              = 0,
57
    NO_WRAP_SUPPORT             = 0,
58
    INCOMPLETE_WRAP_SUPPORT     = 1,
59
    BURSTWRAP_CONST_MASK        = 0,
60
    BURSTWRAP_CONST_VALUE       = -1,
61
 
62
    OUT_NARROW_SIZE             = 0,
63
    OUT_FIXED                   = 0,
64
    OUT_COMPLETE_WRAP           = 0,
65
    BYTEENABLE_SYNTHESIS        = 0,
66
    PIPE_INPUTS                 = 0,
67
 
68
    OUT_BYTE_CNT_H              = 5,
69
    OUT_BURSTWRAP_H             = 11
70
)
71
(
72
    input                            clk,
73
    input                            reset,
74
 
75
    // -------------------
76
    // Command Sink (Input)
77
    // -------------------
78
    input                            sink0_valid,
79
    input [ST_DATA_W-1 : 0]          sink0_data,
80
    input [ST_CHANNEL_W-1 : 0]       sink0_channel,
81
    input                            sink0_startofpacket,
82
    input                            sink0_endofpacket,
83
    output reg                       sink0_ready,
84
 
85
    // -------------------
86
    // Command Source (Output)
87
    // -------------------
88
    output wire                      source0_valid,
89
    output wire [ST_DATA_W-1 : 0]    source0_data,
90
    output wire [ST_CHANNEL_W-1 : 0] source0_channel,
91
    output wire                      source0_startofpacket,
92
    output wire                      source0_endofpacket,
93
    input                            source0_ready
94
);
95
 
96
    localparam PKT_BURSTWRAP_W = PKT_BURSTWRAP_H - PKT_BURSTWRAP_L + 1;
97
 
98
    generate if (COMPRESSED_READ_SUPPORT == 0) begin : altera_merlin_burst_adapter_uncompressed_only
99
 
100
        // -------------------------------------------------------------------
101
        // The reduced version of the adapter is only meant to be used on
102
        // non-bursting wide to narrow links.
103
        // -------------------------------------------------------------------
104
        altera_merlin_burst_adapter_uncompressed_only #(
105
            .PKT_BYTE_CNT_H            (PKT_BYTE_CNT_H),
106
            .PKT_BYTE_CNT_L            (PKT_BYTE_CNT_L),
107
            .PKT_BYTEEN_H              (PKT_BYTEEN_H),
108
            .PKT_BYTEEN_L              (PKT_BYTEEN_L),
109
            .ST_DATA_W                 (ST_DATA_W),
110
            .ST_CHANNEL_W              (ST_CHANNEL_W)
111
        ) burst_adapter (
112
            .clk                   (clk),
113
            .reset                 (reset),
114
            .sink0_valid           (sink0_valid),
115
            .sink0_data            (sink0_data),
116
            .sink0_channel         (sink0_channel),
117
            .sink0_startofpacket   (sink0_startofpacket),
118
            .sink0_endofpacket     (sink0_endofpacket),
119
            .sink0_ready           (sink0_ready),
120
            .source0_valid         (source0_valid),
121
            .source0_data          (source0_data),
122
            .source0_channel       (source0_channel),
123
            .source0_startofpacket (source0_startofpacket),
124
            .source0_endofpacket   (source0_endofpacket),
125
            .source0_ready         (source0_ready)
126
        );
127
 
128
    end
129
    else if (ADAPTER_VERSION == "13.1") begin : altera_merlin_burst_adapter_13_1
130
 
131
        // -----------------------------------------------------
132
        // This is the generic converter implementation, which attempts
133
        // to convert all burst types with a generalized conversion
134
        // function. This results in low area, but low fmax.
135
        // -----------------------------------------------------
136
        altera_merlin_burst_adapter_13_1 #(
137
            .PKT_BEGIN_BURST           (PKT_BEGIN_BURST),
138
            .PKT_ADDR_H                (PKT_ADDR_H ),
139
            .PKT_ADDR_L                (PKT_ADDR_L),
140
            .PKT_BYTE_CNT_H            (PKT_BYTE_CNT_H),
141
            .PKT_BYTE_CNT_L            (PKT_BYTE_CNT_L ),
142
            .PKT_BURSTWRAP_H           (PKT_BURSTWRAP_H),
143
            .PKT_BURSTWRAP_L           (PKT_BURSTWRAP_L),
144
            .PKT_TRANS_COMPRESSED_READ (PKT_TRANS_COMPRESSED_READ),
145
            .PKT_TRANS_WRITE           (PKT_TRANS_WRITE),
146
            .PKT_TRANS_READ            (PKT_TRANS_READ),
147
            .PKT_BYTEEN_H              (PKT_BYTEEN_H),
148
            .PKT_BYTEEN_L              (PKT_BYTEEN_L),
149
            .PKT_BURST_TYPE_H          (PKT_BURST_TYPE_H),
150
            .PKT_BURST_TYPE_L          (PKT_BURST_TYPE_L),
151
            .PKT_BURST_SIZE_H          (PKT_BURST_SIZE_H),
152
            .PKT_BURST_SIZE_L          (PKT_BURST_SIZE_L),
153
            .IN_NARROW_SIZE            (IN_NARROW_SIZE),
154
            .BYTEENABLE_SYNTHESIS      (BYTEENABLE_SYNTHESIS),
155
            .OUT_NARROW_SIZE           (OUT_NARROW_SIZE),
156
            .OUT_FIXED                 (OUT_FIXED),
157
            .OUT_COMPLETE_WRAP         (OUT_COMPLETE_WRAP),
158
            .ST_DATA_W                 (ST_DATA_W),
159
            .ST_CHANNEL_W              (ST_CHANNEL_W),
160
            .BURSTWRAP_CONST_MASK      (BURSTWRAP_CONST_MASK),
161
            .BURSTWRAP_CONST_VALUE     (BURSTWRAP_CONST_VALUE),
162
            .PIPE_INPUTS               (PIPE_INPUTS),
163
            .NO_WRAP_SUPPORT           (NO_WRAP_SUPPORT),
164
            .OUT_BYTE_CNT_H            (OUT_BYTE_CNT_H),
165
            .OUT_BURSTWRAP_H           (OUT_BURSTWRAP_H)
166
        ) burst_adapter (
167
            .clk                   (clk),
168
            .reset                 (reset),
169
            .sink0_valid           (sink0_valid),
170
            .sink0_data            (sink0_data),
171
            .sink0_channel         (sink0_channel),
172
            .sink0_startofpacket   (sink0_startofpacket),
173
            .sink0_endofpacket     (sink0_endofpacket),
174
            .sink0_ready           (sink0_ready),
175
            .source0_valid         (source0_valid),
176
            .source0_data          (source0_data),
177
            .source0_channel       (source0_channel),
178
            .source0_startofpacket (source0_startofpacket),
179
            .source0_endofpacket   (source0_endofpacket),
180
            .source0_ready         (source0_ready)
181
        );
182
 
183
    end
184
    else begin : altera_merlin_burst_adapter_new
185
 
186
        // -----------------------------------------------------
187
        // This is the per-burst-type converter implementation. This attempts
188
        // to convert bursts with specialized functions for each burst
189
        // type. This typically results in higher area, but higher fmax.
190
        // -----------------------------------------------------
191
        altera_merlin_burst_adapter_new #(
192
            .PKT_BEGIN_BURST           (PKT_BEGIN_BURST),
193
            .PKT_ADDR_H                (PKT_ADDR_H ),
194
            .PKT_ADDR_L                (PKT_ADDR_L),
195
            .PKT_BYTE_CNT_H            (PKT_BYTE_CNT_H),
196
            .PKT_BYTE_CNT_L            (PKT_BYTE_CNT_L ),
197
            .PKT_BURSTWRAP_H           (PKT_BURSTWRAP_H),
198
            .PKT_BURSTWRAP_L           (PKT_BURSTWRAP_L),
199
            .PKT_TRANS_COMPRESSED_READ (PKT_TRANS_COMPRESSED_READ),
200
            .PKT_TRANS_WRITE           (PKT_TRANS_WRITE),
201
            .PKT_TRANS_READ            (PKT_TRANS_READ),
202
            .PKT_BYTEEN_H              (PKT_BYTEEN_H),
203
            .PKT_BYTEEN_L              (PKT_BYTEEN_L),
204
            .PKT_BURST_TYPE_H          (PKT_BURST_TYPE_H),
205
            .PKT_BURST_TYPE_L          (PKT_BURST_TYPE_L),
206
            .PKT_BURST_SIZE_H          (PKT_BURST_SIZE_H),
207
            .PKT_BURST_SIZE_L          (PKT_BURST_SIZE_L),
208
            .IN_NARROW_SIZE            (IN_NARROW_SIZE),
209
            .BYTEENABLE_SYNTHESIS      (BYTEENABLE_SYNTHESIS),
210
            .OUT_NARROW_SIZE           (OUT_NARROW_SIZE),
211
            .OUT_FIXED                 (OUT_FIXED),
212
            .OUT_COMPLETE_WRAP         (OUT_COMPLETE_WRAP),
213
            .ST_DATA_W                 (ST_DATA_W),
214
            .ST_CHANNEL_W              (ST_CHANNEL_W),
215
            .BURSTWRAP_CONST_MASK      (BURSTWRAP_CONST_MASK),
216
            .BURSTWRAP_CONST_VALUE     (BURSTWRAP_CONST_VALUE),
217
            .PIPE_INPUTS               (PIPE_INPUTS),
218
            .NO_WRAP_SUPPORT           (NO_WRAP_SUPPORT),
219
            .INCOMPLETE_WRAP_SUPPORT   (INCOMPLETE_WRAP_SUPPORT),
220
            .OUT_BYTE_CNT_H            (OUT_BYTE_CNT_H),
221
            .OUT_BURSTWRAP_H           (OUT_BURSTWRAP_H)
222
        ) burst_adapter (
223
            .clk                   (clk),
224
            .reset                 (reset),
225
            .sink0_valid           (sink0_valid),
226
            .sink0_data            (sink0_data),
227
            .sink0_channel         (sink0_channel),
228
            .sink0_startofpacket   (sink0_startofpacket),
229
            .sink0_endofpacket     (sink0_endofpacket),
230
            .sink0_ready           (sink0_ready),
231
            .source0_valid         (source0_valid),
232
            .source0_data          (source0_data),
233
            .source0_channel       (source0_channel),
234
            .source0_startofpacket (source0_startofpacket),
235
            .source0_endofpacket   (source0_endofpacket),
236
            .source0_ready         (source0_ready)
237
        );
238
 
239
    end
240
    endgenerate
241
 
242
    // synthesis translate_off
243
 
244
    // -----------------------------------------------------
245
    // Simulation-only check for incoming burstwrap values inconsistent with
246
    // BURSTWRAP_CONST_MASK, which would indicate a paramerization error.
247
    //
248
    // Should be turned into an assertion, really.
249
    // -----------------------------------------------------
250
    always @(posedge clk or posedge reset) begin
251
        if (~reset && sink0_valid &&
252
          BURSTWRAP_CONST_MASK[PKT_BURSTWRAP_W - 1:0] &
253
          (BURSTWRAP_CONST_VALUE[PKT_BURSTWRAP_W - 1:0] ^ sink0_data[PKT_BURSTWRAP_H : PKT_BURSTWRAP_L])
254
        ) begin
255
            $display("%t: %m: Error: burstwrap value %X is inconsistent with BURSTWRAP_CONST_MASK value %X", $time(), sink0_data[PKT_BURSTWRAP_H : PKT_BURSTWRAP_L], BURSTWRAP_CONST_MASK[PKT_BURSTWRAP_W - 1:0]);
256
        end
257
    end
258
 
259
    // synthesis translate_on
260
 
261
endmodule

powered by: WebSVN 2.1.0

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