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(); }
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 MonoArgMonoResPrimOp(string opName, Output aIn, IFIRType outType, FirrtlNode defNode) : base(outType, defNode) { this.OpName = opName; this.A = new Input(this, aIn.Type); aIn.ConnectToInput(A); }
public FirStop(Output clock, Output enable, int exitCode, FirrtlNode defNode) : base(defNode) { this.Clock = new Input(this, new ClockType()); this.Enable = new Input(this, new UIntType(1)); this.ExitCode = exitCode; clock.ConnectToInput(Clock); enable.ConnectToInput(Enable); }
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); }
public FIRRTLPrimOP(IFIRType type, FirrtlNode defNode) : base(defNode) { this.Result = new Output(this, null, type); }
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()); }
public FIRRTLContainer(FirrtlNode defNode) : base(defNode) { }
public ConstBitRange(string name, Output arg1, IFIRType outType, FirrtlNode defNode) : base(outType, defNode) { this.OpName = name; this.In = new Input(this, arg1.Type); arg1.ConnectToInput(In); }
public Module(string name, string instanceName, Module parentMod, FirrtlNode defNode) : base(defNode) { this.Name = name; this.InstanceName = instanceName; SetModResideIn(parentMod); }
public PairedIOFIRRTLNode(FirrtlNode defNode) : base(defNode) { }
public Conditional(FirrtlNode defNode) : base(defNode) { }
public FIRRTLNode(FirrtlNode defNode) { this.FirDefNode = defNode; }