Search in sources :

Example 1 with NetlistComponent

use of com.bfh.logisim.designrulecheck.NetlistComponent in project logisim-evolution by reds-heig.

the class MappableResourcesContainer method BuildIOMappingInformation.

public void BuildIOMappingInformation() {
    if (fpgaInputsList == null) {
        fpgaInputsList = new HashMap<String, Integer>();
    } else {
        fpgaInputsList.clear();
    }
    if (fpgaInOutsList == null) {
        fpgaInOutsList = new HashMap<String, Integer>();
    } else {
        fpgaInOutsList.clear();
    }
    if (fpgaOutputsList == null) {
        fpgaOutputsList = new HashMap<String, Integer>();
    } else {
        fpgaOutputsList.clear();
    }
    nrOfFPGAInputPins = 0;
    nrOfFPGAInOutPins = 0;
    nrOfFPGAOutputPins = 0;
    for (ArrayList<String> key : myMappableResources.keySet()) {
        NetlistComponent comp = myMappableResources.get(key);
        for (String Map : GetMapNamesList(key, comp)) {
            FPGAIOInformationContainer BoardComp = currentUsedBoard.GetComponent(comp.getMap(Map));
            if (BoardComp.GetType().equals(IOComponentTypes.Pin)) {
                if (comp.getEnd(0).IsOutputEnd()) {
                    fpgaInputsList.put(Map, nrOfFPGAInputPins);
                    nrOfFPGAInputPins++;
                } else {
                    fpgaOutputsList.put(Map, nrOfFPGAOutputPins);
                    nrOfFPGAOutputPins++;
                }
            } else {
                int NrOfPins = IOComponentTypes.GetFPGAInputRequirement(BoardComp.GetType());
                if (NrOfPins != 0) {
                    fpgaInputsList.put(Map, nrOfFPGAInputPins);
                    if (BoardComp.GetType().equals(IOComponentTypes.DIPSwitch)) {
                        nrOfFPGAInputPins += BoardComp.getNrOfPins();
                    } else if (BoardComp.GetType().equals(IOComponentTypes.PortIO)) {
                        nrOfFPGAInputPins += BoardComp.getNrOfPins();
                    } else {
                        nrOfFPGAInputPins += NrOfPins;
                    }
                }
                NrOfPins = IOComponentTypes.GetFPGAOutputRequirement(BoardComp.GetType());
                if (NrOfPins != 0) {
                    fpgaOutputsList.put(Map, nrOfFPGAOutputPins);
                    nrOfFPGAOutputPins += NrOfPins;
                }
                NrOfPins = IOComponentTypes.GetFPGAInOutRequirement(BoardComp.GetType());
                if (NrOfPins != 0) {
                    fpgaInOutsList.put(Map, nrOfFPGAInOutPins);
                    if (BoardComp.GetType().equals(IOComponentTypes.PortIO)) {
                        nrOfFPGAInOutPins += BoardComp.getNrOfPins();
                    } else {
                        nrOfFPGAInOutPins += NrOfPins;
                    }
                }
            }
        }
    }
}
Also used : NetlistComponent(com.bfh.logisim.designrulecheck.NetlistComponent) FPGAIOInformationContainer(com.bfh.logisim.fpgaboardeditor.FPGAIOInformationContainer)

Example 2 with NetlistComponent

use of com.bfh.logisim.designrulecheck.NetlistComponent in project logisim-evolution by reds-heig.

the class MappableResourcesContainer method ToggleAlternateMapping.

public void ToggleAlternateMapping(String item) {
    ArrayList<String> key = GetHierarchyKey(item);
    NetlistComponent comp = myMappableResources.get(key);
    if (comp != null) {
        if (comp.AlternateMappingEnabled(key)) {
            for (String MapName : GetMapNamesList(key, comp)) {
                if (mappedList.containsKey(MapName)) {
                    return;
                }
            }
        }
        comp.ToggleAlternateMapping(key);
    }
}
Also used : NetlistComponent(com.bfh.logisim.designrulecheck.NetlistComponent)

Example 3 with NetlistComponent

use of com.bfh.logisim.designrulecheck.NetlistComponent in project logisim-evolution by reds-heig.

the class MappableResourcesContainer method GetSelectableItemsList.

