Write the output in SOP form, like for
wherever the 1 is present-
A1 = y3'y2y1'y0'+ y3y2'y1'y0' (in sop o is treated as bar and take 1 same as it is)
A2 = y3'y2'y1y0' + y3y2'y1'y0'
and then minimize the output using a K-map, and then implement it in hardware...