To execute a certain code,where should it be stored?flash or sram?
Your compiled code is normally stored in flash since it doesn't change throughout the life of the application. It is not possible for a PSoC3 to execute code from sram (as far as I know) due to its strong Harvard architecture.
As Bob mentioned, PSOC 3 cannot execute code out of RAM, PSOC 5 can.
User historically have used RAM to speed up code snippets, like ISR response,
and PSOC 5 can accomplish this. See http://www.cypress.com/?rID=40986
Here is the link for executing the code from PSoC 5 SRAM - http://www.cypress.com/?rID=61932