220 const auto bytecode_length = bytecode.size();
222 if (pos >= bytecode_length) {
223 vinfo(
"PC is out of range. Position: ", pos,
" Bytecode length: ", bytecode_length);
227 const uint8_t opcode_byte = bytecode[pos];
229 if (!is_wire_opcode_valid(opcode_byte)) {
230 vinfo(
"Invalid wire opcode byte: 0x",
to_hex(opcode_byte),
" at position: ", pos);
234 const auto opcode =
static_cast<WireOpCode>(opcode_byte);
237 const auto& inst_format = iter->second;
243 if (pos + instruction_size > bytecode_length) {
244 vinfo(
"Instruction does not fit in remaining bytecode. Wire opcode: ",
248 " instruction size: ",
250 " bytecode length: ",
257 uint16_t indirect = 0;
261 assert(pos + operand_size <= bytecode_length);
267 operands.emplace_back(Operand::from<uint8_t>(bytecode[pos]));
271 indirect = bytecode[pos];
275 uint16_t operand_u16 = 0;
276 uint8_t
const* pos_ptr = &bytecode[pos];
278 indirect = operand_u16;
282 uint16_t operand_u16 = 0;
283 uint8_t
const* pos_ptr = &bytecode[pos];
285 operands.emplace_back(Operand::from<uint16_t>(operand_u16));
289 uint32_t operand_u32 = 0;
290 uint8_t
const* pos_ptr = &bytecode[pos];
292 operands.emplace_back(Operand::from<uint32_t>(operand_u32));
296 uint64_t operand_u64 = 0;
297 uint8_t
const* pos_ptr = &bytecode[pos];
299 operands.emplace_back(Operand::from<uint64_t>(operand_u64));
304 uint8_t
const* pos_ptr = &bytecode[pos];
306 operands.emplace_back(Operand::from<uint128_t>(operand_u128));
311 uint8_t
const* pos_ptr = &bytecode[pos];
312 read(pos_ptr, operand_ff);
313 operands.emplace_back(Operand::from<FF>(operand_ff));
321 .indirect = indirect,