OpenCores
URL https://opencores.org/ocsvn/soc_maker/soc_maker/trunk

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [lib/] [soc_maker/] [core_def.rb] - Diff between revs 7 and 8

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 7 Rev 8
Line 72... Line 72...
    coder[ 'hdlfiles' ] = @hdlfiles
    coder[ 'hdlfiles' ] = @hdlfiles
  end
  end
  def init_with( coder )
  def init_with( coder )
    super( coder )
    super( coder )
 
 
    serr_if( coder[ 'hdlfiles' ] == nil,
#  TODO: this was removed because we want to
      'No hdlfiles field found',
#        support cores, which have a config-file only
      instance: @name,
#        (where config and implementation is in one file)
      fiel:     'hdlfiles' )
 
    @hdlfiles = coder[ 'hdlfiles' ]
#   serr_if( coder[ 'hdlfiles' ] == nil,
 
#     'No hdlfiles field found',
 
#     instance: @name,
 
#     fiel:     'hdlfiles' )
 
    @hdlfiles = coder[ 'hdlfiles' ] || {}
    serr_if( !@hdlfiles.is_a?( Hash ),
    serr_if( !@hdlfiles.is_a?( Hash ),
      'HDL file def. != Hash',
      'HDL file def. != Hash',
      instance: @name,
      instance: @name,
      field:    'hdlfiles' )
      field:    'hdlfiles' )
    serr_if( @hdlfiles.size  == 0,
#   serr_if( @hdlfiles.size  == 0,
      'No HDL files are given',
#     'No HDL files are given',
      instance: @name,
#     instance: @name,
      field:    'hdlfiles' )
#     field:    'hdlfiles' )
 
 
    @hdlfiles.each do |file_name, defn |
    @hdlfiles.each do |file_name, defn |
      serr_if( defn == nil,
      serr_if( defn == nil,
            'HDL file not defined',
            'HDL file not defined',
            instance:   @name+":"+file_name.to_s )
            instance:   @name+":"+file_name.to_s )
Line 110... Line 114...
    end
    end
  end
  end
 
 
 
 
  #
  #
 
  # TODO  this also exists in component.rb
 
  #       might this be removed?
 
  #       If yes, make sure, that the 'default' stuff
 
  #       is also done in component.rb!!!
 
  #
  # Iterates over interface list.
  # Iterates over interface list.
  # For each interface, all ports are processed.
  # For each interface, all ports are processed.
  # For each port within each interface, we lookup the port defn
  # For each port within each interface, we lookup the port defn
  # and yield the call block with
  # and yield the call block with
  #   - port-name
  #   - port-name
Line 121... Line 130...
  #   - info if last
  #   - info if last
  # as argument
  # as argument
  #
  #
  #
  #
  #
  #
  def ports( *args )
  #def ports( *args )
 
 
 
 
    if args.size == 0
    #if args.size == 0
      @interfaces.values.each_with_index do | ifc, i_ifc; ifc_def|
      #@interfaces.values.each_with_index do | ifc, i_ifc; ifc_def|
 
 
        # get interface definition
        ## get interface definition
        ifc_def = SOCMaker::lib.get_ifc( ifc.name, ifc.version )
        #ifc_def = SOCMaker::lib.get_ifc( ifc.name, ifc.version )
 
 
        # loop over ports in this interface
        ## loop over ports in this interface
        ifc.ports.each_with_index do |(port_name, port_def), i_port; port_dir|
        #ifc.ports.each_with_index do |(port_name, port_def), i_port; port_dir|
 
 
          # the reference to the port in the definition
          ## the reference to the port in the definition
          defn_ref = port_def.defn
          #defn_ref      = port_def.defn
          port_dir = ifc_def.ports[ defn_ref.to_sym ]
          #port_dir      = ifc_def.ports[ defn_ref.to_sym ][ :dir      ]
          perr_if( port_dir == nil,
          #port_default  = ifc_def.ports[ defn_ref.to_sym ][ :default  ]
                "Can't find #{defn_ref} in interface " +
          #perr_if( port_dir == nil,
                "definition #{ifc_def.name} version "  +
                #"Can't find #{defn_ref} in interface " +
                ifc_def.version + "==>>" + ifc_def.to_yaml )
                #"definition #{ifc_def.name} version "  +
 
                #ifc_def.version + "==>>" + ifc_def.to_yaml )
 
 
 
          ## An xor mechanism between port_dir and ifc=>dir is used
 
          ## to determine the direction of a port, for example:
 
          ##  If the interface is declared as input (1) and a port is declared as input (1)
 
          ##  the resulting direction will be an output 1^1 = 0.
 
          ##  But if the overall interface direction is an output (0) and a port is declared
 
          ##  as input, the resulting direction will an input 0^1 = 1.
 
          ## This allows to define a port-direction in the interface definition,
 
          ## and toggle the directions on core-definition level.
 
 
 
          ##  (name, direction, length, is_last)
 
          #yield(  port_name.to_s,
 
                  #port_dir ^ ifc.dir,
 
                  #port_def.len,
 
                  #port_default,
 
                  #( (i_port == ifc.ports.size-1 ) and (i_ifc == @interfaces.size-1 ) ) )
 
        #end
 
      #end
 
 
          # An xor mechanism between port_dir and ifc=>dir is used
