public void PortsToUpper(string netlist) { var instances = _instanceRepository.GetLibraryGateInstances(netlist); _instanceMutator.Take(instances).PortsToUpper(); _instanceRepository.UpdateMany(instances); }
private List <Instance> ReplaceWires(Module module, string inputPort, string outputPort, Instance buffer) { var instances = _instanceRepository.GetByHostModule(module.Netlist, module.Name); if (_bufferWiringVerifier.HostModuleDrivesBuffer(module, buffer, inputPort)) { _instanceMutator.Take(instances).ReplaceWires(buffer.GetWire(outputPort), buffer.GetWire(inputPort)); } else { _instanceMutator.Take(instances).ReplaceWires(buffer.GetWire(inputPort), buffer.GetWire(outputPort)); } _instanceRepository.UpdateMany(instances); return(instances.Where(instance => instance.ModuleName == buffer.ModuleName).ToList()); }
public void ReplacePorts_NoMapping_NoReplace() { var portsMap = new PortsMapping(); var instances = new List <Instance> { new Instance("netlist", "host", "name", "instName") { Net = new List <PortWirePair>() { new PortWirePair("a", "w1"), new PortWirePair("b", "w2") } } }; _target.Take(instances).ReplacePorts(portsMap); Assert.That(instances[0].Net, Has.Count.EqualTo(2)); Assert.That(instances[0].Net[0].Port, Is.EqualTo("a")); Assert.That(instances[0].Net[0].Wire, Is.EqualTo("w1")); Assert.That(instances[0].Net[1].Port, Is.EqualTo("b")); Assert.That(instances[0].Net[1].Wire, Is.EqualTo("w2")); }
public void Replace(string netlist, string gateToReplace, string newGate, PortsMapping portsMapping) { if (_moduleRepository.Exists(netlist, gateToReplace)) { throw new InvalidOperationException("can replace only library gates"); } var instances = _instanceRepository.GetByModuleName(netlist, gateToReplace); _instanceMutator.Take(instances) .MutateModuleName(newGate) .ReplacePorts(portsMapping); _instanceRepository.UpdateMany(instances); }