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

Last change on this file was 6184, checked in by nmedfort, 9 months ago

Initial version of PipelineKernel? + revised StreamSet? model.

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
10namespace kernel {
11//
12// Convert a byte stream of hexadecimal values into a bit stream.
13// Each hexadecimal input byte generates 4 bits to the output stream.
14//
15
16class HexToBinary final : public kernel::BlockOrientedKernel {
17public:
18    HexToBinary(const std::unique_ptr<kernel::KernelBuilder> & b, StreamSet * hexStream, StreamSet * binStream);
19    bool isCachable() const override { return true; }
20    bool hasSignature() const override { return false; }
21protected:
22    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & b) override;
23};
24
25//
26// Produce a hexadecimal output stream with one hexadecimal byte
27// for each 4 bits of an input bit stream.
28//
29
30class BinaryToHex final : public kernel::BlockOrientedKernel {
31public:
32    BinaryToHex(const std::unique_ptr<kernel::KernelBuilder> & b, StreamSet * binStream, StreamSet * hexStream);
33    bool isCachable() const override { return true; }
34    bool hasSignature() const override { return false; }
35protected:
36    void generateDoBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & b) override;
37    void generateFinalBlockMethod(const std::unique_ptr<kernel::KernelBuilder> & b, llvm::Value * const remainingBits) override;
38};
39
40}
41#endif
Note: See TracBrowser for help on using the repository browser.