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
- from Rev 9 to Rev 10
- ↔ Reverse comparison
Rev 9 → Rev 10
/lib/soc_maker/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 |
|
/lib/soc_maker/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 |
/lib/soc_maker/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_\-]*$/, |
|
/lib/soc_maker/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 ) |
|
|
# |
/lib/soc_maker/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" + |
/lib/soc_maker/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 ) |
|
|
/lib/soc_maker/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 |
|
/lib/soc_maker/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/soc_maker/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 |
|
/lib/soc_maker/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 |
|
/spec/core_def_spec.rb
65,7 → 65,7
FULL_YAML = '''SOCM_CORE |
name: core_A |
description: A test IP-core |
version: rel1 |
id: core_A,rel1 |
date: 1.1.2014 |
license: LGPL |
licensefile: |
77,7 → 77,7
:ifc01: SOCM_IFC |
name: core_AB_ifc |
dir: 0 |
version: "1" |
id: core_AB_ifc,1 |
ports: |
:sig_con1a: SOCM_PORT |
defn: sig_a |
121,7 → 121,7
# minimalistic def with one vhdl file |
MIN_YAML1 = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: top_A |
hdlfiles: |
:core_a.vhd: SOCM_HDL_FILE |
135,7 → 135,7
# vhdl and one verilog file |
MIN_YAML2 = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: top_A |
hdlfiles: |
:core_a.vhd: SOCM_HDL_FILE |
185,7 → 185,7
# def with toplevel.size == 0 |
F_YAML_TOPLEVEL = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: '' |
hdlfiles: |
:core_a.vhd: SOCM_HDL_FILE |
199,7 → 199,7
# def with hdlfiles.class != Hash |
F_YAML_FILE_HASH = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: top_A |
hdlfiles: |
- test1.vhd |
214,7 → 214,7
# minimal setup with one interface |
MIN_YAML_IFC = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: top_A |
hdlfiles: |
:core_a.vhd: SOCM_HDL_FILE |
223,7 → 223,7
:ifc01: SOCM_IFC |
name: a_ifc_def |
dir: 0 |
version: "1" |
id: a_ifc_def,1 |
ports: |
:sig_con1a: SOCM_PORT |
defn: sig_a |
238,7 → 238,7
# minimal setup with one instance parameter |
MIN_YAML_INSTP = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: top_A |
hdlfiles: |
:core_a.vhd: SOCM_HDL_FILE |
254,7 → 254,7
# empty hash for param1 |
F_YAML_INSTP_EMPTY = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: top_A |
hdlfiles: |
:core_a.vhd: SOCM_HDL_FILE |
268,7 → 268,7
# minimal def with one static parameter |
MIN_YAML_STATIC = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: top_A |
hdlfiles: |
:core_a.vhd: SOCM_HDL_FILE |
290,7 → 290,7
# empty static parameter |
F_YAML_STATIC_EMPTY = '''SOCM_CORE |
name: core_A |
version: rel1 |
id: core_A,rel1 |
toplevel: top_A |
hdlfiles: |
:core_a.vhd: SOCM_HDL_FILE |
315,7 → 315,7
|
it "should return a CoreDef object, if the object is created via new" do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
c = SOCMaker::CoreDef.new( "acore", "v1", file, "top" ) |
c = SOCMaker::CoreDef.new( "acore", "acore,v1", file, "top" ) |
c.class.should be == SOCMaker::CoreDef |
end |
|
475,7 → 475,7
|
it "should be possible to encode and decode a core definition" do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
o1 = SOCMaker::CoreDef.new( "acore", "v1", file, "top" ) |
o1 = SOCMaker::CoreDef.new( "acore", "acore,v1", file, "top" ) |
yaml_str = o1.to_yaml |
o2 = YAML::load( yaml_str ) |
o1.should be == o2 |
483,9 → 483,9
|
it "should return false for two non-equal objects" do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
o1 = SOCMaker::CoreDef.new( "acore", "v1", file, "top" ) |
o1 = SOCMaker::CoreDef.new( "acore", "acore,v1", file, "top" ) |
o2 = Marshal::load(Marshal.dump(o1)) |
o2.version = "v2" |
o2.id = "acore,v2" |
( o2 == o1 ).should be == false |
o2 = Marshal::load(Marshal.dump(o1)) |
o2.hdlfiles[ "file.vhd".to_sym ].use_syn = false |
/spec/ifc_spc_spec.rb
49,7 → 49,7
IFC_YAML_VALID = """ |
SOCM_IFC_SPC |
name: core_ifc |
version: '1' |
id: 'core_ifc,1' |
ports: |
:sig_a: |
:dir: 1 |
62,7 → 62,7
IFC_YAML_INVALID = """ |
SOCM_IFC_SPC |
:name: core_ifc |
:version: '1' |
:id: 'core_ifc,1' |
:ports: |
:sig_a: '12' |
:sig_b: 1 |
72,7 → 72,7
IFC_YAML_INVALID2 = """ |
SOCM_IFC_SPC |
:name: core_ifc |
:version: '1' |
:id: 'core_ifc,1' |
:ports: |
:sig_a: |
:sig_b: 1 |
94,12 → 94,12
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
it "should raise an error if the version is not a string" do |
it "should raise an error if the id is not a string" do |
expect{ SOCMaker::IfcSpc.new( "myifc", 234, { :p1 => "a-string" } ) }. |
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
it "should raise an error if the version is an a empty string" do |
it "should raise an error if the id is an a empty string" do |
expect{ SOCMaker::IfcSpc.new( "myifc", "", { :p1 => "a-string" } ) }. |
to raise_error( SOCMaker::ERR::ValueError ) |
end |
106,7 → 106,7
|
|
it "should raise an error if a port direction is neither 0 nor 1" do |
expect{ SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { :p1 => "a-string" } ) }. |
expect{ SOCMaker::IfcSpc.new( "myifc", "myifc,v1", 'ports' => { :p1 => "a-string" } ) }. |
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
/spec/lib_spec.rb
111,21 → 111,33
describe "library access" do |
it "should be possible to add, get and remove a core" do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
c = SOCMaker::CoreDef.new( "acore", "v1", file, "top" ) |
c = SOCMaker::CoreDef.new( "A core", "acore,v1", file, "top" ) |
@lib.add_core( c ) |
@lib.get_core( "acore", "v1" ).should be == c |
@lib.get_core( "acore,v1" ).should be == c |
@lib.rm_core( c ) |
expect { @lib.get_core( "acore", "v1" ) }. |
expect { @lib.get_core( "acore,v1" ) }. |
to raise_error( SOCMaker::ERR::LibError ) |
end |
|
it "should be possible to add, get and remove an interface" do |
i = SOCMaker::IfcSpc.new( "myifc", "v2" ) |
i = SOCMaker::IfcSpc.new( "My Interface", "myifc,v2" ) |
|
# removing with instance |
@lib.add_ifc( i ) |
@lib.get_ifc( "myifc", "v2" ).should be == i |
@lib.get_ifc( "myifc,v2" ).should be == i |
@lib.rm_ifc( i ) |
expect { @lib.get_ifc( "myifc", "v2" ) }. |
|
expect { @lib.get_ifc( "myifc,v2" ) }. |
to raise_error( SOCMaker::ERR::LibError ) |
|
# removing with id |
@lib.add_ifc( i ) |
@lib.get_ifc( "myifc,v2" ).should be == i |
@lib.rm_ifc( i.id ) |
|
expect { @lib.get_ifc( "myifc,v2" ) }. |
to raise_error( SOCMaker::ERR::LibError ) |
|
end |
|
it "should process all folders in add_include" do |
143,9 → 155,9
|
it "should load all elements from our test library" do |
@lib.refresh( './spec/test_soc_lib' ) |
core_A = @lib.get_core( "core_A", "rel1" ) |
core_B = @lib.get_core( "core_B", "rel1" ) |
core_AB_ifc = @lib.get_ifc( "core_AB_ifc", "1" ) |
core_A = @lib.get_core( "core_A,rel1" ) |
core_B = @lib.get_core( "core_B,rel1" ) |
core_AB_ifc = @lib.get_ifc( "core_AB_ifc,1" ) |
core_A.class.should be SOCMaker::CoreDef |
core_B.class.should be SOCMaker::CoreDef |
core_AB_ifc.class.should be SOCMaker::IfcSpc |
/spec/test_soc.yaml
1,7 → 1,7
SOCM_SOC |
name: test_soc |
description: 'This is a test SOC' |
version: v1 |
id: test_soc,v1 |
date: '13. May 2014' |
license: 'GPL' |
licensefile: '' |
12,7 → 12,7
:top_ifc: SOCM_IFC |
name: core_AB_ifc |
dir: 0 |
version: "1" |
id: core_AB_ifc,1 |
ports: |
:sig_con1a: SOCM_PORT |
defn: sig_a |
29,22 → 29,22
static_parameters: {} |
cores: |
:inst_a: SOCM_INST |
type: core_Arel1 |
type: core_A,rel1 |
params: |
:param1: 8 |
:param2: 8 |
:param3: 16 |
:inst_b: SOCM_INST |
type: core_Arel1 |
type: core_A,rel1 |
params: |
:param1: 8 |
:param2: 16 |
:param3: 16 |
:inst_c: SOCM_INST |
type: core_Brel1 |
type: core_B,rel1 |
params: {} |
:inst_d: SOCM_INST |
type: core_Brel1 |
type: core_B,rel1 |
params: {} |
|
static: |
/spec/ifc_def_spec.rb
46,46 → 46,42
tmp_port = SOCMaker::IfcPort.new( "abc" ) |
|
it "should return a SOCMaker::IfcDef object when creating with new" do |
s = SOCMaker::IfcDef.new( "myifc", "v1", 1, { test: tmp_port } ) |
s = SOCMaker::IfcDef.new( "myifc", "myifc,v1", 1, { test: tmp_port } ) |
s.class.should be SOCMaker::IfcDef |
end |
|
it "should raise an error if the name is not a string" do |
expect{ SOCMaker::IfcDef.new( 4, "v1", 1, { test: tmp_port } ) }. |
expect{ SOCMaker::IfcDef.new( 4, "myifc,v1", 1, { test: tmp_port } ) }. |
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
it "should raise an error if the direction is neither 0 nor 1 " do |
expect{ SOCMaker::IfcDef.new( "myifc", "v1", 4, { test: tmp_port } ) }. |
expect{ SOCMaker::IfcDef.new( "myifc", "myifc,v1", 4, { test: tmp_port } ) }. |
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
|
it "should raise an error if no ports are given " do |
expect{ SOCMaker::IfcDef.new( "myifc", "v1", 4, { } ) }. |
expect{ SOCMaker::IfcDef.new( "myifc", "myifc,v1", 4, { } ) }. |
to raise_error( SOCMaker::ERR::StructureError ) |
end |
|
|
it "should raise an error if a ports is nil " do |
expect{ SOCMaker::IfcDef.new( "myifc", "v1", 4, { a_port: nil} ) }. |
expect{ SOCMaker::IfcDef.new( "myifc", "myifc,v1", 4, { a_port: nil} ) }. |
to raise_error( SOCMaker::ERR::StructureError ) |
end |
|
it "should raise an error if a ports is not of type SOCMaker::IfcPort " do |
expect{ SOCMaker::IfcDef.new( "myifc", "v1", 4, { a_port: "string-type"} ) }. |
expect{ SOCMaker::IfcDef.new( "myifc", "myifc,v1", 4, { a_port: "string-type"} ) }. |
to raise_error( SOCMaker::ERR::StructureError ) |
end |
|
it "should raise an error if no ports are given (nil)" do |
expect{ SOCMaker::IfcDef.new( "myifc", "v1", 4, nil ) }. |
expect{ SOCMaker::IfcDef.new( "myifc", "myifc,v1", 4, nil ) }. |
to raise_error( SOCMaker::ERR::StructureError ) |
end |
|
it "should auto-convert a numerical version to string version" do |
s = SOCMaker::IfcDef.new( "myifc", 1, 1, { test: tmp_port } ) |
s.version.should be == "1" |
end |
end |
|
describe SOCMaker::IfcDef, "object handling, en-decoding:" do |
92,14 → 88,14
tmp_port = SOCMaker::IfcPort.new( "abc" ) |
|
it "should return false for two non-equal objects" do |
o1 = SOCMaker::IfcDef.new( "myifc", "v1", 1, { test: tmp_port } ) |
o1 = SOCMaker::IfcDef.new( "myifc", "myifc,v1", 1, { test: tmp_port } ) |
o2 = Marshal::load(Marshal.dump(o1)) |
o2.version = "v2" |
o2.id = "myifc,v2" |
( o2 == o1 ).should be == false |
end |
|
it "should be possible to encode and decode a interface definition" do |
o1 = SOCMaker::IfcDef.new( "myifc", "v1", 1, { test: tmp_port } ) |
o1 = SOCMaker::IfcDef.new( "myifc", "myifc,v1", 1, { test: tmp_port } ) |
yaml_str = o1.to_yaml |
o2 = YAML::load( yaml_str ) |
o1.should be == o2 |
/spec/core_inst_spec.rb
56,10 → 56,10
|
it "should raise an error, if parameters are given, which doesn't exist in the definition" do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core = SOCMaker::CoreDef.new( "mycore", "rel1", file, "top" ) |
core = SOCMaker::CoreDef.new( "My Core", "mycore,rel1", file, "top" ) |
SOCMaker::lib.add_core( core ) |
expect{ |
inst = SOCMaker::CoreInst.new( "mycorerel1", { "aparameter".to_sym => 4 } ) |
inst = SOCMaker::CoreInst.new( "mycore,rel1", { "aparameter".to_sym => 4 } ) |
inst.consistency_check }. |
to raise_error( SOCMaker::ERR::ValueError ) |
SOCMaker::lib.rm_core( core ) |
71,11 → 71,11
# create core with one file and one instance parameter |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
parameters = { "param1".to_sym => SOCMaker::Parameter.new( "integer" ) } |
core = SOCMaker::CoreDef.new( "mycore", "rel1", file, "top" ) |
core = SOCMaker::CoreDef.new( "My Core", "mycore,rel1", file, "top" ) |
core.inst_parameters = parameters |
SOCMaker::lib.add_core( core ) |
|
inst = SOCMaker::CoreInst.new( "mycorerel1", {} ) |
inst = SOCMaker::CoreInst.new( "mycore,rel1", {} ) |
inst.consistency_check |
inst.params[ :param1 ].should be == 0 |
SOCMaker::lib.rm_core( core ) |
88,7 → 88,7
# it 'should return true and false for implements_port?, when a port is implemented and |
# not implemented' do |
# file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
# core = SOCMaker::CoreDef.new( "mycore", "rel1", file, "top" ) |
# core = SOCMaker::CoreDef.new( "My Core", "mycore,rel1", file, "top" ) |
# ifc_spc = SOCMaker::IfcSpc.new( "a_ifc", "v1", "ports" => { p1: 1, p2: 0 } ) |
# ifc = SOCMaker::IfcDef.new( "a_ifc", "v1", 1, { p1: SOCMaker::IfcPort.new( "p1", 1 ) } ) |
# core.interfaces[ :i1 ] = ifc |
95,7 → 95,7
# SOCMaker::lib.add_core( core ) |
# SOCMaker::lib.add_ifc( ifc_spc ) |
|
# o1 = SOCMaker::CoreInst.new( "mycorerel1", {} ) |
# o1 = SOCMaker::CoreInst.new( "mycore,rel1", {} ) |
# o1.consistency_check |
# o1.implements_port?( 'i1', 'p1' ).should be == true |
# o1.implements_port?( 'i1', 'p2' ).should be == false |
107,11 → 107,11
it "should be possible to encode and decode a core instance" do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
parameters = { "param1".to_sym => SOCMaker::Parameter.new( "integer" ) } |
core = SOCMaker::CoreDef.new( "mycore", "rel1", file, "top" ) |
core = SOCMaker::CoreDef.new( "My Core", "mycore,rel1", file, "top" ) |
core.inst_parameters = parameters |
SOCMaker::lib.add_core( core ) |
|
o1 = SOCMaker::CoreInst.new( "mycorerel1", {} ) |
o1 = SOCMaker::CoreInst.new( "mycore,rel1", {} ) |
yaml_str = o1.to_yaml |
o2 = YAML::load( yaml_str ) |
o1.should be == o2 |
120,11 → 120,11
it "should return false for two non-equal objects" do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
parameters = { "param1".to_sym => SOCMaker::Parameter.new( "integer" ) } |
core = SOCMaker::CoreDef.new( "mycore", "rel1", file, "top" ) |
core = SOCMaker::CoreDef.new( "My Core", "mycore,rel1", file, "top" ) |
core.inst_parameters = parameters |
SOCMaker::lib.add_core( core ) |
|
o1 = SOCMaker::CoreInst.new( "mycorerel1" ) |
o1 = SOCMaker::CoreInst.new( "mycore,rel1" ) |
o1.consistency_check |
o2 = Marshal::load(Marshal.dump(o1)) |
o2.type << "X" |
137,7 → 137,7
it "should call coder functions for each core-def. (stub-version)" do |
|
SOCMaker::lib.clear |
soc = SOCMaker::SOCDef.new( "test_soc", "v1", "my_soc_top" ) |
soc = SOCMaker::SOCDef.new( "test_soc", "test_soc,v1", "my_soc_top" ) |
|
|
coder = double() |
175,18 → 175,18
|
|
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core_a = SOCMaker::CoreDef.new( "core_a", "v1", file, "top" ) |
core_b = SOCMaker::CoreDef.new( "core_b", "v1", file, "top" ) |
core_a = SOCMaker::CoreDef.new( "core_a", "core_a,v1", file, "top" ) |
core_b = SOCMaker::CoreDef.new( "core_b", "core_b,v1", file, "top" ) |
SOCMaker::lib.add_core( core_a ) |
SOCMaker::lib.add_core( core_b ) |
|
ifc_spc = SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { port_a: { dir: 1}, port_b: { dir: 0 } } ) |
ifc_spc = SOCMaker::IfcSpc.new( "myifc", "myifc,v1", 'ports' => { port_a: { dir: 1}, port_b: { dir: 0 } } ) |
SOCMaker::lib.add_ifc( ifc_spc ) |
ifc_def_1 = SOCMaker::IfcDef.new( "myifc", "v1", 0, { a: SOCMaker::IfcPort.new( "port_a", 1 ), |
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
ifc_def_1 = SOCMaker::IfcDef.new( "myifc", "myifc,v1", 0, { a: SOCMaker::IfcPort.new( "port_a", 1 ), |
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
|
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "v1", 1, { a: SOCMaker::IfcPort.new( "port_a", 1 ), |
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "myifc,v1", 1, { a: SOCMaker::IfcPort.new( "port_a", 1 ), |
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
|
|
core_a.interfaces[ :ifc_a ] = ifc_def_0 |
195,10 → 195,10
core_b.interfaces[ :ifc_b ] = ifc_def_1 |
|
|
i1 = SOCMaker::CoreInst.new( "core_av1" ) |
i2 = SOCMaker::CoreInst.new( "core_av1" ) |
i3 = SOCMaker::CoreInst.new( "core_bv1" ) |
i4 = SOCMaker::CoreInst.new( "core_bv1" ) |
i1 = SOCMaker::CoreInst.new( "core_a,v1" ) |
i2 = SOCMaker::CoreInst.new( "core_a,v1" ) |
i3 = SOCMaker::CoreInst.new( "core_b,v1" ) |
i4 = SOCMaker::CoreInst.new( "core_b,v1" ) |
|
soc.cores[ :inst_a ] = i1 |
soc.cores[ :inst_b ] = i2 |
209,7 → 209,7
|
|
SOCMaker::lib.add_core( soc ) |
soc_inst = SOCMaker::CoreInst.new( 'test_socv1' ) |
soc_inst = SOCMaker::CoreInst.new( 'test_soc,v1' ) |
soc_inst.consistency_check |
|
soc_inst.stub( :gen_toplevel_con ) do |name_arg, |
228,7 → 228,7
File.should_receive(:open).and_yield(file_mock) |
|
soc_inst.gen_toplevel( coder ); |
added_cores.should be == { :core_av1 => core_a, :core_bv1 => core_b } |
added_cores.should be == { "core_a,v1".to_sym => core_a, "core_b,v1".to_sym => core_b } |
added_instances.should be == { inst_a: i1, inst_b: i2, inst_c: i3, inst_d: i4 } |
added_cons.should be == { a_new_con: { rule: "or", m0: {inst_a: :ifc_a}, m1: {inst_b: :ifc_b } } } |
dir_path.should be == dir_path_ref |
245,7 → 245,7
SOCMaker::lib.refresh( './spec/test_soc_lib' ) |
soc = SOCMaker::from_f( './spec/test_soc.yaml' ); |
SOCMaker::lib.add_core( soc ) |
soc_inst = SOCMaker::CoreInst.new( 'test_socv1' ) |
soc_inst = SOCMaker::CoreInst.new( 'test_soc,v1' ) |
soc_inst.consistency_check |
soc_inst.gen_toplevel( coder ); |
soc.copy_files |
/spec/test_soc_lib/ifcs/core_AB_ifc/top_ifc.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: top_ifc |
version: "1" |
name: Top IFC |
id: top_ifc,1 |
ports: |
:sig_1: |
:dir: 1 |
/spec/test_soc_lib/ifcs/core_AB_ifc/core_AB_ifc.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: core_AB_ifc |
version: "1" |
name: Core AB Interface |
id: core_AB_ifc,1 |
ports: |
:sig_a: |
:dir: 1 |
/spec/test_soc_lib/cores/core_A_rel1/00_core_a.yaml
1,7 → 1,7
SOCM_CORE |
name: core_A |
description: A test IP-core |
version: rel1 |
name: Core A |
description: A test IP-core, which has no functionallity |
id: core_A,rel1 |
date: 1.1.2014 |
license: LGPL |
licensefile: |
13,7 → 13,7
:ifc01: SOCM_IFC |
name: core_AB_ifc |
dir: 0 |
version: "1" |
id: core_AB_ifc,1 |
ports: |
:sig_con1a: SOCM_PORT |
defn: sig_a |
27,7 → 27,7
:ifc02: SOCM_IFC |
name: core_AB_ifc |
dir: 1 |
version: "1" |
id: core_AB_ifc,1 |
ports: |
:sig_con1ax: SOCM_PORT |
defn: sig_a |
/spec/test_soc_lib/cores/core_B_rel1/core_b.yaml
1,7 → 1,7
SOCM_CORE |
name: core_B |
name: Core B |
description: B test IP-core |
version: rel1 |
id: core_B,rel1 |
date: 1.1.2014 |
license: LGPL |
licensefile: |
13,7 → 13,7
:myifc: SOCM_IFC |
name: core_AB_ifc |
dir: 1 |
version: "1" |
id: core_AB_ifc,1 |
ports: |
:mysig_con1a: SOCM_PORT |
defn: sig_a |
/spec/soc_def_spec.rb
65,7 → 65,7
FULL_SOC_YAML = '''SOCM_SOC |
name: my_soc |
description: A test SOC |
version: rel2 |
id: my_soc,rel2 |
date: 1.1.2014 |
license: LGPL |
licensefile: |
79,7 → 79,7
SOC_YAML_WITH_CORE = '''SOCM_SOC |
name: my_soc |
description: A test SOC |
version: rel2 |
id: my_soc,rel2 |
date: 1.1.2014 |
license: LGPL |
licensefile: |
125,9 → 125,9
|
before( :each )do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core = SOCMaker::CoreDef.new( "mycore", "rel1", file, "top" ) |
core = SOCMaker::CoreDef.new( "My Core", "mycore,rel1", file, "top" ) |
SOCMaker::lib.add_core( core ) |
@soc = SOCMaker::SOCDef.new( "test-soc", "v1", "my_soc_top" ) |
@soc = SOCMaker::SOCDef.new( "Test SOC", "test-soc,v1", "my_soc_top" ) |
end |
|
describe "adding/removing cores, connections etc." do |
170,11 → 170,11
|
it "should return nil if a instance is added twice" do |
@soc.cores[ :core_inst ] = SOCMaker::CoreInst.new( "mycorerel1" ) |
@soc.add_core( "mycore", "rel1", "core_inst" ).should be == false |
@soc.add_core( "mycore,rel1", "core_inst" ).should be == false |
end |
|
it "should return non-nil value, if a instance is added once" do |
@soc.add_core( "mycore", "rel1", "core_inst" ).should_not be == false |
@soc.add_core( "mycore,rel1", "core_inst" ).should_not be == false |
end |
|
# in one of the first version, we returned nil, but now this is |
185,7 → 185,7
end |
|
it "should raise a library error when adding an unknown core" do |
expect{ @soc.add_core( "some_unknown_core", "v_xyz", "test" ) }. |
expect{ @soc.add_core( "some_unknown_core,v_xyz", "test" ) }. |
to raise_error( SOCMaker::ERR::LibError ) |
end |
|
228,8 → 228,8
end |
|
it "should raise an ProcessingError if a interface doesn't exist" do |
@soc.cores[ :core_a ] = SOCMaker::CoreInst.new( "mycorerel1" ) |
@soc.cores[ :core_b ] = SOCMaker::CoreInst.new( "mycorerel1" ) |
@soc.cores[ :core_a ] = SOCMaker::CoreInst.new( "mycore,rel1" ) |
@soc.cores[ :core_b ] = SOCMaker::CoreInst.new( "mycore,rel1" ) |
expect{ @soc.add_connection( "core_a", "ifc_a", "core_b", "ifc_c", "a_new_con" ) }. |
to raise_error( SOCMaker::ERR::ProcessingError ) |
end |
237,13 → 237,13
|
it "should raise an ProcessingError if the ifc.-version is wrong" do |
|
ifc_spc1 = SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { port_a: {dir:1}, port_b: {dir:0} } ) |
ifc_spc2 = SOCMaker::IfcSpc.new( "myifc", "v2", 'ports' => { port_a: {dir:1}, port_b: {dir:0} } ) |
ifc_def_1 = SOCMaker::IfcDef.new( "myifc", "v1", 0, { a: SOCMaker::IfcPort.new( "port_a", 1 ) } ) |
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "v2", 1, { b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
ifc_spc1 = SOCMaker::IfcSpc.new( "myifc", "myifc,v1", 'ports' => { port_a: {dir:1}, port_b: {dir:0} } ) |
ifc_spc2 = SOCMaker::IfcSpc.new( "myifc", "myifc,v2", 'ports' => { port_a: {dir:1}, port_b: {dir:0} } ) |
ifc_def_1 = SOCMaker::IfcDef.new( "myifc", "myifc,v1", 0, { a: SOCMaker::IfcPort.new( "port_a", 1 ) } ) |
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "myifc,v2", 1, { b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core_a = SOCMaker::CoreDef.new( "core_a", "v1", file, "top" ) |
core_b = SOCMaker::CoreDef.new( "core_b", "v1", file, "top" ) |
core_a = SOCMaker::CoreDef.new( "core_a", "core_a,v1", file, "top" ) |
core_b = SOCMaker::CoreDef.new( "core_b", "core_a,v1", file, "top" ) |
core_a.interfaces[ :ifc_a ] = ifc_def_0 |
core_a.interfaces[ :ifc_b ] = ifc_def_1 |
core_b.interfaces[ :ifc_a ] = ifc_def_0 |
253,8 → 253,8
SOCMaker::lib.add_ifc( ifc_spc2 ) |
SOCMaker::lib.add_core( core_a ) |
SOCMaker::lib.add_core( core_b ) |
@soc.cores[ :core_a ] = SOCMaker::CoreInst.new( "core_av1" ) |
@soc.cores[ :core_b ] = SOCMaker::CoreInst.new( "core_bv1" ) |
@soc.cores[ :core_a ] = SOCMaker::CoreInst.new( "core_a,v1" ) |
@soc.cores[ :core_b ] = SOCMaker::CoreInst.new( "core_b,v1" ) |
expect { @soc.add_connection( "inst_a", "ifc_a", "inst_b", "ifc_b", "a_new_con" ) }. |
to raise_error( SOCMaker::ERR::ProcessingError ) |
end |
264,18 → 264,18
|
it "should add a connection entry" do |
|
ifc_spc = SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { port_a: {dir:1}, port_b: {dir:0} } ) |
ifc_spc = SOCMaker::IfcSpc.new( "myifc", "myifc,v1", 'ports' => { port_a: {dir:1}, port_b: {dir:0} } ) |
|
ifc_def_1 = SOCMaker::IfcDef.new( "myifc", "v1", 0, { a: SOCMaker::IfcPort.new( "port_a", 1 ), |
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
ifc_def_1 = SOCMaker::IfcDef.new( "myifc", "myifc,v1", 0, { a: SOCMaker::IfcPort.new( "port_a", 1 ), |
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
|
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "v1", 1, { a: SOCMaker::IfcPort.new( "port_a", 1 ), |
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "myifc,v1", 1, { a: SOCMaker::IfcPort.new( "port_a", 1 ), |
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
|
|
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core_a = SOCMaker::CoreDef.new( "core_a", "v1", file, "top" ) |
core_b = SOCMaker::CoreDef.new( "core_b", "v1", file, "top" ) |
core_a = SOCMaker::CoreDef.new( "core_a", "core_a,v1", file, "top" ) |
core_b = SOCMaker::CoreDef.new( "core_b", "core_b,v1", file, "top" ) |
core_a.interfaces[ :ifc_a ] = ifc_def_0 |
core_a.interfaces[ :ifc_b ] = ifc_def_1 |
core_b.interfaces[ :ifc_a ] = ifc_def_0 |
287,8 → 287,8
|
|
|
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_av1" ) |
@soc.cores[ :inst_b ] = SOCMaker::CoreInst.new( "core_bv1" ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_a,v1" ) |
@soc.cores[ :inst_b ] = SOCMaker::CoreInst.new( "core_b,v1" ) |
@soc.consistency_check |
@soc.add_connection( "inst_a", "ifc_a", "inst_b", "ifc_b", "a_new_con" ) |
@soc.cons[ :a_new_con ].should be == { rule:'or', mapping: [ {inst_a: :ifc_a},{inst_b: :ifc_b} ] } |
308,7 → 308,7
b: SOCMaker::IfcPort.new( "port_b", 1 ) } ) |
|
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core_a = SOCMaker::CoreDef.new( "core_a", "v1", file, "top" ) |
core_a = SOCMaker::CoreDef.new( "core_a", "core_a,v1", file, "top" ) |
core_a.interfaces[ :ifc_a ] = ifc_def_0 |
core_a.interfaces[ :ifc_b ] = ifc_def_1 |
|
318,10 → 318,10
|
SOCMaker::lib.add_core( @soc ) |
@soc.interfaces[ :t1 ] = ifc_def_1 |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_av1" ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_a,v1" ) |
@soc.consistency_check |
@soc.add_connection( "inst_a", "ifc_a", @soc.name, "t1", "a_new_con" ) |
@soc.cons[ :a_new_con ].should be == { rule:'or', mapping: [ {inst_a: :ifc_a},{ @soc.name.to_sym => :t1} ] } |
@soc.add_connection( "inst_a", "ifc_a", @soc.id, "t1", "a_new_con" ) |
@soc.cons[ :a_new_con ].should be == { rule:'or', mapping: [ {inst_a: :ifc_a},{ @soc.id.to_sym => :t1} ] } |
end |
|
|
342,7 → 342,7
parameter = SOCMaker::Parameter.new( "integer" ) |
core_a.inst_parameters[ :p1 ] = parameter |
SOCMaker::lib.add_core( core_a ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_av1" ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_a,v1" ) |
expect{ @soc.set_param( "inst_a", "px", 1234 ) }. |
to raise_error( SOCMaker::ERR::ProcessingError ) |
expect{ @soc.get_param( "inst_a", "px" ) }. |
351,11 → 351,11
|
it "should set a parameter and provide a parameter" do |
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core_a = SOCMaker::CoreDef.new( "core_a", "v1", file, "top" ) |
core_a = SOCMaker::CoreDef.new( "core_a", "core_a,v1", file, "top" ) |
parameter = SOCMaker::Parameter.new( "integer" ) |
core_a.inst_parameters[ :p1 ] = parameter |
SOCMaker::lib.add_core( core_a ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_av1" ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_a,v1" ) |
@soc.set_param( "inst_a", "p1", 1234 ) |
@soc.cores[ :inst_a ].params[ :p1 ].should be == 1234 |
@soc.get_param( "inst_a", "p1" ).should be == 1234 |
376,13 → 376,13
it "should an error, a static parameter doesn't exist" do |
|
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core_a = SOCMaker::CoreDef.new( "core_a", "v1", file, "top" ) |
core_a = SOCMaker::CoreDef.new( "core_a", "core_a,v1", file, "top" ) |
SOCMaker::lib.add_core( core_a ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_av1" ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_a,v1" ) |
|
expect{ @soc.set_sparam( "core_av1", "p1", 1234 ) }. |
expect{ @soc.set_sparam( "core_a,v1", "p1", 1234 ) }. |
to raise_error( SOCMaker::ERR::ProcessingError ) |
expect{ @soc.get_sparam( "core_av1", "p1" ) }. |
expect{ @soc.get_sparam( "core_a,v1", "p1" ) }. |
to raise_error( SOCMaker::ERR::ProcessingError ) |
end |
|
389,7 → 389,7
it "should set a static-parameter and provide this static parameter" do |
|
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) } |
core_a = SOCMaker::CoreDef.new( "core_a", "v1", file, "top" ) |
core_a = SOCMaker::CoreDef.new( "core_a", "core_a,v1", file, "top" ) |
pentry = SOCMaker::SParameterEntry.new( "integer", "TOK" ) |
parameter = SOCMaker::SParameter.new( "file/path.vhd.src", |
"file/path.vhd", |
396,11 → 396,11
'parameters' => { p1: pentry } ) |
core_a.static_parameters[ :p1 ] = parameter |
SOCMaker::lib.add_core( core_a ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_av1" ) |
@soc.cores[ :inst_a ] = SOCMaker::CoreInst.new( "core_a,v1" ) |
|
@soc.set_sparam( "core_av1", "p1", 1234 ) |
@soc.static[ :core_av1 ][ :p1 ].should be == 1234 |
@soc.get_sparam( "core_av1", "p1" ).should be == 1234 |
@soc.set_sparam( "core_a,v1", "p1", 1234 ) |
@soc.static[ "core_a,v1".to_sym ][ :p1 ].should be == 1234 |
@soc.get_sparam( "core_a,v1", "p1" ).should be == 1234 |
end |
|
|
/spec/component_spec.rb
66,43 → 66,23
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
it 'should raise an error, if the name doesnt start with [a-zA-Z]' do |
expect{ SOCMaker::Component.new( "4abc", "v1", "top" ) }. |
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
it 'should raise an error, if the name conatins invalid symbols' do |
expect{ SOCMaker::Component.new( "abc$abc", "v1", "top" ) }. |
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
|
|
|
|
# test the version |
it "should raise an error, if the version is nil" do |
# test the id |
it "should raise an error, if the id is nil" do |
expect{ SOCMaker::Component.new( "acore", nil, "top" ) }. |
to raise_error( SOCMaker::ERR::StructureError ) |
end |
|
it "should raise an error, if the version has zero-length" do |
it "should raise an error, if the id has zero-length" do |
expect{ SOCMaker::Component.new( "acore", "", "top" ) }. |
to raise_error( SOCMaker::ERR::StructureError ) |
end |
|
it "should raise an error, if the version is not of type string neither of type Numerical" do |
it "should raise an error, if the id is not of type string " do |
expect{ SOCMaker::Component.new( "acore", [ 1, 2, 3 ], "top" ) }. |
to raise_error( SOCMaker::ERR::ValueError ) |
end |
|
it "should cast a numerical version to a string version" do |
c = SOCMaker::Component.new( "acore", 3, "top" ) |
c.class.should be == SOCMaker::Component |
c.version = "3" |
end |
|
|
%w[ description date license licensefile |
author authormail vccmd ].each do |m| |
it "should auto-set #{m} to an empty string" do |
150,6 → 130,7
|
it 'should iterate over all generics (inst. parameters)' do |
|
|
p1 = SOCMaker::Parameter.new( "integer" ) |
p2 = SOCMaker::Parameter.new( "string" ) |
p3 = SOCMaker::Parameter.new( "integer" ) |
180,8 → 161,8
it 'should iterate over all ports' do |
|
SOCMaker::lib.clear |
ifc_s1 = SOCMaker::IfcSpc.new( "i1", "v1", 'ports' => { p1:{dir:1}, p2:{dir:1}, p3:{dir:0} } ) |
ifc_s2 = SOCMaker::IfcSpc.new( "i2", "v1", 'ports' => { x1:{dir:1}, x2:{dir:0} } ) |
ifc_s1 = SOCMaker::IfcSpc.new( "Interface 1", "i1,v1", 'ports' => { p1:{dir:1}, p2:{dir:1}, p3:{dir:0} } ) |
ifc_s2 = SOCMaker::IfcSpc.new( "Interface 2", "i2,v1", 'ports' => { x1:{dir:1}, x2:{dir:0} } ) |
SOCMaker::lib.add_ifc( ifc_s1 ) |
SOCMaker::lib.add_ifc( ifc_s2 ) |
|
191,11 → 172,11
x1 = SOCMaker::IfcPort.new( "x1", 1 ) |
x2 = SOCMaker::IfcPort.new( "x2", 2 ) |
|
ifc_d1 = SOCMaker::IfcDef.new( "i1", "v1", 0, { m_p1: p1, m_p2: p2, m_p3: p3 } ) |
ifc_d2 = SOCMaker::IfcDef.new( "i2", "v1", 0, { m_x1: x1, m_x2: x2 } ) |
ifc_d1 = SOCMaker::IfcDef.new( "i1", "i1,v1", 0, { m_p1: p1, m_p2: p2, m_p3: p3 } ) |
ifc_d2 = SOCMaker::IfcDef.new( "i2", "i2,v1", 0, { m_x1: x1, m_x2: x2 } ) |
|
|
c = SOCMaker::Component.new( "acore", "v1", "top", |
c = SOCMaker::Component.new( "A core", "acore,v1", "top", |
{ 'interfaces' => { i1: ifc_d1, i2: ifc_d2 } } ) |
|
r_name = [] |
219,7 → 200,6
r_name = [] |
r_dir = [] |
|
p c.interfaces |
c.ports( "i1" ) do |arg_name,arg_dir, arg_default, arg_is_last| |
#r_def << arg_def |
r_name << arg_name |
/core_lib/interfaces/clk_rst/single.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: single |
version: "1" |
id: single,1 |
ports: |
:single: |
:dir: 0 |
/core_lib/interfaces/clk_rst/rst.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: rst |
version: "1" |
id: rst,1 |
ports: |
:rst: |
:dir: 0 |
/core_lib/interfaces/clk_rst/clk.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: clk |
version: "1" |
id: clk,1 |
ports: |
:clk: |
:dir: 0 |
/core_lib/interfaces/jtag/jtag.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: jtag |
version: "1" |
id: jtag,1 |
ports: |
:tck: |
:dir: 1 |
/core_lib/interfaces/jtag/jtag_tap.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: jtag_tap |
version: "1" |
id: jtag_tap,1 |
ports: |
:tck: |
:dir: 0 |
/core_lib/interfaces/debug/debug.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: debug |
version: "1" |
id: debug,1 |
ports: |
:dbg_stall: |
:dir: 0 |
/core_lib/interfaces/power/or_power.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: or_power_management |
version: "1" |
id: or_power_management,1 |
ports: |
:pm_cpustall: |
:dir: 0 |
/core_lib/interfaces/wishbone/wishbone_ma_b3.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: wishbone_ma |
version: "b3" |
name: Wishbone Master |
id: wishbone_ma,b3 |
ports: |
:clk: |
:dir: 0 |
/core_lib/interfaces/wishbone/wishbone_sl_b3.yaml
1,6 → 1,6
SOCM_IFC_SPC |
name: wishbone_sl |
version: "b3" |
name: Wishbone Slave |
id: wishbone_sl,b3 |
ports: |
:clk: |
:dir: 0 |
/core_lib/cores/wb_connect/wb_connect.yaml
1,7 → 1,7
SOCM_CORE |
name: wb_connect |
description: A block to connect RISC and peripheral controllers together |
version: "1" |
id: wb_connect,1 |
license: LGPL |
licensefile: |
author: Damjan Lampret |
13,7 → 13,7
:clk: SOCM_IFC |
name: clk |
dir: 1 |
version: "1" |
id: clk,1 |
ports: |
:wb_clk_i: SOCM_PORT |
len: 1 |
22,7 → 22,7
:rst: SOCM_IFC |
name: rst |
dir: 1 |
version: "1" |
id: rst,1 |
ports: |
:wb_rst_i: SOCM_PORT |
len: 1 |
33,7 → 33,7
:i0: SOCM_IFC |
name: wishbone_ma |
dir: 0 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:i0_wb_clk_o: SOCM_PORT |
defn: clk |
71,7 → 71,7
:i1: SOCM_IFC |
name: wishbone_ma |
dir: 0 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:i1_wb_clk_o: SOCM_PORT |
defn: clk |
109,7 → 109,7
:i2: SOCM_IFC |
name: wishbone_ma |
dir: 0 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:i2_wb_clk_o: SOCM_PORT |
defn: clk |
147,7 → 147,7
:i3: SOCM_IFC |
name: wishbone_ma |
dir: 0 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:i3_wb_clk_o: SOCM_PORT |
defn: clk |
185,7 → 185,7
:i4: SOCM_IFC |
name: wishbone_ma |
dir: 0 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:i4_wb_clk_o: SOCM_PORT |
defn: clk |
223,7 → 223,7
:i5: SOCM_IFC |
name: wishbone_ma |
dir: 0 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:i5_wb_clk_o: SOCM_PORT |
defn: clk |
261,7 → 261,7
:i6: SOCM_IFC |
name: wishbone_ma |
dir: 0 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:i6_wb_clk_o: SOCM_PORT |
defn: clk |
299,7 → 299,7
:i7: SOCM_IFC |
name: wishbone_ma |
dir: 0 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:i7_wb_clk_o: SOCM_PORT |
defn: clk |
337,7 → 337,7
:t0: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t0_wb_clk_o: SOCM_PORT |
defn: clk |
375,7 → 375,7
:t1: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t1_wb_clk_o: SOCM_PORT |
defn: clk |
413,7 → 413,7
:t2: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t2_wb_clk_o: SOCM_PORT |
defn: clk |
451,7 → 451,7
:t3: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t3_wb_clk_o: SOCM_PORT |
defn: clk |
489,7 → 489,7
:t4: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t4_wb_clk_o: SOCM_PORT |
defn: clk |
527,7 → 527,7
:t5: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t5_wb_clk_o: SOCM_PORT |
defn: clk |
565,7 → 565,7
:t6: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t6_wb_clk_o: SOCM_PORT |
defn: clk |
603,7 → 603,7
:t7: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t7_wb_clk_o: SOCM_PORT |
defn: clk |
641,7 → 641,7
:t8: SOCM_IFC |
name: wishbone_sl |
dir: 0 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:t8_wb_clk_o: SOCM_PORT |
defn: clk |
/core_lib/cores/or1200_rel2/01_or1200.yaml
1,7 → 1,7
SOCM_CORE |
name: or1200 |
name: OpenRISC 1200 |
description: OpenRISC CPU |
version: rel2 |
id: or1200,rel2 |
license: LGPL |
licensefile: |
author: |
12,7 → 12,7
:clmode: SOCM_IFC |
name: single |
dir: 1 |
version: "1" |
id: single,1 |
ports: |
:clmode_i: SOCM_PORT |
len: 2 |
21,7 → 21,7
:pic_ints: SOCM_IFC |
name: single |
dir: 1 |
version: "1" |
id: single,1 |
ports: |
:pic_ints_i: SOCM_PORT |
len: 20 |
30,7 → 30,7
:clk: SOCM_IFC |
name: clk |
dir: 1 |
version: "1" |
id: clk,1 |
ports: |
:clk_i: SOCM_PORT |
len: 1 |
39,7 → 39,7
:rst: SOCM_IFC |
name: rst |
dir: 1 |
version: "1" |
id: rst,1 |
ports: |
:rst_i: SOCM_PORT |
len: 1 |
48,7 → 48,7
:wb_instruction: SOCM_IFC |
name: wishbone_ma |
dir: 1 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:iwb_clk_i: SOCM_PORT |
defn: clk |
90,7 → 90,7
:wb_data: SOCM_IFC |
name: wishbone_ma |
dir: 1 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:dwb_clk_i: SOCM_PORT |
defn: clk |
132,7 → 132,7
:ext_debug: SOCM_IFC |
name: debug |
dir: 1 |
version: "1" |
id: debug,1 |
ports: |
:dbg_stall_i: SOCM_PORT |
defn: dbg_stall |
174,7 → 174,7
:pow_man: SOCM_IFC |
name: or_power_management |
dir: 1 |
version: "1" |
id: or_power_management,1 |
ports: |
:pm_cpustall_i: SOCM_PORT |
len: 1 |
/core_lib/cores/ram_wb/ram_wb.yaml
1,7 → 1,7
SOCM_CORE |
name: ram_wb |
name: Wishbone RAM |
description: Onchip-RAM |
version: b3 |
id: ram_wb,b3 |
license: LGPL |
licensefile: |
author: |
11,9 → 11,9
|
interfaces: |
:wb_ifc: SOCM_IFC |
name: wishbone_sl |
name: Wishbone IFC |
dir: 1 |
version: "b3" |
id: wishbone_sl,b3 |
ports: |
:wb_adr_i: SOCM_PORT |
len: 32 |
/core_lib/cores/adv_debug_sys/01_adv_debug_sys.yaml
1,7 → 1,7
SOCM_CORE |
name: adv_debug_sys |
name: Advanced Debug System |
description: Advanced Debug System |
version: ads_3 |
id: adv_debug_sys,ads_3 |
license: LGPL |
licensefile: |
author: |
16,7 → 16,7
:jtag: SOCM_IFC |
name: jtag_tap |
dir: 1 |
version: "1" |
id: jtag_tap,1 |
ports: |
:tck_i: SOCM_PORT |
len: 1 |
53,7 → 53,7
:wb_ifc: SOCM_IFC |
name: wishbone_ma |
dir: 1 |
version: "b3" |
id: wishbone_ma,b3 |
ports: |
:wb_clk_i: SOCM_PORT |
len: 1 |
101,7 → 101,7
:cpu0_dbg_clk: SOCM_IFC |
name: clk |
dir: 1 |
version: "1" |
id: clk,1 |
ports: |
:cpu0_clk_i: SOCM_PORT |
len: 1 |
110,7 → 110,7
:cpu0_dbg_rst: SOCM_IFC |
name: rst |
dir: 0 |
version: "1" |
id: rst,1 |
ports: |
:cpu0_rst_o: SOCM_PORT |
len: 1 |
119,7 → 119,7
:cpu0_dbg: SOCM_IFC |
name: debug |
dir: 0 |
version: "1" |
id: debug,1 |
ports: |
:cpu0_addr_o: SOCM_PORT |
len: 32 |
/examples/or1200_test/or1200_test.rb
19,21 → 19,21
# core.update_vcs |
end |
|
soc = SOCMaker::SOCDef.new( 'or1200_test', 'v1', 'or1200_test' ) |
soc = SOCMaker::SOCDef.new( 'OR1200 Test SOC', 'or1200_test,v1', 'or1200_test' ) |
SOCMaker::lib.add_core( soc ) |
soc_inst = SOCMaker::CoreInst.new( 'or1200_testv1' ) |
soc_inst = SOCMaker::CoreInst.new( 'or1200_test,v1' ) |
#soc_inst.name = "soc_inst" |
|
|
port = SOCMaker::IfcPort.new( 'clk', 1 ) |
ifc = SOCMaker::IfcDef.new( 'clk', '1', 1, { 'clk_i' => port} ) |
ifc = SOCMaker::IfcDef.new( 'clk', 'clk,1', 1, { 'clk_i' => port} ) |
soc.interfaces[ 'clk_ifc'.to_sym ] = ifc |
|
port = SOCMaker::IfcPort.new( 'rst', 1 ) |
ifc = SOCMaker::IfcDef.new( 'rst', '1', 1, { 'rst_i' => port} ) |
ifc = SOCMaker::IfcDef.new( 'rst', 'rst,1', 1, { 'rst_i' => port} ) |
soc.interfaces[ 'rst_ifc'.to_sym ] = ifc |
|
soc.interfaces[ 'jtag_ifc'.to_sym ] = SOCMaker::IfcDef.new( 'jtag_tap', '1', 1, { |
soc.interfaces[ 'jtag_ifc'.to_sym ] = SOCMaker::IfcDef.new( 'jtag_tap', 'jtag_tap,1', 1, { |
'tck_i' => SOCMaker::IfcPort.new( 'tck', 1 ), |
'tdi_i' => SOCMaker::IfcPort.new( 'tdi', 1 ), |
'tdo_o' => SOCMaker::IfcPort.new( 'tdo' ,1 ), |
44,7 → 44,7
'capture_dr_i' => SOCMaker::IfcPort.new( 'capture', 1 ), |
'debug_select_i' => SOCMaker::IfcPort.new( 'select', 1 ) } ) |
|
soc.interfaces[ 'uart_ifc'.to_sym ] = SOCMaker::IfcDef.new( 'uart', '1', 1, { |
soc.interfaces[ 'uart_ifc'.to_sym ] = SOCMaker::IfcDef.new( 'uart', 'uart,1', 1, { |
'stx_pad_o' => SOCMaker::IfcPort.new( 'stx_pad', 1 ), |
'srx_pad_i' => SOCMaker::IfcPort.new( 'srx_pad', 1 ), |
'rts_pad_o' => SOCMaker::IfcPort.new( 'rts_pad', 1 ), |
55,12 → 55,12
'dcd_pad_i' => SOCMaker::IfcPort.new( 'dcd_pad', 1 ) } ) |
|
|
soc.add_core( 'or1200', 'rel2', 'cpu' ) |
soc.add_core( 'wb_connect', '1', 'wb_bus' ) |
soc.add_core( 'adv_debug_sys', 'ads_3', 'dbg' ) |
soc.add_core( 'ram_wb', 'b3', 'ram1' ) |
soc.add_core( 'ram_wb', 'b3', 'ram2' ) |
soc.add_core( 'uart16550', 'rel4', 'uart' ) |
soc.add_core( 'or1200,rel2', 'cpu' ) |
soc.add_core( 'wb_connect,1', 'wb_bus' ) |
soc.add_core( 'adv_debug_sys,ads_3', 'dbg' ) |
soc.add_core( 'ram_wb,b3', 'ram1' ) |
soc.add_core( 'ram_wb,b3', 'ram2' ) |
soc.add_core( 'uart16550,rel4', 'uart' ) |
soc.consistency_check |
|
|
67,34 → 67,34
# |
# Setup the CPU |
# |
soc.set_sparam( 'or1200rel2', 'VCD_DUMP', false ) |
soc.set_sparam( 'or1200rel2', 'VERBOSE', false ) |
soc.set_sparam( 'or1200rel2', 'ASIC' , false ) |
soc.set_sparam( 'or1200,rel2', 'VCD_DUMP', false ) |
soc.set_sparam( 'or1200,rel2', 'VERBOSE', false ) |
soc.set_sparam( 'or1200,rel2', 'ASIC' , false ) |
|
soc.set_sparam( 'or1200rel2', 'ASIC_MEM_CHOICE', 0 ) |
soc.set_sparam( 'or1200rel2', 'ASIC_NO_DC', true ) |
soc.set_sparam( 'or1200rel2', 'ASIC_NO_IC', true ) |
soc.set_sparam( 'or1200rel2', 'ASIC_NO_DMMU', true ) |
soc.set_sparam( 'or1200rel2', 'ASIC_NO_IMMU', true ) |
soc.set_sparam( 'or1200rel2', 'ASIC_MUL_CHOICE', 0 ) |
soc.set_sparam( 'or1200rel2', 'ASIC_IC_CHOICE', 0 ) |
soc.set_sparam( 'or1200rel2', 'ASIC_DC_CHOICE', 0 ) |
soc.set_sparam( 'or1200,rel2', 'ASIC_MEM_CHOICE', 0 ) |
soc.set_sparam( 'or1200,rel2', 'ASIC_NO_DC', true ) |
soc.set_sparam( 'or1200,rel2', 'ASIC_NO_IC', true ) |
soc.set_sparam( 'or1200,rel2', 'ASIC_NO_DMMU', true ) |
soc.set_sparam( 'or1200,rel2', 'ASIC_NO_IMMU', true ) |
soc.set_sparam( 'or1200,rel2', 'ASIC_MUL_CHOICE', 0 ) |
soc.set_sparam( 'or1200,rel2', 'ASIC_IC_CHOICE', 0 ) |
soc.set_sparam( 'or1200,rel2', 'ASIC_DC_CHOICE', 0 ) |
|
|
soc.set_sparam( 'or1200rel2', 'FPGA_MEM_CHOICE', 0 ) |
soc.set_sparam( 'or1200rel2', 'FPGA_NO_DC', true ) |
soc.set_sparam( 'or1200rel2', 'FPGA_NO_IC', true ) |
soc.set_sparam( 'or1200rel2', 'FPGA_NO_DMMU', true ) |
soc.set_sparam( 'or1200rel2', 'FPGA_NO_IMMU', true ) |
soc.set_sparam( 'or1200rel2', 'FPGA_MUL_CHOICE', 1 ) |
soc.set_sparam( 'or1200rel2', 'FPGA_IC_CHOICE', 0 ) |
soc.set_sparam( 'or1200rel2', 'FPGA_DC_CHOICE', 0 ) |
soc.set_sparam( 'or1200,rel2', 'FPGA_MEM_CHOICE', 0 ) |
soc.set_sparam( 'or1200,rel2', 'FPGA_NO_DC', true ) |
soc.set_sparam( 'or1200,rel2', 'FPGA_NO_IC', true ) |
soc.set_sparam( 'or1200,rel2', 'FPGA_NO_DMMU', true ) |
soc.set_sparam( 'or1200,rel2', 'FPGA_NO_IMMU', true ) |
soc.set_sparam( 'or1200,rel2', 'FPGA_MUL_CHOICE', 1 ) |
soc.set_sparam( 'or1200,rel2', 'FPGA_IC_CHOICE', 0 ) |
soc.set_sparam( 'or1200,rel2', 'FPGA_DC_CHOICE', 0 ) |
|
# |
# Setup the on-chip memory |
# |
soc.set_sparam( 'ram_wbb3', 'MEM_SIZE', 20 ) |
soc.set_sparam( 'ram_wbb3', 'MEM_ADR_WIDTH', 17 ) |
soc.set_sparam( 'ram_wb,b3', 'MEM_SIZE', 10 ) |
soc.set_sparam( 'ram_wb,b3', 'MEM_ADR_WIDTH', 14 ) |
|
|
# |
101,10 → 101,10
# |
# |
|
soc.add_connection( 'or1200_test', 'clk_ifc', 'cpu', 'clk', 'con_main_clk' ) |
soc.add_connection( 'or1200_test', 'rst_ifc', 'cpu', 'rst', 'con_main_rst' ) |
soc.add_connection( 'or1200_test', 'clk_ifc', 'wb_bus', 'clk', 'con_main_clk' ) |
soc.add_connection( 'or1200_test', 'rst_ifc', 'wb_bus', 'rst', 'con_main_rst' ) |
soc.add_connection( 'clk_ifc', 'cpu', 'clk', 'con_main_clk' ) |
soc.add_connection( 'rst_ifc', 'cpu', 'rst', 'con_main_rst' ) |
soc.add_connection( 'clk_ifc', 'wb_bus', 'clk', 'con_main_clk' ) |
soc.add_connection( 'rst_ifc', 'wb_bus', 'rst', 'con_main_rst' ) |
|
soc.add_connection( 'wb_bus', 'i3', 'dbg', 'wb_ifc', 'con_wb_debug' ) |
soc.add_connection( 'wb_bus', 'i4', 'cpu', 'wb_data', 'con_data' ) |
115,9 → 115,9
|
soc.add_connection( 'dbg', 'cpu0_dbg', 'cpu', 'ext_debug', 'con_debug' ) |
|
soc.add_connection( 'or1200_test', 'clk_ifc', 'dbg', 'cpu0_dbg_clk', 'con_main_clk' ) |
soc.add_connection( 'or1200_test', 'jtag_ifc', 'dbg', 'jtag', 'con_jtag_top' ) |
soc.add_connection( 'or1200_test', 'uart_ifc', 'uart', 'uart_ifc', 'con_uart_top' ) |
soc.add_connection( 'clk_ifc', 'dbg', 'cpu0_dbg_clk', 'con_main_clk' ) |
soc.add_connection( 'jtag_ifc', 'dbg', 'jtag', 'con_jtag_top' ) |
soc.add_connection( 'uart_ifc', 'uart', 'uart_ifc', 'con_uart_top' ) |
|
soc_inst.consistency_check |
soc_inst.gen_toplevel |