in hardware/xilinx/src/vta.cc [132:167]
void fetch(
uint32_t insn_count,
volatile insn_T *insns,
hls::stream<insn_T> &load_queue,
hls::stream<insn_T> &gemm_queue,
hls::stream<insn_T> &store_queue) {
PRAGMA_HLS(HLS INTERFACE s_axilite port = insn_count bundle = CONTROL_BUS offset = VTA_FETCH_INSN_COUNT_OFFSET)
#pragma HLS INTERFACE m_axi port = insns offset = slave bundle = ins_port
#pragma HLS INTERFACE axis port = load_queue
#pragma HLS INTERFACE axis port = gemm_queue
#pragma HLS INTERFACE axis port = store_queue
#pragma HLS INTERFACE s_axilite port = return bundle = CONTROL_BUS
INSN_DECODE: for (int pc = 0; pc < insn_count; pc++) {
#pragma HLS PIPELINE
// Read instruction fields
insn_T raw_insn = insns[pc];
VTAInsn insn;
insn.generic = *((VTAGenericInsn *) &raw_insn);
// Do some partial decoding
opcode_T opcode = insn.generic.opcode;
memop_id_T memory_type = insn.mem.memory_type;
// Push to appropriate instruction queue
if (opcode == VTA_OPCODE_STORE) {
store_queue.write(raw_insn);
} else if (opcode == VTA_OPCODE_LOAD) {
if (memory_type == VTA_MEM_ID_INP || memory_type == VTA_MEM_ID_WGT) {
load_queue.write(raw_insn);
} else {
gemm_queue.write(raw_insn);
}
} else {
gemm_queue.write(raw_insn);
}
}
}