private void AddTemplate(string moduleName, PlacementInfo placeInfo, FIRRTLNode[] nodeOrder) { PlaceTemplate template = new PlaceTemplate(placeInfo, nodeOrder); lock (Templates) { Templates.Add(moduleName, template); } lock (Converters) { if (Converters.TryGetValue(moduleName, out var convs)) { foreach (var conv in convs) { conv.TemplateUpdated(template); } } } }
public PlacementInfo Convert(PlaceTemplate template) { List <Positioned <FIRRTLNode> > convertedNodePos = new List <Positioned <FIRRTLNode> >(); Dictionary <FIRRTLNode, Rectangle> convertedSpace = new Dictionary <FIRRTLNode, Rectangle>(); for (int i = 0; i < template.NodeOrder.Length; i++) { if (template.NodeOrder[i] == null) { continue; } Positioned <FIRRTLNode> from = template.NodeOrder[i].Value; FIRRTLNode to = NodeOrder[i]; convertedNodePos.Add(new Positioned <FIRRTLNode>(from.Position, to)); convertedSpace.Add(to, template.PlaceInfo.UsedSpace[from.Value]); } return(new PlacementInfo(convertedNodePos, convertedSpace, template.PlaceInfo.SpaceNeeded)); }
public void TemplateUpdated(PlaceTemplate template) { Ctrl.PlaceNodes(Convert(template)); }