# Femtosecond CDMA Using Dielectric Metasurfaces:

Design Procedure and Challenges

###### Abstract

Inspired by the ever-increasing demand for higher data transmission rates and the tremendous attention toward all-optical signal processing based on miniaturized nanophotonics, in this paper, for the first time, we investigate the integrable design of coherent ultrashort light pulse code-division multiple-access (CDMA) technique, also known as femtosecond CDMA, using all-dielectric metasurfaces (MSs). In this technique, the data bits are firstly modulated using ultrashort femtosecond optical pulses generated by mode-locked lasers, and then by employing a unique phase metamask for each data stream, in order to provide the multiple access capability, the optical signals are spectrally encoded. This procedure spreads the optical signal in the temporal domain and generates low-intensity pseudo-noise bursts through random phase coding leading to minimized multiple access interference. This paper comprehensively presents the principles and design approach to realize fundamental components of a typical femtosecond CDMA encoder, including the grating, lens, and phase mask, by employing high-contrast CMOS-compatible MSs. By controlling the interference between the provided Mie and Fabry-Perot resonance modes, we tailor the spectral and spatial responses of the impinging light locally and independently. Accordingly, we design a MS-based grating with the highest possible refracted angle and, in the meantime, the maximized efficiency which results in a reasonable diameter for the subsequent lens. Moreover, to design our MS-based lens commensurate with the spot size and distance requirements of the pursuant phase mask, we leverage a new optimization method which splits the lens structure into central and peripheral parts, and then design the peripheral part using a collection of gratings converging the impinging at the subsequent phase mask. This work can be regarded as a pioneering attempt to make a bridge between the recent tremendous advancement in the nonophotonics technology and that of optical communication networks to extend the boundaries and facilitate their effective miniaturized deployment.

## Introduction

As an inseparable ingredient of optics and photonics fields, light shaping techniques in which arbitrary ultrashort laser pulses are modulated to realize user-defined waveforms has gained significant interests during the past decades. Recent advancements in the cutting-edge technologies including scanning microscopy, direct laser writing/cutting, imaging, and signal processing stem in the development of novel approaches of beam sculpting [1, 2]. More importantly, optical communications with distinctive capabilities such as bit error correction, electromagnetic (EM) interference immunity, high data transfer rates, and secrecy are becoming more and more attractive [3]. Although a remarkable growth has been made with the multiplexing, demultiplexing, and correlation methods in the physical layer, a challenge with the developed systems still exists. Beam manipulation in the hardware level of all-optical communication systems are majorly dependent on conventional EM components suffering from bulky geometries which hamper their merging with the ubiquitous integrated photonics. Considering the late advancement in nanotechnology fabrication, realizing ultra-flat, highly-integrable, and wave-based photonic devices have recently garnered more attentions [4, 5]. To turn the miniaturized communication systems into the reality, evolution of novel encoding/decoding techniques, capable of directly manipulating the information in the optical domain along with ultra-compact flat optical devices, to control the impinging wave dynamics in the subwavelength regime, are inevitable.

As a mature spread-spectrum method in the optical networks, code-division multiple-access (CDMA) which provides simultaneous, (a)synchronously multiplexed, and random channel access to a large number of users has gotten much more attentions among other techniques [6, 7]. Ultrashort light pulse CDMA, also known as femtosecond CDMA, is an efficient technique where the data bits modulated using ultrashort femtosecond optical pulses, generated by mode-locked lasers, are spectrally encoded using a unique phase mask for each data stream to provide the multiple access capability. In fact, this procedure spreads the optical signals in the temporal domain and generates low-intensity pseudo-noise bursts through random phase coding leading to minimized multiple access interference [8]. The key elements in the commercialized femtosecond CDMA networks are encoders and decoders comprising of traditional components including gratings, lenses, and phase masks. Such conventional optical devices rely on the phase accumulation effect during wave propagation in the given medium to modify the state of EM wave leading to the complex, volumetric configurations prone to the detrimental effects such as reflection losses, alignment difficulty, and vibration sensitivity [9, 10]. To overcome such drawbacks, a novel class of nanoscale artificial media has recently introduced yielded to the revolutionary photonic phenomena. All-dielectric optical metasurfaces (MSs), two-dimensional versions of metamaterials, composed of (a)periodic array of subwavelength high-contrast resonators (i.e., meta-atoms), which simultaneously couple to the electric and magnetic components of the incident EM fields, offer a promising alternative to the traditional optics [11, 12, 13, 14]. Such MSs enable abrupt modifications of EM waves dynamic in terms of amplitude, phase, and polarization offering a variety of intriguing optical effects associated with promising practical applications such as biosensing [15], energy harvesting [16], analog computing [17, 18], and cloaking [19], to name a few.

