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
#ifndef ULMDOC0_INSTRFMT_HPP
#define ULMDOC0_INSTRFMT_HPP

#include <cstddef>
#include <string>
#include <vector>

#include "expr.hpp"

namespace ulmdoc {

class InstrFmt
{
  public:
    InstrFmt(std::vector<ExprWrapper> fmtField);

    std::string tikz(std::size_t opCode);

  private:
    std::string tikzHeader() const;
    std::string tikzFooter() const;
    std::string tikzCell(std::size_t numBits, std::size_t offset,
                         std::string label, bool used = true) const;
    std::string tikzCellOffset(std::size_t offset) const;

    std::vector<std::string> sym;
    std::vector<std::size_t> size, offset;
    std::vector<Expr::BitPatternType> type;

    double scale = 0.4;
};

} // namespace ulmdoc

#endif // ULMDOC0_INSTRFMT_HPP