OpenCores
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/spec
    from Rev 7 to Rev 8
    Reverse comparison

Rev 7 → Rev 8

/core_def_spec.rb
502,4 → 502,5
end
 
 
 
# vim: noai:ts=2:sw=2
/ifc_spc_spec.rb
51,9 → 51,12
name: core_ifc
version: '1'
ports:
:sig_a: 1
:sig_b: 1
:sig_c: 0
:sig_a:
:dir: 1
:sig_b:
:dir: 1
:sig_c:
:dir: 0
"""
 
IFC_YAML_INVALID = """
/test_soc.yaml
46,7 → 46,12
:inst_d: SOCM_INST
type: core_Brel1
params: {}
static: {}
 
static:
:core_Arel1:
:p1: 11
:pv1: 0
 
cons:
:a_new_con:
:rule: or
/core_inst_spec.rb
134,24 → 134,6
( o2 == o1 ).should be == false
end
 
 
 
it "should create valid vhdl output with our test library" do
SOCMaker::conf[ :build_dir ] = 'spec/tmp_build2'
SOCMaker::conf[ :hdl_dir ] = 'b'
coder = SOCMaker::VHDLCoder.new
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.consistency_check
soc_inst.gen_toplevel( coder );
#soc.copy_files
#p soc.cons
#puts soc.to_yaml
end
 
it "should call coder functions for each core-def. (stub-version)" do
SOCMaker::lib.clear
176,6 → 158,7
coder.stub( :filename ){ |x| x + ".vhd" }
 
coder.stub( :add_ifc_default_assignment )
 
coder.stub( :add_ifc_connection )
 
197,10 → 180,13
SOCMaker::lib.add_core( core_a )
SOCMaker::lib.add_core( core_b )
ifc_spc = SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { port_a: 1, port_b: 0 } )
ifc_spc = SOCMaker::IfcSpc.new( "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 ) } )
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "v1", 1, { b: SOCMaker::IfcPort.new( "port_b", 1 ) } )
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_0 = SOCMaker::IfcDef.new( "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
249,6 → 235,24
end
 
 
 
 
it "should create valid vhdl output with our test library" do
SOCMaker::conf[ :build_dir ] = 'spec/tmp_build2'
SOCMaker::conf[ :hdl_dir ] = 'b'
coder = SOCMaker::VHDLCoder.new
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.consistency_check
soc_inst.gen_toplevel( coder );
soc.copy_files
#p soc.cons
#puts soc.to_yaml
end
 
end
 
# vim: noai:ts=2:sw=2
/test_soc_lib/ifcs/core_AB_ifc/top_ifc.yaml
2,6 → 2,8
name: top_ifc
version: "1"
ports:
:sig_1: 1
:sig_2: 1
:sig_1:
:dir: 1
:sig_2:
:dir: 1
 
/test_soc_lib/ifcs/core_AB_ifc/core_AB_ifc.yaml
2,6 → 2,14
name: core_AB_ifc
version: "1"
ports:
:sig_a: 1
:sig_b: 1
:sig_c: 0
:sig_a:
:dir: 1
:mandatory: true
:sig_b:
:dir: 1
:mandatory: true
:default: '1'
:sig_c:
:dir: 0
:mandatory: false
:default: 'X'
/test_soc_lib/cores/core_A_rel1/core_a_pkg3.v.src
0,0 → 1,6
 
 
TOK_V1
 
 
 
/test_soc_lib/cores/core_A_rel1/00_core_a.yaml
24,6 → 24,20
:sig_con1c: SOCM_PORT
defn: sig_c
len: 1
:ifc02: SOCM_IFC
name: core_AB_ifc
dir: 1
version: "1"
ports:
:sig_con1ax: SOCM_PORT
defn: sig_a
len: param1
:sig_con1bx: SOCM_PORT
defn: sig_b
len: param2
:sig_con1cx: SOCM_PORT
defn: sig_c
len: 1
 
 
hdlfiles:
/test_soc_lib/cores/core_A_rel1/01_core_a.yaml
11,7 → 11,7
max: 100
visible: true
editable: true
default: 3
default: 22
description: Some setup
:p3: SOCM_SENTRY
token: TOK_XYZ
37,4 → 37,21
default: 5
description: More setup
 
 
:core_a_pkg3.v.src: SOCM_SPARAM
dir: .
path: ./core_a_pkg3.v.src
file_dst: core_a_pkg3.v
parameters:
:pv1: SOCM_SENTRY
token: TOK_V1
type: enum
min: 0
max: 100
visible: true
editable: true
default: 5
description: More setup
choice:
- "`define SEL_1"
- "`define SEL_2"
- "`define SEL_3"
/soc_def_spec.rb
235,8 → 235,8
 
it "should raise an ProcessingError if the ifc.-version is wrong" do
 
ifc_spc1 = SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { port_a: 1, port_b: 0 } )
ifc_spc2 = SOCMaker::IfcSpc.new( "myifc", "v2", 'ports' => { port_a: 1, port_b: 0 } )
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 ) } )
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) }
262,9 → 262,15
 
