fun delay_pipe()
{
    pipe.resources?pop_front();

    val ii = 0;
    val new_first = 0;
    while(ii < pipe.instructions?length) {
	var inst = pipe.instructions[+ii];
	if(inst.ready > 0?cvt(uchar)) inst.ready = inst.ready - 1?cvt(uchar);
	if(inst.ready > 0?cvt(uchar) && new_first <= 0) new_first = ii;
	ii = ii + 1;
    }

    pipe.instructions?pop_front(new_first?cvt(uchar));

    cycles = cycles + 1?cvt(ullong);
}