Exemplo n.º 1
0
        public VectorAssign(Vector input, Output index, Output condition, FirrtlNode defNode) : base(defNode)
        {
            if (!input.IsPassiveOfType <Input>())
            {
                throw new Exception("Vector assign input must be a passive input type.");
            }

            this.VecIn  = (Vector)input.Copy(this);
            this.Index  = (Input)index.Flip(this);
            this.Value  = VecIn.GetIndex(0).Copy(this);
            this.VecOut = (Vector)input.Flip(this);

            this.VecInputs   = VecIn.Flatten().Cast <Input>().ToArray();
            this.VecOutputs  = VecOut.Flatten().Cast <Output>().ToArray();
            this.ValueInputs = Value.Flatten().Cast <Input>().ToArray();

            Input[] inputs = input.Flatten().Cast <Input>().ToArray();
            for (int i = 0; i < inputs.Length; i++)
            {
                inputs[i].TransferConnectionsTo(VecInputs[i]);
                VecOutputs[i].ConnectToInput(inputs[i], false, false, condition);
            }

            index.ConnectToInput(Index);

            Index.SetName("Index");
            Value.SetName("Value");
        }
        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);
        }
Exemplo n.º 3
0
        public Mux(List <FIRIO> choises, Output decider, FirrtlNode defNode, bool isVectorIndexer = false) : base(defNode)
        {
            choises = choises.Select(x => x.GetOutput()).ToList();
            if (!choises.All(x => x.IsPassiveOfType <Output>()))
            {
                throw new Exception("Inputs to mux must all be passive output types.");
            }

            this.Choises         = choises.Select(x => x.Flip(this)).ToArray();
            this.Decider         = new Input(this, decider.Type);
            this.Result          = choises.First().Copy(this);
            this.IsVectorIndexer = isVectorIndexer;
            foreach (var res in Result.Flatten())
            {
                res.RemoveType();
            }

            for (int i = 0; i < Choises.Length; i++)
            {
                choises[i].ConnectToInput(Choises[i]);
            }
            decider.ConnectToInput(Decider);

            AddOneToManyPairedIO(Result, Choises.ToList());

            this.ChoiseInputs  = Choises.SelectMany(x => x.Flatten().Cast <Input>()).ToArray();
            this.ResultOutputs = Result.Flatten().Cast <Output>().ToArray();
        }
Exemplo n.º 4
0
 internal void AddPairedIO(FIRIO io, FIRIO ioFlipped)
 {
     if (io is ScalarIO ioScalar && ioFlipped is ScalarIO ioFlipScalar)
     {
         ioScalar.SetPaired(ioFlipScalar);
         ioFlipScalar.SetPaired(ioScalar);
     }
Exemplo n.º 5
0
        public bool IsAnonymousExtIntIO(FIRIO io)
        {
            if (io.IsAnonymous)
            {
                return(false);
            }

            return(io.Name.StartsWith("~$"));
        }
Exemplo n.º 6
0
        private void AddIO(FIRIO externalIO, FIRIO internalIO)
        {
            Debug.Assert(externalIO.Flatten().All(x => x.Node == this));
            Debug.Assert(internalIO.Flatten().All(x => x.Node == this));

            ExternalIO.Add(externalIO.Name, externalIO);
            InternalIO.Add(internalIO.Name, internalIO);
            AllIOInOrder.Add(internalIO);

            AddPairedIO(externalIO, internalIO);
        }
Exemplo n.º 7
0
        public Wire(string name, FIRIO inputType, FirrtlNode defNode) : base(defNode)
        {
            if (!inputType.IsPassiveOfType <Input>())
            {
                throw new Exception("Wire input type must be a passive input type.");
            }

            this.Name   = name;
            this.In     = inputType.Copy(this);
            this.Result = inputType.Flip(this);
            AddPairedIO(In, Result);

            In.SetName(Name + "/in");
            Result.SetName(Name);
        }
Exemplo n.º 8
0
        public Memory(string name, FIRIO inputType, ulong size, int readLatency, int writeLatency, ReadUnderWrite ruw, FirrtlNode defNode) : base(defNode)
        {
            if (!inputType.IsPassiveOfType <Input>())
            {
                throw new Exception("Input type must be a passive input type.");
            }

            this.Name         = name;
            this.InputType    = inputType.Copy(this);
            this.Size         = size;
            this.ReadLatency  = readLatency;
            this.WriteLatency = writeLatency;
            this.RUW          = ruw;
            this.MemIO        = new MemoryIO(this, name, new List <FIRIO>(), InputType, GetAddressWidth());
        }
Exemplo n.º 9
0
 public void MouseExitIO(FIRIO io, MouseEventArgs args)
 {
     IOWindow?.MouseExit(io, args);
 }
Exemplo n.º 10
0
 public void MouseEntersIO(FIRIO io, MouseEventArgs args)
 {
     IOWindow?.MouseEnter(io, args);
 }
Exemplo n.º 11
0
        public void AddInternalIO(FIRIO io)
        {
            FIRIO flipped = io.Flip(this);

            AddIO(flipped, io);
        }
Exemplo n.º 12
0
        public void AddExternalIO(FIRIO io)
        {
            FIRIO flipped = io.Flip(this);

            AddIO(io, flipped);
        }
Exemplo n.º 13
0
 public DirectedIO(FIRIO io, Point pos, MoveDirs initialDir)
 {
     this.IO         = io;
     this.Position   = pos;
     this.InitialDir = initialDir;
 }
Exemplo n.º 14
0
 public void AddIORename(string name, FIRIO io)
 {
     NameToIO.Add(name, io);
 }