Replaced in[] by in0..3 to facilitate move to BRAMs