Programming Wireless Security through Learning-Aided Spatiotemporal Digital Coding Metamaterial Antenna

The advancement of future large-scale wireless networks necessitates the development of cost-effective and scalable security solutions. Conventional cryptographic methods, due to their computational and key management complexity, are unable to fulfill the low-latency and scalability requirements of these networks. Physical layer (PHY) security has been put forth as a cost-effective alternative to cryptographic mechanisms that can circumvent the need for explicit key exchange between communication devices, owing to the fact that PHY security relies on the physics of the signal transmission for providing security. In this work, a space-time-modulated digitally-coded metamaterial (MTM) leaky wave antenna (LWA) is proposed that can enable PHY security by achieving the functionalities of directional modulation (DM) using a machine learning-aided branch and bound (B&B) optimized coding sequence. From the theoretical perspective, it is first shown that the proposed space-time MTM antenna architecture can achieve DM through both the spatial and spectral manipulation of the orthogonal frequency division multiplexing (OFDM) signal received by a user equipment. Simulation results are then provided as proof-of-principle, demonstrating the applicability of our approach for achieving DM in various communication settings. To further validate our simulation results, a prototype of the proposed architecture controlled by a field-programmable gate array (FPGA) is realized, which achieves DM via an optimized coding sequence carried out by the learning-aided branch-and-bound algorithm corresponding to the states of the MTM LWA's unit cells. Experimental results confirm the theory behind the space-time-modulated MTM LWA in achieving DM, which is observed via both the spectral harmonic patterns and bit error rate (BER) measurements.

directions. In addition to metasurfaces, MTMs can also be utilized to realize leaky wave antennas (LWAs) exhibiting frequency-dependent beam scanning due to their unique dispersion relationship where the propagation constant can vary from negative to positive values [32,33,34]. This LWA solution is considerably low cost with respect to conventional phased arrays and can substantially reduce the design complexity and fabrication cost [35,36]. In order to operate MTM-LWAs at a fixed frequency, tuning elements such as PIN or varactor diodes can be incorporated into the MTM unit cell to manipulate the dispersion diagram by controlling the bias voltage of tunable components [37,38,39]. Based on this concept, very recently, dynamic metasurface antennas have been proposed for multi-input multi-output systems [40,41] that modulate the MTM unit cell spatially to provide required beamforming characteristics. In these metasurface antennas, only space coding has been utilized, while the time dimension has not been exploited. In other words, the coding sequences are assumed to be fixed over time and only change in accordance with the beamforming functionality requirements. Also very recently, spatiotemporally modulated metasurface antennas are proposed in [42] that can extract and mould guided waves into any desired free-space waves in both space and frequency domains in order to overcome the issue of sideband pollution.
In this work, we leverage a newly proposed space-time digitally-coded programmable MTM-LWA [43] to achieve DM that is controlled via machine learning-aided spatio-temporal coding sequences, as illustrated in Figure 1. Specifically, in our proposed architecture, the propagation constants of the constituent composite right-/left-handed (CRLH) unit cells [32] of a MTM-LWA are changed periodically in order to achieve the functionalities of DM, i.e., reliable communication for the desired user equipment located in a predetermined direction and security against unintended receivers in the other directions. We focus on the case where orthogonal frequency-division multiplexing (OFDM) signals, which have widely been adopted in the modern wireless communication systems including 5G new radio, are being transmitted, leading to a multicarrier DM scheme. Our proposed scheme bridges the concepts of reconfigurable MTM antennas [37,38,39] and time-modulated arrays [6,7,9] towards achieving DM for PHY security. Notably, our proposed transmitter architecture enables simultaneous beam steering at the fundamental frequency and beam shaping for the generated harmonics via a machine learning-aided branch and bound (B&B) optimized coding sequence. In addition, the proposed space-time modulated CRLH unit cell can toggle between positive and negative phase constants, which will not decrease the SNR in the desired secured angle as compared to the aforementioned time-modulated arrays using pin diodes-based switches that exhibit certain off-period preventing signal transmission. While the secure backscatter communication system presented in [31] utilizes space-modulated metasurfaces and a large number of meta-atoms to direct narrow beams to legitimate parties and generate noise-like signals to confuse eavesdroppers in the other directions, our proposed space-time-modulated LWA transmitter allows for the generation and manipulation of higher-order harmonics to achieve security via DM, even with a small number of antenna elements.
In the remainder, we first present our theoretical derivations concerning the received signal from time-modulated MTM-LWAs in a given direction for both one and two dimensional spaces using the Fourier analysis. Secondly, we describe the underlying communication setting consisting of a pair of legitimate transmitter and receiver along with an eavesdropper. Subsequently, we formulate the mathematical problem of achieving DM as a mixed-integer non-linear program (MINLP) whose optimization variables include the coding sequence determining the states of the LWA's unit cells, and utilize the B&B algorithm as the solver. We also take the effect of wireless channel into account in our analysis and show how the proposed architecture can achieve DM in a wireless channel setting.
Due to the time-varying nature of the wireless channels, we also propose to utilize deep learning to enhance the B&B algorithm, and obtain a learning-aided B&B solver for finding space-time coding sequences. Finally, a space-time digitally coded MTM-LWA with 9 unit cells, each equipped with sequence is incorporated. Time-modulation feature leads to generation and control of higher-order harmonics, while space-modulation enables beam steering for the main harmonic. In fact, for the case of free space, this architecture enables us to steer the main beam direction in the fundamental frequency (f 0 ) towards the direction of the desired legitimate receiver while suppressing the received power in the higher-order harmonic frequencies (f 0 + kf p ) in that direction. In this way, the original data constellation is received by the legitimate user in each OFDM subcarrier while it is distorted for the unauthorized users in all the other directions. For the case of wireless channels, similar functionality can be achieved within each coherence time by the proposed architecture as discussed later on in the paper.
varactors for controlling the underlying states, is fabricated and experimentally tested to verify the theoretical/simulation results.

