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

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [spec/] [core_def_spec.rb] - Diff between revs 8 and 10

Show entire file | Details | Blame | View Log

Rev 8 Rev 10
Line 63... Line 63...
  #   - one static parameter
  #   - one static parameter
  #
  #
  FULL_YAML = '''SOCM_CORE
  FULL_YAML = '''SOCM_CORE
name: core_A
name: core_A
description: A test IP-core
description: A test IP-core
version: rel1
id: core_A,rel1
date: 1.1.2014
date: 1.1.2014
license: LGPL
license: LGPL
licensefile:
licensefile:
author: Christian Haettich
author: Christian Haettich
authormail: feddischson@opencores.org
authormail: feddischson@opencores.org
Line 75... Line 75...
toplevel: core_a
toplevel: core_a
interfaces:
interfaces:
  :ifc01: SOCM_IFC
  :ifc01: SOCM_IFC
    name: core_AB_ifc
    name: core_AB_ifc
    dir: 0
    dir: 0
    version: "1"
    id: core_AB_ifc,1
    ports:
    ports:
      :sig_con1a: SOCM_PORT
      :sig_con1a: SOCM_PORT
         defn: sig_a
         defn: sig_a
         len:  param1
         len:  param1
hdlfiles:
hdlfiles:
Line 119... Line 119...
 
 
 
 
  # minimalistic def with one vhdl file
  # minimalistic def with one vhdl file
  MIN_YAML1 = '''SOCM_CORE
  MIN_YAML1 = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: top_A
toplevel: top_A
hdlfiles:
hdlfiles:
   :core_a.vhd: SOCM_HDL_FILE
   :core_a.vhd: SOCM_HDL_FILE
      path: ./core_a.vhd
      path: ./core_a.vhd
'''
'''
Line 133... Line 133...
 
 
  # minimalistic def with one
  # minimalistic def with one
  # vhdl and one verilog file
  # vhdl and one verilog file
  MIN_YAML2 = '''SOCM_CORE
  MIN_YAML2 = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: top_A
toplevel: top_A
hdlfiles:
hdlfiles:
   :core_a.vhd: SOCM_HDL_FILE
   :core_a.vhd: SOCM_HDL_FILE
      path: ./core_a.vhd
      path: ./core_a.vhd
   :core_b.v: SOCM_HDL_FILE
   :core_b.v: SOCM_HDL_FILE
Line 183... Line 183...
 
 
 
 
  # def with toplevel.size == 0
  # def with toplevel.size == 0
  F_YAML_TOPLEVEL = '''SOCM_CORE
  F_YAML_TOPLEVEL = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: ''
toplevel: ''
hdlfiles:
hdlfiles:
   :core_a.vhd: SOCM_HDL_FILE
   :core_a.vhd: SOCM_HDL_FILE
      path: ./core_a.vhd
      path: ./core_a.vhd
'''
'''
Line 197... Line 197...
 
 
 
 
  # def with hdlfiles.class != Hash
  # def with hdlfiles.class != Hash
  F_YAML_FILE_HASH = '''SOCM_CORE
  F_YAML_FILE_HASH = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: top_A
toplevel: top_A
hdlfiles:
hdlfiles:
   - test1.vhd
   - test1.vhd
   - test2.vhd
   - test2.vhd
'''
'''
Line 212... Line 212...
 
 
 
 
  # minimal setup with one interface
  # minimal setup with one interface
  MIN_YAML_IFC = '''SOCM_CORE
  MIN_YAML_IFC = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: top_A
toplevel: top_A
hdlfiles:
hdlfiles:
   :core_a.vhd: SOCM_HDL_FILE
   :core_a.vhd: SOCM_HDL_FILE
      path: ./core_a.vhd
      path: ./core_a.vhd
interfaces:
interfaces:
  :ifc01: SOCM_IFC
  :ifc01: SOCM_IFC
    name: a_ifc_def
    name: a_ifc_def
    dir: 0
    dir: 0
    version: "1"
    id: a_ifc_def,1
    ports:
    ports:
      :sig_con1a: SOCM_PORT
      :sig_con1a: SOCM_PORT
         defn: sig_a
         defn: sig_a
'''
'''
  valid_yamls << { desc: 'should return a class of type CoreDef when loading a minimal core-def with a minimal interface',
  valid_yamls << { desc: 'should return a class of type CoreDef when loading a minimal core-def with a minimal interface',
Line 236... Line 236...
 
 
 
 
  # minimal setup with one instance parameter
  # minimal setup with one instance parameter
  MIN_YAML_INSTP = '''SOCM_CORE
  MIN_YAML_INSTP = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: top_A
