Difference between diversity gain and coding gain I am reading about space-time codes. They break down further into 2 sub categories called space-time trellis codes and space-time block codes. It says that trellis codes offer both diversity and coding gain. However, block codes only offer diversity gain. I don't quite understand this.

I understand the general forms of diversity gains such as time, frequency, site, etc. However, how exactly is space-time codes different from space-diversity or even MIMO? 

Further more, what exactly is the criteria for coding gain? My intuition is that if we are actually decoding the original message which was encoded using parity bits, etc, then this is coding gain. This confusion carries over when I am trying to understand the distinctions between trellis and block codes.
MIMO refers to any system with multiple antennas, where signals are transmitted over the same bandwidth and at the same time.

Space-time coding (block or trellis, or a different one) is a specific way to transmit the data symbols. In space-time block coding, symbols are repeated over time and space in a specific pattern, which creates (potentially) both transmit and space diversity. They don't offer an intrinsic coding gain because the information is not encoded.

Trellis codes, on the other hand, allow for a coding gain because not all symbol sequences are permissible. This is similar to non-MIMO trellis modulation, where previous transmitted symbols define a sub-set of the constellation that can be used for the following symbol. This is a form of encoding, with the main benefit of neither increasing the data rate nor the required bandwidth.