Ejemplo n.º 1
0
        private static List <FIRIO> CreateIO(FIRIO inputType, int addressWidth, FIRRTLNode node)
        {
            FIRIO dataOut = inputType.Flip(node);

            dataOut.SetName("rdata");

            FIRIO dataIn = inputType.Copy(node);

            dataIn.SetName("wdata");

            FIRIO mask = inputType.Copy(node);

            mask.SetName("wmask");
            AsMaskType(mask);

            List <FIRIO> io = new List <FIRIO>();

            io.Add(new Input(node, "wmode", new UIntType(1)));
            io.Add(dataOut);
            io.Add(dataIn);
            io.Add(mask);
            io.Add(new Input(node, "addr", new UIntType(addressWidth)));
            io.Add(new Input(node, "en", new UIntType(1)));
            io.Add(new Input(node, "clk", new ClockType()));

            return(io);
        }
Ejemplo n.º 2
0
 public Computable(FIRRTLNode node)
 {
     this.Node       = node;
     this.Con        = null;
     this.IsBorderIO = false;
     this.OldValue   = new BinaryVarValue();
 }
Ejemplo n.º 3
0
 public ScalarIO(FIRRTLNode node, string name, IFIRType type) : base(node, name)
 {
     if (type is GroundType ground && ground.IsTypeFullyKnown())
     {
         this.Type = ground;
     }
 }