Digitally-coded space-time MTM-LWA
We propose a space-time MTM-LWA programmed via a temporal sequence of digital codes where by applying control voltages to varactors associated with unit cells of a MTM-LWA, the resulting induced phase shift from a unit cell can be dynamically modified. As shown in Figure 1, these control voltages are produced by a field-programmable gate array (FPGA) and only take on quantized values that change periodically over time, resulting in a finite number of states for each unit cell at a time step. Considering the case of binary sequences, i.e., digital codes of 0's and 1's, where the unit cells can be in two different states at a time, the time-domain far-field radiation pattern of a digitally-coded MTM-LWA can be expressed as where S(t) is the input signal to be transmitted, N is the number of unit cells, k 0 = 2π λ is the free space wavenumber, and λ denotes the wavelength. Also, p, ψ and α are the LWA's period, radiating angle, and the LWA's leakage factor, respectively. The time-modulated nature of the nth unit cell's contribution to the radiation pattern is attributed to a periodic phase-delay function U n (t) defined as over 0 ≤ t ≤ T p , where q u denotes the coding sequence of length N , L denotes length of the digital codes, and H u (t) = Phase-delay of the nth unit cell during for the case of binary sequences, and q u (k) represents state of the kth unit cell in T u . We note that κ q k (u) can be modified accordingly to account for more number of states as needed. Owing to the travelling wave nature of the LWA structure, the amount of phase delay experienced by the input wave passing through the nth unit cell not only depends on the current state of that cell but also on the states of all the previous unit cells. As an illustrative example, when q u = 1, 0, 0, 1, 0, 1 , assuming β 0 p = −18 • and β 1 p = 15.5 • , the phase delay incurred to the incoming wave after the sixth unit cell would be The periodic function U n (t) can be further expressed by using Fourier series: where the Fourier coefficients c νn can be shown to be (see Section S1 of the Supporting Information) Plugging Equations (2) and (3) in Equation (1), the radiation pattern can be simplified to R(ψ, t) = and The periodic changes in states of the unit cells with a period of 1 fp cause the LWA to create an infinite number of harmonics with frequencies νf p and magnitudes |w(ν, L, t, ψ)| for ν = −∞, . . . , ∞ at the receiver where ν denotes the generated harmonic index. The magnitude of the harmonics at each receiving angle is a function of the number of time steps (L), the digital coding sequences, phase delays associated with each state (β 0 p and β 1 p), and the phase shifts in each branch. We note that for the case of L = 1 where the state of a unit cell remains fixed over time, one could steer the angle of the LWA's main beam toward a certain direction by setting the states of the unit cells. In addition to this beam-scanning feature, the time-modulated nature of the proposed LWA enables us to control the radiated spectral components.
Our proposed architecture enable the manipulation of spectral components of the received signals by the use of digital codes for any receiving angles. This is of prime applicability in multi-carrier communication systems, e.g., when the signal S(t) being transmitted by the LWA is of OFDM type.
For the OFDM transmission, the information is sent over a limited frequency band composed of a finite number of spectral bins called subcarriers. In order for the generated harmonics to interact with the received constellation symbols in each subcarrier and meet the DM functionalities for the case of OFDM signals, the corresponding subcarrier width is set to be the same as the switching frequency f p . As a result, harmonics of the form w(ν, L, t, ψ), for ν ̸ = 0, cause interference in all the received subcarriers. The key aspect of our proposed method is to design the digital codes, i.e., q k in order to control the behavior of the interference terms and enforce the way they contribute to the received signal's subcarriers in different angles. In particular, for the case of free space transmission, the digital codes would be designed in order to minimize the level of such interference for the legitimate user equipment in the desired angle, while maximizing it for the unauthorized receivers in all the other directions as highlighted in Figure 1. Similar functionality can also be achieved in different coherence times for the case of transmission through wireless channels as discussed in a later section, where space-time coding sequences are obtained via learning-aided B&B algorithm.
Before delving into the specifics of designing the digital codes, we make a connection between the interference terms as a product of the time-modulated nature of transmission and a well-known notion in the physical layer security literature, i.e., secrecy capacity. This notion, which is derived based on the prominent work of Wyner [44], serves as a metric to quantify both reliability and security of a communication link, and is defined as C s = log(1 + SNR R ) − log(1 + SNR E ) when SNR R > SNR E . In this definition, SNR R and SNR E refer to the SNRs at the desired and unintended UEs, respectively. Therefore, a higher SNR for the desired angles and lower SNR for the undesired angles is required to maximize the secrecy capacity. For conventional phased-array antennas, the difference between the receiving SNRs merely stems from the fact that the main beam of the radiation pattern is directed towards the desired angles while the unintended parties receive the signal through the side lobes. Although the resulting SNR from the side lobe transmission is smaller, it might still enable the unintended receivers to decode the data. The above time-modulated transmission enables one to further reduce the SNR in the undesired angles without tampering with it at the desired angle.
To this end, we design coding sequences q u that generate interference at the received signal only for the undesired angles through the w function in Equation (5), which increases the noise level at the unintended receivers and reduces their corresponding SNR.

