(TTA) Improve generate script.
(TTA) Restrict memory size according to TCE limitation. Raise a warning
in case of overflow.