Direct detection and characterization of exoplanets is a major scientific driver of the next decade. Direct imaging requires challenging techniques to observe faint companions around bright stars. The development of future large telescopes will increase the capability to directly image and characterize exoplanets thanks to their high resolution and photon collecting power. The E-ELT will be composed of a segmented ~40 m-diameter primary mirror. High contrast imaging techniques for E-ELT will thus need to deal with amplitude errors due to segmentation (pupil discontinuities between the segments). A promising technique is the wavefront shaping. It consists in the use of deformable(s) mirror(s) to cancel the intensity inside the focal plane region. Algorithm improvements and laboratory demonstrations have been developed since the last 20 years. The use of 2 deformable mirrors (DM) in non-conjugated planes will allow correcting not only for phase aberrations but also for the amplitude errors. Lagrange laboratory has begun in 2013 the development of an instrumental project called SPEED (Segmented Pupil Experiment for Exo-planet Detection). Its goal is to develop and test high-contrast imaging techniques optimized for segmented pupil. In this paper we present a detailed end-to-end simulation for the optimization of the SPEED experiment optical design. In particular, we pay attention to the optimal separation between the two DMs necessary for phase and amplitude correction. The trade-off between various parameters (field of correction, field of view, size constraints,...) is presented and discussed.