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

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [lib/] [soc_maker/] [hdl_coder.rb] - Diff between revs 3 and 5

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

Rev 3 Rev 5
Line 188... Line 188...
  end
  end
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  def ifc_declaration( ifc_spec, ifc_name, length )
  def ifc_declaration( ifc_spec, ifc_name, length )
 
 
    ifc_spec.ports.each do |port_name, port|
    ifc_spec.ports.each do |port_name, port|
 
 
      @decl_part << "signal #{ifc_name}_#{port_name.to_s} : "
      @decl_part << "signal #{ifc_name}_#{port_name.to_s} : "
Line 219... Line 222...
        dst_inst_sel = src_inst
        dst_inst_sel = src_inst
        src_ifc_sel  = dst_ifc
        src_ifc_sel  = dst_ifc
        dst_ifc_sel  = src_ifc
        dst_ifc_sel  = src_ifc
      end
      end
 
 
 
 
 
      # length == 0 means, that no
 
      # signal is assigned to this connection
 
      if length[ port_name ] > 0
 
 
      port_tmp_name = "#{ifc_name}_#{port_name.to_s}"
      port_tmp_name = "#{ifc_name}_#{port_name.to_s}"
 
 
 
 
      # combine all sources
      # combine all sources
      tmp = "#{port_tmp_name} <= "
      tmp = "#{port_tmp_name} <= "
      # loop over instances
      # loop over instances
      src_inst_sel.each_with_index do |(inst_name, inst), i|
      src_inst_sel.each_with_index do |(inst_name, inst), i|
        ( tmp_name, port) = inst.get_port( src_ifc_sel[ inst_name ], port_name )
        ( tmp_name, port) = inst.get_port( src_ifc_sel[ inst_name ], port_name )
 
          if port != nil
        tmp << "\"" + "0" * ( length[ port_name ] - port[ :len ] ) + "\" & "  if port[ :len ] < length[ port_name ]
        tmp << "\"" + "0" * ( length[ port_name ] - port[ :len ] ) + "\" & "  if port[ :len ] < length[ port_name ]
        tmp << "#{inst_name}_#{tmp_name}"
        tmp << "#{inst_name}_#{tmp_name}"
        tmp << " and \n" unless i == src_inst_sel.size-1
        tmp << " and \n" unless i == src_inst_sel.size-1
      end
      end
 
 
 
        end
      tmp << ";\n"
      tmp << ";\n"
      @asgn_part << tmp
      @asgn_part << tmp
 
 
      # assign to destination
      # assign to destination
      tmp = ""
      tmp = ""
      dst_inst_sel.each_with_index do |(inst_name, inst), i|
      dst_inst_sel.each_with_index do |(inst_name, inst), i|
        ( tmp_name, port) = inst.get_port( dst_ifc_sel[ inst_name ], port_name )
        ( tmp_name, port) = inst.get_port( dst_ifc_sel[ inst_name ], port_name )
 
          if port != nil
        tmp << "#{inst_name}_#{tmp_name} <= #{port_tmp_name}"
        tmp << "#{inst_name}_#{tmp_name} <= #{port_tmp_name}"
        tmp << "( #{port[ :len ]}-1 downto 0 )" if port[ :len ] > 1
        tmp << "( #{port[ :len ]}-1 downto 0 )" if port[ :len ] > 1
        tmp << ";\n"
        tmp << ";\n"
      end
      end
 
        end
      @asgn_part << tmp
      @asgn_part << tmp
 
      end
 
 
    end
    end
 
 
 
 
 
 
Line 255... Line 268...
 
 
 
 
 
 
  # TODO: add sig list as argument (or interface list) for entity description
  # TODO: add sig list as argument (or interface list) for entity description
  def get_entity( soc, entity_name )
  def get_entity( soc, entity_name )
    entity_str = SOCMaker::conf[ :LIC ].split(/\n/).map{ |s| "-- "+s }.join("\n")
    add_toplevel_sig( soc, entity_name )
 
    entity_str = SOCMaker::conf[ :LIC ].split(/\n/).map{ |s| "-- "+s }.join("\n") + "\n"
    entity_str << "-- Auto-Generated by #{SOCMaker::conf[ :app_name ]} \n"
    entity_str << "-- Auto-Generated by #{SOCMaker::conf[ :app_name ]} \n"
    entity_str << "-- Date: #{Time.now}\n"
    entity_str << "-- Date: #{Time.now}\n"
    entity_str << SOCMaker::conf[ :vhdl_include ] + "\n"
    entity_str << SOCMaker::conf[ :vhdl_include ] + "\n"
    entity_str << "entity #{entity_name} is \n"
    entity_str << "entity #{entity_name} is \n"
    tmp = entity_port_str( soc )
    tmp = entity_port_str( soc )
Line 283... Line 297...
    entity_str << @inst_part
    entity_str << @inst_part
    entity_str << "end ARCHITECTURE IMPL;"
    entity_str << "end ARCHITECTURE IMPL;"
    return entity_str
    return entity_str
  end
  end
 
 
 
  def add_toplevel_sig( soc, entity_name )
 
    soc.ports do |port_name, length, dir, is_last|
 
      @asgn_part << "#{port_name} <= #{entity_name}_#{port_name}"
 
      @asgn_part << "," unless is_last
 
      @asgn_part << "\n"
 
      if length > 1
 
        @decl_part << "signal #{entity_name}_#{port_name} : std_logic_vector( #{length}-1 downto 0 );\n"
 
      else
 
        @decl_part << "signal #{entity_name}_#{port_name} : std_logic;\n"
 
      end
 
    end
 
  end
 
 
 
 
 
 
  def asgn_str( ifc_spec, con,  ifc_name, core1, core1_name, core2, core2_name )
  def asgn_str( ifc_spec, con,  ifc_name, core1, core1_name, core2, core2_name )
    port_string = ""
    port_string = ""

powered by: WebSVN 2.1.0

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