source: icGREP/icgrep-devel/icgrep/kernels/hex_convert.h @ 6135

Last change on this file since 6135 was 6050, checked in by cameron, 10 months ago

IDISA testing

File size: 1.4 KB
Line 
1/*
2 *  Copyright (c) 2018 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5#ifndef HEX_CONVERT_H
6#define HEX_CONVERT_H
7
8#include <kernels/kernel.h>
9#include <kernels/kernel_builder.h>
10#include <kernels/interface.h>
11#include <kernels/streamset.h>
12#include <llvm/IR/Value.h>
13
14namespace kernel {
15//
16// Convert a byte stream of hexadecimal values into a bit stream.
17// Each hexadecimal input byte generates 4 bits to the output stream.
18//
19
20class HexToBinary final : public kernel::BlockOrientedKernel {
21public:
22    HexToBinary(const std::unique_ptr<kernel::KernelBuilder> & b);
23    bool isCachable() const override { return true; }
24    bool hasSignature() const override { return false; }
25protected:
26    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & b) override;
27};
28
29//
30// Produce a hexadecimal output stream with one hexadecimal byte
31// for each 4 bits of an input bit stream.
32//
33
34class BinaryToHex final : public kernel::BlockOrientedKernel {
35public:
36    BinaryToHex(const std::unique_ptr<kernel::KernelBuilder> & b);
37    bool isCachable() const override { return true; }
38    bool hasSignature() const override { return false; }
39protected:
40    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & b) override;
41    void generateFinalBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & b, llvm::Value * const remainingBits) override;
42};
43}
44#endif
Note: See TracBrowser for help on using the repository browser.