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

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [lib/] [soc_maker/] [ifc_spc.rb] - Diff between revs 9 and 10

Show entire file | Details | Blame | View Log

Rev 9 Rev 10
Line 42... Line 42...
class IfcSpc
class IfcSpc
  include ERR
  include ERR
  include YAML_EXT
  include YAML_EXT
 
 
  attr_accessor :name
  attr_accessor :name
  attr_accessor :version
  attr_accessor :id
  attr_accessor :ports
  attr_accessor :ports
 
 
  def initialize( name, version, optional = {} )
  def initialize( name, id, optional = {} )
    init_with( { 'name' => name,
    init_with( { 'name' => name,
                 'version' => version }.merge( optional ) )
                 'id' => id }.merge( optional ) )
  end
  end
  def encode_with( coder )
  def encode_with( coder )
    %w[ name version ports ].
    %w[ name id ports ].
          each { |v| coder[ v ] = instance_variable_get "@#{v}" }
          each { |v| coder[ v ] = instance_variable_get "@#{v}" }
  end
  end
  def init_with( coder )
  def init_with( coder )
 
 
    verr_if( coder[ 'name' ] == nil,
    verr_if( coder[ 'name' ] == nil,
Line 67... Line 67...
    verr_if( @name.size == 0,
    verr_if( @name.size == 0,
        "Name has zero length",
        "Name has zero length",
        field: "name" )
        field: "name" )
 
 
 
 
    verr_if( coder[ 'version' ] == nil,
    verr_if( coder[ 'id' ] == nil,
      "Version is not defined",
      "Id is not defined",
      field: "version" )
      field: "id" )
    @version = coder[ 'version' ]
    @id = coder[ 'id' ]
    verr_if( !@version.is_a?( String ),
    verr_if( !@id.is_a?( String ),
        "Version is not defined as string",
        "Version is not defined as string",
      instance: @name,
      instance: @name,
      field:    "version" )
      field:    "id" )
    verr_if( @version.size == 0,
    verr_if( @id.size == 0,
        "Version has zero length",
        "Version has zero length",
        field: "name" )
        field: "name" )
 
 
    @ports = coder[ 'ports' ] || {}
    @ports = coder[ 'ports' ] || {}
    @ports.each do |pname, port|
    @ports.each do |pname, port|

powered by: WebSVN 2.1.0

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