コード例 #1
0
    def test_get_all_component_as_urns(self):
        """
        Go through all the devices and return a URN that will allow users
        to obtain a unique reference to a device

        """

        som = self.nsm.som
        root = som.get_root()
        c = create_synthesis_record("test",
                                    0,
                                    "xilinx",
                                    14.1,
                                    "bill")
        som.insert_component(root, c)
        c = create_repo_url_record("http://www.example.com")
        som.insert_component(root, c)
        c = create_integration_record("integrating is fun")
        som.insert_component(root, c)

        urns = self.nsm.get_all_components_as_urns()

        #print urns
        self.assertIn("/top", urns)
        self.assertIn("/top/peripheral", urns)
        self.assertIn("/top/peripheral/SDB", urns)
        self.assertIn("/top/peripheral/uart1", urns)
        self.assertIn("/top/peripheral/gpio1", urns)
        self.assertIn("/top/memory", urns)
        self.assertIn("/top/memory/wb_sdram", urns)
コード例 #2
0
    def test_generate_one_sub_bus_with_url(self):
        sm = som.SOM()
        sm.initialize_root()
        root = sm.get_root()
        peripheral = sm.insert_bus()
        peripheral.set_name("peripheral")
        memory = sm.insert_bus()
        memory.set_name("memory")
        d1 = sdbc.create_device_record(name = "device 1", size = 0x100)
        d2 = sdbc.create_device_record(name = "device 2", size = 0x100)
        m1 = sdbc.create_device_record(name = "memory 1", size = 0x10000)
        m2 = sdbc.create_device_record(name = "memory 2", size = 0x20000)
        intr = sdbc.create_integration_record("Integration Data",
                                                vendor_id = 0x800BEAF15DEADC03,
                                                device_id = 0x00000000)
        url = sdbc.create_repo_url_record("http://www.geocities.com")
        sm.insert_component(root, url)

        peripheral.set_child_spacing(0x0100000000)
        sm.insert_component(peripheral, intr)
        sm.insert_component(peripheral, d1)
        sm.insert_component(peripheral, d2)
        sm.insert_component(memory, m1)
        sm.insert_component(memory, m2)
        rom = generate_rom_image(sm)
        rom_in = sdbc.convert_rom_to_32bit_buffer(rom)
 
        #print_sdb(rom)
        sm = parse_rom_image(rom_in)
        rom_out = generate_rom_image(sm)
        rom_out = sdbc.convert_rom_to_32bit_buffer(rom_out)
        #print_sdb_rom(rom_out)
        #compare_roms(rom_in, rom_out)
        self.assertEqual(rom_in, rom_out)
コード例 #3
0
    def test_get_total_number_of_records(self):
        self.som.initialize_root()
        root = self.som.get_root()
        url = sdbc.create_repo_url_record("http://www.geocities.com")
        synthesis = sdbc.create_synthesis_record("Synthesis Name", 123, "cool tool", 1.0, "jeff")
        intr = sdbc.create_integration_record("Integration Data", vendor_id=0x800BEAF15DEADC03, device_id=0x00000000)

        peripheral = self.som.insert_bus()
        peripheral.set_name("peripheral")
        memory = self.som.insert_bus()
        memory.set_name("memory")
        self.som.insert_component(root, url)
        self.som.insert_component(root, synthesis)
        d1 = sdbc.create_device_record(name="device 1", size=0x100)
        d2 = sdbc.create_device_record(name="device 2", size=0x100)
        m1 = sdbc.create_device_record(name="memory 1", size=0x10000)
        m2 = sdbc.create_device_record(name="memory 2", size=0x20000)
        peripheral.set_child_spacing(0x0100000000)
        self.som.insert_component(peripheral, d1)
        self.som.insert_component(peripheral, d2)
        self.som.insert_component(peripheral, intr)
        self.som.insert_component(memory, m1)
        self.som.insert_component(memory, m2)
        count = get_total_number_of_records(self.som)
        print "count: %d" % count
コード例 #4
0
    def test_get_total_number_of_records(self):
        self.som.initialize_root()
        root = self.som.get_root()
        url = sdbc.create_repo_url_record("http://www.geocities.com")
        synthesis = sdbc.create_synthesis_record("Synthesis Name", 123,
                                                 "cool tool", 1.0, "jeff")
        intr = sdbc.create_integration_record("Integration Data",
                                              vendor_id=0x800BEAF15DEADC03,
                                              device_id=0x00000000)

        peripheral = self.som.insert_bus()
        peripheral.set_name("peripheral")
        memory = self.som.insert_bus()
        memory.set_name("memory")
        self.som.insert_component(root, url)
        self.som.insert_component(root, synthesis)
        d1 = sdbc.create_device_record(name="device 1", size=0x100)
        d2 = sdbc.create_device_record(name="device 2", size=0x100)
        m1 = sdbc.create_device_record(name="memory 1", size=0x10000)
        m2 = sdbc.create_device_record(name="memory 2", size=0x20000)
        peripheral.set_child_spacing(0x0100000000)
        self.som.insert_component(peripheral, d1)
        self.som.insert_component(peripheral, d2)
        self.som.insert_component(peripheral, intr)
        self.som.insert_component(memory, m1)
        self.som.insert_component(memory, m2)
        count = get_total_number_of_records(self.som)
        print "count: %d" % count
