# Exploring a New Adaptive Routing Based on the Dijkstra Algorithm in Optical Networks-on-Chip
## 3 Adaptive Power Control of ONoCs Based on the Dijkstra Algorithm
### Network Architecture  
Based on the \(5\times 5\) mesh-based ONoCs shown in Figure 4, we analyze how to select the routing path using the Dijkstra algorithm as follows. The \(5\times 5\) mesh model based ONoCs is shown in Figure 4a, and the internal structure of the router is shown in Figure 4b. We use a two-dimensional coordinate system to denote the position of the router in the \(5\times 5\) mesh-based ONoCs shown in Figure 4a. For example, the coordinate of router connected to core \(IP_{-}1\) is expressed as (\(1\), \(1\)). \(L_{ij}(x,y)\) represents the transmission loss from the \(i\)th output port to the \(j\)th input port in router \((x,y)\). In the Dijkstra algorithm, it is used as the weight value between the current router and the next-hop router which the \(j\)th port of the current router will be connected to. In multiple pairs of source nodes in concurrent communication with mesh-based ONoCs, the coordinates of source node and destination node can be divided into four types. The destination node is in the upper left, upper right, lower left, or lower right of the source node. We use a two-dimensional matrix to store all possible port transmission losses of the router in Figure 4b. After obtaining the packet with the coordinate information of the destination node, the corresponding weights of router will be updated according to the transmission loss stored in the two-dimensional matrix. Moreover, the Dijkstra algorithm is used to compare the port-to-port transmission loss of the current router and determine the next hop router. For example, when processor core \(IP_{-}1\) communicates with processor core \(IP_{-}8\), the optical signal will be transmitted from \(IP_{-}1\) to router \((1,1)\) through the \(0\)th input port of router \((1,1)\). We choose \(L_{0,2}(1,1)\) as the transmission loss between router \((1,1)\) and router \((1,2)\), then treat \(L_{0,3}(1,1)\) as the transmission loss between router \((1,1)\) and router \((2,1)\). Firstly, compare \(L_{0,2}(1,1)\) and \(L_{0,3}(1,1)\). In terms of the internal structure of router used in this paper, \(L_{0,2}(1,1)\) is smaller; the optical signal will be transmitted from the 2 nd output port of router \((1,1)\) to the 4 th input port of router \((1,2)\). Secondly, compare the transmission loss \(L_{4,3}(1,2)\) between the processor core router \((1,2)\) and router \((2,2)\) and the transmission loss \(L_{4,2}(1,2)\) between processor core router \((1,2)\) and router \((1,3)\). As \(L_{4,3}(1,2)\) is smaller, the optical signal will be transmitted from the 3 rd output port of router \((1,2)\) to the 1 st input port of router \((2,2)\). More importantly, the Dijkstra algorithm will calculate and compare between \(L_{0,2}(1,1)\) + \(L_{4,3}(1,2)\) and \(L_{0,3}(1,1)\) + \(L_{1,2}(2,1)\) to determine whether the routing path achieves the minimum transmission loss or not. Finally, the optical signal will be transmitted from the 2 nd output port of router \((2,2)\) to the 4 th input port of router \((2,3)\). The optical signal passes from the 0 th output port of the router \((2,3)\) to processor core \(IP_{-}8\) to complete this communication. Ultimately, when processor core \(IP_{-}1\) communicates with processor core \(IP_{-}8\), the routing path selected by the above algorithm is: \(IP_{-}1\)-router \((1,1)\)-router \((1,2)\)-router \((2,2)\)-router \((2,3)\)-\(IP_{-}8\). The control information and data are transmitted through the electrical link in the traditional electronic interconnection network, whose packet switching mechanisms are circuit switching, packet switching, wormhole switching, etc. The optoelectronic interconnection network on the chip is composed of the combination between the electronic interconnection layer and the optical interconnection layer. Considering that there is no effective buffering technique for optical signal in ONocs so far, the circuit has great difficulty in reserving the routing path.