DM enabled by space-time digitally-coded MTM-LWAs
Consider a communication setting composed of three parties: transmitter, legitimate receiver, and eavesdropper, referred to as Alice, Bob, and Eve, respectively. Bob, demonstrated as the green party in Figure 1, is located at a certain angle with respect to Alice. Eves, the red parties located at the other directions, are listening to the transmission, aiming to infer secret information sent by Alice to Bob. In this scenario, the goal of our proposed space-time digitally-coded MTM-LWA is to provide reliable communication to Bob, given the spatial angular information of Bob, while preventing Eves from correctly decoding the data We assume the communication link between Alice and Bob is operated over a total bandwidth of B over which Alice transmits an OFDM signal of K subcarriers. Mathematically, S(t) can be expressed as S(t) = 1/K K k=1 s k e j2π(f0+(k−1)fp)t , where f 0 , f p , and s k denote the carrier frequency, subcarrier width, and complex symbol transmitted in the kth subcarrier, respectively. The input secret bit stream at Alice is modulated with complex symbols, also known as the constellation points (see Figure 1), and subsequently mapped to the subcarriers. We note that the DM technique can effectively accomplish the two aforementioned design goals of security and reliability by intentionally manipulating the spectral components received at Bob and Eve. Our proposed MTM-LWAs can fulfill the functionalities of DM [8,9] solely by the use of digital coding sequence.
In order to enable DM for Bob, the following two goals shall be achieved. First, the original transmitted constellation points corresponding to the subcarriers of the OFDM signal, S(t), should be preserved along the desired angle ψ 0 , in order to facilitate the decoding process for the receiver. As the non-zero order harmonics in the w function in Equation (10) are the source of the interference introduced into the subcarriers, mathematically, we can express this constraint by    w(ν ̸ = 0, L, t, ψ 0 ) = 0, w(ν = 0, L, t, ψ 0 ) ̸ = 0 . Second, the received constellation points at different subcarriers along all the other angles should be distorted to reduce the chance of an eavesdropper to correctly decode the transmitted data. This is equivalent to imposing that w(ν ̸ = 0, L, t, ψ ̸ = ψ 0 ) ̸ = 0. Besides these two constraints, in order to maximize the SNR towards Bob, the angle of the main beam associated with R(ψ, t), i.e., the angle at which the radiation pattern has its maximum value, should be the same as ψ 0 for all t. This amounts to ψ 0 being the solution of argmax ψ |R(ψ, t)| for all t. By satisfying these three criteria, we have shown in Section S2 of the Supporting Information that the received signal in the desired angle is a weighted version of the transmitted OFDM signal, i.e., the complex symbols sent over the subcarriers can be reliably decoded. For the undesired angles, on the other hand, the received symbol in each subcarrier is corrupted by the interference terms.
The first two constraints mentioned above are related to the physical layer security while the third constraint pertains to the beam pattern of MTM-LWA, ensuring that the maximum amount of power is radiated in the desired direction. We have discussed in Section S3 of the Supporting Information why the second and the third constraints cannot be satisfied simultaneously. For the purpose of physical layer security, we relax the third constraint as ψ 0 = argmax ψ |R(ψ + d 1 u , t)| when t ∈ T u by introducing slack variables d 1 u for u = 1, . . . , L, which account for the deviations of the radiation pattern's main beam angle from the desired angle at different time steps. Based on the theoretical results obtained in the previous section, we then mathematically formulate the problem of finding digital coding sequences satisfying the above three constraints for a given ψ 0 as (see Section S3 of the Supporting Information) where L u and U u are decimal values representing the lower and upper bounds on the deviation slack variables, respectively. As Ξ(ψ 0 , q u ) corresponds to a LWA's radiation pattern with states q u , the first summation effectively computes the difference between the LWA radiation patterns for all L time steps at the desired angle. In other words, the minimizer finds coding sequences whose corresponding radiation patterns have similar values for the desired angle. The second summation accounts for the fact that the maximum of the radiation patterns occurs in the vicinity of the desired angle. In fact, larger values of d 1 u 's translate to larger differences between the radiation patterns at the undesired angles, which in part lead to higher levels of interference introduced to the received subcarriers in those angles. As the objective function explicitly depends on the radiation patterns at different time steps, and since more variations in the radiation patterns are desirable for satisfying the above requirements, the higher number of unit cells N would result in higher levels of security and reliability. It is important to note that one could add the phase delay values, i.e., β 0 p and β 1 p, to the list of optimization variables in the above problem as well. In particular, as β 0 p can be easily controlled by modifying the input voltage to the varactors of each unit cell, one could also optimize the above problem over the possible values of β 0 p. Generally, higher feasible values for phase delays are desirable as it makes a wider range of beam scanning possible for the LWA's radiation patterns.
We also comment on the role of the number of time steps (L) in the above optimization problem. We recall that the reliability constraint calls for the radiation patterns at different time steps to have the same value. Therefore, L = 2 can be deemed as the most suitable choice for meeting the reliability constraint as it is more challenging to satisfy this constraint for larger L's. However, one would have higher degrees of freedom for controlling the level of interference in the undesired angles by increasing L. In fact, one could compromise on the reliability level for the desired angle by increasing L in order to ensure a higher security level at the undesired angles.
The stated problem in Equation (7) is known to be MINLP optimization problem where the objective function is non-linear and the optimization variables are a mix of integer and real-valued quantities. We have also verified that the Hessian of the above objective function could have negative eigenvalues in general, which makes the problem non-convex. This kind of problem is NP-hard and no efficient global optimal solver is available in the literature [45]. A well-known mathematical optimization technique for finding local minima to the above problem is the branch and bound algorithm [46], which is the state-of-the-art solver for MINLPs, and we utilize it to find the digital coding sequences as elaborated in the Methods section. e where it is shown that one is able to achieve DM for different given desired angles by using the proper coding sequences obtained from solving the above MINLP. This would indeed reduce the complexity of the overall architecture compared to the existing time-modulated phased-arrays systems achieving DM [8,9], as it circumvents the need for the phase shifters.
The radiation pattern for this architecture is given by where θ and ϕ denote the elevation and azimuth receiving angles, respectively. Also. the phase-delay function for this architecture is given by where t ∈ T p and θ 0 and ϕ 0 denote the desired elevation and azimuth angles, respectively. We note that Λ u m is the phase shifter value of the mth branch during T u . As digital phase shifters have finite precision in practice, the amount of phase shift should be set to the closest quantized value to Λ u m . Also, similar to LWAs' states, phase shifters' values change periodically with a period of 1 fp which is governed by binary sequences generated by an FPGA. Focusing on the case in which two states are available for each unit cell in each branch, the digital coding sequence corresponding to the kth unit cell in the mth branch is given by The radiation pattern in this case can be obtained in a similar fashion to the above 1D digitally- and Similar to the 1D case, we then mathematically formulate the problem of finding digital coding sequences satisfying the three DM constraints mentioned in the previous section for a given θ 0 and ϕ 0 as (see Section S3 of the Supporting Information) where θ 0 and ϕ 0 denote the desired angles corresponding to the direction of legitimate receiver. Also, d 1 u and d 2 u are the optimization variables determining the amount of deviation of the radiation pattern from the desired angles at time step T u . We note that the coding sequences, q u , in this case is a matrix whose rows correspond to the digital codes for the LWA in each branch.   (7) for the 2D case. Figure 4.b displays the harmonic pattern of the fundamental frequency (ν = 0), which shows that the space-time digitally-coded MTM-LWA

