Line 50... |
Line 50... |
|
|
attr_accessor :defn
|
attr_accessor :defn
|
attr_accessor :type
|
attr_accessor :type
|
attr_accessor :params
|
attr_accessor :params
|
|
|
|
#
|
|
# Constructor
|
|
# There is one mandatory attributes and an optional one.
|
|
#
|
|
# *type*:: The id of the core-definition, which is instanciated
|
|
# *params*:: Instanciation parameters
|
|
#
|
def initialize( type, params = {} )
|
def initialize( type, params = {} )
|
init_with( 'type' => type,
|
init_with( 'type' => type,
|
'params' => params )
|
'params' => params )
|
|
|
end
|
end
|
Line 159... |
Line 166... |
|
|
|
|
#
|
#
|
# Get filename
|
# Get filename
|
#
|
#
|
file_name = coder.filename( @defn.name )
|
file_name = coder.filename( @defn.dir_name )
|
|
|
SOCMaker::logger.proc( "START of creating top-level '" + file_name + "'" )
|
SOCMaker::logger.proc( "START of creating top-level '" + file_name + "'" )
|
|
|
|
|
#
|
#
|
Line 186... |
Line 193... |
@defn.cores.each do |inst_name, inst|
|
@defn.cores.each do |inst_name, inst|
|
coder.add_core_instance( inst_name.to_s, inst )
|
coder.add_core_instance( inst_name.to_s, inst )
|
end
|
end
|
|
|
|
|
|
|
# Iterate over all connections:
|
# Iterate over all connections:
|
# - create signal instances
|
# - create signal instances
|
# - add assignments
|
# - add assignments
|
#
|
#
|
@defn.cons.each do |con_name, con_def|
|
@defn.cons.each do |con_name, con_def|
|
Line 210... |
Line 216... |
SOCMaker::logger.proc( "writing top-level" )
|
SOCMaker::logger.proc( "writing top-level" )
|
file_dir = File.join( SOCMaker::conf[ :build_dir ],
|
file_dir = File.join( SOCMaker::conf[ :build_dir ],
|
SOCMaker::conf[ :hdl_dir ] )
|
SOCMaker::conf[ :hdl_dir ] )
|
::FileUtils.mkdir_p file_dir
|
::FileUtils.mkdir_p file_dir
|
File.open( File.join( file_dir, file_name ), 'w' ) do |f|
|
File.open( File.join( file_dir, file_name ), 'w' ) do |f|
|
f.write( coder.get_hdl_code( self, @defn.name ) )
|
f.write( coder.get_hdl_code( self, @defn.toplevel ) )
|
end
|
end
|
SOCMaker::logger.proc( "END of creating top-level hdl code for #{@defn.name}" )
|
SOCMaker::logger.proc( "END of creating top-level hdl code for #{@defn.name}" )
|
|
|
end
|
end
|
|
|
Line 240... |
Line 246... |
ifc_sel = @_ifcs_evaluated
|
ifc_sel = @_ifcs_evaluated
|
else
|
else
|
ifc_sel = @_ifcs_evaluated.select{ |k,v| args.include?( k.to_s ) }
|
ifc_sel = @_ifcs_evaluated.select{ |k,v| args.include?( k.to_s ) }
|
end
|
end
|
|
|
ifc_sel.each_with_index do |(ifc_name, ifc), i_ifc|
|
ifc_sel.values.each_with_index do |ifc, i_ifc|
|
ifc.each_with_index do |(port_name, port_def), i_port|
|
ifc.each_with_index do |(port_name, port_def), i_port|
|
yield( port_name.to_s,
|
yield( port_name.to_s,
|
port_def[ :dir ],
|
port_def[ :dir ],
|
port_def[ :len ],
|
port_def[ :len ],
|
port_def[ :default ],
|
port_def[ :default ],
|
Line 306... |
Line 312... |
tmp = @defn.interfaces[ ifc_name.to_sym ].
|
tmp = @defn.interfaces[ ifc_name.to_sym ].
|
ports.select{ |key,hash| hash.defn == port_spec_name.to_s }.
|
ports.select{ |key,hash| hash.defn == port_spec_name.to_s }.
|
keys.first.to_s
|
keys.first.to_s
|
return tmp.size == 0 ? 0 : @_ifcs_evaluated[ ifc_name.to_sym ][ tmp.to_sym ][ :len ]
|
return tmp.size == 0 ? 0 : @_ifcs_evaluated[ ifc_name.to_sym ][ tmp.to_sym ][ :len ]
|
else
|
else
|
if inst == @defn.name.to_sym
|
if inst == @defn.toplevel.to_sym
|
return port_length( ifc_name, port_spec_name )
|
return port_length( ifc_name, port_spec_name )
|
else
|
else
|
return @defn.port_length( ifc_name, port_spec_name, inst )
|
return @defn.port_length( ifc_name, port_spec_name, inst )
|
end
|
end
|
end
|
end
|
Line 390... |
Line 396... |
|
|
#
|
#
|
# Get the interface specification by using the 1st source entry
|
# Get the interface specification by using the 1st source entry
|
# and searching for the core-definition.
|
# and searching for the core-definition.
|
#
|
#
|
ifc_spec = SOCMaker::lib.get_ifc( ifc.name, ifc.version )
|
|
|
|
if !@defn.ifc_in_use?( inst_name, ifc_name )
|
if !@defn.ifc_in_use?( inst_name, ifc_name )
|
|
coder.add_ifc_default_assignment( inst, inst_name, ifc_name )
|
default_tmp = {};
|
|
ifc_spec.ports.each do |_name,_port|
|
|
default_tmp[ _name ] = _port[ :default ]
|
|
end
|
|
|
|
coder.add_ifc_default_assignment( inst, inst_name, ifc_name, default_tmp )
|
|
end
|
end
|
end
|
end
|
end
|
end
|
end
|
end
|
|
|
|
|
#
|
#
|
# This function is called during the toplevel generation
|
# This function is called during the toplevel generation
|
# for each connection.
|
# for each connection.
|
#
|
#
|
# +name+:: The name of the connection
|
# +name+:: The name of the connection
|
Line 426... |
Line 423... |
#
|
#
|
# Get the interface specification by using the 1st source entry
|
# Get the interface specification by using the 1st source entry
|
# and searching for the core-definition.
|
# and searching for the core-definition.
|
#
|
#
|
ifc_spec = SOCMaker::lib.get_ifc(
|
ifc_spec = SOCMaker::lib.get_ifc(
|
core_definition( src.keys.first.to_s ).interfaces[ src.values.first ].name,
|
core_definition( src.keys.first.to_s ).interfaces[ src.values.first ].id )
|
core_definition( src.keys.first.to_s ).interfaces[ src.values.first ].version )
|
|
|
|
|
|
#
|
#
|
# Get the maximum required signal length
|
# Get the maximum required signal length
|
#
|
#
|