215 const auto bytecode_length = bytecode.size();
217 if (pos >= bytecode_length) {
218 vinfo(
"PC is out of range. Position: ", pos,
" Bytecode length: ", bytecode_length);
222 const uint8_t opcode_byte = bytecode[pos];
224 if (!is_wire_opcode_valid(opcode_byte)) {
225 vinfo(
"Invalid wire opcode byte: 0x",
to_hex(opcode_byte),
" at position: ", pos);
229 const auto opcode =
static_cast<WireOpCode>(opcode_byte);
232 const auto& inst_format = iter->second;
238 if (pos + instruction_size > bytecode_length) {
239 vinfo(
"Instruction does not fit in remaining bytecode. Wire opcode: ",
243 " instruction size: ",
245 " bytecode length: ",
252 uint16_t indirect = 0;
256 assert(pos + operand_size <= bytecode_length);
262 operands.emplace_back(Operand::from<uint8_t>(bytecode[pos]));
266 indirect = bytecode[pos];
270 uint16_t operand_u16 = 0;
271 uint8_t
const* pos_ptr = &bytecode[pos];
273 indirect = operand_u16;
277 uint16_t operand_u16 = 0;
278 uint8_t
const* pos_ptr = &bytecode[pos];
280 operands.emplace_back(Operand::from<uint16_t>(operand_u16));
284 uint32_t operand_u32 = 0;
285 uint8_t
const* pos_ptr = &bytecode[pos];
287 operands.emplace_back(Operand::from<uint32_t>(operand_u32));
291 uint64_t operand_u64 = 0;
292 uint8_t
const* pos_ptr = &bytecode[pos];
294 operands.emplace_back(Operand::from<uint64_t>(operand_u64));
299 uint8_t
const* pos_ptr = &bytecode[pos];
301 operands.emplace_back(Operand::from<uint128_t>(operand_u128));
306 uint8_t
const* pos_ptr = &bytecode[pos];
307 read(pos_ptr, operand_ff);
308 operands.emplace_back(Operand::from<FF>(operand_ff));
316 .indirect = indirect,