Stack cache memory for on-chip implementation