Shakespeare never uses the word "cod" by itself, just in the words "codpiece" and "peascod". A peascod was a pea-pod, the container peas grow in. The codpiece was the part of the pants (worn during that era) which was a pouch sewn to the front of the pants in order to contain the male genitalia. Presumably it got its name because it looked a bit like a pea-pod.