In this paper, we propose for the first time, a novel class of miniaturized, integrable, and wave-based encoder system for optical CDMA networks by incorporating multiple metadevices comprising of ultra-compact, highly-efficient, and planar all-dielectric MSs. After a theoretical investigation of ultrashort light pulse CDMA technique, the principles and design approach to realize fundamental components of a typical encoder, including the grating, lens, and phase mask, by employing high-contrast complementary metal oxide semiconductor (CMOS) compatible MSs will be comprehensively presented. The stunning capability of MSs in spatial, spectral, and/or temporal manipulation of the light substantiates the effectiveness of our approach in simultaneous implementation of on-chip encoders and decoders necessary for a fully integrable nanophotonic-based CDMA network.

## Theory of Femtosecond Optical CDMA Technique

Coherent ultrashort light pulse CDMA technique was firstly introduced by Salehi et al. in as an effective all-optical signal processing multiple-access mechanism in fiber-optic networks, though using bulky optics [8]. In this technique, as shown in Fig. 1, in order to spectrally encode a specific data stream, the coherent ultrashort pulse output of a mode-locked laser, representing one bit of information, is directed to a grating which spatially decomposes the spectral components of the incoming ultrashort pulse with a specific resolution. Then the diffracted spectral components of the grating are all collected and focused by a lens which gives the Fourier transform of the input light at its focal plane. At the focal plane of the lens, where different components are spatially separated, a phase mask is inserted to introduce pseudorandom phase shifts among the different spectral components. The second lens and grating after the phase mask reassemble the encoded version of different spectral components into a single optical beam. In this case, the temporal profile of the encoded optical beam can be obtained from the Fourier transform of the transferred pattern of the mask onto the spectrum of the incoming ultrashort light pulse; therefore, the pseudorandom phase mask temporally spreads the input ultrashort pulse into a low-intensity pseudorandom burst. In a femtosecond CDMA network, each transmitter employs its own distinct phase mask to spectrally encode a data stream based on the above-explained procedure and then broadcasts the encoded pulses into a common optical channel, e.g., a fiber-optic channel, that is shared between all the transmitters and receivers. The two main parts of each receiver in an ultrashort light pulse CDMA network are: the decoder which exactly has the same architecture of the corresponding transmitter encoder except that its phase mask is the complex conjugate version of the transmitter phase mask, and the optical threshold device. Therefore, when the transmitter and receiver phase masks are a complex conjugate pair, the spectral phase shifts all components are removed and the original coherent ultrashort pulse can properly be decoded and reconstructed. On the other hand, the undesired receivers, without knowledge of the mask architecture of the desired transmitter, cannot remove the spectral phase shifts. In other words, when the encoded signal of the desired transmitter passes through the decoder of a typical undesired receiver, the phase masks do not match thoroughly, and hence the spectral phase shifts rearrange and do not vanish; therefore, the decoder’s output signal remains a low-intensity pseudorandom temporally-spread burst. In this case, the threshold device is set to reject any improperly-decoded low-intensity pseudorandom burst and detect the properly-decoded intense pulses of the matched transmitter-receiver pairs.

To better envision the femtosecond CDMA technique, we briefly overview the essence of the physics behind this technique. Let us consider the baseband Fourier spectrum of the starting ultrashort pulses as , i.e., a rectangular spectrum with amplitude over the angular frequency band , where is the total bandwidth of the band-limited source and is the peak power of the ultrashort light pulse. Then the time-domain version of the input signal can be expressed as and consequently the corresponding instantaneous power is given by , where is the sinc function. We note that describes an ultrashort pulse with the approximate temporal duration of [8]. In order to spectrally encode the starting ultrashort light pulse, is multiplied by the Fourier response of the mask which consists of distinct chips each with the bandwidth . We assume that the phase value of each chip, which operates on a distinct spatial component of the focused spectrally decomposed light impinging on the mask, can independently be adjusted while all of the chips have the same amplitude response such that the relative amplitude of the different spectral components remains unchanged when they pass through the mask. Considering the -th chip of the mask with the unit amplitude, i.e., , and phase , the temporal shape of the encoded field amplitude can be represented as

