I'm mot sure you can do this in an easy way, since each output only has 7 or 8 product terms. Is there a special reason you need to do this big task on a tiny chip?
If I should do this with 'logic', I would use a couple of old eproms, like 27c16, and just program them with the correct...