source: icGREP/icgrep-devel/icgrep/kernels/lz4/lz4_generate_deposit_stream.cpp @ 5864

Last change on this file since 5864 was 5864, checked in by xwa163, 15 months ago

Add LZ4D extract deposit related kernel, target and test cases

File size: 1.2 KB
Line 
1//
2// Created by wxy325 on 2017/7/10.
3//
4
5#include <pablo/builder.hpp>
6#include "lz4_generate_deposit_stream.h"
7#include <kernels/kernel_builder.h>
8
9using namespace llvm;
10using namespace kernel;
11using namespace std;
12using namespace pablo;
13
14namespace kernel {
15    void LZ4GenerateDepositStreamKernel::generatePabloMethod() {
16        PabloBuilder pb(getEntryScope());
17
18        Var* m0Marker = getInputStreamVar("m0");
19        PabloAST* v = pb.createExtract(m0Marker, 0);
20
21        Var* dMarker = getOutputStreamVar("deposit");
22
23        // d_marker = ~(M0_marker | pablo.Advance(M0_marker))
24        PabloAST* value = pb.createAdvance(v, 1);
25        value = pb.createOr(v, value);
26        value = pb.createNot(value);
27
28        pb.createAssign(pb.createExtract(dMarker, 0), value);
29    }
30
31    LZ4GenerateDepositStreamKernel::LZ4GenerateDepositStreamKernel (const std::unique_ptr<kernel::KernelBuilder> & b)
32            :
33            PabloKernel(
34                    b,
35                    "lz4_genereate_deposit_stream_kernel",
36                    {// Stream Input
37                            {b->getStreamSetTy(1), "m0"}
38                    },
39                    {// Stream Output
40                            {b->getStreamSetTy(1), "deposit"}
41                    }){
42
43    }
44}
Note: See TracBrowser for help on using the repository browser.