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 9 and 10

Show entire file | Details | Blame | View Log

Rev 9 Rev 10
Line 33... Line 33...
###############################################################
###############################################################
#
#
#   Description:
#   Description:
#
#
########
########
#
 
# TODO
 
#
 
#
 
###############################################################
 
 
 
 
 
module SOCMaker
module SOCMaker
 
 
 
 
#########
#########
#
#
Line 62... Line 55...
  include YAML_EXT
  include YAML_EXT
 
 
  attr_accessor :hdlfiles
  attr_accessor :hdlfiles
 
 
 
 
  def initialize( name, version, hdl_files, toplevel, optional = {} )
  #
 
  # Constructor
 
  # The four attributes are required, and all other attributes
 
  # can be given as a optinal hash
 
  #
 
  # *name*:: Name of this component
 
  # *id*:: Id of this component
 
  # *hdl_files*:: Hash of HDL files
 
  # *toplevel*:: Toplevel name
 
  # *optional*:: Non-mandatory values, which can be set during initialization.
 
  #
 
  #
 
  def initialize( name, id, hdl_files, toplevel, optional = {} )
    init_with( { 'name'      => name,
    init_with( { 'name'      => name,
                 'version'   => version,
                 'id'        => id,
                 'hdlfiles'  => hdl_files,
                 'hdlfiles'  => hdl_files,
                 'toplevel'  => toplevel }.merge( optional ) )
                 'toplevel'  => toplevel }.merge( optional ) )
  end
  end
 
 
 
  #
 
  # Encoder function (to yaml)
 
  #
 
  # +coder+:: An instance of the Psych::Coder to encode this class to a YAML file
 
  #
  def encode_with( coder )
  def encode_with( coder )
    super coder
    super coder
    coder[ 'hdlfiles' ] = @hdlfiles
    coder[ 'hdlfiles' ] = @hdlfiles
  end
  end
 
 
 
  #
 
  # Initialization function (from yaml)
 
  #
 
  # +coder+:: An instance of the Psych::Coder to init this class from a YAML file
 
  #
 
  #
  def init_with( coder )
  def init_with( coder )
    super( coder )
    super( coder )
 
 
    @hdlfiles = coder[ 'hdlfiles' ] || {}
    @hdlfiles = coder[ 'hdlfiles' ] || {}
    serr_if( !@hdlfiles.is_a?( Hash ),
    serr_if( !@hdlfiles.is_a?( Hash ),
Line 95... Line 113...
 
 
  end
  end
 
 
 
 
 
 
 
  #
 
  # Loop over all generic values of the core
 
  # and yield the block with the
 
  # - generic name
 
  # - generic type
 
  # - the default value
 
  # - is-last value
 
  #
 
  #
  def generics
  def generics
    @inst_parameters.each_with_index do |(name, val), i|
    @inst_parameters.each_with_index do |(name, val), i|
      yield( name.to_s, val.type, val.default, i == @inst_parameters.size-1 )
      yield( name.to_s, val.type, val.default, i == @inst_parameters.size-1 )
    end
    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 )
 
    perr_if( nil, "We don't have sub-cores" )
    return nil
    return nil
  end
  end
 
 
 
 
 
  #
 
  # Nothing implemented, yet.
 
  #
  def consistency_check
  def consistency_check
    super
    super
  end
  end
 
 
 
 
  def param_ok?( param_name, param_value )
  #
    param = inst_parameters[ param_name.to_sym ]
  # Equality operator
    param = static_parameters[ param_name.to_sym ] if param == nil
  #
    return false if param == nil
 
  end
 
 
 
 
 
  def ==(o)
  def ==(o)
    o.class         == self.class       &&
    o.class         == self.class       &&
    o.hdlfiles      == self.hdlfiles    &&
    o.hdlfiles      == self.hdlfiles    &&
    super( o )
    super( o )
  end
  end
 
 
 
  #
 
  # Returns a string describing this instance
 
  #
 
  def to_s
 
    super
 
  end
 
 
 
 
end # class CoreDef
end # class CoreDef
end # module SOCMaker
end # module SOCMaker
 
 
 
 

powered by: WebSVN 2.1.0

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