Wireless channel and BER analysis
Until now we have shown the applicability of our proposed digitally coded MTM-LWAs for enabling DM in free space where there is only line of sight communication between the transmitter and the receiver. We now consider communications through a wireless channel where there could be more than one transmission path between the communication parties. This so-called multi-path effect is caused by refraction and reflection of waves from water bodies and terrestrial objects. The knowledge of channel gains between the antenna elements at the transmitter and those at a receiver, known as channel state information (CSI), is commonly available at two levels of perfect instantaneous CSI and partial CSI [2,47], where the former amounts to the actual realization of the channel gain at a given time, while the latter implies only the statistical distribution of the channel. In practice, CSI knowledge can readily be acquired in OFDM systems where certain subcarriers are allotted for sending/receiving known signals termed 'pilot'. Having access to the received version of the pilot and the actual transmitted pilot, one can utilize methods like least squares to estimate the channel coefficients [48]. Given the CSI of the Bob's and Eve's channels, Alice can perform beamforming in order to ensure data can be reliably decoded by Bob while preventing Eve from doing so. Such beamforming can be efficiently performed in the proposed programmable MTM-LWAs through the use of digital codes. The mathematical expression for the received signal in this case, which is a function of channel gains between the antenna elements at the transmitter and those at the receiver, can be obtained in a similar fashion to Equation (8) based on the Ξ function in Equation (11), which here we denote by Ξ(H, q u ) to emphasize its dependence on the channel gains H (see Section S4 of the Supporting Information).
As already alluded to, the digital codes in this case are found based on the criteria of reliability for Bob and security against Eve. As shown in Section S4 of the Supporting Information, the optimization problem can be formulated as follows where H AB and H EB denote the instantaneous CSI corresponding to Alice-Bob and Eve-Bob channels, respectively. The first summation imposes the requirement that the radiation patterns' The B&B algorithm finds the solution by iteratively searching a binary tree based on the MINLP.
At each node, the integrality constraints are dropped and a relaxed version of the optimization problem is solved whose objective value serves as a lower bound to the original problem. A global upper bound is only available when a feasible solution, which satisfies all the constraints including the integrality ones, is found at the node. The algorithm pops a node from a stack of nodes, evaluates the aforesaid two bounds, and then decides whether to prune a node or proceed to explore its children.
This process continues until the node stack is empty. The three main components of the branch and bound algorithm during this searching process are node selection, variable selection, and node  pruning policy [49]. The high time complexity of the branch and bound algorithm is attributed to the computational complexity of these three main components. In particular, node pruning policy is of utmost significance as it controls the size of the node stack. The original pruning policy of the algorithm takes the most conservative approach aimed at finding the optimal solution and guaranteeing its optimality by investigating all the feasible solutions. By designing an alternative pruning policy, one can significantly reduce the computational complexity of the algorithm by pruning the unpromising portions of the search tree more aggressively at the cost of compromising on a certificate for optimality [49,45].
We leverage supervised and transfer learning methods to devise a new node pruning policy for the B&B algorithm, which we refer to as learning-aided B&B. During the offline training stage,  such speed enhancement is compromising on the achieved reliability and security levels. However, we point out that the BER performance degradation, as shown in Figure 5, is not significant in terms of both system reliability/security, while the resulting speed improvement is substantial.