it "should add a connection entry" do
 
ifc_spc = SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { port_a: 1, port_b: 0 } )
ifc_def_1 = SOCMaker::IfcDef.new( "myifc", "v1", 0, { a: SOCMaker::IfcPort.new( "port_a", 1 ) } )
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "v1", 1, { b: SOCMaker::IfcPort.new( "port_b", 1 ) } )
ifc_spc = SOCMaker::IfcSpc.new( "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_0 = SOCMaker::IfcDef.new( "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" )
291,9 → 297,14
 
it "should add a connection entry, which connects the toplevel's port" do
 
ifc_spc = SOCMaker::IfcSpc.new( "myifc", "v1", 'ports' => { port_a: 1, port_b: 0 } )
ifc_def_1 = SOCMaker::IfcDef.new( "myifc", "v1", 0, { a: SOCMaker::IfcPort.new( "port_a", 1 ) } )
ifc_def_0 = SOCMaker::IfcDef.new( "myifc", "v1", 1, { b: SOCMaker::IfcPort.new( "port_b", 1 ) } )
ifc_spc = SOCMaker::IfcSpc.new( "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_0 = SOCMaker::IfcDef.new( "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_a.interfaces[ :ifc_a ] = ifc_def_0
/component_spec.rb
180,8 → 180,8
it 'should iterate over all ports' do
 
SOCMaker::lib.clear
ifc_s1 = SOCMaker::IfcSpc.new( "i1", "v1", 'ports' => { p1: 1, p2: 1, p3: 0 } )
ifc_s2 = SOCMaker::IfcSpc.new( "i2", "v1", 'ports' => { x1: 1, x2: 0 } )
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} } )
SOCMaker::lib.add_ifc( ifc_s1 )
SOCMaker::lib.add_ifc( ifc_s2 )
 
203,7 → 203,7
r_len = []
r_is_last = []
 
c.ports do |arg_name,arg_dir,arg_len,arg_is_last|
c.ports do |arg_name,arg_dir,arg_len,arg_default,arg_is_last|
r_name << arg_name
r_dir << arg_dir
r_len << arg_len
215,22 → 215,47
r_is_last.should be == [ false, false, false, false, true ]
 
 
r_def = []
#r_def = []
r_name = []
r_dir = []
 
c.ports( "i1" ) do |arg_name,arg_def,arg_dir|
r_def << arg_def
c.ports( "i1" ) do |arg_name,arg_dir, arg_default, arg_is_last|
#r_def << arg_def
r_name << arg_name
r_dir << arg_dir
end
r_def.should be == %w[ m_p1 m_p2 m_p3 ]
r_name.should be == %w[ p1 p2 p3 ]
#r_def.should be == %w[ m_p1 m_p2 m_p3 ]
r_name.should be == %w[ m_p1 m_p2 m_p3 ]
r_dir.should be == [ 1, 1, 0, ]
 
end
 
end
 
 
describe SOCMaker::Component, "consistency_check" do
 
 
it "should throw an error if an incomplete interface is used" do
file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) }
 
# three (auto) mandatory ports
ifc_s1 = SOCMaker::IfcSpc.new( "i1", "v1", 'ports' => { p1: { dir: 1}, p2: {dir: 1}, p3: {dir:0} } )
 
# interface implementaiton with only two of the three ports
p1 = SOCMaker::IfcPort.new( "p1", 1 )
p2 = SOCMaker::IfcPort.new( "p2", 2 )
ifc_d1 = SOCMaker::IfcDef.new( "i1", "v1", 0, { m_p1: p1, m_p2: p2 } )
c = SOCMaker::Component.new( "acore", "v1", "top",
{ 'interfaces' => { i1: ifc_d1 } } )
 
 
expect{ c.consistency_check }.
to raise_error( SOCMaker::ERR::ProcessingError )
end
 
end
 
# vim: noai:ts=2:sw=2

powered by: WebSVN 2.1.0

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