An optimal memory allocation scheme for scratch-pad-based embedded systems | Synapse