##    elsif args.size == 1
          # to determine the direction of a port, for example:
 
          #  If the interface is declared as input (1) and a port is declared as input (1)
 
          #  the resulting direction will be an output 1^1 = 0.
 
          #  But if the overall interface direction is an output (0) and a port is declared
 
          #  as input, the resulting direction will an input 0^1 = 1.
 
          # This allows to define a port-direction in the interface definition,
 
          # and toggle the directions on core-definition level.
 
 
 
          #  (name, direction, length, is_last)
##      # get interface (input is the name as string  )
          yield(  port_name.to_s,
##      ifc = @interfaces[ args.first.to_sym  ]
                  port_dir ^ ifc.dir,
 
                  port_def.len,
 
                  ( (i_port == ifc.ports.size-1 ) and (i_ifc == @interfaces.size-1 ) ) )
 
        end
 
      end
 
 
 
#    elsif args.size == 1
##      ifc_def = SOCMaker::lib.get_ifc( ifc.name, ifc.version )
 
##      ifc.ports.each do |port_name, port_def; port_dir|
 
##        port_def = port_def.defn
 
##        port_dir = ifc_def.ports[ port_def.to_sym ]
 
##        if port_dir == nil
 
##          perr_if( port_dir==nil,
 
##              "Can't find #{port_def} in" +
 
##              "interface definition #{ifc_def.name} " +
 
##              "version #{ifc_def.version}" )
 
##        end
 
##        yield(  port_def.to_s,
 
##                port_name.to_s,
 
##                port_dir ^ ifc.dir )
 
##     end
 
 
#      # get interface (input is the name as string  )
    #else
#      ifc = @interfaces[ args.first.to_sym  ]
 
 
 
#      ifc_def = SOCMaker::lib.get_ifc( ifc.name, ifc.version )
 
#      ifc.ports.each do |port_name, port_def; port_dir|
 
#        port_def = port_def.defn
 
#        port_dir = ifc_def.ports[ port_def.to_sym ]
 
#        if port_dir == nil
 
#          perr_if( port_dir==nil,
 
#              "Can't find #{port_def} in" +
 
#              "interface definition #{ifc_def.name} " +
 
#              "version #{ifc_def.version}" )
 
#        end
 
#        yield(  port_def.to_s,
 
#                port_name.to_s,
 
#                port_dir ^ ifc.dir )
 
#     end
#     end
 
 
    else
  #end
 
 
    end
 
 
 
  end
 
 
 
 
 
  # this is a core_def and doesn't have
  # this is a core_def and doesn't have
  # sub-cores
  # sub-cores
  def get_core_def( inst )
  def get_core_def( inst )
    return nil
    return nil
  end
  end
 
 
  def consistency_check
  def consistency_check
 
    super
  end
  end
 
 
 
 
  def param_ok?( param_name, param_value )
  def param_ok?( param_name, param_value )
    param = inst_parameters[ param_name.to_sym ]
    param = inst_parameters[ param_name.to_sym ]

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.