コード例 #5
0
    def test_generate_one_sub_bus_with_url(self):
        sm = som.SOM()
        sm.initialize_root()
        root = sm.get_root()
        peripheral = sm.insert_bus()
        peripheral.set_name("peripheral")
        memory = sm.insert_bus()
        memory.set_name("memory")
        d1 = sdbc.create_device_record(name="device 1", size=0x100)
        d2 = sdbc.create_device_record(name="device 2", size=0x100)
        m1 = sdbc.create_device_record(name="memory 1", size=0x10000)
        m2 = sdbc.create_device_record(name="memory 2", size=0x20000)
        intr = sdbc.create_integration_record("Integration Data",
                                              vendor_id=0x800BEAF15DEADC03,
                                              device_id=0x00000000)
        url = sdbc.create_repo_url_record("http://www.geocities.com")
        sm.insert_component(root, url)

        peripheral.set_child_spacing(0x0100000000)
        sm.insert_component(peripheral, intr)
        sm.insert_component(peripheral, d1)
        sm.insert_component(peripheral, d2)
        sm.insert_component(memory, m1)
        sm.insert_component(memory, m2)
        rom = generate_rom_image(sm)
        rom_in = sdbc.convert_rom_to_32bit_buffer(rom)

        #print_sdb(rom)
        sm = parse_rom_image(rom_in)
        rom_out = generate_rom_image(sm)
        rom_out = sdbc.convert_rom_to_32bit_buffer(rom_out)
        #print_sdb_rom(rom_out)
        #compare_roms(rom_in, rom_out)
        self.assertEqual(rom_in, rom_out)
コード例 #6
0
 def test_generate_one_sub_bus_with_url(self):
     self.som.initialize_root()
     root = self.som.get_root()
     bus = self.som.insert_bus()
     url = sdbc.create_repo_url_record("http://www.geocities.com")
     d = sdbc.create_device_record(name="device 1", size=0x100)
     self.som.insert_component(bus, d)
     self.som.insert_component(root, url)
     rom = generate_rom_image(self.som)
コード例 #7
0
 def test_generate_one_sub_bus_with_url(self):
     self.som.initialize_root()
     root = self.som.get_root()
     bus = self.som.insert_bus()
     url = sdbc.create_repo_url_record("http://www.geocities.com")
     d = sdbc.create_device_record(name="device 1", size=0x100)
     self.som.insert_component(bus, d)
     self.som.insert_component(root, url)
     rom = generate_rom_image(self.som)
コード例 #8
0
 def test_generate_one_sub_bus_with_synthesis(self):
     self.som.initialize_root()
     root = self.som.get_root()
     bus = self.som.insert_bus()
     url = sdbc.create_repo_url_record("http://www.geocities.com")
     synthesis = sdbc.create_synthesis_record("Synthesis Name", 123, "cool tool", 1.0, "jeff")
     d = sdbc.create_device_record(name="device 1", size=0x100)
     self.som.insert_component(bus, d)
     self.som.insert_component(root, synthesis)
     rom = generate_rom_image(self.som)
コード例 #9
0
 def test_generate_one_sub_bus_with_synthesis(self):
     self.som.initialize_root()
     root = self.som.get_root()
     bus = self.som.insert_bus()
     url = sdbc.create_repo_url_record("http://www.geocities.com")
     synthesis = sdbc.create_synthesis_record("Synthesis Name", 123,
                                              "cool tool", 1.0, "jeff")
     d = sdbc.create_device_record(name="device 1", size=0x100)
     self.som.insert_component(bus, d)
     self.som.insert_component(root, synthesis)
     rom = generate_rom_image(self.som)
コード例 #10
0
    def test_insert_url(self):
        self.som.initialize_root()
        root = self.som.get_root()
        din1 = sdbc.create_device_record(name = "t0", size = 0x10)
        din2 = sdbc.create_device_record(name = "t1", size = 0x10)
        din3 = sdbc.create_device_record(name = "t3", size = 0x10)

        self.som.insert_component(root, din1)
        self.som.insert_component(root, din2)
        self.som.insert_component(root, din3)

        url = sdbc.create_repo_url_record(   "http://www.geocities.com")
        self.som.insert_component(root, url, 1)
        record = self.som.get_component(root, 3)
        self.assertEqual(record, url)
コード例 #11
0
    def test_get_device_address(self):
        address = self.nsm.get_device_address("/top/peripheral/gpio1")
        som = self.nsm.som
        root = som.get_root()
        c = create_synthesis_record("test",
                                    0,
                                    "xilinx",
                                    14.1,
                                    "bill")
        som.insert_component(root, c)
        c = create_repo_url_record("http://www.example.com")
        som.insert_component(root, c)
        c = create_integration_record("integrating is fun")
        som.insert_component(root, c)

        self.assertEqual(address, long(0x02000000))
コード例 #12
0
 def test_create_repo_url_record(self):
     url = sdb_component.create_repo_url_record("wwww.cospandesign.com")
     self.assertTrue(url.is_url_record())
コード例 #13
0
 def test_create_repo_url_record(self):
     url = sdb_component.create_repo_url_record("wwww.cospandesign.com")
     self.assertTrue(url.is_url_record())