(1) |

where . Therefore, the encoded field amplitude after the second lens and grating is in fact a periodic pseudo-random signal , with period , modulated by a real envelope determining the temporal width of the encoded pulse. Obviously, for , , reduces to . Considering binary phase masks in which the phase of each spectral chip is either or with the probabilities and , respectively, ’s are independent and identically distributed (i.i.d.) random variables (RVs) with the probability density function (PDF) where represents Dirac’s delta function. In this case, the ensemble average of is given by where denotes the amplitude of an ideal mode-locked laser ( for all ’s) with period ; this means that for the random coding, i.e., , the ensemble average of is equal to zero. Moreover, based on the mathematical manipulations in Ref. [8], the instantaneous power of the normalized field amplitude is given by , where can be obtained as

(2) |

And the ensemble average of can be expressed as

(3) |

where is the intensity of an ideal mode-locked laser with period and peak power without a phase mask, and is the time average of the laser intensity over a period of seconds. While for the uncoded pulses () the ensemble average of is equal to which reflects an ultrashort pulse with the temporal duration and the peak power , for the random coding () the ensemble average is . Therefore, in the case of random coding, the ideal ultrashort light pulse disappears and the output average intensity is reduced by a factor of due to the intensity spread over an times larger time period. Clearly, for the other values of the peak of is between the peak power of the uncoded pulse () and that of the randomly encoded pulse (). Further statistical analysis in Ref. [8] have revealed that for the randomly encoded ultrashort light pulse with an unknown transmission time and initial phase, the real and imaginary parts of the encoded signal are statistically independent joint Gaussian RVs. Therefore, the encoded intensity signal has a chi-square PDF as

(4) |

which is a typical PDF for all polarized random light [20, 21, 22, 23, 24]. Therefore, it is claimed that the encoded femtosecond pulses appear as random light to a typical undesired receiver which has no knowledge of the code, transmission time, and the initial phase of the desired data stream.

## Results

### Design Principles and Challenges

Before explaining our proposed design scheme, we first describe the basic principles of the integrable platform of femtosecond CDMA based on dielectric MSs. Then we highlight the main challenges playing critical roles toward the effective design of this technique that can better envision the advantages and potentials of our proposed solution in the next subsection. To begin with, we recall the schematic configuration shown in Fig. 1 where the collimated ultrashort beam of a mode-locked laser impinges on the grating, which decomposes the different spectral components of the incoming light to different angles. Then each spectral component is focused, with a specific spot size, deemed , to the mask which introduces a certain phase to each component. The phase mask can be implemented by employing a two-dimensional array of predefined unit cells; the area of each unit cell determines the spot size that the precedent lens is supposed to produce, and the distance between each pair of two consecutive unit cells defines the center-to-center distance of the adjacent focused beams, namely . The parameter is related to the angular distance of two adjacent diffracted spectral components as

(5) |

where is the focal length of the lens which can be determined using the distance of two consecutive spots when is known for a grating. To evaluate the required for a grating in a femtosecond CDMA system, we first note that based on the generalized Snell’s law of refraction [25, 26], for any normal incident light to the grating the refracted angle is related to the phase discontinuity function as , which means that arbitrary angles for the refracted beam can be achieved if an appropriate gradient of the phase discontinuity along the interface is satisfied. Based on the grating phase profile, we have , where is the grating period. Therefore, we find for the refracted angle of grating that and taking a differentiation with respect to leads to . Consequently, we have

(6) |

where represents angular distance of two adjacent diffracted spectral components in which and are the bandwidth of each spectral component impinging on the phase mask and the total bandwidth of the femtosecond CDMA system, respectively. Therefore, the required can be obtained considering the design parameters of the femtosecond CDMA system including , , and , and then the desired focal length of the lens can be calculated from the distance of adjacent focused beams using Eq. (5). On the other hand, when and are known, the required diameter of the lens can be obtained based on the spot size of each focused spectral component, which itself is imposed by the dimensions of each unit cell of the phase mask, using the relation[27]

(7) |

