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;
}
}
}
}
}
}
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);
}
}
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);
}
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();
}
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);
}
}
}
}
}
Aggregations