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 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); }