GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — kactus2dev/PythonAPI/ExampleScripts/createComponent.py at main · kactus2/kactus2dev Expand file tree/ Copy pathcreateComponent.pyMore file actions 100 lines (80 loc) · 3.75 KB / Copy pathcreateComponent.pyFile metadata and controls100 lines (80 loc) · 3.75 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 import pythonAPI #from ExampleScripts.createComponentItems import createPort #from ExampleScripts.createComponentItems import createRegister #from ExampleScripts.createComponentItems import createField #from ExampleScripts.createComponentItems import createReset import ExampleScripts.createComponentItems as itemConstructor def constructComponent(api, vendor, library, name, version): if (api.vlnvExistsInLibrary(vendor, library, name, version)): print ("Component exists already") return False # Create a component. success = api.createComponent(vendor, library, name, version) if (not success): print ("Could not create the example component") return False api mapInterface = api.getMapInterface() mapName = "memoryMap" mapInterface.addMemoryMap(0, mapName) mapInterface.setAddressUnitBits(mapName, "16") # Set available address blocks for the address block interface. api.setBlocksForInterface(mapName) blockInterface = mapInterface.getAddressBlockInterface() blockName = "Address_Block" blockInterface.addBlock(0, blockName) blockInterface.setDescription(blockName, "Peripheral address block") blockInterface.setBaseAddress(blockName, "'h0") blockInterface.setRange(blockName, "32") blockInterface.setWidth(blockName, "32") # Set available register for the register interface. api.setRegistersForInterface(mapName, blockName) registerInterface = blockInterface.getSubInterface() registerName1 = "STAT" registerIndex = 0 itemConstructor.createRegister(registerInterface, registerIndex, registerName1, "Status register", "2", "32") # Set available fields for the field interface. api.setFieldsForInterface(mapName, blockName, registerName1) fieldInterface = registerInterface.getSubInterface() fieldName1 = "RX_FIFO" fieldIndex = 0 itemConstructor.createField(fieldInterface, fieldIndex, fieldName1, "RX_FIFO Not Empty", "0", "1", "read-only") # Set available resets for the reset interface. api.setResetsForInterface(mapName, blockName, registerName1, fieldName1) resetInterface = fieldInterface.getSubInterface() itemConstructor.createReset(resetInterface, 0, "", "1'b1", "1'b1") fieldName2 = "RX_FIFO_OVFL" fieldIndex = fieldIndex + 1 itemConstructor.createField(fieldInterface, fieldIndex, fieldName2, "RX_FIFO Overflow", "1", "1", "read-write") # Set available resets for the reset interface. api.setResetsForInterface(mapName, blockName, registerName1, fieldName2) itemConstructor.createReset(resetInterface, 0, "", "1'b1", "1'b1") registerName2 = "CMD" registerIndex = registerIndex + 1 itemConstructor.createRegister(registerInterface, registerIndex, registerName2, "Command register", "4", "32") # Set available fields for the field interface. api.setFieldsForInterface(mapName, blockName, registerName2) fieldName3 = "COMMAND" fieldIndex = 0 itemConstructor.createField(fieldInterface, fieldIndex, fieldName3, "Peripheral Command", "0", "4", "read-write") # Set available resets for the reset interface. api.setResetsForInterface(mapName, blockName, registerName2, fieldName3) itemConstructor.createReset(resetInterface, 0, "", "1'b1", "1'b1") # Create ports portInterface = api.getPortsInterface() itemConstructor.createPort(portInterface, "inPort", "in", "31", "0") itemConstructor.createPort(portInterface, "outPort", "out", "7", "0") itemConstructor.createPort(portInterface, "inOutPort", "inout", "31", "0") return True print ("\n", end='') print ("Example for constructing a Kactus2 component") api = pythonAPI.PythonAPI() vendor = "tut.fi" library = "example" name = "register_if" version = "1.0" success = constructComponent(api, vendor, library, name, version) if (success): api.saveComponent() api.closeOpenComponent() print ("Creation of component " + vendor + "." + library + "." + name + "." + version + " complete.") |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |