private bool TryFindVerilogMemPort(string ioName, MemoryIO memory, out IContainerIO foundIO) { foreach (MemPort port in memory.GetIOInOrder()) { if (ioName.Contains(port.Name)) { int portNameStart = ioName.IndexOf(port.Name); string remaining = ioName.Substring(0, portNameStart); string portPath = ioName.Substring(portNameStart); if (TryFindIO(portPath, memory, false, out foundIO)) { if (foundIO is ScalarIO) { return(true); } if (TryFindIO(remaining, foundIO, false, out var fullFoundIO)) { if (fullFoundIO is not ScalarIO) { foundIO = null; return(false); } foundIO = fullFoundIO; return(true); } } } } foundIO = null; return(false); }
public bool TryGetIO(string ioName, out IContainerIO container) { if (MemIO.TryGetIO(ioName, out IContainerIO innerIO)) { container = innerIO; return(true); } container = null; return(false); }
public override bool TryGetIO(string ioName, out IContainerIO container) { if (base.TryGetIO(ioName, out container)) { return(true); } else if (DataOut.TryGetIO(ioName, out container)) { return(true); } return(false); }
public bool TryGetIO(string ioName, out IContainerIO container) { foreach (var condMod in ConditionalModules) { if (condMod.Mod.TryGetIO(ioName, out container)) { return(true); } } container = null; return(false); }
private IContainerIO GetModuleContainer(Span <string> modulePath, bool isVerilogVCD) { IContainerIO rootContainer = MainModule; IContainerIO moduleIO = null; if (rootContainer.TryGetIO(modulePath, out moduleIO)) { return(moduleIO); } if (!(!isVerilogVCD && (modulePath[^ 1].EndsWith("_w") || modulePath[^ 1].EndsWith("_r"))))
public override bool TryGetIO(string ioName, out IContainerIO container) { if (int.TryParse(ioName, out int index)) { if (index >= IO.Length || index < 0) { container = null; return(false); } container = IO[index]; return(true); } container = null; return(false); }
public bool TryGetIOInternal(string ioName, bool lookUp, out IContainerIO container) { if (NameToIO.TryGetValue(ioName, out FIRIO innerIO)) { container = innerIO; return(true); } if (InternalIO.TryGetValue(ioName, out FIRIO io)) { container = io; return(true); } if (lookUp) { foreach (var condNode in Nodes.OfType <Conditional>()) { foreach (var condMod in condNode.CondMods) { if (condMod.Mod.TryGetIO(ioName, out container)) { return(true); } } } } if (IsConditional && ResideIn.TryGetIOInternal(ioName, false, out container)) { return(true); } container = null; return(false); }
public override bool TryGetIO(string ioName, out IContainerIO container) { container = null; return(false); }
public abstract bool TryGetIO(string ioName, out IContainerIO container);
public override bool TryGetIO(string ioName, out IContainerIO container) { return(TryGetIOInternal(ioName, true, out container)); }
private bool TryFindIO(string ioName, IContainerIO container, bool isVerilogVCD, out IContainerIO foundIO) { string remainingName = ioName; string searchName = remainingName; while (true) { if (container.TryGetIO(searchName, out foundIO)) { container = foundIO; //Remove found name from what still needs to be found remainingName = remainingName.Substring(searchName.Length); //Also remove _ from the name as firrtl uses it as an io name //separator if (remainingName.Length > 0) { remainingName = remainingName.Substring(1); } if (remainingName.Length == 0) { return(true); } //Verilog represents memport names in a wierd way in the vcd //which is why that case has to be specially handled if (isVerilogVCD && container is MemoryIO memory && memory.GetDataType() is AggregateIO) { if (TryFindVerilogMemPort(remainingName, memory, out foundIO)) { return(true); } foundIO = null; return(false); } if (container is ScalarIO) { foundIO = null; return(false); } if (container is DuplexIO duplex) { if (remainingName.EndsWith("/in")) { container = duplex.GetInput(); remainingName = remainingName.Substring(0, remainingName.Length - "/in".Length); } else { container = duplex.GetOutput(); } } searchName = remainingName; } else { int _index = searchName.LastIndexOf('_'); if (_index == -1) { foundIO = null; return(false); } searchName = searchName.Substring(0, _index); } } }