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

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [lib/] [soc_maker/] [soc_def.rb] - Diff between revs 5 and 6

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

Rev 5 Rev 6
Line 129... Line 129...
    return false
    return false
 
 
  end
  end
 
 
 
 
 
  def get_len( ifc_name, port_name, inst )
 
    if @cores[ inst.to_sym ] != nil
 
      return @cores[ inst ].get_len( ifc_name, port_name )
 
    else
 
      return nil
 
    end
 
  end
 
 
  def get_core_def( inst )
  def get_core_def( inst )
      if @cores[ inst.to_sym ] != nil
      if @cores[ inst.to_sym ] != nil
        return @cores[ inst.to_sym ].defn
        return @cores[ inst.to_sym ].defn
      elsif inst == @name
      elsif inst == @name
        return self
        return self
      else
      else
        perr_if( true,
        return nil
          "Instance '#{inst}' does not exist in SOC '#{self.name}'" )
 
      end
      end
  end
  end
 
 
 
 
 
 
Line 247... Line 253...
 
 
    return @static[ core.to_sym ][ param.to_sym ]
    return @static[ core.to_sym ][ param.to_sym ]
  end
  end
 
 
 
 
 
 
  def gen_toplevel( coder = VHDLCoder.new() )
 
 
 
    file_name = @name.dup
 
 
 
    if coder.is_a?( VHDLCoder )
 
      file_name << ".vhd"
 
    elsif coder.is_a?( VerilogCoder )
 
      file_name << ".v"
 
    else
 
      perr_if( true,
 
        "No valid coder" )
 
    end
 
 
 
 
 
    SOCMaker::logger.proc( "START of creating top-level '" + file_name + "'" )
 
 
 
 
 
    #
 
    # Create a unique list of cores and
 
    # add every core to your implementation.
 
    # Even if there are multiple instances of a core,
 
    # we need to decalre it only once
 
    #
 
    @cores.values.uniq{|x| x.type }.each do |inst; spec|
 
 
 
      spec = SOCMaker::lib.get_core( inst.type  )
 
      SOCMaker::lib.check_nil( spec, "Can't find #{ inst.type } in SOC library" )
 
 
 
      coder.add_core_declaration( inst.type, spec )
 
    end
 
 
 
   #core_instances = {}
 
   #@cores.each do |inst_name, _core_inst|
 
   #  # the corresponding core from SOC lib
 
   #  core_def = SOCMaker::lib.get_core( _core_inst[ :type ] )
 
   #  core_instances[ inst_name ] = SOCMaker::CoreInst.new( core_def, _core_inst[ :params ] )
 
   #end
 
 
 
 
 
    @cores.each do |inst_name, inst|
 
      coder.add_core_inst( inst_name.to_s, inst )
 
    end
 
 
 
 
 
 
 
    # Iterate over all connections:
 
    #  - create signal instances
 
    #  - add assignments
 
    #
 
    @cons.each do |con_name, con_def|
 
      gen_toplevel_con(   con_name.to_s,
 
                          con_def[ :rule ],
 
                          con_def[ :mapping ][0],
 
                          con_def[ :mapping ][1],
 
      coder  )
 
 
 
    end
 
 
 
    SOCMaker::logger.proc( "writing top-level" )
 
 
 
    file_dir  = File.join( SOCMaker::conf[ :build_dir ],
 
                           SOCMaker::conf[ :hdl_dir   ] )
 
    ::FileUtils.mkdir_p file_dir
 
    file_path = File.join( file_dir, file_name )
 
    File.open( file_path, 'w' ) do |f|
 
      f.write( coder.get_entity( self, "test" ) )
 
    end
 
    SOCMaker::logger.proc( "END of creating top-level" )
 
 
 
  end
 
 
 
 
 
  def gen_toplevel_con( name, rule, src, dst, coder )
 
 
 
    src_inst            = {};
 
    dst_inst            = {};
 
 
 
    # fetch somehow the spec
 
    ifc_spec = SOCMaker::lib.get_ifc(
 
      get_core_def( src.keys.first.to_s ).interfaces[ src.values.first ].name,
 
      get_core_def( src.keys.first.to_s ).interfaces[ src.values.first ].version )
 
 
 
    port_used_tmp = {};
 
    ifc_spec.ports.keys.each do |_name|
 
      # TODO: bis dahin konnte angenommen werden, dass self auch eine Art instanz ist,
 
      #       aber hier geht das nicht mehr, weil get_len nur für CoreInst definiert ist.
 
      #
 
 
 
 
 
      # create a length table
 
      port_used_tmp[ _name ] = false
 
      dst.each do |inst_name, ifc_name|
 
        port_used_tmp[ _name ] ||= get_core_def( inst_name ).implements_port?( ifc_name, _name )
 
      end
 
      src.each do |inst_name, ifc_name|
 
        port_used_tmp[ _name ] ||= get_core_def( inst_name ).implements_port?( ifc_name, _name )
 
      end
 
    end
 
 
 
    # getting the maximum length for each signal
 
#    max_length = Hash[ length_tmp.map{ |key, arr| [ key, arr.max ] } ]
 
 
 
#    coder.ifc_declaration( ifc_spec, name, max_length )
 
 
 
 
 
 
 
    src.keys.each do |inst_name|
 
      src_inst[ inst_name ]            = @cores[ inst_name ]
 
    end
 
    dst.keys.each do |inst_name|
 
      dst_inst[ inst_name ]            = @cores[ inst_name ]
 
    end
 
 
 
 
 
 
 
#    coder.ifc_assignment( ifc_spec, name, max_length, src_inst, dst_inst, src, dst )
 
 
 
  end
 
 
 
  def copy_files
  def copy_files
 
 
    SOCMaker::logger.proc( "START of copying all HDL files" )
    SOCMaker::logger.proc( "START of copying all HDL files" )
 
 
    #
    #
Line 443... Line 329...
 
 
    SOCMaker::logger.proc( "END of copying all HDL files" )
    SOCMaker::logger.proc( "END of copying all HDL files" )
  end
  end
 
 
 
 
 
 
  def ==(o)
  def ==(o)
    o.class   == self.class   &&
    o.class   == self.class   &&
    o.cores   == self.cores   &&
    o.cores   == self.cores   &&
    o.cons    == self.cons    &&
    o.cons    == self.cons    &&
    o.static  == self.static  &&
    o.static  == self.static  &&

powered by: WebSVN 2.1.0

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