Ejemplo n.º 4
0
        private bool UpdateOffsets(FIRRTLNode node, Dictionary <FIRRTLNode, List <DirectedIO> > nodeOffsets, List <DirectedIO> offsets)
        {
            //Data changed if this node didn't have previous offsets
            if (nodeOffsets.TryAdd(node, offsets))
            {
                return(true);
            }

            //Only update if the offsets are different
            List <DirectedIO> oldOffsets = nodeOffsets[node];

            if (oldOffsets.Count != offsets.Count)
            {
                nodeOffsets[node] = offsets;
                return(true);
            }

            for (int i = 0; i < oldOffsets.Count; i++)
            {
                if (oldOffsets[i] != offsets[i])
                {
                    nodeOffsets[node] = offsets;
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 5
0
        public MemWritePort(FIRRTLNode node, string name, List <FIRIO> io) : base(node, name, io)
        {
            this.DataIn = (FIRIO)GetIO("data");
            this.Mask   = (FIRIO)GetIO("mask");

            InitDataToMask();
        }
Ejemplo n.º 6
0
 public FIRComponentUpdate(FIRRTLNode node, Point size, List <DirectedIO> inputOffsets, List <DirectedIO> outputOffsets)
 {
     this.Node          = node;
     this.Size          = size;
     this.InputOffsets  = inputOffsets;
     this.OutputOffsets = outputOffsets;
 }
Ejemplo n.º 7
0
        internal void AddNodePlacement(FIRRTLNode node, Rectangle shape)
        {
            NodePositions.Add(new Positioned <FIRRTLNode>(shape.Pos, node));
            SpaceNeeded = Point.Max(SpaceNeeded, new Point(shape.RightX, shape.BottomY));

            UsedSpace.Add(node, shape);
        }
        public List <WirePath> Convert(RouteTemplate template)
        {
            List <WirePath> convWires = new List <WirePath>();

            for (int i = 0; i < template.Wires.Count; i++)
            {
                WirePath   fromWires     = template.Wires[i];
                FIRRTLNode fromStartNode = fromWires.GetStartNode();
                FIRRTLNode fromEndNode   = fromWires.GetEndNode();
                FIRIO      fromStartIO   = fromWires.GetStartIO();
                FIRIO      fromEndIO     = fromWires.GetEndIO();

                int startNodeIndex = template.NodeOrderIndex[fromStartNode];
                int endNodeIndex   = template.NodeOrderIndex[fromEndNode];
                int startIOIndex   = template.IOOrderIndex[fromStartIO];
                int endIOIndex     = template.IOOrderIndex[fromEndIO];

                FIRRTLNode toStartNode = NodeOrder[startNodeIndex];
                FIRRTLNode toEndNode   = NodeOrder[endNodeIndex];
                FIRIO      toStartIO   = IOOrder[startIOIndex];
                FIRIO      toEndIO     = IOOrder[endIOIndex];

                convWires.Add(fromWires.CopyWithNewNodes(toStartNode, toStartIO, toEndNode, toEndIO));
            }

            return(convWires);
        }
Ejemplo n.º 9
0
 public Computable(Output con)
 {
     this.Node       = null;
     this.Con        = con;
     this.IsBorderIO = con.Node is Module || con.Node is Wire;
     this.OldValue   = new BinaryVarValue();
 }
Ejemplo n.º 10
0
        public MemRWPort(FIRRTLNode node, string name, List <FIRIO> io) : base(node, name, io)
        {
            this.DataOut   = (FIRIO)GetIO("rdata");
            this.DataIn    = (FIRIO)GetIO("wdata");
            this.Mask      = (FIRIO)GetIO("wmask");
            this.WriteMode = (FIRIO)GetIO("wmode");

            InitDataToMask();
        }
Ejemplo n.º 11
0
        public void UpdateIOFromNode(FIRRTLNode node, List <DirectedIO> inputOffsets, List <DirectedIO> outputOffsets)
        {
            Connections.UpdateIOFromNode(node, inputOffsets, outputOffsets);

            lock (MissingNodeIO)
            {
                MissingNodeIO.Remove(node);
            }
        }
Ejemplo n.º 12
0
 public override FIRIO ToFlow(FlowChange flow, FIRRTLNode node)
 {
     return(flow switch
     {
         FlowChange.Source => new Output(node, Name, Type),
         FlowChange.Sink => new Input(node, Name, Type),
         FlowChange.Flipped => new Input(node, Name, Type),
         FlowChange.Preserve => new Output(node, Name, Type),
         var error => throw new Exception($"Unknown flow. Flow: {flow}")
     });
Ejemplo n.º 13
0
        public IOBundle(FIRRTLNode node, string name, List <FIRIO> io) : base(node, name)
        {
            this.OrderedIO = io.ToList();

            foreach (var firIO in io)
            {
                IO.Add(firIO.Name, firIO);
                firIO.SetParentIO(this);
            }
        }
Ejemplo n.º 14
0
 public override FIRIO ToFlow(FlowChange flow, FIRRTLNode node)
 {
     return(flow switch
     {
         FlowChange.Source => OutIO.ToFlow(flow, node),
         FlowChange.Sink => InIO.ToFlow(flow, node),
         FlowChange.Flipped => new DuplexIO(node, Name, InIO.ToFlow(flow, node), OutIO.ToFlow(flow, node)),
         FlowChange.Preserve => new DuplexIO(node, Name, InIO.ToFlow(flow, node), OutIO.ToFlow(flow, node)),
         var error => throw new Exception($"Unknown flow. Flow: {flow}")
     });
Ejemplo n.º 15
0
 public void UpdateIOFromNode(FIRRTLNode node, List <DirectedIO> inputOffsets, List <DirectedIO> outputOffsets)
 {
     lock (this)
     {
         foreach (var inputPos in inputOffsets)
         {
             IOInfos[inputPos.IO] = new IOInfo(node, inputPos);
         }
         foreach (var inputPos in outputOffsets)
         {
             IOInfos[inputPos.IO] = new IOInfo(node, inputPos);
         }
     }
 }
Ejemplo n.º 16
0
        public void SetNodeSize(FIRRTLNode node, Point size)
        {
            lock (SizeChanges)
            {
                //If the size hasn't changed then there is no need to
                //do anything at all as the result will be the same
                if (NodeSizes.TryGetValue(node, out var oldSize) && oldSize == size)
                {
                    return;
                }

                SizeChanges[node] = size;
                MissingNodeDims.Remove(node);
            }
        }
Ejemplo n.º 17
0
        private static List <FIRIO> CreateIO(FIRIO inputType, int addressWidth, FIRRTLNode node)
        {
            FIRIO dataOut = inputType.Flip(node);

            dataOut.SetName("data");

            List <FIRIO> io = new List <FIRIO>();

            io.Add(dataOut);
            io.Add(new Input(node, "addr", new UIntType(addressWidth)));
            io.Add(new Input(node, "en", new UIntType(1)));
            io.Add(new Input(node, "clk", new ClockType()));

            return(io);
        }
Ejemplo n.º 18
0
        public Vector(FIRRTLNode node, string name, int length, FIRIO firIO) : base(node, name)
        {
            if (!firIO.IsPassive())
            {
                throw new Exception("IO type of vector must be passive.");
            }

            this.IO = new FIRIO[length];
            for (int i = 0; i < IO.Length; i++)
            {
                IO[i] = firIO.Copy(node);
                IO[i].SetName(i.ToString());
                IO[i].SetParentIO(this);
            }
        }
Ejemplo n.º 19
0
        public IOBundle(FIRRTLNode node, string name, List <FIRIO> io, List <string> ioNames, bool twoWayRelationship = true) : base(node, name)
        {
            this.OrderedIO = io.ToList();

            foreach (var(firIO, ioName) in io.Zip(ioNames))
            {
                IO.Add(ioName, firIO);
            }

            if (twoWayRelationship)
            {
                foreach (var firIO in IO.Values)
                {
                    firIO.SetParentIO(this);
                }
            }
        }
Ejemplo n.º 20
0
        private bool UpdateNodeSize(FIRRTLNode node, Point size)
        {
            //Data changed if this node didn't have a previous size
            if (ModuleSizes.TryAdd(node, size))
            {
                return(true);
            }

            //Data only changed if old and now are not the same
            Point oldSize = ModuleSizes[node];

            if (oldSize != size)
            {
                ModuleSizes[node] = size;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 21
0
        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));
        }
Ejemplo n.º 22
0
 public override FIRIO ToFlow(FlowChange flow, FIRRTLNode node)
 {
     return(new MemoryIO(node, Name, GetIOInOrder().Select(x => x.ToFlow(flow, node)).ToList(), InputType.ToFlow(flow, node), AddressWidth, Ports.Select(x => (MemPort)x.ToFlow(flow, node)).ToList()));
 }
Ejemplo n.º 23
0
 public Output(FIRRTLNode node, string name, IFIRType type) : base(node, name, type)
 {
 }
Ejemplo n.º 24
0
 public MemoryIO(FIRRTLNode node, string name, List <FIRIO> io, FIRIO inputType, int addressWidth) : this(node, name, io, inputType, addressWidth, new List <MemPort>())
 {
 }
Ejemplo n.º 25
0
 public void UpdateIOFromNode(FIRRTLNode node, List <DirectedIO> inputOffsets, List <DirectedIO> outputOffsets)
 {
     WireRouter.UpdateIOFromNode(node, inputOffsets, outputOffsets);
 }
Ejemplo n.º 26
0
 public Input(FIRRTLNode node, IFIRType type) : this(node, null, type)
 {
 }
Ejemplo n.º 27
0
 public MemRWPort(FIRRTLNode node, FIRIO inputType, int addressWidth, string name) : this(node, name, CreateIO(inputType, addressWidth, node))
 {
 }
Ejemplo n.º 28
0
 public AggregateIO(FIRRTLNode node, string name) : base(node, name)
 {
 }
Ejemplo n.º 29
0
 public override FIRIO ToFlow(FlowChange flow, FIRRTLNode node)
 {
     return(new ModuleIO(Mod, Name, GetIOInOrder().Select(x => x.ToFlow(flow, node)).ToList()));
 }
Ejemplo n.º 30
0
 private MemoryIO(FIRRTLNode node, string name, List <FIRIO> io, FIRIO inputType, int addressWidth, List <MemPort> ports) : base(node, name, io)
 {
     this.Ports        = ports;
     this.InputType    = inputType.Copy(null);
     this.AddressWidth = addressWidth;
 }