/
lz4_compress_mm.hpp
79 lines (73 loc) · 2.31 KB
/
lz4_compress_mm.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* (c) Copyright 2019 Xilinx, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _XFCOMPRESSION_LZ4_COMPRESS_KERNEL_HPP_
#define _XFCOMPRESSION_LZ4_COMPRESS_KERNEL_HPP_
/**
* @file lz4_compress_kernel.hpp
* @brief Header for LZ4 compression kernel.
*
* This file is part of Vitis Data Compression Library.
*/
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include "hls_stream.h"
#include <ap_int.h>
#include "lz_compress.hpp"
#include "lz_optional.hpp"
#include "mm2s.hpp"
#include "s2mm.hpp"
#include "stream_downsizer.hpp"
#include "stream_upsizer.hpp"
#include "lz4_compress.hpp"
#define MIN_BLOCK_SIZE 128
#define GMEM_DWIDTH 512
#define GMEM_BURST_SIZE 16
#define BIT 8
#define MIN_OFFSET 1
#define MIN_MATCH 4
#define LZ_MAX_OFFSET_LIMIT 65536
#define LZ_HASH_BIT 12
#define LZ_DICT_SIZE (1 << LZ_HASH_BIT)
#define MAX_MATCH_LEN 255
#define OFFSET_WINDOW (64 * 1024)
#define BOOSTER_OFFSET_WINDOW (16 * 1024)
#define MATCH_LEN 6
#define MATCH_LEVEL 6
#define MAX_LIT_COUNT 4096
#define PARALLEL_BLOCK 8
// Kernel top functions
extern "C" {
/**
* @brief LZ4 compression kernel takes the raw data as input and compresses the data
* in block based fashion and writes the output to global memory.
*
* @param in input raw data
* @param out output compressed data
* @param compressd_size compressed output size of each block
* @param in_block_size input block size of each block
* @param block_size_in_kb input block size in bytes
* @param input_size input data size
*/
void xilLz4Compress(const xf::compression::uintMemWidth_t* in,
xf::compression::uintMemWidth_t* out,
uint32_t* compressd_size,
uint32_t* in_block_size,
uint32_t block_size_in_kb,
uint32_t input_size);
}
#endif