base generate code