Experimental verification
In order to validate the DM functionality of the proposed architecture, we realize a space-time digitally-coded MTM-LWA with 9 unit cells pertaining to the 1D transmitter architecture in Figure   1.a. A schematic of the designed CRLH LWA is illustrated in Figure 6.a. Figure 6.b shows a blow-up version of the unit cell consisting of interdigital capacitors, shunt stub, and three varactors sharing a common bias voltage to make the unit cell tunable similar to the design procedure reported in [53]. The length of each unit cell (p) is 1.52 cm. We apply two levels of bias voltages to varactors via FPGA, each making the underlying unit cell work in either state "0" (β 0 p < 0) or state "1" (β 1 p > 0) in the frequency around 2 GHz located in the fast wave region of the unit cell (see Section S6 of the Supporting Information for the dispersion diagram of the unit cells). As shown in Figure 6.d, a prototype of the LWA with 9 tunable CRLH cells was fabricated on a RO5880 board with dielectric constant of 2.2 and thickness of 1.57 mm. In accordance with the measurement setup illustrated in It should be noted that the coding sequences used in our study are theoretically expected to suppress even-numbered harmonics, which is consistent with the measurement results showing that the level of these harmonics falls more than 30 dB below the dominant ones. Therefore, in Figures   6.h and 6.k, we have chosen not to display the even-numbered harmonics to emphasize the dominant ones. This similarity between the theoretical and measured results in harmonic patterns supports the concept of space-time LWA. However, we note that the null levels in the simulation results are much lower than those observed in the measurements. This can be attributed to non-ideal time-varying characteristics of the components, such as varactors, and also to a realistic wireless environment.
The simulation results are based on the array factor approach, as explained in Section 2, which does not account for these factors.
For the BER measurements, the transmitted OFDM signal with a carrier frequency of 1.95 GHz, subcarrier width of 15 kHz, and a total number of 64 subcarriers is generated via a commercially available software-defined radio (SDR) module. QPSK modulation is employed for mapping the information bits to the constellation points. Another SDR is also used to process the signal received by the horn antenna. Specifically, GNU Radio interface is used to implement the IEEE 802.11 standard for transmission and reception of OFDM packets. We have measured the BER through sending/receiving OFDM packets over the air (see Section S5 of the Supporting Information for more details). These results are illustrated in Figures 6.i and 6.l for the ψ 0 = 75 • and ψ 0 = 105 • cases, respectively. For one to appreciate this BER performance, it is necessary to compare it against a transmitter without DM. To this end, we have fixed the states of the cells in our MTM-LWA to [0 0 1 1 1 1 0 0 0] and [0 0 0 1 0 0 0 0 1] whose radiation patterns are illustrated in Figures   6.h and 6.k, respectively. As shown, the main beam directions for these two cases are the same as that of their corresponding fundamental frequency pattern in the time-modulated case, while the beam is more directive for the latter case due to DM. It can be seen that by using the DM scheme one can substantially improve the security of the system in physical layer as the BER in the undesired angles is much higher than that of the not time-modulated case. Also, note that under the proposed scheme the DM can be achieved for two different desired angles by the mere change of the coding sequences. Compared to the similar 1D DM schemes, the proposed space-time digitally-coded MTM-LWA substantially reduces the complexity as it circumvents the need for any phase shifters or antenna feed network design.