toplevel: top_A
hdlfiles:
hdlfiles:
   :core_a.vhd: SOCM_HDL_FILE
   :core_a.vhd: SOCM_HDL_FILE
      path: ./core_a.vhd
      path: ./core_a.vhd
inst_parameters:
inst_parameters:
Line 252... Line 252...
 
 
 
 
  # empty hash for param1
  # empty hash for param1
  F_YAML_INSTP_EMPTY = '''SOCM_CORE
  F_YAML_INSTP_EMPTY = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: top_A
toplevel: top_A
hdlfiles:
hdlfiles:
   :core_a.vhd: SOCM_HDL_FILE
   :core_a.vhd: SOCM_HDL_FILE
      path: ./core_a.vhd
      path: ./core_a.vhd
inst_parameters:
inst_parameters:
Line 266... Line 266...
                        yaml: F_YAML_INSTP_EMPTY }
                        yaml: F_YAML_INSTP_EMPTY }
 
 
  # minimal def with one static parameter
  # minimal def with one static parameter
  MIN_YAML_STATIC = '''SOCM_CORE
  MIN_YAML_STATIC = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: top_A
toplevel: top_A
hdlfiles:
hdlfiles:
   :core_a.vhd: SOCM_HDL_FILE
   :core_a.vhd: SOCM_HDL_FILE
      path: ./core_a.vhd
      path: ./core_a.vhd
static_parameters:
static_parameters:
Line 288... Line 288...
 
 
 
 
  # empty static parameter
  # empty static parameter
  F_YAML_STATIC_EMPTY = '''SOCM_CORE
  F_YAML_STATIC_EMPTY = '''SOCM_CORE
name: core_A
name: core_A
version: rel1
id: core_A,rel1
toplevel: top_A
toplevel: top_A
hdlfiles:
hdlfiles:
   :core_a.vhd: SOCM_HDL_FILE
   :core_a.vhd: SOCM_HDL_FILE
      path: ./core_a.vhd
      path: ./core_a.vhd
static_parameters:
static_parameters:
Line 313... Line 313...
# end
# end
 
 
 
 
  it "should return a CoreDef object, if the object is created via new" do
  it "should return a CoreDef object, if the object is created via new" do
    file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) }
    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
    c.class.should be == SOCMaker::CoreDef
  end
  end
 
 
 
 
 
 
Line 473... Line 473...
 
 
describe SOCMaker::CoreDef, "object handling, en-decoding:" do
describe SOCMaker::CoreDef, "object handling, en-decoding:" do
 
 
  it "should be possible to encode and decode a core definition" do
  it "should be possible to encode and decode a core definition" do
    file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) }
    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
    yaml_str = o1.to_yaml
    o2 = YAML::load( yaml_str )
    o2 = YAML::load( yaml_str )
    o1.should be == o2
    o1.should be == o2
  end
  end
 
 
  it "should return false for two non-equal objects" do
  it "should return false for two non-equal objects" do
    file = { "file.vhd".to_sym => SOCMaker::HDLFile.new( "./file.vhd" ) }
    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 = Marshal::load(Marshal.dump(o1))
    o2.version = "v2"
    o2.id = "acore,v2"
    ( o2 == o1 ).should be == false
    ( o2 == o1 ).should be == false
    o2 = Marshal::load(Marshal.dump(o1))
    o2 = Marshal::load(Marshal.dump(o1))
    o2.hdlfiles[ "file.vhd".to_sym ].use_syn = false
    o2.hdlfiles[ "file.vhd".to_sym ].use_syn = false
    ( o2 == o1 ).should be == false
    ( o2 == o1 ).should be == false
  end
  end

powered by: WebSVN 2.1.0

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