The above-discussed formulas play a critical role in the integrable design of the femtosecond CDMA system and clarify the rigorous relations between the three essential parts of the encoder, i.e., the grating, lens, and mask. To better elucidate this relationship and the challenges they impose on the MS-based design of the femtosecond CDMA system, in the following, we provide an example using the typical parameters reported in the literature. Let us, similar to Ref. [28], consider ultrashort light pulses of duration , corresponding to the source bandwidth of , encoded by a -elements pseudo-random binary phase mask. In the central wavelength of , this is equivalent to the total wavelength bandwidth of , and the per spectral component bandwidth of about . Based on Eq. (6), for a specific wavelength, the larger the refracted angle of grating we have, the more the angular distance of different spectral components we get. According to what reflected in the literature, realizing MS-based gratings with angles of refraction beyond significantly degrades the system performance. In this case, if we limit ourselves to the refracted angle of , the per spectral component bandwidth of results into the angular distance of . On the other hand, we assume that the phase mask is composed of unit cells of with periodicity (details on the structure of our MS-based mask can be found in the next subsection), which imposes the spot sizes on the order of and the center-to-center spot distances as large as . These values necessitate lens focal length and diameter as high as and , respectively, which make the integrable design of femtosecond CDMA using the available MS devices questionable. Therefore, for the integrable implementation of the femtosecond CDMA technique, it is essential to design gratings addressing highest possible refracted angles, one of the goals governing the content of this paper. For example, if we somehow design gratings with refraction angles as high as , the required angular distance, focal length, and lens diameter will be , , and , respectively.

### Proposed Design Scheme

#### Mask

As the heart of a typical encoder in a femtosecond CDMA system, pulse shaping mask manipulates the dynamic of Fourier-transformed spectral components of input laser beam by introducing pseudorandom spatial phase shifts. Based on the theoretical arguments in the previous section, we first generate a pseudorandom sequence with equal probability for the phase values and , and then embed this phase sequence into the mask. Accordingly, the transmitter side broadcasts encoded pulses experienced a phase mask with specific predefined spatial pattern as its finger print. This ensures secured communication as long as a perfect matching occurs with the decoder of the receiver side containing a conjugate of the encoding mask. Conventional shaping masks are mostly based on spatial light modulators, acousto-optic modulators, liquid crystal modulators, and deformable mirrors which are implemented through microlithographic patterning techniques making the ultra-compact realization of encoders impossible [29]. The solution of such fundamental challenge goes through all-dielectric MSs containing nanoscale high contrast constituents capable of fully molding the impinging light in a subwavelength distance [30, 31]. Such dielectric MSs also address the fundamental drawbacks of their plasmonic counterparts in terms of high inherent Ohmic losses, heating, and incompatibility with CMOS fabrication processes. All-dielectric nanoresonators provide a compelling route to highly control the transmitted light with full phase-agility () based on simultaneous excitation of magnetic dipole (first Mie resonance), electric dipole (second Mie resonance), and standing wave along the particle (Fabry-Perot resonance). Such ideal resonance modes empower MSs to realize a perfect transmissive Huygens’ surface, with zero total reflectance, over the telecommunication spectral range [10]. Indeed, the engineered nanoparticles in terms of geometry dimensions, shape, period, orientation, and material tailor the spatial distribution of phase discontinuities both locally and independently over a subwavelength surface [32]. It is worth mentioning that the unique capacity of all-dielectric MSs in concurrently tailoring the phase and polarization of the incident beam facilitates implementation of more complicated encoder systems essential for highly-secured and invulnerable communication networks, which are vital for military applications. Moreover, the rapidly growing field of reconfigurable all-dielectric MSs have shown great promises for realization of light-assisted tunable platforms necessary for the next-generation real-time all-optical modulators excluding electro-optic effects to get higher data transfer rates and bandwidth [33, 34, 35, 36, 37, 38].

#### Grating

Design parameters | |||||||

(nm) | (nm) | (nm) | (nm) | (nm) | |||

Initial |
nanofin 1 | -850 | 0 | 160 | 380 | 1500 | 0 |

nanofin 2 | -270 | 0 | 180 | 330 | 1500 | 30 | |

nanofin 3 | 0 | 0 | 90 | 280 | 1500 | 60 | |

nanofin 4 | 850 | 0 | 60 | 260 | 1500 | 90 | |

Final |
nanofin 1 | -826 | -8 | 161 | 371 | 1500 | -0.3 |

nanofin 2 | -270 | 1 | 175 | 315 | 1500 | 28.2 | |

nanofin 3 | 282 | -5 | 116 | 281 | 1500 | 65.1 | |

nanofin 4 | 791 | 7 | 76 | 272 | 1500 | 93 |