Discussion
In conclusion, we have proposed a DM scheme based on the idea of space-time digitally-codedmodulated MTM-LWA, in which propagation constant of each unit cell is periodically controlled by a set of temporal coding sequences. We have presented theoretical results concerning the radiation pattern in 1D and 2D cases for digitally-coded MTM-LWA. We have shown that by carefully designing the coding sequences, one can achieve the functionalities of the DM, i.e., providing reliability for the intended receiver while making the system secure against the eavesdroppers. To this end, an optimization problem is formulated which takes into account both spatial and spectral requirements pertaining to the DM. Furthermore, we have shown that the proposed transmitter architecture can be used to provide DM in a wireless channel setting where perfect or partial CSI is available at the transmitter. Extensive provided simulation results confirm the applicability of the proposed approach for achieving DM as a way of enhancing physical layer security. Compared to other existing DM transmitter, our newly-proposed architecture reduces the hardware complexity as it does not rely on phase shifters or an antenna feeding structure. As a proof of concept, we have further fabricated a digitally-coded CRLH LWA prototype in which an FPGA controller provides the predetermined coding sequences to the unit cells. This experimental setup have helped us to verify our presented theory in practice through both harmonic patterns and BER measurements.

Branch and bound algorithm as the solver for MINLP
The B&B algorithm solves a (mixed) integer non-linear program by iteratively searching a binary tree in which each node n is associated with a subproblem of the original problem. For each subproblem, constraints of the integer variables are modified in a way that some integer variables are determined while others are undetermined and relaxed into continuous variables within [0, 1] for the binary case.
Solving the corresponding subproblem at node n results in a local lower bound, L n , to the original solution, as the feasible region of the subproblem is larger than that of the original MINLP problem.
The searching process of the B&B algorithm contains four iterative steps.
1) Node selection: selecting a node from the unvisited node list of the tree.
2) Variable selection: selecting an optimization variable from the list of variables for the current node.
3) Evaluation: solving the corresponding nonlinear subproblem of the node to obtain its local upper bound.

4) Pruning policy:
This determines whether the current node is worth expanding or not. Specifically, using the local lower bound, L n , and the global upper bound, U , which is the optimal value of the objective function by far, the algorithm decides whether to prune a node or explore its children. The searching process comes to an end by iteratively repeating the above three steps until the node list is empty.
For simplicity, we adopt the depth-first-search as the node selection rule and always choose the first undetermined element in the coding sequence vector for variable selection process. The original prune policy of the B&B algorithm includes three cases: 1) The sub-problem is infeasible: If the relaxed nonlinear sub-problem in node n is infeasible, the related MINLP problem is also infeasible and then the node n is pruned.
2) A feasible solution is found: If the current solution in node n is an integral vector, the result is also a feasible solution of the related MINLP problem and then the node n is fathomed.
3) The local lower bound is greater than the current global upper: In this case, the node n would not lead to a better solution and is fathomed.

