An optical device for generating a frequency comb comprising: CW optical source (310, 320) including at least two input optical waves with a first input frequency and a second input frequency, respectively, wherein the first input frequency and the second input frequency are separated by a frequency spacing; a first waveguide comprising a nonlinear optical medium with a nonlinear optical response and operable to mix the at least two input optical waves to generate a plurality of first optical waves having respective first frequencies separated from each other by the frequency spacing and having a frequency chirp; a second waveguide concatenated to the first waveguide, wherein the second waveguide is having a first dispersion characteristics such that the second waveguide is operable to compress the waveforms of the plurality of first optical waves and to reduce the frequency chirp introduced by the first waveguide; and a third waveguide concatenated to the second waveguide, wherein the third waveguide comprises a nonlinear optical medium and is operable to mix the plurality of first optical waves to generate a plurality of second optical waves having respective second frequencies separated from each other by the frequency spacing, wherein the third waveguide is a dispersion-flattened waveguide, characterized in that the third waveguide has a physical length that increases with an increasing width of a pulse of the plurality of first optical waves entering the third waveguide to reach spectral convergence, and is operable to increase a total number of second optical waves with respect to a total number of first optical waves. CW optical source (310, 320) including at least two input optical waves with a first input frequency and a second input frequency, respectively, wherein the first input frequency and the second input frequency are separated by a frequency spacing; a first waveguide comprising a nonlinear optical medium with a nonlinear optical response and operable to mix the at least two input optical waves to generate a plurality of first optical waves having respective first frequencies separated from each other by the frequency spacing and having a frequency chirp; a second waveguide concatenated to the first waveguide, wherein the second waveguide is having a first dispersion characteristics such that the second waveguide is operable to compress the waveforms of the plurality of first optical waves and to reduce the frequency chirp introduced by the first waveguide; and a third waveguide concatenated to the second waveguide, wherein the third waveguide comprises a nonlinear optical medium and is operable to mix the plurality of first optical waves to generate a plurality of second optical waves having respective second frequencies separated from each other by the frequency spacing, wherein the third waveguide is a dispersion-flattened waveguide, characterized in that the third waveguide has a physical length that increases with an increasing width of a pulse of the plurality of first optical waves entering the third waveguide to reach spectral convergence, and is operable to increase a total number of second optical waves with respect to a total number of first optical waves.