blob: 5f96fe344597b659629e09faef000b960a46650b (
plain) (
blame)
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
|
#pragma once
#include <cstdint>
#include "infra/pipetrace.h"
struct inst {
infra::transaction transaction;
unsigned int generation;
unsigned int size = 0;
std::uint64_t init_pc = 0;
std::uint64_t linear_next_pc;
std::optional<std::uint64_t> predicted_next_pc;
std::uint64_t field[4] = {};
std::optional<std::uint64_t> result;
};
constexpr unsigned int OPCODE = 0;
constexpr unsigned int FLAGS_DST = 1;
constexpr unsigned int SRC1 = 2;
constexpr unsigned int SRC2 = 3;
constexpr std::uint64_t FLAG_IMM1 = 1 << 4;
constexpr std::uint64_t FLAG_IMM2 = 1 << 5;
enum {
OP_JUMP_ABS_IF_ZERO,
OP_JUMP_ABS_IF_NONZERO,
OP_EMIT,
OP_ADD,
OP_LOAD,
OP_STORE,
};
struct decodebyte {
std::uint8_t bits:4;
std::uint8_t field:2;
std::uint8_t invert:1;
std::uint8_t hold:1;
} __attribute__((packed));
// 0x - shift opcode and issue
// 1x - shift flagsdst and issue
// 2x - shift src1 and issue
// 3x - shift src2 and issue
// 4x - invert+shift opcode and issue
// 5x - invert+shift flagsdst and issue
// 6x - invert+shift src1 and issue
// 7x - invert+shift src2 and issue
// 8x - shift opcode
// 9x - shift flagsdst
// Ax - shift src1
// Bx - shift src2
// Cx - invert+shift opcode
// Dx - invert+shift flagsdst
// Ex - invert+shift src1
// Fx - invert+shift src2
|