Enhancing speed of the B&B algorithm with deep learning
Here, we elaborate on the speed enhancement procedure utilized in this paper for the B&B algorithm.
We first note that the B&B algorithm aims for two primary goals, i.e., finding a solution and guaranteeing its optimality. The latter goal is achieved by searching all feasible solutions and comparing the found solution with them. Most of the time is consumed in this latter goal and a more aggressive pruning policy can significantly reduce the computational complexity. In fact, by pruning more nodes, the underlying search space is being limited, resulting in less time being consumed.
The price that is being paid for this increase in speed is that the solutions cannot be claimed to be optimal. Although the resulting solution would be suboptimal, the performance gap might be negligible compared to the achieved gain in speed. To this end and inspired by the literature of B&B algorithm, we aim for designing an alternative pruning policy that would prune all the non-optimal nodes. The speed enhancement of the B&B algorithm consists of the following steps. We begin by solving a number of training examples via the original B&B algorithm and collect training data in the form of node features and the corresponding labels, which shows whether the B&B algorithm has pruned a particular node or not. The node features correspond to the structure of binary tree utilized by the B&B algorithm and also the specific information about the CSIs. As the structural (problem independent) features, we have used the depth of node n, the plunge depth of node n, its local lower bound L n , value of branching variable, current global upper bound, and the number of solutions found so far. Also, CSI information from Alice-Bob and Alice-Eve channels pertaining to the current branching variable is also stored among the node features. Then, a DNN with three hidden layers, each with 200 number of neurons, is trained on the collected dataset, which given a node feature vector, predicts a binary label 0 (not prune) or 1 (prune). We train this neural network in multiple rounds each of which corresponding to one training example. Once the DNN is initially trained based on the dataset associated with the first training example, in each of the following rounds we utilize fine-tuning [50,51] as a transfer learning technique to refine the DNN's weights. In this way, the DNN learns to mimic the punning policy of the B&B algorithm over different rounds for multiple channel realizations.

BER measurements with SDRs
The BER measurement procedure is detailed as follows. Within a laptop with Ubuntu operating system, the GNU radio interface is used to implement the IEEE 802.11 standard based on OFDM packets. In total 500000 bits are transmitted in packets of length 25. The transmitted bits are saved in a file. Then, the generated OFDM signals are inputted to our proposed prototype, i.e., digitally-coded space-time leaky wave antenna, via a SDR and subsequently gets transmitted over the air. At the reception side, a horn antenna is used to received the time-modulated OFDM signals.
Another SDR is used to process the received signal via the GNU radio interface and save the decoded bits in a new file. By comparing the two saved files the BER is calculated for the over the air communication. A schematic of the BER measurement is provided in Section S5 of the Supporting Information.

Data availability
The data that support the findings of this study are available from the corresponding author upon reasonable request. In the following, we obtain the Fourier series coefficients of the periodic function U n (t) with fundamental frequency of f p = 1 Tp . If the constraints w (ν ̸ = 0, L, t, ψ 0 ) = 0 w (ν = 0, L, t, ψ 0 ) ̸ = 0 are satisfied, the received signal R (ψ 0 , t) at the desired angle ψ 0 would reduce to which is a weighted version of the transmitted OFDM signal.
For the undesired angles where w (ν, L, t, ψ ̸ = ψ 0 ) ̸ = 0, ∀ν, the received signal at the subcarrier f 0 + xf p is given by which is a function of the complex data from all the subcarriers and as well as the interference terms w (ν = x − k, L, t, ψ ).

