Hi Karim, I'm not very familiar with the Mesh_XY topology, but here is my attempt to explain this.
I think the layout of the topology looks like this, 2 (0,1) <-----> 3 (1,1) ^ ^ | | v v 0 (0,0) <-----> 1 (1,0) It's straightforward to send a packet from one node to its adjacent node, such as sending a package from 2 to 3 consists of having the node 2 sending a local packet to its West side. When the source and the destination are more than 1 hop away, it involves sending a packet to immediate node. It showed in your example's line 5, there's a packet that is sent from 1 (1,0) to 2 (0,1). It can't be done in one hop. So, at first, the packet was sent from the local of node 1 to its West side. In the next step, node 0 receives the packet from its East side, and routes that packet to its North side. That explains the example's line 9. Hope this helps! Regards, Hoa Nguyen On Wed, Mar 8, 2023 at 11:25 PM Karim Soliman via gem5-users < gem5-users@gem5.org> wrote: > Hi, for my research I'm trying to implement a custom routing algorithm in > gem5/garnet. > Someone from the mailing list recommended that I should go for the Mexh_XY > routing algorithm to understand how it's working. > > The mesh topology i'm using contains only 4 cpus and 4 dirs and number of > mesh rows is 2, and the routing-algorithm option is set to 1 > > here is the full simulation command i'm using > > *sudo build/NULL/gem5.debug --debug-flags=RubyNetwork > configs/example/garnet_synth_traffic.py --num-cpus=4 --num-dirs=4 > --mesh-rows=2 --network=garnet --routing-algorithm=1 --topology=Mesh_XY > --synthetic=uniform_random --injectionrate=0.1* > > In the file mem/ruby/garnet/RoutingUnit.cc --> the function > outportComputeXY > > int RoutingUnit::outportComputeXY(RouteInfo route, int inport, > PortDirection inport_dirn) > > I'm trying to get some output during the simulation to understand the > routing table at each router and how the lookup table works. > > The following is my code. I'm using a file to get the data during the > simulation > So, the file will print the following: > > [RouterId] [DestinationRouter] [hops_x] [hops_y] [InportDirn] --> > [outport_dirn] [router_x, router_y] [des_x, dest_y]. > and output the lookup table attached to the router. > > std::ofstream myfile; > // open the file in appending mode > myfile.open ("routing_output.txt", std::ios_base::app); > myfile << m_router->get_id() << "\t" << route.dest_router << " | > hops_x: " << x_hops << " | hops_y: " << y_hops << "\t"; > myfile << inport_dirn << " --> " << outport_dirn << "\t" << > m_outports_dirn2idx[outport_dirn] << "\t" << my_x << ", " << my_y; > myfile << " --> "<< dest_x << ", " << dest_y << std::endl; > // iterate over the outports table map and write the data to the file. > std::map<std::__cxx11::basic_string<char>, int>::iterator it; > for(it = m_outports_dirn2idx.begin(); it != m_outports_dirn2idx.end(); > it++) > { > myfile << it->first << "\t" << it->second << std::endl; > } > myfile.close(); > > Here are some samples of my output file and also the full txt file is > attached. > > [image: image.png] > > I don't really know how the packets are routed and also how the lookup > table works. also i can't imagine the connections between the nodes i tried > to draw a flow chart for each router > but some of the output data doesn't match the drawing -- like a packet > from router #2 will go east !! > [image: image.png] > Can anyone explain to me? or if there is any documentation I can check to > understand this. > > Best Regards, > *Eng. Karim Soliman* > Teaching Assistant > Computer Engineering Department > Pharos University in Alexandria (P.U.A) > _______________________________________________ > gem5-users mailing list -- gem5-users@gem5.org > To unsubscribe send an email to gem5-users-le...@gem5.org >
_______________________________________________ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org