public FIRRTL.FirrtlNode GetDefNodeFromLowFirrtlGraph(string nodeName) { GraphFIR.Module lowFirMod = LowFirGraph.MainModule; string[] pathToModule = GetPathToCurrentActualModule(); //Skip first module name as it's the name of the root node //that we start with foreach (var pathModName in pathToModule.Skip(1)) { GraphFIR.FIRRTLNode[] lowModNodes = lowFirMod.GetAllNodes(); GraphFIR.FIRRTLNode childLowModNode = lowModNodes.FirstOrDefault(x => x is GraphFIR.Module mod && mod.Name == pathModName); if (childLowModNode == null) { throw new Exception("High level firrtl module path didn't match low level firrtl module path."); } lowFirMod = (GraphFIR.Module)childLowModNode; } //This is a meh way of going about getting the correct node. //Nodes by themselves don't have a name so it works on the assumption //that there exists an io with the name which points to the correct node. GraphFIR.IO.FIRIO nodeIO = (GraphFIR.IO.FIRIO)lowFirMod.GetIO(nodeName); return(nodeIO.Flatten().First().Node.FirDefNode); }
public void AddNode(FIRRTLNode node) { node.SetModResideIn(this); Nodes.Add(node); foreach (var io in node.GetVisibleIO()) { if (!io.IsAnonymous) { NameToIO.Add(io.Name, io); } } }
public void AddNodeToModule(GraphFIR.FIRRTLNode node) { Mod.AddNode(node); }