URL
https://opencores.org/ocsvn/soc_maker/soc_maker/trunk
Subversion Repositories soc_maker
Compare Revisions
- This comparison shows the changes necessary to convert path
/soc_maker/trunk/lib/soc_maker
- from Rev 9 to Rev 10
- ↔ Reverse comparison
Rev 9 → Rev 10
/ifc_def.rb
39,16 → 39,17
# this information: |
# The class represents an interface definition: |
# - name of the interface (mandatory) |
# - a version (mandatory) |
# - a id (mandatory) |
# - a direction (mandatry) |
# - ports (hash of type SOCMaker::IfcPort, mandatory) |
# |
# Note: instances of this class are used withing core-definitions. |
# Different cores may use the same interface, but with a |
# different naming of the ports. For this reason, the name+version |
# different naming of the ports. For this reason, the name+id |
# is used to identify, which interface specification (SOCMaker::IfcSpc) |
# is defined. The port-hash makes the relation between the core port-naming |
# and the IfcSpc port-naming. |
# TODO |
# |
############################################################### |
|
57,17 → 58,17
include ERR |
attr_accessor :name |
attr_accessor :dir |
attr_accessor :version |
attr_accessor :id |
attr_accessor :ports |
|
def initialize( name, version, dir, ports ) |
def initialize( name, id, dir, ports ) |
init_with( 'name' => name, |
'dir' => dir, |
'version' => version, |
'id' => id, |
'ports' => ports ) |
end |
def encode_with( coder ) |
%w[ name dir version ports ]. |
%w[ name dir id ports ]. |
each { |v| coder[ v ] = instance_variable_get "@#{v}" } |
end |
def init_with( coder ) |
85,18 → 86,17
"Name has zero length", |
field: "name" ) |
|
# version |
serr_if( coder[ 'version' ] == nil, |
'version is not given for interface', |
# id |
serr_if( coder[ 'id' ] == nil, |
'id is not given for interface', |
instance: @name, |
field: 'version' ) |
@version = coder[ 'version' ] |
@version = @version.to_s if @version.is_a?( Numeric ) |
serr_if( !@version.is_a?( String ), |
'Interface version is not defined as string', |
field: 'id' ) |
@id = coder[ 'id' ] |
serr_if( !@id.is_a?( String ), |
'Interface id is not defined as string', |
instance: @name, |
field: 'version' ) |
verr_if( @version.size == 0, |
field: 'id' ) |
verr_if( @id.size == 0, |
"Version has zero length", |
field: "name" ) |
|
144,7 → 144,7
o.class == self.class && |
o.name == self.name && |
o.dir == self.dir && |
o.version == self.version && |
o.id == self.id && |
o.ports == self.ports |
end |
|
/hdl_coder.rb
199,16 → 199,16
|
end |
|
def add_ifc_default_assignment( inst, inst_name, ifc_name, default ) |
def add_ifc_default_assignment( inst, inst_name, ifc_name ) |
|
|
tmp = "" |
inst.ports( ifc_name.to_s ) do |port_name, dir, length, default, is_last| |
inst.ports( ifc_name.to_s ) do |port_name, dir, length, default_val, is_last| |
if dir == 1 # assign default value only if it is an input |
if length > 1 |
tmp << "#{inst_name}_#{port_name} <= ( others => '#{default}' );\n" |
tmp << "#{inst_name}_#{port_name} <= ( others => '#{default_val}' );\n" |
else |
tmp << "#{inst_name}_#{port_name} <= '#{default}';\n" |
tmp << "#{inst_name}_#{port_name} <= '#{default_val}';\n" |
end |
end |
end |
275,7 → 275,6
tmp << "#{inst_name}_#{tmp_name}" |
tmp << " and \n" unless i == src_inst_sel.size-1 |
else |
puts "#{port_tmp_name}: #{length[port_name] > 1}" |
if length[ port_name ] > 1 |
tmp << "( others => '0' )" |
else |
/conf.rb
155,6 → 155,7
|
# |
# Regular expression to match a component's name (core-name or SOC-name) |
# (Obsolete) |
# |
:name_regex => /^[a-zA-Z]+[a-zA-Z0-9_\-]*$/, |
|
/core_inst.rb
52,6 → 52,13
attr_accessor :type |
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 = {} ) |
init_with( 'type' => type, |
'params' => params ) |
161,7 → 168,7
# |
# 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 + "'" ) |
|
188,7 → 195,6
end |
|
|
|
# Iterate over all connections: |
# - create signal instances |
# - add assignments |
212,7 → 218,7
SOCMaker::conf[ :hdl_dir ] ) |
::FileUtils.mkdir_p file_dir |
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 |
SOCMaker::logger.proc( "END of creating top-level hdl code for #{@defn.name}" ) |
|
242,7 → 248,7
ifc_sel = @_ifcs_evaluated.select{ |k,v| args.include?( k.to_s ) } |
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| |
yield( port_name.to_s, |
port_def[ :dir ], |
308,7 → 314,7
keys.first.to_s |
return tmp.size == 0 ? 0 : @_ifcs_evaluated[ ifc_name.to_sym ][ tmp.to_sym ][ :len ] |
else |
if inst == @defn.name.to_sym |
if inst == @defn.toplevel.to_sym |
return port_length( ifc_name, port_spec_name ) |
else |
return @defn.port_length( ifc_name, port_spec_name, inst ) |
392,22 → 398,13
# Get the interface specification by using the 1st source entry |
# 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 ) |
|
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 ) |
coder.add_ifc_default_assignment( inst, inst_name, ifc_name ) |
end |
end |
end |
end |
|
|
# |
# This function is called during the toplevel generation |
# for each connection. |
428,8 → 425,7
# and searching for the core-definition. |
# |
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 ].version ) |
core_definition( src.keys.first.to_s ).interfaces[ src.values.first ].id ) |
|
|
# |
/component.rb
61,8 → 61,8
# name of the core (mandatory) |
attr_accessor :name |
|
# version of the core (mandatory) |
attr_accessor :version |
# ID of the core (mandatory) |
attr_accessor :id |
|
# toplevel name (mandatory) |
attr_accessor :toplevel |
106,14 → 106,14
# can be given as a optinal hash |
# |
# *name*:: Name of this component |
# *version*:: Version of this component |
# *id*:: Id of this component |
# *toplevel*:: Toplevel name of this component |
# *optional*:: Non-mandatory values, which can be set during initialization. |
# |
# |
def initialize( name, version, toplevel, optional = {} ) |
def initialize( name, id, toplevel, optional = {} ) |
init_with( { 'name' => name, |
'version' => version, |
'id' => id, |
'toplevel' => toplevel }.merge( optional ) ) |
end |
|
123,7 → 123,7
# +coder+:: An instance of the Psych::Coder to encode this class to a YAML file |
# |
def encode_with( coder ) |
%w[ name version description date license licensefile |
%w[ name id description date license licensefile |
author authormail vccmd toplevel interfaces |
functions inst_parameters static_parameters ]. |
each { |v| coder[ v ] = instance_variable_get "@#{v}" } |
147,24 → 147,18
serr_if( @name.size == 0, |
'Name not defined (size == 0)', |
field: 'name' ) |
verr_if( !!SOCMaker::conf[ :name_regex ].match( @name ) == false, |
'The core name is invalid', |
instance: @name, |
field: 'name' ) |
|
serr_if( coder[ 'version' ] == nil, |
'Version not defined', |
serr_if( coder[ 'id' ] == nil, |
'Id not defined', |
instance: @name, |
field: 'version' ) |
@version = coder[ 'version' ] |
serr_if( @version.size == 0, |
'Version not defined (size == 0)', |
field: 'id' ) |
@id = coder[ 'id' ] |
serr_if( @id.size == 0, |
'Id not defined (size == 0)', |
instance: @name, |
field: 'version' ) |
field: 'id' ) |
|
# cast from numeric to string, if not given as string |
@version = @version.to_s if @version.is_a? ( Numeric ) |
verr_if( !@version.is_a?( String ), |
verr_if( !@id.is_a?( String ), |
'The name must be of type string or numeric', |
field: 'name' ) |
|
258,7 → 252,15
|
end |
|
# |
# the directory name of this core |
# |
def dir_name |
@id.split(',').join("_") |
end |
|
|
|
# |
# Runs a consistency check: |
# Iterate over all interfaces and check, if the interface is |
270,7 → 272,7
@interfaces.values.each_with_index do | ifc, i_ifc; ifc_def| |
|
# get interface definition |
ifc_def = SOCMaker::lib.get_ifc( ifc.name, ifc.version ) |
ifc_def = SOCMaker::lib.get_ifc( ifc.id ) |
|
|
# check, if all mandatory ports are implemented by this interface |
354,7 → 356,7
@ifc_sel.values.each_with_index do | ifc, i_ifc; ifc_def| |
|
# get interface definition |
ifc_def = SOCMaker::lib.get_ifc( ifc.name, ifc.version ) |
ifc_def = SOCMaker::lib.get_ifc( ifc.id ) |
|
# loop over ports in this interface |
ifc.ports.each_with_index do |(port_name, port_def), i_port | |
364,7 → 366,7
perr_if( !ifc_def.ports.has_key?( defn_ref ), |
"Can't find #{port_def} in" + |
"interface definition #{ifc_def.name} " + |
"version #{ifc_def.version}" ) |
"id #{ifc_def.id}" ) |
|
_port_name = port_name.to_s |
_port_dir = ifc_def.ports[ defn_ref ][:dir] ^ ifc.dir |
386,7 → 388,7
tmp = ( o.class == self.class ) |
return tmp if !tmp |
|
%w[ name version description date license licensefile |
%w[ name id description date license licensefile |
author authormail vccmd toplevel interfaces |
functions inst_parameters static_parameters ]. |
each do |v| |
399,7 → 401,7
# Returns a string describing this instance |
# |
def to_s |
"version: #{@version}\n" + |
"id: #{@id}\n" + |
"toplevel: #{@toplevel}\n" + |
"description: #{@description}\n" + |
"date: #{@date}\n" + |
/soc_def.rb
51,10 → 51,10
attr_accessor :cores |
attr_accessor :cons |
attr_accessor :static |
def initialize( name, version, toplevel, optional = {} ) |
def initialize( name, id, toplevel, optional = {} ) |
|
init_with( { 'name' => name, |
'version' => version, |
'id' => id, |
'toplevel' => toplevel }.merge( optional ) ) |
|
end |
103,15 → 103,15
end |
|
|
def add_core( name, version, inst_name ) |
def add_core( id, inst_name ) |
|
return false if inst_in_use?( inst_name ) |
|
# check, if the core exits in our library |
# if not: an error will be raised |
SOCMaker::lib.get_core( name, version ) |
SOCMaker::lib.get_core( id ) |
|
@cores[ inst_name.to_sym ] = SOCMaker::CoreInst.new( name+version ) |
@cores[ inst_name.to_sym ] = SOCMaker::CoreInst.new( id ) |
end |
|
|
139,7 → 139,7
def core_definition( inst ) |
if @cores[ inst.to_sym ] != nil |
return @cores[ inst.to_sym ].defn |
elsif inst == @name |
elsif inst == @toplevel |
return self |
else |
return nil |
149,7 → 149,26
|
|
|
def add_to_connection( inst1, ifc1_name, inst2, ifc2_name, con_name ) |
#def add_to_connection( inst1, ifc1_name, inst2, ifc2_name, con_name ) |
def add_to_connection( *args ) |
|
if args.size == 4 |
inst1 = @toplevel |
ifc1_name = args[ 0 ] |
inst2 = args[ 1 ] |
ifc2_name = args[ 2 ] |
con_name = args[ 3 ] |
elsif args.size == 5 |
inst1 = args[ 0 ] |
ifc1_name = args[ 1 ] |
inst2 = args[ 2 ] |
ifc2_name = args[ 3 ] |
con_name = args[ 4 ] |
else |
perr_if( true, "FATAL: wrong number of arguments (#{args.size}) for add_to_connection (3 or 4)" ) |
end |
|
|
perr_if( @cons[ con_name.to_sym ] == nil, "Connection instance #{con_name} not found" ) |
@cons[ con_name.to_sym ][:mapping][0][ inst1.to_sym ] = ifc1_name.to_sym |
@cons[ con_name.to_sym ][:mapping][1][ inst2.to_sym ] = ifc2_name.to_sym |
157,8 → 176,25
|
|
|
def add_connection( inst1, ifc1_name, inst2, ifc2_name, con_name ) |
#def add_connection( inst1, ifc1_name, inst2, ifc2_name, con_name ) |
def add_connection( *args ) |
|
if args.size == 4 |
inst1 = @toplevel |
ifc1_name = args[ 0 ] |
inst2 = args[ 1 ] |
ifc2_name = args[ 2 ] |
con_name = args[ 3 ] |
elsif args.size == 5 |
inst1 = args[ 0 ] |
ifc1_name = args[ 1 ] |
inst2 = args[ 2 ] |
ifc2_name = args[ 3 ] |
con_name = args[ 4 ] |
else |
perr_if( true, "FATAL: wrong number of arguments (#{args.size}) for add_connection (3 or 4)" ) |
end |
|
if @cores[ con_name.to_sym ] != nil |
return nil |
elsif @cons[ con_name.to_sym ] != nil |
187,18 → 223,13
"The following interfaces do exist: '#{sub_arr[0].interfaces.keys}'" ) |
end |
|
# check name and version of the ifcs which will be connected |
perr_if( core_def_1.interfaces[ ifc1_name.to_sym ].name != |
core_def_2.interfaces[ ifc2_name.to_sym ].name || |
core_def_1.interfaces[ ifc1_name.to_sym ].version != |
core_def_2.interfaces[ ifc2_name.to_sym ].version, |
# check id of the ifcs which will be connected |
perr_if( core_def_1.interfaces[ ifc1_name.to_sym ].id != |
core_def_2.interfaces[ ifc2_name.to_sym ].id, |
"Can't connect #{ |
core_def_1.interfaces[ ifc1_name.to_sym ].name } - #{ |
core_def_2.interfaces[ ifc2_name.to_sym ].name } : #{ |
core_def_1.interfaces[ ifc1_name.to_sym ].version } - #{ |
core_def_2.interfaces[ ifc2_name.to_sym ].version }" ) |
core_def_1.interfaces[ ifc1_name.to_sym ].id} with #{ |
core_def_2.interfaces[ ifc2_name.to_sym ].id} " ) |
|
|
@cons[ con_name.to_sym ] = { |
:rule => "or", |
:mapping => [ { inst1.to_sym => ifc1_name.to_sym }, |
283,7 → 314,7
core_def = SOCMaker::lib.get_core( core_inst.type ) |
|
# create destination directory name and ensure, that it is exist |
dst_dir = Component.get_and_ensure_dst_dir!( core_def.name ) |
dst_dir = Component.get_and_ensure_dst_dir!( core_def.dir_name ) |
|
# copy each file into destination dir |
core_def.hdlfiles.each do |file, val| |
329,7 → 360,7
|
# create file paths |
src_path = File.join( core_def.dir, sparam.path ) |
dst_dir = Component::get_and_ensure_dst_dir!( core_def.name ) |
dst_dir = Component::get_and_ensure_dst_dir!( core_def.dir_name ) |
dst_path = File.join( dst_dir, sparam.file_dst ) |
|
|
/core_def.rb
35,13 → 35,6
# Description: |
# |
######## |
# |
# TODO |
# |
# |
############################################################### |
|
|
module SOCMaker |
|
|
64,16 → 57,41
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, |
'version' => version, |
'id' => id, |
'hdlfiles' => hdl_files, |
'toplevel' => toplevel }.merge( optional ) ) |
end |
|
# |
# Encoder function (to yaml) |
# |
# +coder+:: An instance of the Psych::Coder to encode this class to a YAML file |
# |
def encode_with( coder ) |
super coder |
coder[ 'hdlfiles' ] = @hdlfiles |
end |
|
# |
# Initialization function (from yaml) |
# |
# +coder+:: An instance of the Psych::Coder to init this class from a YAML file |
# |
# |
def init_with( coder ) |
super( coder ) |
|
97,8 → 115,15
|
|
|
|
|
# |
# 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 |
@inst_parameters.each_with_index do |(name, val), i| |
yield( name.to_s, val.type, val.default, i == @inst_parameters.size-1 ) |
106,25 → 131,26
end |
|
|
|
# |
# this is a core_def and doesn't have |
# sub-cores |
def get_core_def( inst ) |
perr_if( nil, "We don't have sub-cores" ) |
return nil |
end |
|
|
# |
# Nothing implemented, yet. |
# |
def consistency_check |
super |
end |
|
|
def param_ok?( param_name, param_value ) |
param = inst_parameters[ param_name.to_sym ] |
param = static_parameters[ param_name.to_sym ] if param == nil |
return false if param == nil |
end |
|
|
# |
# Equality operator |
# |
def ==(o) |
o.class == self.class && |
o.hdlfiles == self.hdlfiles && |
131,7 → 157,14
super( o ) |
end |
|
# |
# Returns a string describing this instance |
# |
def to_s |
super |
end |
|
|
end # class CoreDef |
end # module SOCMaker |
|
/ifc_spc.rb
44,15 → 44,15
include YAML_EXT |
|
attr_accessor :name |
attr_accessor :version |
attr_accessor :id |
attr_accessor :ports |
|
def initialize( name, version, optional = {} ) |
def initialize( name, id, optional = {} ) |
init_with( { 'name' => name, |
'version' => version }.merge( optional ) ) |
'id' => id }.merge( optional ) ) |
end |
def encode_with( coder ) |
%w[ name version ports ]. |
%w[ name id ports ]. |
each { |v| coder[ v ] = instance_variable_get "@#{v}" } |
end |
def init_with( coder ) |
69,15 → 69,15
field: "name" ) |
|
|
verr_if( coder[ 'version' ] == nil, |
"Version is not defined", |
field: "version" ) |
@version = coder[ 'version' ] |
verr_if( !@version.is_a?( String ), |
verr_if( coder[ 'id' ] == nil, |
"Id is not defined", |
field: "id" ) |
@id = coder[ 'id' ] |
verr_if( !@id.is_a?( String ), |
"Version is not defined as string", |
instance: @name, |
field: "version" ) |
verr_if( @version.size == 0, |
field: "id" ) |
verr_if( @id.size == 0, |
"Version has zero length", |
field: "name" ) |
|
/lib.rb
53,16 → 53,9
# will store all cores |
@cores_lib = {} |
|
# will store the versions of all cores { name => { ver1, ver2, ver3 } } |
@cores_ver = {} |
|
# will store all interfaces |
@ifc_lib = {} |
|
# will store the versions of all interfaces { name => { ver1, ver2, ver3 } } |
@ifc_ver = {} |
|
|
# we remember paths, which we've already processed |
@path_lut = [] |
|
71,9 → 64,7
|
def clear |
@cores_lib.clear |
@cores_ver.clear |
@ifc_lib.clear |
@ifc_ver.clear |
@path_lut.clear |
end |
|
160,57 → 151,72
end |
|
def add_core( core ) |
# generate key-string from name and vesion |
core_key = core.name + core.version |
|
# save core |
@cores_lib[ core_key ] = core |
@cores_ver[ core.name.to_sym ] = [] unless @cores_ver.has_key?(core.name.to_sym) |
@cores_ver[ core.name.to_sym ] << core.version |
@cores_lib[ core.id ] = core |
|
SOCMaker::logger.info "loaded " + |
core.name + |
" version " + |
core.version |
", id = " + |
core.id |
end |
def get_core( name, version = "" ) |
core_key = name + version |
tmp = @cores_lib[ core_key ] |
check_nil( tmp, "Core '#{name}' version '#{version}' does not exist" ) |
|
def get_core( id ) |
tmp = @cores_lib[ id ] |
check_nil( tmp, "Core with id '#{id}' does not exist" ) |
return tmp |
end |
def rm_core( core ) |
core_key = core.name + core.version |
@cores_lib.delete( core_key ) |
|
def rm_core( arg ) |
|
if arg.is_a?( String ) |
check_nil( @cores_lib[ arg ], "Core with id '#{arg}' does not exist" ) |
@cores_lib.delete( arg ) |
|
elsif arg.is_a?( SOCMaker::CoreDef ) |
check_nil( @cores_lib[ arg.id ], "Core with id '#{arg.id}' does not exist" ) |
@cores_lib.delete( arg.id ) |
|
else |
raise SOCMaker::ERR::LibError.new( "", "FATAL: Can't remove interface" ) |
end |
end |
|
|
|
|
def add_ifc( ifc ) |
ifc_key = ifc.name + ifc.version |
@ifc_lib[ ifc_key ] = ifc |
@ifc_ver[ ifc.name.to_sym ] = [] unless @ifc_ver.has_key?(ifc.name.to_sym) |
@ifc_ver[ ifc.name.to_sym ] << ifc.version |
@ifc_lib[ ifc.id ] = ifc |
end |
def get_ifc( name, version = "" ) |
ifc_key = name + version |
tmp = @ifc_lib[ ifc_key ] |
check_nil( tmp, "Interface '#{name}' version '#{version}' does not exist" ) |
|
def get_ifc( id ) |
tmp = @ifc_lib[ id ] |
check_nil( tmp, "Interface with id '#{id}' does not exist" ) |
return tmp |
end |
def rm_ifc( ifc ) |
ifc_key = ifc.name + ifc.version |
@ifc_lib.delete( ifc_key ) |
|
def rm_ifc( arg ) |
|
if arg.is_a?( String ) |
check_nil( @ifc_lib[ arg ], |
"Interface with id '#{arg}' does not exist" ) |
@ifc_lib.delete( arg ) |
|
elsif arg.is_a?( SOCMaker::IfcSpc ) |
check_nil( @ifc_lib[ arg.id ], |
"Interface with id '#{arg.id}' does not exist" ) |
@ifc_lib.delete( arg.id ) |
|
else |
raise SOCMaker::ERR::LibError.new( "", "FATAL: Can't remove interface" ) |
end |
|
end |
|
def to_s |
"IP-Core - lib: \n" + |
@cores_lib.keys.to_s + |
"\n\nIP-Core - versions: \n" + |
@cores_ver.to_s + |
"\n\nInterface - lib: \n" + |
@ifc_lib.keys.to_s + |
"\n\nInterface - versions: \n" + |
@ifc_ver.to_s + "\n" |
"\n\nIP-Interfaces - lib: \n" + |
@ifc_lib.keys.to_s |
end |
|
|
228,30 → 234,30
# get all interfaces in a list |
# |
# TODO untested: do we need this? |
def get_ifcs( core ) |
ifc_list = []; |
core.interfaces.values.each do |ifc; ifc_tmp| |
ifc_tmp = get_ifc( ifc[ :name ], ifc[ :version ] ) |
|
# error handling |
if ifc_tmp == nil |
SOCMaker::logger.error "Can't find #{ifc[ :name ]} version #{ifc[ :version ]} in SOC library" |
raise NameError, "Can't find #{ifc[ :name ]} version #{ifc[ :version ]} in SOC library" |
end |
# def get_ifcs( core ) |
# ifc_list = []; |
# core.interfaces.values.each do |ifc; ifc_tmp| |
# ifc_tmp = get_ifc( ifc[ :name ], ifc[ :version ] ) |
# |
# # error handling |
# if ifc_tmp == nil |
# SOCMaker::logger.error "Can't find #{ifc[ :name ]} version #{ifc[ :version ]} in SOC library" |
# raise NameError, "Can't find #{ifc[ :name ]} version #{ifc[ :version ]} in SOC library" |
# end |
# |
# # add interface to list |
# ifc_list << ifc_tmp |
# end |
# return ifc_list |
# end |
|
# add interface to list |
ifc_list << ifc_tmp |
end |
return ifc_list |
end |
|
|
# |
# TODO add test code |
# |
def cores |
@cores_lib.each do |nameversion,core| |
yield( nameversion.to_s, core ) |
@cores_lib.each do |id,core| |
yield( id.to_s, core ) |
end |
end |
|
/cli.rb
96,9 → 96,9
# New |
# |
NEW_USAGE = |
" > new <<name>> <<version>> <<toplevel>> # opens a system-on-chip file |
" > new <<name>> <<id>> <<toplevel>> # opens a system-on-chip file |
- <<name>> : the SOC name |
- <<version>> : the SOC version |
- <<id>> : the SOC id |
- <<toplevel>> : the toplevel name |
" |
def do_new( args ) |
129,7 → 129,7
puts "loading #{args[0]}" |
@soc = SOCMaker::from_f( args[0] ) |
SOCMaker::lib.add_core( @soc ) |
@soc_inst = SOCMaker::CoreInst.new( "#{@soc.name}#{@soc.version}" ) |
@soc_inst = SOCMaker::CoreInst.new( "#{@soc.version.to_s}" ) |
#puts FMSG if @soc.load_soc( args[ 0 ] ) == nil |
end |
end |
152,18 → 152,17
# Add |
# |
ADD_USAGE = |
" > add <<core>> <<version>> <<name>> |
# adds a ip-core from the library to the SOC |
- <<core>> : name of the IP core |
- <<version>> : version of the IP core |
- <<name>> : instanciation name |
" > add <<id>> <<name>> |
# adds an ip-core from the library to the SOC |
- <<id>> : id of the IP core |
- <<name>> : instanciation name |
|
" |
def do_add( args ) |
if args.size != 3 |
puts "three arguments are required:\nusage:\n#{ADD_USAGE}" |
if args.size != 2 |
puts "two arguments are required:\nusage:\n#{ADD_USAGE}" |
else |
puts FMSG if @soc.add_core( args[ 0 ], args[ 1 ], args[ 2 ] ) == nil |
puts FMSG if @soc.add_core( args[ 0 ], args[ 1 ] ) == nil |
end |
end |
|