<commit_before>#=========================================================================
# RouteCompute
#=========================================================================
# This class implements the logic for route computation based on greedy
# routing algorithm. We assume a ring network with provided netmsg_params
# parameters, obtained from the net_msgs model, to calculate a route. We
# use each routers_id and route information to caculate the route.

from   pymtl import *
import pmlib

from   math import log,ceil,sqrt

import pmlib.net_msgs   as net_msgs
from   pmlib.TestVectorSimulator import TestVectorSimulator

class RouteCompute (Model):

  @capture_args
  def __init__( s, router_x_id, router_y_id, num_routers, srcdest_nbits ):

    # Local Constants

    s.router_x_id = router_x_id
    s.router_y_id = router_y_id

    # Note: Currently, converting a linear router_id into the x and y
    # dimensions assumes square torus networks with the number of nodes to
    # be a power of 2**n
    # CHANGED: Assuming that we pass in the x,y mapping to the router and
    # preserve it once it has been statically elaborated

    s.num_routers_1D = int( sqrt( num_routers ) )
    s.dim_nbits      = int( ceil( log( num_routers_1D, 2 ) ) )

    # Interface Ports

    s.dest          = InPort  ( srcdest_nbits )
    s.route         = OutPort ( 3 )

    # Temporary Wires

    s.dist_east     = Wire    ( s.dim_nbits )
    s.dist_west     = Wire    ( s.dim_nbits )
    s.dist_north    = Wire    ( s.dim_nbits )
    s.dist_south    = Wire    ( s.dim_nbits )

    s.x_dest        = Wire    ( s.dim_nbits )
    s.y_dest        = Wire    ( s.dim_nbits )
    s.x_self        = Wire    ( s.dim_nbits )
    s.y_self        = Wire    ( s.dim_nbits )

    #connect( s.x_self, s.router_x_id )
    #connect( s.y_self, s.router_y_id )

    #connect( s.x_dest, s.dest[ 0           :   s.dim_nbits ] )
    #connect( s.y_dest, s.dest[ s.dim_nbits : 2*s.dim_nbits ] )

    # Route Constants<commit_msg>[pex_dac] updates to dimension calc in route compute<commit_after>#=========================================================================
# RouteCompute
#=========================================================================
# This class implements the logic for route computation based on greedy
# routing algorithm. We assume a ring network with provided netmsg_params
# parameters, obtained from the net_msgs model, to calculate a route. We
# use each routers_id and route information to caculate the route.

from   pymtl import *
import pmlib

from   math import log,ceil,sqrt

import pmlib.net_msgs   as net_msgs
from   pmlib.TestVectorSimulator import TestVectorSimulator

class RouteCompute (Model):

  @capture_args
  def __init__( s, router_x_id, router_y_id, num_routers, srcdest_nbits ):

    # Local Constants

    s.router_x_id = router_x_id
    s.router_y_id = router_y_id

    # Note: Currently, converting a linear router_id into the x and y
    # dimensions assumes square torus networks with the number of nodes to
    # be a power of 2**n
    # CHANGED: Assuming that we pass in the x,y mapping to the router and
    # preserve it once it has been statically elaborated

    s.num_routers_1D = int( sqrt( num_routers ) )
    s.dim_nbits      = int( ceil( log( s.num_routers_1D, 2 ) ) )

    # Interface Ports

    s.dest          = InPort  ( srcdest_nbits )
    s.route         = OutPort ( 3 )

    # Temporary Wires

    s.dist_east     = Wire    ( s.dim_nbits )
    s.dist_west     = Wire    ( s.dim_nbits )
    s.dist_north    = Wire    ( s.dim_nbits )
    s.dist_south    = Wire    ( s.dim_nbits )

    s.x_dest        = Wire    ( s.dim_nbits )
    s.y_dest        = Wire    ( s.dim_nbits )
    s.x_self        = Wire    ( s.dim_nbits )
    s.y_self        = Wire    ( s.dim_nbits )

    #connect( s.x_self, s.router_x_id )
    #connect( s.y_self, s.router_y_id )

    #connect( s.x_dest, s.dest[ 0           :   s.dim_nbits ] )
    #connect( s.y_dest, s.dest[ s.dim_nbits : 2*s.dim_nbits ] )

    # Route Constants
{'fraction_non_alphanumeric': 0.14553990610328638, 'fraction_numerical': 0.003459352606869286, 'mean_word_length': 2.808090310442145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4476608', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1313, 'n_words': 382}