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)
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
def test_create_synthesis_record(self): synth_record = sdb_component.create_synthesis_record( synthesis_name = "name of names", commit_id = 0000, tool_name = "xilinx", tool_version = 14.1, user_name = "Dave McCoy") self.assertTrue(synth_record.is_synthesis_record())
def test_create_synthesis_record(self): synth_record = sdb_component.create_synthesis_record( synthesis_name="name of names", commit_id=0000, tool_name="xilinx", tool_version=14.1, user_name="Dave McCoy") self.assertTrue(synth_record.is_synthesis_record())
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)
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))
def test_insert_synthesis_record(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) synthesis = sdbc.create_synthesis_record( synthesis_name = "image.bit", commit_id = 01234567, tool_name = "xilinx xst", tool_version = 14.1, user_name = "*****@*****.**") self.som.insert_component(root, synthesis, 1) record = self.som.get_component(root, 3) self.assertEqual(record, synthesis)
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") synthesis = sdbc.create_synthesis_record("Synthesis Name", 123, "cool tool", 1.0, "jeff") sm.insert_component(root, url) sm.insert_component(root, synthesis) 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)
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") synthesis = sdbc.create_synthesis_record("Synthesis Name", 123, "cool tool", 1.0, "jeff") sm.insert_component(root, url) sm.insert_component(root, synthesis) 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)