How to generate Generation Matrix?
If the message given to you and message is also given to you then we can produce codewword.
C=d[G] and G is the concatenation of [I] and [P]
It is a combination of identity matrix I and parity sub-matrix P : In identity matrix number of column and row are same and diagonal elements are 1 and other elements are zero.
Generator Ploynomial matrix:

Example: for (6,3) codewords the generation matrix will be 3 by 6 matrix where there will be 3 by 3 identity matrix and a parity sub-matrix will be 3 by 3 matrix

Statlearner
Statlearner