A base station (101, 102, 103) for transmitting a reference signal, comprising: a downlink transmit path comprising circuitry configured to transmit up to eight reference signals in one subframe, each subframe comprising two slots, each slot comprising a plurality of orthogonal frequency division multiplexing, OFDM, symbols, and each of the plurality of OFDM symbols comprising a plurality of resource elements; further comprising a reference signal controller configured to apply a code corresponding to an antenna port to a set of resource elements among a plurality of sets of resource elements; wherein a total number of antenna ports is based on a number of layers, wherein up to 2 sets of resource elements including a first set of resource elements and a second set of resource elements are available in the one subframe, the first set of resource elements including a different resource element pattern from the second set of resource elements, each set of resource elements includes up to 4 reference signals, each reference signal within a set of resource elements is for one antenna port, each antenna port within the set of resource elements is associated with one code; wherein in case that the number of layers is less than or equal to 4, a length of each of up to 2 different codes is 2, and wherein in case that the number of layers is greater than 4, a length of each of up to 4 different codes is 4 and a code is applied to 4 resource elements; wherein a first antenna port within the first set of resource elements is mapped on the first set of resource elements with a first code, a second antenna port within the first set of resource elements is mapped on the first set of resource elements with a second code, a third antenna port within the first set of resource elements is mapped on the first set of resource elements with a third code, and a fourth antenna port within the first set of resource elements is mapped on the first set of resource elements with a code [1, -1, -1, 1]; wherein a fifth antenna port within the second set of resource elements is mapped on the second set of resource elements with the first code, a sixth antenna port within the second set of resource elements is mapped on the second set of resource elements with the second code, a seventh antenna port within the second set of resource elements is mapped on the second set of resource elements with a fourth code, and an eighth antenna port within the second set of resource elements is mapped on the second set of resource elements with a code [-1, 1, 1, -1], and wherein the first code is based on [1,1], the second code is based on [1, -1], and the fourth code corresponds to values of the third code multiplied by -1. a downlink transmit path comprising circuitry configured to transmit up to eight reference signals in one subframe, each subframe comprising two slots, each slot comprising a plurality of orthogonal frequency division multiplexing, OFDM, symbols, and each of the plurality of OFDM symbols comprising a plurality of resource elements; further comprising a reference signal controller configured to apply a code corresponding to an antenna port to a set of resource elements among a plurality of sets of resource elements; wherein a total number of antenna ports is based on a number of layers, wherein up to 2 sets of resource elements including a first set of resource elements and a second set of resource elements are available in the one subframe, the first set of resource elements including a different resource element pattern from the second set of resource elements, each set of resource elements includes up to 4 reference signals, each reference signal within a set of resource elements is for one antenna port, each antenna port within the set of resource elements is associated with one code; wherein in case that the number of layers is less than or equal to 4, a length of each of up to 2 different codes is 2, and wherein in case that the number of layers is greater than 4, a length of each of up to 4 different codes is 4 and a code is applied to 4 resource elements; wherein a first antenna port within the first set of resource elements is mapped on the first set of resource elements with a first code, a second antenna port within the first set of resource elements is mapped on the first set of resource elements with a second code, a third antenna port within the first set of resource elements is mapped on the first set of resource elements with a third code, and a fourth antenna port within the first set of resource elements is mapped on the first set of resource elements with a code [1, -1, -1, 1]; wherein a fifth antenna port within the second set of resource elements is mapped on the second set of resource elements with the first code, a sixth antenna port within the second set of resource elements is mapped on the second set of resource elements with the second code, a seventh antenna port within the second set of resource elements is mapped on the second set of resource elements with a fourth code, and an eighth antenna port within the second set of resource elements is mapped on the second set of resource elements with a code [-1, 1, 1, -1], and wherein the first code is based on [1,1], the second code is based on [1, -1], and the fourth code corresponds to values of the third code multiplied by -1.