Esempio n. 1
0
        private static GraphFIR.IO.FIRIO VisitBundle(VisitHelper helper, FIRRTL.Dir direction, string bundleName, FIRRTL.BundleType bundle, bool forcePassive)
        {
            List <GraphFIR.IO.FIRIO> io = new List <GraphFIR.IO.FIRIO>();

            foreach (var field in bundle.Fields)
            {
                //If passive then ignore flips so all flows are the same
                FIRRTL.Dir fieldDir = !forcePassive?direction.Flip(field.Flip) : direction;

                io.Add(VisitType(helper, fieldDir, field.Name, field.Type, forcePassive));
            }

            return(new GraphFIR.IO.IOBundle(null, bundleName, io));
        }
Esempio n. 2
0
 private static GraphFIR.IO.FIRIO VisitType(VisitHelper helper, FIRRTL.Dir direction, string name, FIRRTL.IFIRType type, bool forcePassive)
 {
     if (type is FIRRTL.BundleType bundle)
     {
         return(VisitBundle(helper, direction, name, bundle, forcePassive));
     }
     else if (type is FIRRTL.VectorType vec)
     {
         return(VisitVector(helper, direction, name, vec, forcePassive));
     }
     else if (direction == FIRRTL.Dir.Input)
     {
         return(new GraphFIR.IO.Input(null, name, type));
     }
     else if (direction == FIRRTL.Dir.Output)
     {
         return(new GraphFIR.IO.Output(null, name, type));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Esempio n. 3
0
        private static GraphFIR.IO.FIRIO VisitVector(VisitHelper helper, FIRRTL.Dir direction, string vectorName, FIRRTL.VectorType vec, bool forcePassive)
        {
            var type = VisitType(helper, direction, null, vec.Type, forcePassive);

            return(new GraphFIR.IO.Vector(null, vectorName, vec.Size, type));
        }
Esempio n. 4
0
 private static GraphFIR.IO.FIRIO VisitTypeAsPassive(VisitHelper helper, FIRRTL.Dir direction, string name, FIRRTL.IFIRType type)
 {
     return(VisitType(helper, direction, name, type, true));
 }