Supplementary Note 3: Problem formulation for DM in free space
First, we note that the received signal in the 2D case can be stated as follows 1 : The problem formulation follows similar steps for the 1D case.
where Ξ (θ, ϕ, q u ) is given in equation (10) of the paper. The first optimization constraint pertaining to the desired direction can be stated by Here, the requirement on the second line is always satisfied while the first one imposes that L u=1 Ξ (θ 0 , ϕ 0 , q u ) e j2νπu L = 0. This condition is equivalent to Ξ (θ 0 , ϕ 0 , q ui ) = Ξ θ 0 , ϕ 0 , q uj , ∀u i , u j since it always holds that the sum of the Lth roots of unity equals to zero, i.e., which is satisfied by imposing that Ξ (θ , ϕ , q ui ) ̸ = Ξ θ , ϕ , q uj , ∀u i , u j , θ, ϕ. Finally, the third optimization constraint corresponding to the MTM-LWA beam pattern can be stated as θ 0 , ϕ 0 = argmax θ, ϕ |Ξ (θ , ϕ , q u )| , ∀u. As Ξ (θ , ϕ , q u ) corresponds to a LWA radiation pattern, this latter constraint results in time-invariant (not time-modulated) coding sequences, i.e., q ui = q uj , ∀u i , u j , which do not generate any harmonics. Therefore, aiming at satisfying the second constraint and achieving directional modulation, we relax the third constraint as θ 0 , ϕ 0 = argmax θ, ϕ Ξ θ + d 1 u , ϕ + d 2 u , q u , ∀u by introducing new variables d 1 u and d 2 u . This formulates the optimization problem as follows: where L u and U u correspond to the lower and upper limits for the introduced variables, respectively.
In the remaining, we have conducted further investigation for the 2D case. Specifically, we have obtained coding sequences for the case where the legitimate receiver is located in the direction  Fig. S1.a -S1.d illustrate the coding sequences, main harmonic, and the first four dominant higher-order harmonics. By comparing these results to the N = 12 case, which is presented in the paper, we have seen that higher-order harmonic levels are around 4 dB higher in average. Therefore, similar to the 1D case, increasing the number of unit cells leads to raising the harmonic levels for the undesired angles. This indeed causes more distortion for the received signal by Eve at the undesired angles or equivalently higher BER for Eve. Specifically, this can be verified by comparing the corresponding BER results from the N = 8 and N = 12 cases presented in Fig.   S1.e, S1.f, respectively, where the latter leads to a narrower low BER region (higher security) due to using a greater number of unit cells. We further note that increasing the number of time steps L would have similar effect to 1D, which is raising the harmonics levels for the undesired angles, i.e., higher security against Eve, but at the same time raising the null level, which leads to lower reliability for the legitimate receiver.

Supplementary Note 4: Problem formulation for DM in the case of wireless channel
The received signal from a digitally-coded LWA in the presence of a wireless channel is obtained by s k e j2π(fc+(k−1)fp)t e −α(n−1)p h AB nk U n (t) . where the number of receive antenna is set to 1 without loss of generality. The periodic phasedelay function is defined as U n (t) = L u=1 Γ n (q u ) H u (t), the same way as equation (2) in the paper. In particular, we note that the above signal is normalized for the path loss and h AB nk represents the normalized complex channel gain between Alice and Bob. Similar to the free space scenario, by expanding U n (t) in terms of its Fourier series we get R AB (t) = For the case of narrow-band communications, the channel gains for an antenna element over the whole frequency band can be taken to be identical, i.e., h ni ≈ h nj , ∀i, j. For this case, we define Ξ(H AB , q u ) = N n=1 Γ n (q u )e −α(n−1)p h AB n , where H AB denotes the instantaneous CSI vector consisting of h AB n 's. For the Alice-eavesdropper (AE) link, the received signal R AE (t) can be similarly obtained as above, given the corresponding instantaneous CSI H AE : Γ n (q u )e −α(n−1)p h AE n In order to provide DM towards the legitimate receiver, i.e., reliability for Bob and security for Eve, we again invoke the fact that the sum of the Lth roots of unity equals to zero. Subsequently, we can formulate the problem as follows arg min For the scenario where only partial CSI of the Alice-Eve link is available, we note that the AE channel can be modeled as a doubly correlated fading MIMO channel [47], namely, H AE = In the following table we have provided the BER degradation values corresponding to the learning-aided algorithm that is trained based on data corresponding to 40 CSIs from each of the Alice-Bob and Alice-Eve channels. The following table summarizes these results for two different set of (N, L) parameters and various SNR values. For the case of (N = 12, L = 2), the degradation values are smaller as the search space for the branch and bound algorithm is limited compared to the (N = 24, L = 4) case, where it is easier for the learning-aided algorithm to mimic the node pruning policy of the original branch and bound. Also, focusing on the (N = 24, L = 4) case and assuming a working SNR of 12 dB for both Bob and Eve, one can confirm from the Figure 5.h in the original manuscript that even the degraded BER values corresponding to the learning-aided algorithm still results in low BER of around 10 −4 for Bob and high BER of around 0.3 for Eve.
Case study SNR (dB) 0 2 4 6 8 10 12 Supplementary Note 5: BER measurements with software-defined radios (SDRs) Fig. S2 illustrates a schematic of the BER measurement procedure that is used to obtain BER results by sending/receiving bits over the air. As discussed in the methods OFDM signals are generated from the GNU radio interface which carry information bits over the air with the help of SDR from the transmitter to the receiver. At the reception side, a horn antenna is used to received the time-modulated OFDM signals and decode the information bits.