As discussed before, the more the refracted angle the grating has, the smaller the lens we will have; however, increasing the grating refracted angle will simultaneously decrease its efficiency. Therefore, we aim to design a grating with the highest possible refracted angle and, at the same time, with an optimum efficiency. A well-established approach toward designing a grating is to discretize the phase profile of the grating functionality and assign a specific unit cell to each of the digitized values[39, 40]. This can cause a significant degradation on the overall performance of gratings associated with high refracted angles in that such a sampling method deteriorates the inherent periodicity of the sawtooth phase profile of the grating. Furthermore, employing well-known optimization methods to the above-mentioned approach is ineffective since all unit cells are considered isolated, giving no information regarding the mutual interactions between the neighboring unit cells. To design a highly-efficient grating, a recently developed method modifies the design parameters of a building block, namely geometrical dimensions, position, shape, and orientation angle by making the output intensity of the first diffraction order of the target refracted angle as a criteria [41]. Here, we utilize silicon nanofins[42] with a specified orientation angle as building blocks of the grating component(see Fig. 2). The design procedure of such a metasurface-based grating with the desired refracted angle and maximized efficiency is shown in Algorithm 1. As the first step, we set some nanofins with random design parameters for a specific grating period which defines the diffracted angle according to the incident wavelength. In each step, we take one of the design parameters and gradually change it until the diffracted power of the first order is not improving anymore. Hence, in order to design a grating with this novel algorithm, at the first, we set our target diffracted angle as , then according to the target wavelength and , our grating period will be . Finally, by applying Algorithm 1 to four nanofins with random initial design parameters listed in Table 1, we will reach to the optimized grating which its final parameters has been listed in Table 1 as well. The designed grating was simulated using full-wave commercial EM solver, CST Microwave Studio, and the resultant nearfiled and farfield pattens are depicted in Fig. 3.

#### Lens

As mentioned before, achieving practical spot size, , and distance, , on the mask necessitates diameters on the order of at least hundreds of microns for the lens, which makes the simulation process cumbersome. Design procedure of such a big lens is not feasible with conventional methods unless using supercomputers, so another approach is considered. As discussed in Ref.[41] to design and simulate a lens with such a size (meta-lens), we split the lens into two parts, i.e., center and periphery of the lens. Center part of the lens is designed in a conventional method like a small lenss[43, 44, 45] but design of the periphery is different which will be discussed later in this subsection.

A flat lens which focuses light in the -direction with focal length should be designed such that the transmit phase adopt the following hyperboloidal profile, in which and are the cartesian coordinates and is our design wavelength[46]

(8) |

In conventional methods, one should design a number of unit cells to span the phase shift of to . Then by moving in constant steps from center of the lens, and taking enough samples, the phase profile as well as place of the best-matching designed unit cells are achieved. The unit cell in this design is a silicon nanofin with a square cross-section that by changing its length different phase shifts are achieved; hence, with this method we create our unit cell collection which consists of position of unit cells as well as their specification for producing the phase shift profile.

However, by getting far away from the center of lens at some point our sampling will result poorly because of the rapid changes in the phase profile which requires modifications on the design approach. Away from the lens center, hyperboloid phase profile of a lens can be approximated with a linear sawtooth phase (see Fig. 4) so that these parts can safely be assumed as gratings with slowly-changing periods and refraction angles. In other words, we approximate the periphery of the lens with gratings which bend the incident collimated light so that the refracted light of these gratings converges at the focal length. Therefore, instead of designing every single unit cell to make the phase profile, which would be inaccurate and impractical because of high gradient in the profile, we designed gratings with various refraction angles starting from (the angle at which the lens starts to be approximated via bunch of gratings) to (the angle at which the lens produces the desired numerical aperture which corresponds to the desired spot size) in the way described in the previous subsection. Then for every semi-sawtooth part in the lens phase profile, we placed a grating with best matching period in the final design of the periphery. In order to archive the gratings, we first select and optimize five gratings with the refracted angles shown in Fig. 5. The optimization process is according to that of described in Algorithm 1. Then starting with these gratings and applying the grating collection design method described in Algorithm 2 the archive is complete, which is shown in Fig. 5. Based on Algorithm 2 to design a grating with the refracted angle we start the optimization with the initial values from the properties of the previously-optimized grating with the refracted angle . Because there is only a slight difference in the period of these two gratings this initialization suggests a considerably higher starting efficiency than a random one which significantly reduces the optimization time. Now by putting center and periphery design together our lens is completed.

