In the Standard Model (SM) of $SU(3)_{C} x SU(2)_{L} X U(1)_{Y}$ gauge symmetry with three fermion generations, the interactions of quarks with the $SU(2)_{L}$ gauge bosons $(W_{\mu}^{a})$ are given by

$$\mathcal{L}_{W}= -\frac{1}{2}g\gamma^{\mu}\tau^{a}W^{a}_{\mu}\overline{\chi_{iL}}1_{ij}\chi_{jL} + h.c.,$$
where $\gamma^{\mu}$ ($\mu=1$ to $4$) operates in Lorentz space, $\tau^{a}$ ($a=1$ to $3$) operates in $SU(2)_{L}$ space, $1_{ij}$ ($i$ and $j=1$ to $3$) is the unit matrix operating in generation space, and $\chi_{iL}$ are the fundamental left-handed quark states of the unbroken electroweak theory:
$$\chi_{iL} = \begin{pmatrix}
u_{1} \\
d_{1}
\end{pmatrix}_{L}
\begin{pmatrix}
u_{2} \\
d_{2}
\end{pmatrix}_{L}
\begin{pmatrix}
u_{3} \\
d_{3}
\end{pmatrix}_{L}
$$
The interactions of quarks with the single Higgs scalar doublet $\phi = (\phi^{+},\phi^{0})$ are given by
$$\mathcal{l}_{Y} = -G_{ij}\overline{\chi_{iL}}1_{ij}\phi d_{jR}-F_{ij}\overline{\chi_{iL}}1_{ij}\bar{\phi}u_{jR}+ h.c.$$
where $G_{ij}$ and $F_{ij}$ are general complex $3x3$ matrices and $u_{iR}(d_{iR})$ represents the fundamental right-handed up type (down type) quark states of the unbroken electroweak theory:
$$u_{iR} = u_{1R},u_{2R},u_{3R}.$$
$$d_{iR} = d_{1R},d_{2R},d_{3R}.$$
With the spontaneous symmetry breaking:
$$\phi = \begin{pmatrix}
\phi^{\pm} \\
\phi^{0}
\end{pmatrix}
\rightarrow \sqrt{\dfrac{1}{2}}
\begin{pmatrix}
0 \\
v
\end{pmatrix}
$$
the mass terms are given by
$$\mathcal{L}_{M}= -M_{dij}\overline{d_{iL}}d_{jR}-M_{uij}\overline{u_{iL}}u_{jR} + h.c.,$$
where the mass matrices, $M_{d}$ and $M_{u}$, are defined by
$$M_{d} = Gv/\sqrt{2}, M_{u} = Fv/\sqrt{2}.$$
Then the interaction of the quarks with the charged gauge boson $(W^{\pm})$ is given by
$$\mathcal{L}_{W}= -\frac{1}{2}g\gamma^{\mu}W^{+}_{\mu}\overline{u_{iL}}1_{ij}d_{jL} + h.c.,$$
The SM does not give any predictions on the $3X3$ mass matrices $M_{d}$ and $M_{u}$, thus the SM does not predict the quark mass. The mass matrices are not necessary to be diagonal matrices, and can have complex elements. These are sources of the quark generation mixing and the CP violation in the SM.
In the minimal Standard Model, neutrino masses are assumed to be zero. It means the mass matrix for the neutrino was thought to be zero. However recent observation of the disappearance of the second generation neutrino in atmospheric neutrinos at Super Kamiokande (SK) experiment shows that the charged current interaction of the leptons also has similar structure as the quark sector, and it requires a certain extension of the current SM with mass-less neutrinos.
Any complex matrix can be transformed to a diagonal matrix by multiplying on the left and right by appropriate unitary matrices. Thus by unitary transformations on the fundamental quark states of the unbroken electroweak theory,
$$\begin{pmatrix}
u_{1} \\
u_{2} \\
u_{3}
\end{pmatrix}_{L,R}
= V_{uL,R}\begin{pmatrix}
u \\
c \\
t
\end{pmatrix}_{L,R}
$$
$$\begin{pmatrix}
d_{1} \\
d_{2} \\
d_{3}
\end{pmatrix}_{L,R}
= V_{dL,R}\begin{pmatrix}
d \\
d \\
b
\end{pmatrix}_{L,R}
$$
we can transform $M_{u}$ and $M_{d}$ to diagonal forms
$$V$$
$X \stackrel{+}{=} Y$