Hardware looping unit