The lens parameters are derived based on the specifications of the femtosecond CDMA system. In particular, similar to the previous example, we consider a femtosecond CDMA system with the total bandwidth of nm around the central wavelength of nm comprised of a -elements mask. Eqs. (5), (6), and (7) imply that a lens with and is required. The farthest grating used in the lens design should have the refracted angle of .

As we discussed before, the mask plays a critical role in defining the spot size of the lens meaning that our lens should produce the spot sizes equal to the size of mask unit cells, i.e., nm in our case; hence, we need to measure the spot sizes produced by our lens. It is known that our lens focuses the collimated light into a small region in the focal plane, i.e., the focus region, and due to the reciprocity principle if we put a point source in a focus region the light which comes out from the lens should be collimated. While we move our point source in a focus region, our far-field power will not change, but as soon as we come out from the focus region the far-field power will change. Accordingly, the distance which far-field power will change specifies the spot size of the lens. By using this method we calculate the spot size of lens about nm which is an appropriate lens for the femtosecond CDMA system.

## Discussions

In conclusion, as an attempt to incorporate the recent invaluable progress in nanophotonics technology into the advanced optical communication systems and highlight their effective miniaturized deployment, we investigated the integrable design of femtosecond CDMA technique, as a mature all-optical multiple-access mechanism in multiuser networks, using high-contrast CMOS-compatible all-dielectric metasurfaces. In particular, we rigorously developed the fundamental principles and approaches toward the realization of a typical femtosecond CDMA encoder and explored the design of its pivotal building blocks including gratings, lenses, and phase masks. We observed that an efficacious implementation of the femtosecond CDMA system requires joint design of these essential parts meaning that each block should be designed based on the characteristics of the other blocks as well as the femtosecond CDMA system’s specifications. For example, a smaller size for the lens necessitates larger angles of refraction for the precedent grating which itself decreases the grating efficiency. Therefore, we firstly designed a MS-based grating with the highest possible refracted angle and, in the meantime, the maximized efficiency which leads to a reasonable diameter for the subsequent lens. Moreover, to design our MS-based lens which fulfills the spot size and distance requirements of the following phase mask, based on an optimization procedure separating the structure of the lens into central and peripheral distinct sections, we built the peripheral part using a collection of gratings that their diffracted light converges at the focal plane of the lens where the phase mask is assumed to be placed.

This work can be considered as a pioneering attempt in extending the boundaries to bridge the recent tremendous advancement in the nonophotonics technology, specifically all-dielectric metasurfaces, to that of optical communication networks, which opens the window towards lots of interesting research activities that couple different problems in joint-optimization of optical communication networks and integrated photonics that aim to expedite the implementation of miniaturized all-optical signal processing and communication systems. Designing the decoder part of MS-based femtosecond CDMA system and then developing a rich simulation and experimental set-up to evaluate the overall performance of the underlying multiuser network can be regarded as a mature and potential future work. Moreover, joint design of different essential parts as a single compact module that performs all the functionalities together is unquestionably the next step in the integrable realization of a femtosecond CDMA system.

## Methods

The effective implementation of the femtosecond CDMA encoder requires joint design of the different pivotal parts of the system meaning that each block should be designed based on the characteristics of the other blocks as well as the femtosecond CDMA system’s specifications. For example, a smaller size for the lens necessitates larger angles of refraction for the precedent grating which itself decreases the grating efficiency. Therefore, an optimization process is required to design the MS-based grating with the highest possible refracted angle which in the meantime achieves the maximum efficiency, leading to a reasonable diameter for the subsequent lens. The design procedure of such a MS-based grating which achieves the desired refracted angle with the maximized efficiency is shown in Algorithm 1. At the first, we set some nanofins with random design parameters for specific grating period which specifies the diffracted angle according to the incident wavelength. In each step, we took one of the design parameters and gradually changed it such that the diffracted power of the first order was not improving anymore.

Moreover, to design our MS-based lens commensurate with the spot size and distance requirements of the phase mask, we split the lens into central and peripheral parts and designed the central part using conventional methods like a small lens. On the other hand, for the design of the peripheral part, we used an optimization procedure which constructs the lens using a collection of gratings that bend the incoming collimated light in a way that the diffracted light of the gratings converge at the focal plane of the lens where the phase mask is placed. The design procedure of such a lens with the desired focal length and numerical aperture is summarized in Algorithm 2.

## References

