x393
1.0
FPGAcodeforElphelNC393camera
huffman393.v
Go to the documentation of this file.
1
39
78
// This file may be used to define same pre-processor macros to be included into each parsed file
79
`ifndef
SYSTEM_DEFINES
80
`define
SYSTEM_DEFINES
81
// TODO: Later compare instantiate/infer
82
`define
INSTANTIATE_DSP48E1
83
`define
DEBUG_DCT1D// undefine after debugging is over
// `define USE_OLD_DCT
84
85
// Parameters from x393_sata project
86
`define
USE_DRP
87
`define
ALIGN_CLOCKS
88
// `define STRAIGHT_XCLK
89
`define
USE_DATASCOPE
90
// `define DATASCOPE_INCOMING_RAW
91
`define
PRELOAD_BRAMS
92
// `define AHCI_SATA 1
93
// `define DEBUG_ELASTIC
94
// End of parameters from x393_sata project
95
96
`define
PRELOAD_BRAMS
97
`define
DISPLAY_COMPRESSED_DATA
// if HISPI is not defined, parallel sensor interface is used for all channels
98
`define
HISPI /*************** CHANGE here and x393_hispi/x393_parallel in bitstream tool settings ****************/
// `define USE_OLD_XDCT393
99
// `define USE_PCLK2X
100
// `define USE_XCLK2X
101
`define
REVERSE_LANES 1
`define
DEBUG_RING 1
`define
USE_HARD_CURPARAMS// Adjustment of actual hardware may break simulation
// `define DEBUG_SENS_MEM_PAGES 1
102
// `define MCLK_VCO_MULT 16
103
// DDR3 memory speed grade and density
104
`define
sg25 1
// `define sg15E 1
105
// `define sg187E 1
106
`define
den4096Mb 1
107
`define
MCLK_VCO_MULT 16
// `define MCLK_VCO_MULT 18
108
// `define MCLK_VCO_MULT 20
109
110
`define
MEMBRIDGE_DEBUG_WRITE 1
// Enviroment-dependent options
111
`ifdef
IVERILOG
112
`define
SIMULATION
113
`define
OPEN_SOURCE_ONLY
114
`endif
115
116
`ifdef
COCOTB
117
`define
SIMULATION
118
`define
OPEN_SOURCE_ONLY
119
`endif
120
121
`ifdef
CVC
122
`define
SIMULATION
123
`define
OPEN_SOURCE_ONLY
124
`endif
// CVC
125
126
// will not use simultaneous reset in shift registers, just and input data with ~rst
127
`define
SHREG_SEQUENTIAL_RESET 1
// synthesis does to recognize global clock as G input of the primitive latch
128
`undef
INFER_LATCHES
129
// define when using CDC - it does not support them
130
`undef
IGNORE_ATTR
131
//`define MEMBRIDGE_DEBUG_READ 1
132
`define
use200Mhz 1
`define
USE_CMD_ENCOD_TILED_32_RD 1
// chn 0 is read from memory and write to memory
133
`define
def_enable_mem_chn0
134
`define
def_read_mem_chn0
135
`define
def_write_mem_chn0
136
`undef
def_scanline_chn0
137
`undef
def_tiled_chn0
138
139
// chn 1 is scanline r+w
140
`define
def_enable_mem_chn1
141
`define
def_read_mem_chn1
142
`define
def_write_mem_chn1
143
`define
def_scanline_chn1
144
`undef
def_tiled_chn1
145
146
// chn 2 is tiled r+w
147
`define
def_enable_mem_chn2
148
`define
def_read_mem_chn2
149
`define
def_write_mem_chn2
150
`undef
def_scanline_chn2
151
`define
def_tiled_chn2
152
153
// chn 3 is scanline r+w (reuse later)
154
`define
def_enable_mem_chn3
155
`define
def_read_mem_chn3
156
`define
def_write_mem_chn3
157
`define
def_scanline_chn3
158
`undef
def_tiled_chn3
159
160
// chn 4 is tiled r+w (reuse later)
161
`define
def_enable_mem_chn4
162
`define
def_read_mem_chn4
163
`define
def_write_mem_chn4
164
`undef
def_scanline_chn4
165
`define
def_tiled_chn4
166
167
// chn 5 is disabled
168
`undef
def_enable_mem_chn5
169
170
// chn 6 is disabled
171
`undef
def_enable_mem_chn6
172
173
// chn 7 is disabled
174
`undef
def_enable_mem_chn7
175
176
// chn 8 is scanline w (sensor channel 0)
177
`define
def_enable_mem_chn8
178
`undef
def_read_mem_chn8
179
`define
def_write_mem_chn8
180
`define
def_scanline_chn8
181
`undef
def_tiled_chn8
182
183
// chn 9 is scanline w (sensor channel 1)
184
`define
def_enable_mem_chn9
185
`undef
def_read_mem_chn9
186
`define
def_write_mem_chn9
187
`define
def_scanline_chn9
188
`undef
def_tiled_chn9
189
190
// chn 10 is scanline w (sensor channel 2)
191
`define
def_enable_mem_chn10
192
`undef
def_read_mem_chn10
193
`define
def_write_mem_chn10
194
`define
def_scanline_chn10
195
`undef
def_tiled_chn10
196
197
// chn 11 is scanline w (sensor channel 3)
198
`define
def_enable_mem_chn11
199
`undef
def_read_mem_chn11
200
`define
def_write_mem_chn11
201
`define
def_scanline_chn11
202
`undef
def_tiled_chn11
203
204
// chn 12 is tiled read (compressor channel 0)
205
`define
def_enable_mem_chn12
206
`define
def_read_mem_chn12
207
`undef
def_write_mem_chn12
208
`undef
def_scanline_chn12
209
`define
def_tiled_chn12
210
211
// chn 12 is tiled read (compressor channel 1)
212
`define
def_enable_mem_chn13
213
`define
def_read_mem_chn13
214
`undef
def_write_mem_chn13
215
`undef
def_scanline_chn13
216
`define
def_tiled_chn13
217
218
// chn 12 is tiled read (compressor channel 2)
219
`define
def_enable_mem_chn14
220
`define
def_read_mem_chn14
221
`undef
def_write_mem_chn14
222
`undef
def_scanline_chn14
223
`define
def_tiled_chn14
224
225
// chn 12 is tiled read (compressor channel 3)
226
`define
def_enable_mem_chn15
227
`define
def_read_mem_chn15
228
`undef
def_write_mem_chn15
229
`undef
def_scanline_chn15
230
`define
def_tiled_chn15
231
`endif
232
233
// 01/22/2004 - extended flush until ready (modified stuffer.v too)
234
module
huffman393
(
235
input
xclk
,
// pixel clock, sync to incoming data
236
input
xclk2x
,
// twice frequency - uses negedge inside
237
input
en
,
// will reset if ==0 (sync to xclk)
238
239
input
mclk
,
// system clock to write tables
240
input
tser_we
,
// enable write to a table
241
input
tser_a_not_d
,
// address/not data distributed to submodules
242
input
[
7
:
0
]
tser_d
,
// byte-wide serialized tables address/data to submodules
243
244
input
[
15
:
0
]
di
,
// [15:0] specially RLL prepared 16-bit data (to FIFO) (sync to xclk)
245
input
ds
,
// di valid strobe (sync to xclk)
246
input
rdy
,
// receiver (bit stuffer) is ready to accept data
247
output
reg
[
15
:
0
]
do
,
// [15:0] output data
248
output
reg
[
3
:
0
]
dl
,
// [3:0] data length (4'h0 is 'h16)
249
output
reg
dv
,
// output data valid
250
output
reg
flush
,
// last block done - flush the rest bits
251
output
reg
last_block
,
252
output
reg
test_lbw
,
253
output
gotLastBlock
,
// last block done - flush the rest bits
254
input
clk_flush
,
// other clock to generate synchronized 1-cycle flush_clk output
255
output
flush_clk
,
// 1-cycle flush output @ clk_flush
256
output
fifo_or_full
// FIFO output register full - just for debuging
257
);
258
`ifdef
INFER_LATCHES
259
reg
[15:0]
hcode_latch;
// table output huffman code (1..16 bits)
260
reg
[
3:0]
hlen_latch;
// table - code length only 4 LSBs are used, so 0 means 16
261
reg
[
7:0]
haddr70_latch;
262
reg
haddr8_latch;
263
reg
tables_re_latch;
264
// reg stuffer_was_rdy_early_latch;
265
`else
266
wire
[
15
:
0
]
hcode_latch
;
// table output huffman code (1..16 bits)
267
wire
[
3
:
0
]
hlen_latch
;
// table - code length only 4 LSBs are used
268
wire
[
7
:
0
]
haddr70_latch
;
269
wire
haddr8_latch
;
270
wire
tables_re_latch
;
271
// wire stuffer_was_rdy_early_latch;
272
`endif
273
wire
[
31
:
0
]
tables_out
;
// Only [19:0] are used
274
reg
[
7
:
0
]
haddr_r
;
// index in huffman table
275
wire
[
7
:
0
]
haddr_next
;
276
277
wire
[
8
:
0
]
haddr
= {
haddr8_latch
,
haddr70_latch
};
// index in huffman table (after latches)
278
279
wire
[
15
:
0
]
fifo_o
;
280
reg
stuffer_was_rdy
;
281
wire
read_next
;
// assigned depending on steps (each other cycle for normal codes, each for special 00/F0
282
283
reg
[
5
:
0
]
steps
;
284
// first stage registers
285
reg
[
5
:
0
]
rll
;
// 2 MSBs - counter to send "f0" codes
286
287
// replacing SRL16 with FD as SRL has longer output delay from clock
288
reg
[
3
:
0
]
rll1
;
289
reg
[
3
:
0
]
rll2
;
290
reg
typeDC
;
291
reg
typeAC
;
292
reg
[
11
:
0
]
sval
;
// signed input value
293
294
wire
[
1
:
0
]
code_typ0
;
// valid at steps[0]
295
reg
tbsel_YC0
;
// valid at steps[0] - 0 -Y table, 1 - CbCr
296
reg
[
1
:
0
]
code_typ1
;
297
reg
[
1
:
0
]
code_typ2
;
298
reg
code_typ3
;
299
reg
code_typ4
;
300
reg
tbsel_YC1
;
301
reg
tbsel_YC2
;
302
reg
tbsel_YC3
;
303
304
reg
[
15
:
0
]
out_bits
;
// bits to send
305
reg
[
3
:
0
]
out_len
;
// length of bits to send (4'h0 means 16)
306
// wire fifo_or_full; // fifo output register full read_next
307
wire
will_read
;
308
wire
[
10
:
0
]
var_do
;
309
wire
[
3
:
0
]
var_dl
;
310
wire
[
3
:
0
]
var_dl_late
;
311
312
reg
dv0
;
313
314
reg
eob
;
315
wire
gotDC
;
316
wire
gotAC
;
317
wire
gotRLL
;
318
wire
gotEOB
;
319
wire
gotLastWord
;
320
wire
gotColor
;
321
322
wire
want_read
;
// as will_read, but w/o fifo status
323
reg
ready_to_flush
;
// read the last data from fifo
324
reg
en2x
;
// en sync to xclk2x;
325
326
327
wire
pre_dv
;
328
wire
[
15
:
0
]
pre_bits
;
329
wire
[
3
:
0
]
pre_len
;
330
331
// reg twe_d; // table write enable (twe) delayed by 1 clock
332
333
always
@ (
negedge
xclk2x
)
en2x
<=
en
;
334
335
assign
gotDC
=
fifo_o
[
15
] &&
fifo_o
[
14
];
336
assign
gotAC
=
fifo_o
[
15
] && !
fifo_o
[
14
];
337
assign
gotRLL
= !
fifo_o
[
15
] && !
fifo_o
[
12
];
338
assign
gotEOB
= !
fifo_o
[
15
] &&
fifo_o
[
12
];
339
assign
gotLastBlock
=
fifo_o
[
15
] &&
fifo_o
[
14
] &&
fifo_o
[
12
];
340
assign
gotLastWord
= !
fifo_o
[
14
] &&
fifo_o
[
12
];
// (AC or RLL) and last bit set
341
assign
gotColor
=
fifo_o
[
13
];
342
343
always
@(
negedge
xclk2x
)
stuffer_was_rdy
<= !
en2x
||
rdy
;
// stuffer ready shoud be on if !en (move to register?)for now]
344
// wire want_read_early;
345
346
347
348
assign
read_next
=
en2x
&& ((!
steps
[
0
] && !
rll
[
5
]) ||
eob
) &&
fifo_or_full
;
// fifo will never have data after the last block...
349
assign
will_read
=
stuffer_was_rdy
&&
fifo_or_full
&&
en2x
&& ((!
steps
[
0
] && !
rll
[
5
]) ||
eob
);
// fifo will never have data after the last block...
350
assign
want_read
=
stuffer_was_rdy
&& ((!
steps
[
0
] && !
rll
[
5
]) ||
eob
);
// for FIFO
351
// assign want_read_early= stuffer_was_rdy_early_latch && ((!steps[0] && !rll[5]) || eob ); // for FIFO
352
353
always
@ (
negedge
xclk2x
)
if
(
stuffer_was_rdy
)
begin
354
eob
<=
read_next
&&
gotEOB
;
// will be 1 only during step[0]
355
356
if
(!
en2x
)
steps
[
5
:
0
] <=
'b0
;
357
else
steps
[
5
:
0
] <= {
steps
[
4
] &&
code_typ4
,
// will be skipped for codes 00/F0
358
steps
[
3
:
0
],
359
(
read_next
&& !(
gotRLL
&& (
fifo_o
[
5
:
4
]==
2'b00
))) ||
rll
[
5
] };
// will not start if it was <16, waiting for AC
360
end
361
always
@ (
negedge
xclk2x
)
begin
362
// last_block <= en2x && (last_block?(!flush):(stuffer_was_rdy && will_read && gotLastBlock));
363
364
if
(!
en2x
||
flush
)
last_block
<=
0
;
365
else
if
(
stuffer_was_rdy
&&
will_read
&&
gotLastBlock
)
last_block
<=
1
;
366
367
ready_to_flush
<=
en2x
&& (
ready_to_flush
?(!
flush
):(
stuffer_was_rdy
&&
last_block
&&
will_read
&&
gotLastWord
));
368
test_lbw
<=
en2x
&&
last_block
&&
gotLastWord
;
369
// did not work if flush was just after not ready?
370
flush
<=
en2x
&&(
flush
?(!
rdy
):(
rdy
&&
stuffer_was_rdy
&&
ready_to_flush
&& !(|
steps
)) );
371
end
372
373
374
always
@ (
negedge
xclk2x
)
if
(
will_read
)
begin
375
typeDC
<=
gotDC
;
376
typeAC
<=
gotAC
;
377
sval
[
11
:
0
] <=
fifo_o
[
11
:
0
];
378
if
(
gotDC
)
tbsel_YC0
<=
gotColor
;
379
end
380
381
382
always
@ (
negedge
xclk2x
)
if
(
stuffer_was_rdy
)
begin
383
if
(!
en2x
|| (
read_next
&&
gotAC
) || (
steps
[
0
] &&
typeAC
))
rll
[
5
:
4
] <=
2'b0
;
384
else
if
(
read_next
&&
gotRLL
)
rll
[
5
:
4
] <=
fifo_o
[
5
:
4
];
385
else
if
(
rll
[
5
:
4
]!=
2'b00
)
rll
[
5
:
4
] <=
rll
[
5
:
4
]-
1
;
386
387
if
(!
en2x
|| (
read_next
&& !
gotAC
&& !
gotRLL
) || (
steps
[
0
] &&
typeAC
))
rll
[
3
:
0
] <=
4'b0
;
388
else
if
(
read_next
&&
gotRLL
)
rll
[
3
:
0
] <=
fifo_o
[
3
:
0
];
389
end
390
391
assign
code_typ0
={
typeDC
|| (!
eob
&& (
rll
[
5
:
4
]==
2'b0
)),
392
typeDC
|| (!
eob
&& (
rll
[
5
:
4
]!=
2'b0
))};
393
394
assign
haddr_next
[
7
:
0
] =
code_typ2
[
1
]?
395
(
code_typ2
[
0
]?{
var_dl
[
3
:
0
],
4'hf
}:
// DC (reusing the spare cells of the AC table)
396
{
rll2
[
3
:
0
],
var_dl
[
3
:
0
]}):
// AC normal code
397
(
code_typ2
[
0
]?
8'hf0
:
//skip 16 zeros code
398
8'h00
);
//skip to end of block code
399
400
always
@ (
negedge
xclk2x
)
if
(
stuffer_was_rdy
&&
steps
[
2
])
begin
// may be just if (stuffer_was_rdy)
401
haddr_r
[
7
:
0
] <=
haddr_next
[
7
:
0
];
402
end
403
404
405
assign
pre_dv
=
steps
[
4
] || (
steps
[
5
] && (
var_dl_late
[
3
:
0
]!=
4'b0
));
406
assign
pre_bits
[
15
:
0
] =
steps
[
5
]?{
5'b0
,
var_do
[
10
:
0
]}:
hcode_latch
[
15
:
0
];
407
assign
pre_len
[
3
:
0
] =
steps
[
5
]?
var_dl_late
[
3
:
0
]:
hlen_latch
[
3
:
0
];
408
409
`ifdef
INFER_LATCHES
410
always
@*
if
(~xclk2x)
hlen_latch
<=
tables_out[19:16];
411
always
@*
if
(~xclk2x)
hcode_latch
<=
tables_out[15:0];
412
// always @* if (xclk2x) stuffer_was_rdy_early_latch <= !en2x || rdy;
413
always
@*
if
(xclk2x)
tables_re_latch
<=
en2x
&&
rdy;
414
415
always
@*
if
(xclk2x)
begin
416
if
(stuffer_was_rdy)
haddr8_latch
<=
tbsel_YC2;
417
else
haddr8_latch
<=
tbsel_YC3;
418
end
419
420
always
@*
if
(xclk2x)
begin
421
if
(stuffer_was_rdy
&&
steps[2])
haddr70_latch
<=
haddr_next;
422
else
haddr70_latch
<=
haddr_r;
423
end
424
425
`else
426
latch_g_ce
#(
427
.
WIDTH
(
4
),
428
.
INIT
(
0
),
429
.
IS_CLR_INVERTED
(
0
),
430
.
IS_G_INVERTED
(
1
)
// inverted!
431
)
latch_hlen_i
(
432
.
rst
(
1'b0
),
// input
433
.
g
(
xclk2x
),
// input
434
.
ce
(
1'b1
),
// input
435
.
d_in
(
tables_out
[
19
:
16
]),
// input[0:0]
436
.
q_out
(
hlen_latch
)
// output[0:0]
437
);
438
439
latch_g_ce
#(
440
.
WIDTH
(
16
),
441
.
INIT
(
0
),
442
.
IS_CLR_INVERTED
(
0
),
443
.
IS_G_INVERTED
(
1
)
// inverted!
444
)
latch_hcode_i
(
445
.
rst
(
1'b0
),
// input
446
.
g
(
xclk2x
),
// input
447
.
ce
(
1'b1
),
// input
448
.
d_in
(
tables_out
[
15
:
0
]),
// input[0:0]
449
.
q_out
(
hcode_latch
)
// output[0:0]
450
);
451
/*
452
latch_g_ce #(
453
.WIDTH (1),
454
.INIT (0),
455
.IS_CLR_INVERTED (0),
456
.IS_G_INVERTED (0) // non-inverted!
457
) latch_stuffer_was_rdy_early_i (
458
.rst (1'b0), // input
459
.g (xclk2x), // input
460
.ce (1'b1), // input
461
.d_in (!en2x || rdy), // input[0:0]
462
.q_out (stuffer_was_rdy_early_latch) // output[0:0]
463
);
464
*/
465
latch_g_ce
#(
466
.
WIDTH
(
1
),
467
.
INIT
(
0
),
468
.
IS_CLR_INVERTED
(
0
),
469
.
IS_G_INVERTED
(
0
)
// non-inverted!
470
)
latch_tables_re_i
(
471
.
rst
(
1'b0
),
// input
472
.
g
(
xclk2x
),
// input
473
.
ce
(
1'b1
),
// input
474
.
d_in
(
en2x
&&
rdy
),
// input[0:0]
475
.
q_out
(
tables_re_latch
)
// output[0:0]
476
);
477
478
latch_g_ce
#(
479
.
WIDTH
(
1
),
480
.
INIT
(
0
),
481
.
IS_CLR_INVERTED
(
0
),
482
.
IS_G_INVERTED
(
0
)
// non-inverted!
483
)
latch_haddr8_re_i
(
484
.
rst
(
1'b0
),
// input
485
.
g
(
xclk2x
),
// input
486
.
ce
(
1'b1
),
// input
487
.
d_in
(
stuffer_was_rdy
?
tbsel_YC2
:
tbsel_YC3
),
// input[0:0]
488
.
q_out
(
haddr8_latch
)
// output[0:0]
489
);
490
491
latch_g_ce
#(
492
.
WIDTH
(
8
),
493
.
INIT
(
0
),
494
.
IS_CLR_INVERTED
(
0
),
495
.
IS_G_INVERTED
(
0
)
// non-inverted!
496
)
latch_haddr70_re_i
(
497
.
rst
(
1'b0
),
// input
498
.
g
(
xclk2x
),
// input
499
.
ce
(
1'b1
),
// input
500
.
d_in
((
stuffer_was_rdy
&&
steps
[
2
]) ?
haddr_next
:
haddr_r
),
// input[0:0]
501
.
q_out
(
haddr70_latch
)
// output[0:0]
502
);
503
`endif
504
505
506
always
@ (
negedge
xclk2x
)
if
(
stuffer_was_rdy
)
begin
507
dv0
<=
pre_dv
;
508
out_bits
[
15
:
0
] <=
pre_bits
[
15
:
0
];
509
out_len
[
3
:
0
] <=
pre_len
[
3
:
0
];
510
end
511
512
always
@ (
negedge
xclk2x
)
if
(!
en2x
||
rdy
)
begin
513
dv
<=
stuffer_was_rdy
?
pre_dv
:
dv0
;
514
do
[
15
:
0
] <=
stuffer_was_rdy
?
pre_bits
[
15
:
0
]:
out_bits
[
15
:
0
];
515
dl
[
3
:
0
] <=
stuffer_was_rdy
?
pre_len
[
3
:
0
]:
out_len
[
3
:
0
];
516
end
517
518
519
520
// "Extract shift registers" in synthesis should be off! FD has lower output delay than SRL16
521
always
@ (
negedge
xclk2x
)
if
(
stuffer_was_rdy
)
begin
522
code_typ1
[
1
:
0
] <=
code_typ0
[
1
:
0
];
523
code_typ2
[
1
:
0
] <=
code_typ1
[
1
:
0
];
524
code_typ3
<=
code_typ2
[
1
];
525
code_typ4
<=
code_typ3
;
526
rll1
[
3
:
0
] <=
rll
[
3
:
0
];
527
rll2
[
3
:
0
] <=
rll1
[
3
:
0
];
528
tbsel_YC1
<=
tbsel_YC0
;
529
tbsel_YC2
<=
tbsel_YC1
;
530
tbsel_YC3
<=
tbsel_YC2
;
531
end
532
533
534
wire
twe
;
535
wire
[
15
:
0
]
tdi
;
536
wire
[
22
:
0
]
ta
;
537
538
539
table_ad_receive
#(
540
.
MODE_16_BITS
(
1
),
541
.
NUM_CHN
(
1
)
542
)
table_ad_receive_i
(
543
.
clk
(
mclk
),
// input
544
.
a_not_d
(
tser_a_not_d
),
// input
545
.
ser_d
(
tser_d
),
// input[7:0]
546
.
dv
(
tser_we
),
// input
547
.
ta
(
ta
),
// output[22:0]
548
.
td
(
tdi
),
// output[15:0]
549
.
twe
(
twe
)
// output
550
);
551
552
553
554
huff_fifo393
i_huff_fifo
(
555
.
xclk
(
xclk
),
// input
556
.
xclk2x
(
xclk2x
),
// input
557
.
en
(
en
),
// input
558
.
di
(
di
[
15
:
0
]),
// input[15:0] data in (sync to xclk)
559
.
ds
(
ds
),
// input din valid (sync to xclk)
560
.
want_read
(
want_read
),
// input
561
// .want_read_early (want_read_early), // input
562
.
dav
(
fifo_or_full
),
// output reg FIFO output register has data
563
// .q_latch (fifo_o[15:0])); // output[15:0] reg data (will add extra buffering if needed)
564
.
q
(
fifo_o
[
15
:
0
]));
// output[15:0] reg data (will add extra buffering if needed)
565
566
varlen_encode393
i_varlen_encode
(
567
.
clk
(
xclk2x
),
// input
568
.
en
(
stuffer_was_rdy
),
// input will enable registers. 0 - freeze
569
.
start
(
steps
[
0
]),
// input
570
.
d
(
sval
[
11
:
0
]),
// input[11:0] 12-bit signed
571
.
l
(
var_dl
[
3
:
0
]),
// output[3:0] reg code length
572
.
l_late
(
var_dl_late
[
3
:
0
]),
// output[3:0] reg
573
.
q
(
var_do
[
10
:
0
]));
// output[10:0] reg code
574
575
// always @ (negedge xclk2x) twe_d <= twe;
576
// always @ (posedge sclk) twe_d <= twe;
577
/*
578
RAMB16_S18_S36 i_htab (
579
.DOA(), // Port A 16-bit Data Output
580
.DOPA(), // Port A 2-bit Parity Output
581
.ADDRA({ta[8:0],twe_d}), // Port A 10-bit Address Input
582
.CLKA(!xclk2x), // Port A Clock
583
.DIA(tdi[15:0]), // Port A 16-bit Data Input
584
.DIPA(2'b0), // Port A 2-bit parity Input
585
.ENA(1'b1), // Port A RAM Enable Input
586
.SSRA(1'b0), // Port A Synchronous Set/Reset Input
587
.WEA(twe | twe_d),// Port A Write Enable Input
588
589
.DOB({unused[11:0],tables_out[19:0]}), // Port B 32-bit Data Output
590
.DOPB(), // Port B 4-bit Parity Output
591
.ADDRB(haddr[8:0]), // Port B 9-bit Address Input
592
.CLKB(xclk2x), // Port B Clock
593
.DIB(32'b0), // Port B 32-bit Data Input
594
.DIPB(4'b0), // Port-B 4-bit parity Input
595
.ENB(tables_re_latch), // PortB RAM Enable Input
596
.SSRB(1'b0), // Port B Synchronous Set/Reset Input
597
.WEB(1'b0) // Port B Write Enable Input
598
);
599
*/
600
601
ram18_var_w_var_r
#(
602
.
REGISTERS
(
0
),
603
.
LOG2WIDTH_WR
(
4
),
604
.
LOG2WIDTH_RD
(
5
),
605
.
DUMMY
(
0
)
606
`ifdef
PRELOAD_BRAMS, .INIT_00 (
256'h000800F8000700780005001A0004000B0003000400020001000200000004000A
)
607
, .
INIT_01
(
256'h00020000000000000000000000000000000000000010FF830010FF82000A03F6
)
608
, .
INIT_02
(
256'h0010FF850010FF84000B07F6000901F6000700790005001B0004000C00000000
)
609
, .
INIT_03
(
256'h00030002000000000000000000000000000000000010FF880010FF870010FF86
)
610
, .
INIT_04
(
256'h0010FF8B0010FF8A0010FF89000C0FF4000A03F7000800F90005001C00000000
)
611
, .
INIT_05
(
256'h00030003000000000000000000000000000000000010FF8E0010FF8D0010FF8C
)
612
, .
INIT_06
(
256'h0010FF920010FF910010FF900010FF8F000C0FF5000901F70006003A00000000
)
613
, .
INIT_07
(
256'h00030004000000000000000000000000000000000010FF950010FF940010FF93
)
614
, .
INIT_08
(
256'h0010FF9A0010FF990010FF980010FF970010FF96000A03F80006003B00000000
)
615
, .
INIT_09
(
256'h00030005000000000000000000000000000000000010FF9D0010FF9C0010FF9B
)
616
, .
INIT_0A
(
256'h0010FFA20010FFA10010FFA00010FF9F0010FF9E000B07F70007007A00000000
)
617
, .
INIT_0B
(
256'h00030006000000000000000000000000000000000010FFA50010FFA40010FFA3
)
618
, .
INIT_0C
(
256'h0010FFAA0010FFA90010FFA80010FFA70010FFA6000C0FF60007007B00000000
)
619
, .
INIT_0D
(
256'h0004000E000000000000000000000000000000000010FFAD0010FFAC0010FFAB
)
620
, .
INIT_0E
(
256'h0010FFB20010FFB10010FFB00010FFAF0010FFAE000C0FF7000800FA00000000
)
621
, .
INIT_0F
(
256'h0005001E000000000000000000000000000000000010FFB50010FFB40010FFB3
)
622
, .
INIT_10
(
256'h0010FFBA0010FFB90010FFB80010FFB70010FFB6000F7FC0000901F800000000
)
623
, .
INIT_11
(
256'h0006003E000000000000000000000000000000000010FFBD0010FFBC0010FFBB
)
624
, .
INIT_12
(
256'h0010FFC30010FFC20010FFC10010FFC00010FFBF0010FFBE000901F900000000
)
625
, .
INIT_13
(
256'h0007007E000000000000000000000000000000000010FFC60010FFC50010FFC4
)
626
, .
INIT_14
(
256'h0010FFCC0010FFCB0010FFCA0010FFC90010FFC80010FFC7000901FA00000000
)
627
, .
INIT_15
(
256'h000800FE000000000000000000000000000000000010FFCF0010FFCE0010FFCD
)
628
, .
INIT_16
(
256'h0010FFD50010FFD40010FFD30010FFD20010FFD10010FFD0000A03F900000000
)
629
, .
INIT_17
(
256'h000901FE000000000000000000000000000000000010FFD80010FFD70010FFD6
)
630
, .
INIT_18
(
256'h0010FFDE0010FFDD0010FFDC0010FFDB0010FFDA0010FFD9000A03FA00000000
)
631
, .
INIT_19
(
256'h00000000000000000000000000000000000000000010FFE10010FFE00010FFDF
)
632
, .
INIT_1A
(
256'h0010FFE70010FFE60010FFE50010FFE40010FFE30010FFE2000B07F800000000
)
633
, .
INIT_1B
(
256'h00000000000000000000000000000000000000000010FFEA0010FFE90010FFE8
)
634
, .
INIT_1C
(
256'h0010FFF10010FFF00010FFEF0010FFEE0010FFED0010FFEC0010FFEB00000000
)
635
, .
INIT_1D
(
256'h00000000000000000000000000000000000000000010FFF40010FFF30010FFF2
)
636
, .
INIT_1E
(
256'h0010FFFB0010FFFA0010FFF90010FFF80010FFF70010FFF60010FFF5000B07F9
)
637
, .
INIT_1F
(
256'h00000000000000000000000000000000000000000010FFFE0010FFFD0010FFFC
)
638
, .
INIT_20
(
256'h000700780006003800050019000500180004000A000300040002000100020000
)
639
, .
INIT_21
(
256'h0002000000000000000000000000000000000000000C0FF4000A03F6000901F4
)
640
, .
INIT_22
(
256'h0010FF88000C0FF5000B07F6000901F5000800F6000600390004000B00000000
)
641
, .
INIT_23
(
256'h00020001000000000000000000000000000000000010FF8B0010FF8A0010FF89
)
642
, .
INIT_24
(
256'h0010FF8D0010FF8C000F7FC2000C0FF6000A03F7000800F70005001A00000000
)
643
, .
INIT_25
(
256'h00020002000000000000000000000000000000000010FF900010FF8F0010FF8E
)
644
, .
INIT_26
(
256'h0010FF930010FF920010FF91000C0FF7000A03F8000800F80005001B00000000
)
645
, .
INIT_27
(
256'h00030006000000000000000000000000000000000010FF960010FF950010FF94
)
646
, .
INIT_28
(
256'h0010FF9B0010FF9A0010FF990010FF980010FF97000901F60006003A00000000
)
647
, .
INIT_29
(
256'h0004000E000000000000000000000000000000000010FF9E0010FF9D0010FF9C
)
648
, .
INIT_2A
(
256'h0010FFA30010FFA20010FFA10010FFA00010FF9F000A03F90006003B00000000
)
649
, .
INIT_2B
(
256'h0005001E000000000000000000000000000000000010FFA60010FFA50010FFA4
)
650
, .
INIT_2C
(
256'h0010FFAB0010FFAA0010FFA90010FFA80010FFA7000B07F70007007900000000
)
651
, .
INIT_2D
(
256'h0006003E000000000000000000000000000000000010FFAE0010FFAD0010FFAC
)
652
, .
INIT_2E
(
256'h0010FFB30010FFB20010FFB10010FFB00010FFAF000B07F80007007A00000000
)
653
, .
INIT_2F
(
256'h0007007E000000000000000000000000000000000010FFB60010FFB50010FFB4
)
654
, .
INIT_30
(
256'h0010FFBC0010FFBB0010FFBA0010FFB90010FFB80010FFB7000800F900000000
)
655
, .
INIT_31
(
256'h000800FE000000000000000000000000000000000010FFBF0010FFBE0010FFBD
)
656
, .
INIT_32
(
256'h0010FFC50010FFC40010FFC30010FFC20010FFC10010FFC0000901F700000000
)
657
, .
INIT_33
(
256'h000901FE000000000000000000000000000000000010FFC80010FFC70010FFC6
)
658
, .
INIT_34
(
256'h0010FFCE0010FFCD0010FFCC0010FFCB0010FFCA0010FFC9000901F800000000
)
659
, .
INIT_35
(
256'h000A03FE000000000000000000000000000000000010FFD10010FFD00010FFCF
)
660
, .
INIT_36
(
256'h0010FFD70010FFD60010FFD50010FFD40010FFD30010FFD2000901F900000000
)
661
, .
INIT_37
(
256'h000B07FE000000000000000000000000000000000010FFDA0010FFD90010FFD8
)
662
, .
INIT_38
(
256'h0010FFE00010FFDF0010FFDE0010FFDD0010FFDC0010FFDB000901FA00000000
)
663
, .
INIT_39
(
256'h00000000000000000000000000000000000000000010FFE30010FFE20010FFE1
)
664
, .
INIT_3A
(
256'h0010FFE90010FFE80010FFE70010FFE60010FFE50010FFE4000B07F900000000
)
665
, .
INIT_3B
(
256'h00000000000000000000000000000000000000000010FFEC0010FFEB0010FFEA
)
666
, .
INIT_3C
(
256'h0010FFF20010FFF10010FFF00010FFEF0010FFEE0010FFED000E3FE000000000
)
667
, .
INIT_3D
(
256'h00000000000000000000000000000000000000000010FFF50010FFF40010FFF3
)
668
, .
INIT_3E
(
256'h0010FFFB0010FFFA0010FFF90010FFF80010FFF70010FFF6000F7FC3000A03FA
)
669
, .
INIT_3F
(
256'h00000000000000000000000000000000000000000010FFFE0010FFFD0010FFFC
)
670
671
`endif
672
)
i_htab
(
673
.
rclk
(
xclk2x
),
// input
674
.
raddr
(
haddr
[
8
:
0
]),
// input[8:0]
675
.
ren
(
tables_re_latch
),
// input
676
.
regen
(
1'b1
),
// input
677
// .data_out({unused[11:0],tables_out[19:0]}), // output[31:0]
678
.
data_out
(
tables_out
),
// output[31:0]
679
.
wclk
(
mclk
),
// input
680
// .waddr({ta[8:0],twe_d}), // input[9:0]
681
// .we(twe | twe_d), // input
682
.
waddr
(
ta
[
9
:
0
]),
// input[9:0]
683
.
we
(
twe
),
// input
684
.
web
(
4'hf
),
// input[3:0]
685
.
data_in
(
tdi
[
15
:
0
])
// input[15:0]
686
);
687
688
pulse_cross_clock
flush_clk_i
(
689
.
rst
(!
en2x
),
690
.
src_clk
(~
xclk2x
),
691
.
dst_clk
(
clk_flush
),
692
.
in_pulse
(
flush
),
693
.
out_pulse
(
flush_clk
),
694
.
busy
());
695
696
endmodule
697
698
ram18_var_w_var_r.11591regen
11591regen
Definition:
ram18_var_w_var_r.v:114
latch_g_ce.11311d_in
[WIDTH-1: 0 ] 11311d_in
Definition:
latch_g_ce.v:51
huffman393.2522pre_bits
2522pre_bitswire[15:0]
Definition:
huffman393.v:129
huffman393.2498code_typ2
2498code_typ2reg[1:0]
Definition:
huffman393.v:98
huff_fifo393.2442q
reg [15:0] 2442q
Definition:
huff_fifo393.v:48
huffman393.2465rdy
2465rdy
Definition:
huffman393.v:54
pulse_cross_clock.10722rst
10722rst
Definition:
pulse_cross_clock.v:46
latch_g_ce.11310ce
11310ce
Definition:
latch_g_ce.v:50
huffman393.2500code_typ4
2500code_typ4reg
Definition:
huffman393.v:100
huffman393.2462tser_d
[ 7:0] 2462tser_d
Definition:
huffman393.v:50
huffman393.2479haddr8_latch
2479haddr8_latchwire
Definition:
huffman393.v:70
huffman393.2470last_block
reg 2470last_block
Definition:
huffman393.v:59
huffman393.2496tbsel_YC0
2496tbsel_YC0reg
Definition:
huffman393.v:96
pulse_cross_clock.10724dst_clk
10724dst_clk
Definition:
pulse_cross_clock.v:48
table_ad_receive.11054twe
[NUM_CHN-1:0] 11054twe
Definition:
table_ad_receive.v:51
huffman393.2504out_bits
2504out_bitsreg[15:0]
Definition:
huffman393.v:105
huffman393.2512gotDC
2512gotDCwire
Definition:
huffman393.v:116
latch_g_ce.11312q_out
[WIDTH-1: 0 ] 11312q_out
Definition:
latch_g_ce.v:52
pulse_cross_clock.10727busy
10727busy
Definition:
pulse_cross_clock.v:51
huffman393.2480tables_re_latch
2480tables_re_latchwire
Definition:
huffman393.v:71
huffman393.2456xclk
2456xclk
Definition:
huffman393.v:43
table_ad_receive.11049a_not_d
11049a_not_d
Definition:
table_ad_receive.v:46
huffman393.2511eob
2511eobreg
Definition:
huffman393.v:115
huffman393.2476hcode_latch
2476hcode_latchwire[15:0]
Definition:
huffman393.v:67
huffman393.2519ready_to_flush
2519ready_to_flushreg
Definition:
huffman393.v:124
huff_fifo393.2436xclk2x
2436xclk2x
Definition:
huff_fifo393.v:42
ram18_var_w_var_r.11597data_in
[1 << LOG2WIDTH_WR-1:0] 11597data_in
Definition:
ram18_var_w_var_r.v:121
huffman393.2478haddr70_latch
2478haddr70_latchwire[7:0]
Definition:
huffman393.v:69
huff_fifo393.2440want_read
2440want_read
Definition:
huff_fifo393.v:46
huffman393.2510dv0
2510dv0reg
Definition:
huffman393.v:113
huff_fifo393.2439ds
2439ds
Definition:
huff_fifo393.v:45
huffman393.2508var_dl
2508var_dlwire[3:0]
Definition:
huffman393.v:110
ram18_var_w_var_r.11592data_out
[1 << LOG2WIDTH_RD-1:0] 11592data_out
Definition:
ram18_var_w_var_r.v:115
huffman393.2514gotRLL
2514gotRLLwire
Definition:
huffman393.v:118
huffman393.latch_g_ce
latch_haddr70_re_i latch_g_ce
Definition:
huffman393.v:279
huffman393.2521pre_dv
2521pre_dvwire
Definition:
huffman393.v:128
huffman393.2481tables_out
2481tables_outwire[31:0]
Definition:
huffman393.v:74
huffman393.2520en2x
2520en2xreg
Definition:
huffman393.v:125
huffman393.2491rll2
2491rll2reg[3:0]
Definition:
huffman393.v:90
huffman393.2472gotLastBlock
2472gotLastBlock
Definition:
huffman393.v:61
pulse_cross_clock.10725in_pulse
10725in_pulse
Definition:
pulse_cross_clock.v:49
ram18_var_w_var_r.11589raddr
[13-LOG2WIDTH_RD:0] 11589raddr
Definition:
ram18_var_w_var_r.v:112
huffman393.2459mclk
2459mclk
Definition:
huffman393.v:47
huffman393.2475fifo_or_full
2475fifo_or_full
Definition:
huffman393.v:64
huffman393.2499code_typ3
2499code_typ3reg
Definition:
huffman393.v:99
huffman393.2457xclk2x
2457xclk2x
Definition:
huffman393.v:44
huffman393.2469flush
reg 2469flush
Definition:
huffman393.v:58
huffman393.2477hlen_latch
2477hlen_latchwire[3:0]
Definition:
huffman393.v:68
huffman393.2460tser_we
2460tser_we
Definition:
huffman393.v:48
huffman393.table_ad_receive
table_ad_receive_i table_ad_receive
Definition:
huffman393.v:327
huffman393.2494sval
2494svalreg[11:0]
Definition:
huffman393.v:93
table_ad_receive.11053td
[MODE_16_BITS?15:7:0] 11053td
Definition:
table_ad_receive.v:50
varlen_encode393.3094start
3094start
Definition:
varlen_encode393.v:49
varlen_encode393.3093en
3093en
Definition:
varlen_encode393.v:48
ram18_var_w_var_r.11588rclk
11588rclk
Definition:
ram18_var_w_var_r.v:110
ram18_var_w_var_r.11596web
[ 3:0] 11596web
Definition:
ram18_var_w_var_r.v:120
pulse_cross_clock.10723src_clk
10723src_clk
Definition:
pulse_cross_clock.v:47
huffman393.2482haddr_r
2482haddr_rreg[7:0]
Definition:
huffman393.v:75
table_ad_receive.11050ser_d
[7:0] 11050ser_d
Definition:
table_ad_receive.v:47
huffman393.2483haddr_next
2483haddr_nextwire[7:0]
Definition:
huffman393.v:76
huffman393.2473clk_flush
2473clk_flush
Definition:
huffman393.v:62
huffman393.2490rll1
2490rll1reg[3:0]
Definition:
huffman393.v:89
huffman393.2467dl
reg [ 3:0] 2467dl
Definition:
huffman393.v:56
huffman393.2524twe
2524twe
Definition:
huffman393.v:322
huffman393.2506will_read
2506will_readwire
Definition:
huffman393.v:108
huffman393.2487read_next
2487read_nextwire
Definition:
huffman393.v:82
huffman393.2492typeDC
2492typeDCreg
Definition:
huffman393.v:91
huffman393.ram18_var_w_var_r
i_htab ram18_var_w_var_r
Definition:
huffman393.v:389
huffman393.2509var_dl_late
2509var_dl_latewire[3:0]
Definition:
huffman393.v:111
huffman393.2526ta
2526tawire[22:0]
Definition:
huffman393.v:324
huffman393.2523pre_len
2523pre_lenwire[3:0]
Definition:
huffman393.v:130
ram18_var_w_var_r.11590ren
11590ren
Definition:
ram18_var_w_var_r.v:113
huffman393.2513gotAC
2513gotACwire
Definition:
huffman393.v:117
pulse_cross_clock.10726out_pulse
10726out_pulse
Definition:
pulse_cross_clock.v:50
huff_fifo393.2438di
[15:0] 2438di
Definition:
huff_fifo393.v:44
ram18_var_w_var_r.11595we
11595we
Definition:
ram18_var_w_var_r.v:119
huffman393.2505out_len
2505out_lenreg[3:0]
Definition:
huffman393.v:106
latch_g_ce.11309g
11309g
Definition:
latch_g_ce.v:49
huffman393.2484haddr
2484haddrwire[8:0]
Definition:
huffman393.v:78
huffman393.2466do
reg [15:0] 2466do
Definition:
huffman393.v:55
huffman393.2489rll
2489rllreg[5:0]
Definition:
huffman393.v:86
huffman393.2493typeAC
2493typeACreg
Definition:
huffman393.v:92
huffman393.2461tser_a_not_d
2461tser_a_not_d
Definition:
huffman393.v:49
latch_g_ce.11308rst
11308rst
Definition:
latch_g_ce.v:48
huffman393.2486stuffer_was_rdy
2486stuffer_was_rdyreg
Definition:
huffman393.v:81
huffman393
Definition:
huffman393.v:42
huffman393.2488steps
2488stepsreg[5:0]
Definition:
huffman393.v:84
huffman393.2485fifo_o
2485fifo_owire[15:0]
Definition:
huffman393.v:80
table_ad_receive.11052ta
[23-MODE_16_BITS:0] 11052ta
Definition:
table_ad_receive.v:49
huffman393.2471test_lbw
reg 2471test_lbw
Definition:
huffman393.v:60
ram18_var_w_var_r.11594waddr
[13-LOG2WIDTH_WR:0] 11594waddr
Definition:
ram18_var_w_var_r.v:118
huffman393.pulse_cross_clock
flush_clk_i pulse_cross_clock
Definition:
huffman393.v:413
huffman393.2474flush_clk
2474flush_clk
Definition:
huffman393.v:63
huffman393.2507var_do
2507var_dowire[10:0]
Definition:
huffman393.v:109
varlen_encode393.3092clk
3092clk
Definition:
varlen_encode393.v:47
huffman393.2463di
[15:0] 2463di
Definition:
huffman393.v:52
huffman393.2495code_typ0
2495code_typ0wire[1:0]
Definition:
huffman393.v:95
huffman393.2516gotLastWord
2516gotLastWordwire
Definition:
huffman393.v:120
huffman393.huff_fifo393
i_huff_fifo huff_fifo393
Definition:
huffman393.v:342
huffman393.2503tbsel_YC3
2503tbsel_YC3reg
Definition:
huffman393.v:103
huffman393.2502tbsel_YC2
2502tbsel_YC2reg
Definition:
huffman393.v:102
varlen_encode393.3096l
reg [3:0] 3096l
Definition:
varlen_encode393.v:51
huff_fifo393.2435xclk
2435xclk
Definition:
huff_fifo393.v:41
huff_fifo393.2441dav
2441dav
Definition:
huff_fifo393.v:47
huff_fifo393.2437en
2437en
Definition:
huff_fifo393.v:43
varlen_encode393.3095d
[11:0] 3095d
Definition:
varlen_encode393.v:50
huffman393.2458en
2458en
Definition:
huffman393.v:45
huffman393.2464ds
2464ds
Definition:
huffman393.v:53
huffman393.2518want_read
2518want_readwire
Definition:
huffman393.v:123
huffman393.2501tbsel_YC1
2501tbsel_YC1reg
Definition:
huffman393.v:101
table_ad_receive.11051dv
[NUM_CHN-1:0] 11051dv
Definition:
table_ad_receive.v:48
huffman393.2515gotEOB
2515gotEOBwire
Definition:
huffman393.v:119
table_ad_receive.11048clk
11048clk
Definition:
table_ad_receive.v:45
varlen_encode393.3098q
reg [10:0] 3098q
Definition:
varlen_encode393.v:53
huffman393.2525tdi
2525tdiwire[15:0]
Definition:
huffman393.v:323
ram18_var_w_var_r.11593wclk
11593wclk
Definition:
ram18_var_w_var_r.v:117
huffman393.2468dv
reg 2468dv
Definition:
huffman393.v:57
huffman393.varlen_encode393
i_varlen_encode varlen_encode393
Definition:
huffman393.v:354
huffman393.2497code_typ1
2497code_typ1reg[1:0]
Definition:
huffman393.v:97
huffman393.2517gotColor
2517gotColorwire
Definition:
huffman393.v:121
varlen_encode393.3097l_late
reg [3:0] 3097l_late
Definition:
varlen_encode393.v:52
compressor_jp
huffman393.v
Generated by
1.8.12