doonny / PipeCNN

An OpenCL-based FPGA Accelerator for Convolutional Neural Networks
Apache License 2.0
1.22k stars 370 forks source link

Can you explain why did you use "accum_piped" #31

Closed AndrewSivrit closed 6 years ago

AndrewSivrit commented 6 years ago

Hi, Dong I have one more question. Can you explain why did you use in this code "accum_piped" Why PIPE_DEPTH = 6 ? `

for(unsigned char ll=0; ll<LANE_NUM; ll++){

lane_accum[ll] = (MASK_ACCUM & accum_piped[ll][PIPE_DEPTH-1]) + (MASK_MULT & mac(mac_data.lane[ll], mac_weight.lane[ll]));

// Shift the pipelined registers backwards
#pragma unroll
for(unsigned int p=PIPE_DEPTH-1; p>0; p-- ){
    accum_piped[ll][p] = MASK_ACCUM & accum_piped[ll][p-1];
}

// update the first copy
accum_piped[ll][0] = MASK_ACCUM & lane_accum[ll];

} ` Thank you Best regards

doonny commented 6 years ago

It is a buffered accumulator. It improves the utilization of the multipliers.