# Path: nord/g2/colors.py



from nord.g2.colors import g2conncolors
  reservedmidiccs = [ 0, 1, 7, 11, 17, 18, 19, 32, 64, 70, 80, 96, 97 ] + \
      range(120, 128)
  return cc in reservedmidiccs

def handle_uprate(g2area):
  # parse the entire netlist of the area and .uprate=1 all
  # modules with blue_red and yellow_orange inputs connected to red outputs.
  # scan module list until we don't change any modules
  done = 0
  while not done:
    modified = 0
    for module in g2area.modules:
      #debug('%s:%s' % (module.name, module.type.shortnm))
      for minput in module.inputs:
        if not minput.net:
          continue
        #debug(' %s:%d' % (minput.type.name, minput.rate))
        # try and make all logic run at control rate.
        if minput.rate == g2conncolors.yellow_orange:
          minput.rate = g2conncolors.yellow
          continue
        if minput.rate != g2conncolors.blue_red:
          continue
        if not minput.net.output:
          continue
        if minput.net.output.rate == g2conncolors.red:
          #debug('%s:%s %s' % (
          #     module.name, minput.type.name, minput.net.output.type.name))
          modified = 1
          module.uprate = 1

# Path: nord/g2/colors.py



# Path: nord/g2/misc.py
from nord.g2.colors import g2conncolors

  reservedmidiccs = [ 0, 1, 7, 11, 17, 18, 19, 32, 64, 70, 80, 96, 97 ] + \
      range(120, 128)
  return cc in reservedmidiccs

def handle_uprate(g2area):
  # parse the entire netlist of the area and .uprate=1 all
  # modules with blue_red and yellow_orange inputs connected to red outputs.
  # scan module list until we don't change any modules
  done = 0
  while not done:
    modified = 0
    for module in g2area.modules:
      #debug('%s:%s' % (module.name, module.type.shortnm))
      for minput in module.inputs:
        if not minput.net:
          continue
        #debug(' %s:%d' % (minput.type.name, minput.rate))
        # try and make all logic run at control rate.
        if minput.rate == g2conncolors.yellow_orange:
          minput.rate = g2conncolors.yellow
          continue
        if minput.rate != g2conncolors.blue_red:
          continue
        if not minput.net.output:
          continue
        if minput.net.output.rate == g2conncolors.red:
          #debug('%s:%s %s' % (
          #     module.name, minput.type.name, minput.net.output.type.name))
          modified = 1
          module.uprate = 1

          minput.rate = g2conncolors.red