public ArrayList<BoardRectangle> GetSelectableItemsList(String DisplayName, BoardInformation BoardInfo) {
    ArrayList<BoardRectangle> List;
    ArrayList<String> key = GetHierarchyKey(DisplayName);
    NetlistComponent comp = myMappableResources.get(key);
    int pinNeeded = comp.GetIOInformationContainer().GetNrOfInOutports() + comp.GetIOInformationContainer().GetNrOfInports() + comp.GetIOInformationContainer().GetNrOfOutports();
    /* first check main map type */
    if (!comp.AlternateMappingEnabled(key)) {
        List = BoardInfo.GetIoComponentsOfType(comp.GetIOInformationContainer().GetMainMapType(), pinNeeded);
        if (!List.isEmpty()) {
            return RemoveUsedItems(List, 0);
        }
    }
    List = new ArrayList<BoardRectangle>();
    int MapId = 0;
    IOComponentTypes MapType;
    do {
        MapType = comp.GetIOInformationContainer().GetAlternateMapType(MapId);
        List.addAll(BoardInfo.GetIoComponentsOfType(MapType, 0));
        MapId++;
    } while (MapType != IOComponentTypes.Unknown);
    return RemoveUsedItems(List, pinNeeded);
}
Also used : BoardRectangle(com.bfh.logisim.fpgaboardeditor.BoardRectangle) NetlistComponent(com.bfh.logisim.designrulecheck.NetlistComponent) IOComponentTypes(com.bfh.logisim.fpgaboardeditor.FPGAIOInformationContainer.IOComponentTypes)

Example 4 with NetlistComponent

use of com.bfh.logisim.designrulecheck.NetlistComponent in project logisim-evolution by reds-heig.

the class MappableResourcesContainer method UnMap.

public void UnMap(String comp) {
    ArrayList<String> key = GetHierarchyKey(comp);
    NetlistComponent MapComp = myMappableResources.get(key);
    if (MapComp == null) {
        logger.error("Internal error!");
        return;
    }
    MapComp.removeMap(DisplayNametoMapName(comp));
    rebuildMappedLists();
}
Also used : NetlistComponent(com.bfh.logisim.designrulecheck.NetlistComponent)

Example 5 with NetlistComponent

use of com.bfh.logisim.designrulecheck.NetlistComponent in project logisim-evolution by reds-heig.

the class MappableResourcesContainer method rebuildMappedLists.

public void rebuildMappedLists() {
    mappedList.clear();
    for (ArrayList<String> key : myMappableResources.keySet()) {
        if (key.get(0).equals(currentBoardName)) {
            NetlistComponent comp = myMappableResources.get(key);
            /*
				 * we can have two different situations: 1) A multipin component
				 * is mapped to a multipin resource. 2) A multipin component is
				 * mapped to multiple singlepin resources.
				 */
            /* first we handle the single pin version */
            boolean hasmap = false;
            for (String MapName : GetMapNamesList(key, comp)) {
                if (comp.getMap(MapName) != null) {
                    hasmap = true;
                    mappedList.put(MapName, comp.getMap(MapName));
                }
            }
            if (!hasmap) {
                comp.ToggleAlternateMapping(key);
                for (String MapName : GetMapNamesList(key, comp)) {
                    if (comp.getMap(MapName) != null) {
                        hasmap = true;
                        mappedList.put(MapName, comp.getMap(MapName));
                    }
                }
                if (!hasmap) {
                    comp.ToggleAlternateMapping(key);
                }
            }
        }
    }
}
Also used : NetlistComponent(com.bfh.logisim.designrulecheck.NetlistComponent)

Aggregations

NetlistComponent (com.bfh.logisim.designrulecheck.NetlistComponent)18 ArrayList (java.util.ArrayList)6 ConnectionPoint (com.bfh.logisim.designrulecheck.ConnectionPoint)5 ReptarLocalBus (com.cburch.logisim.std.io.ReptarLocalBus)5 ClockHDLGeneratorFactory (com.cburch.logisim.std.wiring.ClockHDLGeneratorFactory)4 PortIO (com.cburch.logisim.std.io.PortIO)3 TreeMap (java.util.TreeMap)3 Netlist (com.bfh.logisim.designrulecheck.Netlist)2 FPGAIOInformationContainer (com.bfh.logisim.fpgaboardeditor.FPGAIOInformationContainer)2 SubcircuitFactory (com.cburch.logisim.circuit.SubcircuitFactory)2 Component (com.cburch.logisim.comp.Component)2 Pin (com.cburch.logisim.std.wiring.Pin)2 BubbleInformationContainer (com.bfh.logisim.designrulecheck.BubbleInformationContainer)1 BoardRectangle (com.bfh.logisim.fpgaboardeditor.BoardRectangle)1 IOComponentTypes (com.bfh.logisim.fpgaboardeditor.FPGAIOInformationContainer.IOComponentTypes)1 MappableResourcesContainer (com.bfh.logisim.fpgagui.MappableResourcesContainer)1 Splitter (com.cburch.logisim.circuit.Splitter)1 EndData (com.cburch.logisim.comp.EndData)1 Location (com.cburch.logisim.data.Location)1 DipSwitch (com.cburch.logisim.std.io.DipSwitch)1