generate.py: Split gen_gds() in subfunctions.
Refer to README for this sample project documentation.