- [1] Cundiff, S. T. & Weiner, A. M. Optical arbitrary waveform generation. \JournalTitleNature Photonics 4, 760–766 (2010).
- [2] Weiner, A. M. Ultrafast optical pulse shaping: A tutorial review. \JournalTitleOptics Communications 284, 3669–3692 (2011).
- [3] Rubinsztein-Dunlop, H. et al. Roadmap on structured light. \JournalTitleJournal of Optics 19, 013001 (2016).
- [4] Silva, A. et al. Performing mathematical operations with metamaterials. \JournalTitleScience 343, 160–163 (2014).
- [5] Yu, N. & Capasso, F. Flat optics with designer metasurfaces. \JournalTitleNature materials 13, 139 (2014).
- [6] Salehi, J. A. Code division multiple-access techniques in optical fiber networks. i. fundamental principles. \JournalTitleIEEE transactions on communications 37, 824–833 (1989).
- [7] Salehi, J. A. & Brackett, C. A. Code division multiple-access techniques in optical fiber networks. ii. systems performance analysis. \JournalTitleIEEE Transactions on Communications 37, 834–842 (1989).
- [8] Salehi, J. A., Weiner, A. M. & Heritage, J. P. Coherent ultrashort light pulse code-division multiple access communication systems. \JournalTitleJ. Lightwave Technol. 8, 478–491 (1990).
- [9] Zheludev, N. I. & Kivshar, Y. S. From metamaterials to metadevices. \JournalTitleNature materials 11, 917 (2012).
- [10] Jahani, S. & Jacob, Z. All-dielectric metamaterials. \JournalTitleNature nanotechnology 11, 23 (2016).
- [11] Arbabi, A., Horie, Y., Bagheri, M. & Faraon, A. Dielectric metasurfaces for complete control of phase and polarization with subwavelength spatial resolution and high transmission. \JournalTitleNature Nanotechnology 10, 937–943 (2015).
- [12] Lin, D., Fan, P., Hasman, E. & Brongersma, M. L. Dielectric gradient metasurface optical elements. \JournalTitleScience 345, 298–302 (2014).
- [13] Staude, I. et al. Tailoring directional scattering through magnetic and electric resonances in subwavelength silicon nanodisks. \JournalTitleACS nano 7, 7824–7832 (2013).
- [14] Khorasaninejad, M. et al. Metalenses at visible wavelengths: Diffraction-limited focusing and subwavelength resolution imaging. \JournalTitleScience 352, 1190–1194 (2016).
- [15] Liang, Y. et al. Subradiant dipolar interactions in plasmonic nanoring resonator array for integrated label-free biosensing. \JournalTitleACS sensors (2017).
- [16] Brongersma, M. L., Cui, Y. & Fan, S. Light management for photovoltaics using high-index nanostructures. \JournalTitleNature materials 13, 451–460 (2014).
- [17] Chizari, A., Abdollahramezani, S., Jamali, M. V. & Salehi, J. A. Analog optical computing based on a dielectric meta-reflect array. \JournalTitleOptics Letters 41, 3451–3454 (2016).
- [18] Abdollahramezani, S., Chizari, A., Dorche, A. E., Jamali, M. V. & Salehi, J. A. Dielectric metasurfaces solve differential and integro-differential equations. \JournalTitleOptics Letters 42, 1197–1200 (2017).
- [19] Cheng, J., Jafar-Zanjani, S. & Mosallaei, H. All-dielectric ultrathin conformal metasurfaces: lensing and cloaking applications at 532 nm wavelength. \JournalTitleScientific Reports 6, 38440 (2016).
- [20] Mandel, L. Fluctuations of photon beams and their correlations. \JournalTitleProceedings of the Physical Society 72, 1037 (1958).
- [21] Mandel, L. Fluctuations of photon beams: the distribution of the photo-electrons. \JournalTitleProceedings of the Physical Society 74, 233 (1959).
- [22] Mandel, L. & Wolf, E. Coherence properties of optical fields. \JournalTitleReviews of modern physics 37, 231 (1965).
- [23] Loudon, R. The quantum theory of light (OUP Oxford, 2000).
- [24] Goodman, J. W. Statistical optics (John Wiley & Sons, 2015).
- [25] Yu, N. et al. Light propagation with phase discontinuities: generalized laws of reflection and refraction. \JournalTitlescience 334, 333–337 (2011).
- [26] Kildishev, A. V., Boltassea, A. & Shalaev, V. M. Planar photonics with metasurfaces. \JournalTitleScience 339, 1232009 (2013).
- [27] Teich, M. C. & Saleh, B. Fundamentals of photonics. \JournalTitleCanada, Wiley Interscience 3 (1991).
- [28] Sardesai, H., Chang, C.-C. & Weiner, A. A femtosecond code-division multiple-access communication system test bed. \JournalTitleJ. Lightwave Technol. 16, 1953 (1998).
- [29] Weiner, A. M. Femtosecond pulse shaping using spatial light modulators. \JournalTitleReview of scientific instruments 71, 1929–1960 (2000).
- [30] Qiao, P., Yang, W. & Chang-Hasnain, C. J. Recent advances in high-contrast metastructures, metasurfaces and photonic crystals. \JournalTitlearXiv preprint arXiv:1707.07753 (2017).
- [31] Baranov, D. G. et al. All-dielectric nanophotonics: the quest for better materials and fabrication techniques. \JournalTitleOptica 4, 814–825 (2017). URL http://www.osapublishing.org/optica/abstract.cfm?URI=optica-4-7-814. DOI 10.1364/OPTICA.4.000814.
- [32] Kuznetsov, A. I., Miroshnichenko, A. E., Brongersma, M. L., Kivshar, Y. S. & Luk’yanchuk, B. Optically resonant dielectric nanostructures. \JournalTitleScience 354, aag2472 (2016).
- [33] Wang, Q. et al. Optically reconfigurable metasurfaces and photonic devices based on phase change materials. \JournalTitleNature Photonics 10, 60–65 (2016).
- [34] Chu, C. H. et al. Active dielectric metasurface based on phase-change medium. \JournalTitleLaser & Photonics Reviews 10, 986–994 (2016).
- [35] Wuttig, M., Bhaskaran, H. & Taubner, T. Phase-change materials for non-volatile photonic applications. \JournalTitleNature Photonics 11, 465–476 (2017).
- [36] Makarov, S. V. et al. Light-induced tuning and reconfiguration of nanophotonic structures. \JournalTitleLaser & Photonics Reviews 5, 1700108 (2017).
- [37] Cheng, Z., Ríos, C., Pernice, W. H., Wright, C. D. & Bhaskaran, H. On-chip photonic synapse. \JournalTitleScience Advances 3, e1700160 (2017).
- [38] Raeis-Hosseini, N. & Rho, J. Metasurfaces based on phase-change material as a reconfigurable platform for multifunctional devices. \JournalTitleMaterials 10, 1046 (2017).
- [39] Yang, Y. et al. Dielectric meta-reflectarray for broadband linear polarization conversion and optical vortex generation. \JournalTitleNano letters 14, 1394–1399 (2014).
- [40] Decker, M. et al. High-efficiency dielectric Huygens surfaces. \JournalTitleAdvanced Optical Materials 3, 813–820 (2015).
- [41] Byrnes, S. J., Lenef, A., Aieta, F. & Capasso, F. Designing large, high-efficiency, high-numerical-aperture, transmissive meta-lenses for visible light. \JournalTitleOptics Express 24, 5110–5124 (2016).
- [42] Khorasaninejad, M. & Crozier, K. B. Silicon nanofin grating as a miniature chirality-distinguishing beam-splitter. \JournalTitleNature communications 5 (2014).
- [43] Cheng, J., Ansari-Oghol-Beig, D. & Mosallaei, H. Wave manipulation with designer dielectric metasurfaces. \JournalTitleOptics letters 39, 6285–6288 (2014).
- [44] Estakhri, N. M. & Alu, A. Manipulating optical reflections using engineered nanoscale metasurfaces. \JournalTitlePhysical Review B 89, 235419 (2014).
- [45] Pors, A., Nielsen, M. G., Eriksen, R. L. & Bozhevolnyi, S. I. Broadband focusing flat mirrors based on plasmonic gradient metasurfaces. \JournalTitleNano letters 13, 829–834 (2013).
- [46] Aieta, F. et al. Aberration-free ultrathin flat lenses and axicons at telecom wavelengths based on plasmonic metasurfaces. \JournalTitleNano letters 12, 4932–4936 (2012).

## Author contributions statement

T.R. and M.H.M. carried out the research, performed simulations, and wrote Algorithms 1 and 2. S.A. and M.V.J. conducted the research and wrote the manuscript. J.A.S. conceived the idea, proposed the research, and supervised the project. All authors discussed the results, analyzed the data, and reviewed the manuscript.