#pragma once #include #include "infra/pipetrace.h" struct inst { infra::transaction transaction; unsigned int generation; unsigned int size = 0; std::uint64_t linear_next_pc; std::optional predicted_next_pc; std::uint64_t field[4] = {}; std::optional 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