private void CreateSelSymbol(IAutoBinder binder, bool registered) { int count = NumSymbols; if (count < 2) { return; } // This code will create a one-hot decoding var selSymbols = new StdLogicVector[NumSymbols]; _selSymbols = selSymbols; for (int i = 0; i < NumSymbols; i++) { StdLogicVector sym = StdLogicVector._0s(NumSymbols); sym[i] = '1'; selSymbols[i] = sym; } var signal = binder.GetSignal(EPortUsage.Default, "MUXSymbol" + Order, null, selSymbols[0]); _symbol = signal.Descriptor; if (registered) { var dsignal = binder.GetSignal(EPortUsage.Default, "MUXReg" + Order, null, selSymbols[0]); _symbold = dsignal.Descriptor; } }
private void InstantiateControlLogic() { var regTypes = new TypeDescriptor[_regsCur.Length]; for (int i = 0; i < _regIndices.Length; i++) { int rindex = _regIndices[i]; if (rindex < 0) { continue; } regTypes[rindex] = _tempRegTypes[i]; } for (int i = 0; i < _regsCur.Length; i++) { string name = "R" + i + "_cur"; _regsCur[i] = _binder.GetSignal(EPortUsage.Default, name, null, regTypes[i].GetSampleInstance()); name = "R" + i + "_next"; _regsNext[i] = _binder.GetSignal(EPortUsage.Default, name, null, regTypes[i].GetSampleInstance()); } var syncTempl = new SyncTemplate(this); var syncFunc = syncTempl.GetAlgorithm(); Signal <StdLogic> clkInst = _binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); _host.Descriptor.CreateProcess(SystemSharp.Components.Process.EProcessKind.Triggered, syncFunc, clkInst.Descriptor); }
public override void Establish(IAutoBinder binder) { if (_host.Latency > 0) { _host.CLK = binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); } _host.A = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "A", null, StdLogicVector._0s(_host.Awidth)); _host.B = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "B", null, StdLogicVector._0s(_host.Bwidth)); _host.S = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "S", null, StdLogicVector._0s(_host.OutWidth)); if (_host.HasBypass) { _host.BYPASS = binder.GetSignal <StdLogic>(EPortUsage.Default, "bypass", null, '0'); } if (_host.HasCarryIn) { _host.C_in = binder.GetSignal <StdLogic>(EPortUsage.Default, "c_in", null, '0'); } if (_host.HasCarryOut) { _host.C_out = binder.GetSignal <StdLogic>(EPortUsage.Default, "c_out", null, '0'); } if (_host.HasCE) { _host.CE = binder.GetSignal <StdLogic>(EPortUsage.Default, "ce", null, '0'); } if (_host.HasSCLR) { _host.SCLR = binder.GetSignal <StdLogic>(EPortUsage.Default, "sclr", null, '0'); } if (_host.HasSSET) { _host.SSET = binder.GetSignal <StdLogic>(EPortUsage.Default, "sset", null, '0'); } //FIXME: What about SINIT? }
public override void Establish(IAutoBinder binder) { if (_realized) { return; } _addrBits = MathExt.CeilLog2(_array.ArrayObj.Length); _dataBits = Marshal.SerializeForHW(_array.ElementType.GetSampleInstance()).Size; _clkI = (SLSignal)binder.GetSignal(EPortUsage.Clock, "Clk", null, null); _dataOutI = (SLVSignal)binder.GetSignal(EPortUsage.Default, "memIf_dataOut", null, StdLogicVector._0s(_dataBits)); _addrI = (SLVSignal)binder.GetSignal(EPortUsage.Default, "memIf_addr", null, StdLogicVector._0s(_addrBits)); _clk = _clkI.Descriptor; _addr = _addrI.Descriptor; _dataOut = _dataOutI.Descriptor; if (NeedWriteAccess) { _wrEnI = (SLSignal)binder.GetSignal(EPortUsage.Default, "memIf_wrEn", null, StdLogic._0); _dataInI = (SLVSignal)binder.GetSignal(EPortUsage.Default, "memIf_dataIn", null, StdLogicVector._0s(_dataBits)); _wrEn = _wrEnI.Descriptor; _dataIn = _dataInI.Descriptor; } var memIfBuilder = new MemIfBuilder(this); var memIfAlg = memIfBuilder.GetAlgorithm(); memIfAlg.Name = "MemIf"; binder.CreateProcess(Process.EProcessKind.Triggered, memIfAlg, _clk); _realized = true; }
public override void Establish(IAutoBinder binder) { var mux2 = _host; mux2.A = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "A", null, StdLogicVector._0s(mux2.Width)); mux2.B = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "B", null, StdLogicVector._0s(mux2.Width)); mux2.Sel = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "Sel", null, StdLogicVector._0s(1)); mux2.R = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "R", null, StdLogicVector._0s(mux2.Width)); }
public override void Establish(IAutoBinder binder) { var mux2 = _host; mux2.A = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "A", null, StdLogicVector._0s(mux2.Width)); mux2.B = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "B", null, StdLogicVector._0s(mux2.Width)); mux2.Sel = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "Sel", null, StdLogicVector._0s(1)); mux2.R = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "R", null, StdLogicVector._0s(mux2.Width)); }
public override void Establish(IAutoBinder binder) { var lsu = _host; lsu.Clk = binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); lsu.EnIn = binder.GetSignal <StdLogic>(EPortUsage.Default, _host.MappedVariableName + "_StEn", null, '0'); lsu.DIn = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, _host.MappedVariableName + "_In", null, StdLogicVector._0s(lsu.DataWidth)); lsu.DOut = binder.GetSignal <StdLogicVector>(EPortUsage.Result, _host.MappedVariableName + "_Out", null, StdLogicVector._0s(lsu.DataWidth)); }
public override void Establish(IAutoBinder binder) { var shifter = _host; shifter.Clk = binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); shifter.X = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "X", null, StdLogicVector._0s(shifter.DataWidth)); shifter.Shift = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "S", null, StdLogicVector._0s(shifter.ShiftWidth)); shifter.Dir = binder.GetSignal <StdLogicVector>(EPortUsage.Default, "Dir", null, StdLogicVector._0s(1)); shifter.Y = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "Y", null, StdLogicVector._0s(shifter.DataWidth)); }
public override void Establish(IAutoBinder binder) { if (_established) return; _host.X = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "X", null, StdLogicVector._0s(_host.InIntWidth + _host.FracWidth)); _host.R = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "R", null, StdLogicVector._0s(_host.OutIntWidth + _host.FracWidth)); _established = true; }
private void CreateState(int ncsteps) { int pcWidth = MathExt.CeilLog2(ncsteps); _pc = (SLVSignal)_binder.GetSignal(EPortUsage.State, "State", null, StdLogicVector._0s(pcWidth)); _altAddr = (SLVSignal)_binder.GetSignal(EPortUsage.Default, "BCU_AltAddr", null, StdLogicVector._0s(pcWidth)); _rdEn = (SLSignal)_binder.GetSignal(EPortUsage.Default, "ROM_RdEn", null, StdLogic._1); _brP = (SLVSignal)_binder.GetSignal <StdLogicVector>(EPortUsage.Default, "BCU_BrP", null, "0"); _brN = (SLVSignal)_binder.GetSignal <StdLogicVector>(EPortUsage.Default, "BCU_BrN", null, "1"); _rst = (SLSignal)_binder.GetSignal(EPortUsage.Default, "BCU_Rst", null, StdLogic._1); }
public override void Establish(IAutoBinder binder) { var mul = _host; if (mul.PipeStages > 0) { mul.CLK = binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); } mul.A = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "A", null, StdLogicVector._0s(mul.PortAWidth)); mul.B = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "B", null, StdLogicVector._0s(mul.PortBWidth)); mul.P = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "P", null, StdLogicVector._0s(mul.OutputWidthHigh - mul.OutputWidthLow + 1)); }
public override void Establish(IAutoBinder binder) { if (_established) { return; } _host.X = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "X", null, StdLogicVector._0s(_host.InIntWidth + _host.FracWidth)); _host.R = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "R", null, StdLogicVector._0s(_host.OutIntWidth + _host.FracWidth)); _established = true; }
public override void Establish(IAutoBinder binder) { if (_established) { return; } _host.DIn = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "DIn", null, StdLogicVector._0s(_host.FloatWidth)); _host.DOut = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "DOut", null, StdLogicVector._0s(_host.OutFormat.TotalWidth)); _established = true; }
public void CreateStagedDecoder(IAutoBinder binder, SLVSignal cwSignal, SLSignal clkSignal, bool registered) { var valWordInit = StdLogicVector._0s(_vcf.ValueWordWidth); var rcwSignal = (SLVSignal)binder.GetSignal(EPortUsage.Default, "D1_CW", null, valWordInit); var rcwSignalDesc = rcwSignal.Descriptor; SLVSignal rrcwSignal = null; if (registered) { rrcwSignal = (SLVSignal)binder.GetSignal(EPortUsage.Default, "D2_CW", null, valWordInit); } var syncBuilder = new DefaultAlgorithmBuilder(); syncBuilder.If(clkSignal.ToSignalRef(SignalRef.EReferencedProperty.RisingEdge)); syncBuilder.Store(rcwSignal.ToSignalRef(SignalRef.EReferencedProperty.Next), ((ISignal)cwSignal[_vcf.ValueWordWidth - 1, 0]).ToSignalRef(SignalRef.EReferencedProperty.Cur)); if (registered) { syncBuilder.Store(rrcwSignal.ToSignalRef(SignalRef.EReferencedProperty.Next), rcwSignal.ToSignalRef(SignalRef.EReferencedProperty.Cur)); } foreach (var ms in _strings) { ms.AssembleStagedDecoderSync(binder, syncBuilder, cwSignal, registered); } syncBuilder.EndIf(); var syncFunc = syncBuilder.Complete(); syncFunc.Name = "cwdecode_sync"; binder.CreateProcess(SystemSharp.Components.Process.EProcessKind.Triggered, syncFunc, clkSignal.Descriptor); var combBuilder = new DefaultAlgorithmBuilder(); var sensitivity = new HashSet <ISignalOrPortDescriptor>(); sensitivity.Add(cwSignal.Descriptor); sensitivity.Add(rcwSignalDesc); if (registered) { sensitivity.Add(rrcwSignal.Descriptor); } foreach (var ms in _strings) { ms.AssembleStagedDecoderComb(combBuilder, registered ? rrcwSignal : rcwSignal, sensitivity, registered); } var combFunc = combBuilder.Complete(); combFunc.Name = "cwdecode_comb"; binder.CreateProcess(SystemSharp.Components.Process.EProcessKind.Triggered, combFunc, sensitivity.ToArray()); }
public void SplitPipe(int pipe, long delay1, long delay2, out int mid, out int left, out int right) { var pi = _pipes[pipe]; Debug.Assert(pi.delay == delay1 + delay2); int mididx = _pipeInSignals.Count; mid = mididx; object initval = _pipeInSignals[pi.source].InitialValueObject; int icridx = _icrCurSignals.Count; var curSignal = _binder.GetSignal(EPortUsage.Default, "fifo" + icridx + "_in", null, initval); _pipeInSignals.Add(curSignal); _icrCurSignals.Add(mid); _preds.Add(new List <int>()); _succs.Add(new List <int>()); var piLeft = new PipeInfo() { source = pi.source, sink = mididx, delay = delay1 }; var piRight = new PipeInfo() { source = mididx, sink = pi.sink, delay = delay2 }; _pipes[pipe] = piLeft; left = pipe; int rightidx = _pipes.Count; right = rightidx; _pipes.Add(piRight); _preds[pi.sink].Remove(pipe); _preds[mididx].Add(pipe); _succs[mididx].Add(rightidx); _preds[pi.sink].Add(rightidx); var rmap = new Dictionary <long, ResInfo>(); _resTable.Add(rmap); foreach (var kvp in _resTable[pipe]) { rmap[kvp.Key + delay1] = kvp.Value; } }
public override void Establish(IAutoBinder binder) { if (_established) { return; } var cc = _host; cc.Ops = (XIn <StdLogicVector[], InOut <StdLogicVector> >)binder.GetSignal(EPortUsage.Operand, "Ops", null, Enumerable.Repeat(StdLogicVector._0s(cc.WordWidth), cc.NumWords).ToArray()); cc.R = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "R", null, StdLogicVector._0s(cc.OutputWidth)); _established = true; }
public void Establish(IAutoBinder binder) { if (_established) { return; } var fna = _host; fna.Clk = binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, StdLogic._0); fna.DIn = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "DIn", null, StdLogicVector._0s(fna.TotalWidth)); fna.DOut = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "DOut", null, StdLogicVector._0s(fna.TotalWidth)); _established = true; }
public override void Establish(IAutoBinder binder) { if (_established) { return; } if (_host.Latency > 0) { _host.Clk = (SLSignal)binder.GetSignal(EPortUsage.Clock, null, null, null); } _host.Operand = (SLVSignal)binder.GetSignal(EPortUsage.Operand, "Operand", null, StdLogicVector._0s(_host.InputWidth)); _host.Result = (SLVSignal)binder.GetSignal(EPortUsage.Result, "Result", null, StdLogicVector._0s(_host.OutputWidth)); _established = true; }
protected override void DeclareAlgorithm() { Signal <StdLogic> clkInst = _binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); SignalRef clkRising = SignalRef.Create(clkInst.Descriptor, SignalRef.EReferencedProperty.RisingEdge); LiteralReference lrClkRising = new LiteralReference(clkRising); SignalRef altFlagP = SignalRef.Create(_taSite._brAltFlagP, SignalRef.EReferencedProperty.Cur); LiteralReference lrAltFlagP = new LiteralReference(altFlagP); SignalRef altFlagN = SignalRef.Create(_taSite._brAltFlagN, SignalRef.EReferencedProperty.Cur); LiteralReference lrAltFlagN = new LiteralReference(altFlagN); SignalRef curState = SignalRef.Create(_taSite._curState, SignalRef.EReferencedProperty.Next); SignalRef incState = SignalRef.Create(_taSite._incState, SignalRef.EReferencedProperty.Cur); LiteralReference lrIncState = new LiteralReference(incState); SignalRef altState = SignalRef.Create(_taSite._altState, SignalRef.EReferencedProperty.Cur); LiteralReference lrAltState = new LiteralReference(altState); LiteralReference vcc = LiteralReference.CreateConstant((StdLogicVector)"1"); LiteralReference gnd = LiteralReference.CreateConstant((StdLogicVector)"0"); If(lrClkRising); { If(Expression.Equal(lrAltFlagP, vcc) | Expression.Equal(lrAltFlagN, gnd)); { Store(curState, altState); } Else(); { Store(curState, incState); } EndIf(); } EndIf(); }
public void Establish(IAutoBinder binder) { if (_established) { return; } var unit = _host; unit.Clk = binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, StdLogic._0); unit.X = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "X", null, StdLogicVector._0s(unit.XIntWidth + unit.XFracWidth)); unit.Sin = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "SinOut", null, StdLogicVector._0s(unit.YIntWidth + unit.YFracWidth)); unit.Cos = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "CosOut", null, StdLogicVector._0s(unit.YIntWidth + unit.YFracWidth)); _established = true; }
public override void Establish(IAutoBinder binder) { if (_allocated) { return; } _brAltFlagP = (SLVSignal)binder.GetSignal(EPortUsage.Default, "BCU_BrP", null, StdLogicVector._0s(1)); _brAltFlagN = (SLVSignal)binder.GetSignal(EPortUsage.Default, "BCU_BrN", null, StdLogicVector._1s(1)); _curState = binder.GetSignal(EPortUsage.State, "BCU_CurState", null, null).Descriptor; _tState = _curState.ElementType.CILType; Array enumValues = _tState.GetEnumValues(); int numStates = enumValues.Length; object defaultState = Activator.CreateInstance(_tState); _incState = binder.GetSignal(EPortUsage.Default, "BCU_IncState", null, defaultState).Descriptor; _altState = binder.GetSignal(EPortUsage.Default, "BCU_AltState", null, defaultState).Descriptor; _nextState = binder.GetSignal(EPortUsage.Default, "BCU_NextState", null, defaultState).Descriptor; IncStateProcessBuilder ispb = new IncStateProcessBuilder(this); Function incStateFn = ispb.GetAlgorithm(); incStateFn.Name = "BCU_IncState"; binder.CreateProcess(Process.EProcessKind.Triggered, incStateFn, _curState); SyncProcessBuilder spb = new SyncProcessBuilder(this, binder); Function syncStateFn = spb.GetAlgorithm(); syncStateFn.Name = "BCU_FSM"; ISignalOrPortDescriptor sdClock = binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0').Descriptor; binder.CreateProcess(Process.EProcessKind.Triggered, syncStateFn, sdClock); _allocated = true; }
public override void Establish(IAutoBinder binder) { if (_established) { return; } _clk = binder.GetSignal(EPortUsage.Clock, null, null, null).Descriptor; _enI = (SLSignal)binder.GetSignal(EPortUsage.Default, _port.Name + "_en", null, StdLogic._1); _en = _enI.Descriptor; _slvSignalI = (SLVSignal)binder.GetSignal(EPortUsage.Default, _port.Name + "_in", null, StdLogicVector._0s(_dataWidth)); _slvSignal = _slvSignalI.Descriptor; var templ = new ConvProcessBuilder(this); var alg = templ.GetAlgorithm(); binder.CreateProcess(Process.EProcessKind.Triggered, alg, _clk, _en); _established = true; }
public override void Establish(IAutoBinder binder) { if (_realized) { return; } _inSignals = _argWidths.Select((w, i) => (SLVSignal)binder.GetSignal(EPortUsage.Default, "concat" + i, null, StdLogicVector.Us(w))).ToArray(); int total = _argWidths.Sum(); _outSignal = (SLVSignal)binder.GetSignal(EPortUsage.Default, "concout", null, StdLogicVector.Us(total)); var pb = new ConcatProcessBuilder(this); var alg = pb.GetAlgorithm(); alg.Name = "concatenize"; binder.CreateProcess(Process.EProcessKind.Triggered, alg, _inSignals.Select(s => s.Descriptor).ToArray()); _realized = true; }
public override void Establish(IAutoBinder binder) { if (_established) { return; } var boundSignal = _host.Port as SignalDescriptor; if (boundSignal == null) { boundSignal = (SignalDescriptor)((IPortDescriptor)_host.Port).BoundSignal; } SignalBase portSignal = boundSignal.Instance; _host.Bind( binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'), binder.GetSignal <StdLogic>(EPortUsage.Default, _host.Port.Name + "_En", null, '0'), binder.GetSignal <StdLogicVector>(EPortUsage.Operand, _host.Port.Name + "_In", null, StdLogicVector._0s(_host.DataWidth)), portSignal); _established = true; }
public override void Establish(IAutoBinder binder) { var divider = _host; divider.CLK = binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); divider.DIVIDEND = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "dividend", null, StdLogicVector._0s(divider.DividendAndQuotientWidth)); divider.DIVISOR = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "divisor", null, StdLogicVector._0s(divider.DivisorWidth)); divider.QUOTIENT = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "quotient", null, StdLogicVector._0s(divider.DividendAndQuotientWidth)); if (divider.FractionWidth != 0) { divider.FRACTIONAL = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "fractional", null, StdLogicVector._0s(divider.FractionWidth)); } divider.RDY = binder.GetSignal <StdLogic>(EPortUsage.Default, "rdy", null, '0'); divider.RFD = binder.GetSignal <StdLogic>(EPortUsage.Default, "rfd", null, '0'); divider.ND = binder.GetSignal <StdLogic>(EPortUsage.Default, "nd", null, '0'); }
public override void Establish(IAutoBinder binder) { if (_createSignal) { _constSignal = Host.Descriptor .GetSignals() .Where(s => s.HasAttribute <ConstLoadingTransactionSite>() && s.InitialValue.Equals(_constValue)) .Select(s => s.Instance) .Cast <SLVSignal>() .SingleOrDefault(); if (_constSignal == null) { _constSignal = (SLVSignal)binder.GetSignal(EPortUsage.Default, "const_" + _constValue.ToString(), null, _constValue); _constSignal.Descriptor.AddAttribute(this); } } }
public override void Establish(IAutoBinder binder) { if (_createSignal) { _constSignal = Host.Descriptor .GetSignals() .Where(s => s.HasAttribute<ConstLoadingTransactionSite>() && s.InitialValue.Equals(_constValue)) .Select(s => s.Instance) .Cast<SLVSignal>() .SingleOrDefault(); if (_constSignal == null) { _constSignal = (SLVSignal)binder.GetSignal(EPortUsage.Default, "const_" + _constValue.ToString(), null, _constValue); _constSignal.Descriptor.AddAttribute(this); } } }
public void PrepareAllocation(long cstepCount) { string[] stateNames = new string[cstepCount]; for (int i = 0; i < cstepCount; i++) { stateNames[i] = "CStep" + i; } var design = _host.Descriptor.GetDesign(); string typeName = "TState" + cstepCount; var tstate = design.GetTypes() .Where(t => t.Name == typeName) .FirstOrDefault(); if (tstate == null) { tstate = design.CreateEnum(typeName, stateNames); } _stateValues = tstate.CILType.GetEnumValues(); object defaultState = Activator.CreateInstance(tstate.CILType); _stateSignal = _binder.GetSignal(EPortUsage.State, "State", null, defaultState); }
public void Establish(IAutoBinder binder) { if (_established) { return; } if (!_portSignal.ElementType.CILType.Equals(typeof(StdLogicVector))) { var signalInst = binder.GetSignal(EPortUsage.Default, _port.Name + "_slv", null, Marshal.SerializeForHW(_portSignal.InitialValue)); _slvSignal = signalInst.Descriptor; var templ = new ConvProcessBuilder(this); var alg = templ.GetAlgorithm(); binder.CreateProcess(Process.EProcessKind.Triggered, alg, _portSignal); } else { _slvSignal = _portSignal; } _established = true; }
public override void Establish(IAutoBinder binder) { _host.DIn = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "DIn", null, StdLogicVector._0s(_host.InputWidth)); _host.DOut = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "DOut", null, StdLogicVector._0s(_host.HiOffset - _host.LoOffset + 1)); }
public override void Establish(IAutoBinder binder) { var mul = _host; if (mul.PipeStages > 0) mul.CLK = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); mul.A = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "A", null, StdLogicVector._0s(mul.PortAWidth)); mul.B = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "B", null, StdLogicVector._0s(mul.PortBWidth)); mul.P = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "P", null, StdLogicVector._0s(mul.OutputWidthHigh - mul.OutputWidthLow + 1)); }
public ISignalOrPortDescriptor GetSignal(EBinderFlags flags, EPortUsage portUsage, string name, string domainID, object initialValue) { return(_orgBinder.GetSignal(flags, portUsage, name, domainID, initialValue)); }
public override void Establish(IAutoBinder binder) { if (_established) return; var alu = _host; alu.Clk = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); alu.A = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "A", null, StdLogicVector._0s(alu.AWidth)); if (alu.Arity > 1) alu.B = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "B", null, StdLogicVector._0s(alu.BWidth)); if (alu.FuncSel == ALU.EFunction.Compare) { alu.CmpLt = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "IsLt", null, StdLogicVector._0s(1)); alu.CmpLte = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "IsLte", null, StdLogicVector._0s(1)); alu.CmpEq = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "IsEq", null, StdLogicVector._0s(1)); alu.CmpNeq = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "IsNEq", null, StdLogicVector._0s(1)); alu.CmpGte = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "IsGte", null, StdLogicVector._0s(1)); alu.CmpGt = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "IsGt", null, StdLogicVector._0s(1)); } else { alu.R = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "R", null, StdLogicVector._0s(alu.RWidth)); } _established = true; }
public override void Establish(IAutoBinder binder) { if (_realized) return; _inSignals = _argWidths.Select((w, i) => (SLVSignal)binder.GetSignal(EPortUsage.Default, "concat" + i, null, StdLogicVector.Us(w))).ToArray(); int total = _argWidths.Sum(); _outSignal = (SLVSignal)binder.GetSignal(EPortUsage.Default, "concout", null, StdLogicVector.Us(total)); var pb = new ConcatProcessBuilder(this); var alg = pb.GetAlgorithm(); alg.Name = "concatenize"; binder.CreateProcess(Process.EProcessKind.Triggered, alg, _inSignals.Select(s => s.Descriptor).ToArray()); _realized = true; }
public override void Establish(IAutoBinder binder) { var lsu = _host; lsu.Clk = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); lsu.EnIn = binder.GetSignal<StdLogic>(EPortUsage.Default, _host.MappedVariableName + "_StEn", null, '0'); lsu.DIn = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, _host.MappedVariableName + "_In", null, StdLogicVector._0s(lsu.DataWidth)); lsu.DOut = binder.GetSignal<StdLogicVector>(EPortUsage.Result, _host.MappedVariableName + "_Out", null, StdLogicVector._0s(lsu.DataWidth)); }
public override void Establish(IAutoBinder binder) { _host.DIn = binder.GetSignal <StdLogicVector>(EPortUsage.Operand, "DIn", null, StdLogicVector._0s(_host.InputWidth)); _host.DOut = binder.GetSignal <StdLogicVector>(EPortUsage.Result, "DOut", null, StdLogicVector._0s(_host.HiOffset - _host.LoOffset + 1)); }
public override void Establish(IAutoBinder binder) { var bmem = _mem; if (bmem.ClkA == null) bmem.ClkA = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); if (bmem.UseEnableA && bmem.EnA == null) bmem.EnA = binder.GetSignal<StdLogic>(EPortUsage.Default, "EnA", null, '0'); if (bmem.WeA == null) bmem.WeA = binder.GetSignal<StdLogicVector>(EPortUsage.Default, "WeA", null, "0"); if (bmem.DinA == null) bmem.DinA = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "DInA", null, StdLogicVector._0s(bmem.WriteWidthA)); if (bmem.DoutA == null) bmem.DoutA = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "DOutA", null, StdLogicVector._0s(bmem.ReadWidthA)); if (bmem.MemoryType == EMemoryType.DualPortROM || bmem.MemoryType == EMemoryType.SimpleDualPortRAM || bmem.MemoryType == EMemoryType.TrueDualPortRAM) { if (bmem.AddrB == null) bmem.AddrB = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "AddrB", null, StdLogicVector._0s(bmem.AddrWidthB)); if (bmem.ClkB == null) bmem.ClkB = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); if (bmem.UseEnableB && bmem.EnB == null) bmem.EnB = binder.GetSignal<StdLogic>(EPortUsage.Default, "EnB", null, '0'); if (bmem.WeB == null) bmem.WeB = binder.GetSignal<StdLogicVector>(EPortUsage.Default, "WeB", null, "0"); if (bmem.DinB == null) bmem.DinB = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "DInB", null, StdLogicVector._0s(bmem.WriteWidthB)); if (bmem.DoutB != null) bmem.DoutB = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "DOutB", null, StdLogicVector._0s(bmem.ReadWidthB)); if (bmem.AddrB != null) bmem.AddrB = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "AddrB", null, StdLogicVector._0s(bmem.AddrWidthB)); } }
private void CreateSelSymbol(IAutoBinder binder, bool registered) { int count = NumSymbols; if (count < 2) return; // This code will create a one-hot decoding var selSymbols = new StdLogicVector[NumSymbols]; _selSymbols = selSymbols; for (int i = 0; i < NumSymbols; i++) { StdLogicVector sym = StdLogicVector._0s(NumSymbols); sym[i] = '1'; selSymbols[i] = sym; } var signal = binder.GetSignal(EPortUsage.Default, "MUXSymbol" + Order, null, selSymbols[0]); _symbol = signal.Descriptor; if (registered) { var dsignal = binder.GetSignal(EPortUsage.Default, "MUXReg" + Order, null, selSymbols[0]); _symbold = dsignal.Descriptor; } }
public override void Establish(IAutoBinder binder) { if (_allocated) return; _brAltFlagP = (SLVSignal)binder.GetSignal(EPortUsage.Default, "BCU_BrP", null, StdLogicVector._0s(1)); _brAltFlagN = (SLVSignal)binder.GetSignal(EPortUsage.Default, "BCU_BrN", null, StdLogicVector._1s(1)); _curState = binder.GetSignal(EPortUsage.State, "BCU_CurState", null, null).Descriptor; _tState = _curState.ElementType.CILType; Array enumValues = _tState.GetEnumValues(); int numStates = enumValues.Length; object defaultState = Activator.CreateInstance(_tState); _incState = binder.GetSignal(EPortUsage.Default, "BCU_IncState", null, defaultState).Descriptor; _altState = binder.GetSignal(EPortUsage.Default, "BCU_AltState", null, defaultState).Descriptor; _nextState = binder.GetSignal(EPortUsage.Default, "BCU_NextState", null, defaultState).Descriptor; IncStateProcessBuilder ispb = new IncStateProcessBuilder(this); Function incStateFn = ispb.GetAlgorithm(); incStateFn.Name = "BCU_IncState"; binder.CreateProcess(Process.EProcessKind.Triggered, incStateFn, _curState); SyncProcessBuilder spb = new SyncProcessBuilder(this, binder); Function syncStateFn = spb.GetAlgorithm(); syncStateFn.Name = "BCU_FSM"; ISignalOrPortDescriptor sdClock = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0').Descriptor; binder.CreateProcess(Process.EProcessKind.Triggered, syncStateFn, sdClock); _allocated = true; }
public override void Establish(IAutoBinder binder) { if (_realized) return; _addrBits = MathExt.CeilLog2(_array.ArrayObj.Length); _dataBits = Marshal.SerializeForHW(_array.ElementType.GetSampleInstance()).Size; _clkI = (SLSignal)binder.GetSignal(EPortUsage.Clock, "Clk", null, null); _dataOutI = (SLVSignal)binder.GetSignal(EPortUsage.Default, "memIf_dataOut", null, StdLogicVector._0s(_dataBits)); _addrI = (SLVSignal)binder.GetSignal(EPortUsage.Default, "memIf_addr", null, StdLogicVector._0s(_addrBits)); _clk = _clkI.Descriptor; _addr = _addrI.Descriptor; _dataOut = _dataOutI.Descriptor; if (NeedWriteAccess) { _wrEnI = (SLSignal)binder.GetSignal(EPortUsage.Default, "memIf_wrEn", null, StdLogic._0); _dataInI = (SLVSignal)binder.GetSignal(EPortUsage.Default, "memIf_dataIn", null, StdLogicVector._0s(_dataBits)); _wrEn = _wrEnI.Descriptor; _dataIn = _dataInI.Descriptor; } var memIfBuilder = new MemIfBuilder(this); var memIfAlg = memIfBuilder.GetAlgorithm(); memIfAlg.Name = "MemIf"; binder.CreateProcess(Process.EProcessKind.Triggered, memIfAlg, _clk); _realized = true; }
public override void Establish(IAutoBinder binder) { if (_established) return; var cc = _host; cc.Ops = (XIn<StdLogicVector[], InOut<StdLogicVector>>)binder.GetSignal(EPortUsage.Operand, "Ops", null, Enumerable.Repeat(StdLogicVector._0s(cc.WordWidth), cc.NumWords).ToArray()); cc.R = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "R", null, StdLogicVector._0s(cc.OutputWidth)); _established = true; }
public override void Establish(IAutoBinder binder) { if (_realized) return; object constValue; var literal = (Literal)_literal; if (literal.IsConst(out constValue)) { var slv = Marshal.SerializeForHW(constValue); _dataOutI = (SLVSignal)binder.GetSignal(EPortUsage.Default, "constSignal_" + constValue.ToString(), null, slv); _dataOut = _dataOutI.Descriptor; } else { bool needRead = true, needWrite = true; var fref = _literal as FieldRef; if (fref != null) { needRead = fref.FieldDesc.IsReadInCurrentContext(Host.Context); needWrite = fref.FieldDesc.IsWrittenInCurrentContext(Host.Context); } var stlit = (IStorableLiteral)_literal; string name = stlit.Name; var valueSample = _literal.Type.GetSampleInstance(); _dataBits = Marshal.SerializeForHW(valueSample).Size; _clkI = (SLSignal)binder.GetSignal(EPortUsage.Clock, null, null, null); _clk = _clkI.Descriptor; if (needWrite) { _wrEnI = (SLSignal)binder.GetSignal(EPortUsage.Default, name + "_wrEn", null, StdLogic._0); _wrEn = _wrEnI.Descriptor; _dataInI = (SLVSignal)binder.GetSignal(EPortUsage.Default, name + "_dataIn", null, StdLogicVector._0s(_dataBits)); _dataIn = _dataInI.Descriptor; } if (needRead) { _dataOutI = (SLVSignal)binder.GetSignal(EPortUsage.Default, name + "_dataOut", null, StdLogicVector._0s(_dataBits)); _dataOut = _dataOutI.Descriptor; } //var apb = new AccessProcessBuilder(this, needRead, needWrite); //var alg = apb.GetAlgorithm(); //alg.Name = name + "_process"; //binder.CreateProcess(Process.EProcessKind.Triggered, alg, _clk); CommonClockProcess ccp = null; string algName = name + "_process"; if (Host.Descriptor.HasAttribute<CommonClockProcess>()) { ccp = Host.Descriptor.QueryAttribute<CommonClockProcess>(); Host.Descriptor.RemoveChild(ccp.CCProc); } else { ccp = new CommonClockProcess(_clk); Host.Descriptor.AddAttribute(ccp); } ccp.AddAccessor(this, needRead, needWrite); var alg = ccp.FrameBuilder.Complete(); alg.Name = algName; ccp.CCProc = binder.CreateProcess(Process.EProcessKind.Triggered, alg, _clk); } _realized = true; }
public void CreateStagedDecoder(IAutoBinder binder, SLVSignal cwSignal, SLSignal clkSignal, bool registered) { var valWordInit = StdLogicVector._0s(_vcf.ValueWordWidth); var rcwSignal = (SLVSignal)binder.GetSignal(EPortUsage.Default, "D1_CW", null, valWordInit); var rcwSignalDesc = rcwSignal.Descriptor; SLVSignal rrcwSignal = null; if (registered) { rrcwSignal = (SLVSignal)binder.GetSignal(EPortUsage.Default, "D2_CW", null, valWordInit); } var syncBuilder = new DefaultAlgorithmBuilder(); syncBuilder.If(clkSignal.ToSignalRef(SignalRef.EReferencedProperty.RisingEdge)); syncBuilder.Store(rcwSignal.ToSignalRef(SignalRef.EReferencedProperty.Next), ((ISignal)cwSignal[_vcf.ValueWordWidth - 1, 0]).ToSignalRef(SignalRef.EReferencedProperty.Cur)); if (registered) { syncBuilder.Store(rrcwSignal.ToSignalRef(SignalRef.EReferencedProperty.Next), rcwSignal.ToSignalRef(SignalRef.EReferencedProperty.Cur)); } foreach (var ms in _strings) { ms.AssembleStagedDecoderSync(binder, syncBuilder, cwSignal, registered); } syncBuilder.EndIf(); var syncFunc = syncBuilder.Complete(); syncFunc.Name = "cwdecode_sync"; binder.CreateProcess(SystemSharp.Components.Process.EProcessKind.Triggered, syncFunc, clkSignal.Descriptor); var combBuilder = new DefaultAlgorithmBuilder(); var sensitivity = new HashSet<ISignalOrPortDescriptor>(); sensitivity.Add(cwSignal.Descriptor); sensitivity.Add(rcwSignalDesc); if (registered) sensitivity.Add(rrcwSignal.Descriptor); foreach (var ms in _strings) { ms.AssembleStagedDecoderComb(combBuilder, registered ? rrcwSignal : rcwSignal, sensitivity, registered); } var combFunc = combBuilder.Complete(); combFunc.Name = "cwdecode_comb"; binder.CreateProcess(SystemSharp.Components.Process.EProcessKind.Triggered, combFunc, sensitivity.ToArray()); }
public void Establish(IAutoBinder binder) { if (_established) return; var unit = _host; unit.Clk = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, StdLogic._0); unit.X = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "X", null, StdLogicVector._0s(unit.XIntWidth + unit.XFracWidth)); unit.Sin = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "SinOut", null, StdLogicVector._0s(unit.YIntWidth + unit.YFracWidth)); unit.Cos = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "CosOut", null, StdLogicVector._0s(unit.YIntWidth + unit.YFracWidth)); _established = true; }
public override void Establish(IAutoBinder binder) { if (_established) return; _host.DIn = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "DIn", null, StdLogicVector._0s(_host.FloatWidth)); _host.DOut = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "DOut", null, StdLogicVector._0s(_host.OutFormat.TotalWidth)); _established = true; }
public void Establish(IAutoBinder binder) { if (_established) return; var fna = _host; fna.Clk = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, StdLogic._0); fna.DIn = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "DIn", null, StdLogicVector._0s(fna.TotalWidth)); fna.DOut = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "DOut", null, StdLogicVector._0s(fna.TotalWidth)); _established = true; }
public override void Establish(IAutoBinder binder) { var shifter = _host; shifter.Clk = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); shifter.X = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "X", null, StdLogicVector._0s(shifter.DataWidth)); shifter.Shift = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "S", null, StdLogicVector._0s(shifter.ShiftWidth)); shifter.Dir = binder.GetSignal<StdLogicVector>(EPortUsage.Default, "Dir", null, StdLogicVector._0s(1)); shifter.Y = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "Y", null, StdLogicVector._0s(shifter.DataWidth)); }
private void InstantiateControlLogic() { int scount = _flowSpec.FlowTargets.Select(t => t.GetTemporaryIndex()).Max() + 1; _regIndices = new int[scount]; for (int i = 0; i < scount; i++) { _regIndices[i] = -1; } int curReg = 0; for (int i = 0; i < _flowSpec.NumCSteps; i++) { var pflow = _flowSpec.GetFlow(i); foreach (var flow in pflow.Flows) { var sflow = flow as SignalFlow; var target = flow.Target; int tindex = flow.Target.GetTemporaryIndex(); if (sflow != null) { var source = sflow.Source; int sindex = sflow.Source.GetTemporaryIndex(); if (sindex >= 0 && _regIndices[sindex] < 0) { _regIndices[sindex] = curReg++; } } } } int numRegs = curReg; _regsCur = new SignalBase[numRegs]; _regsNext = new SignalBase[numRegs]; foreach (var target in _flowSpec.FlowTargets) { if (!target.IsTemporary()) { continue; } int index = target.GetTemporaryIndex(); int rindex = _regIndices[index]; if (rindex < 0) { continue; } if (_regsCur[rindex] != null) { continue; } string name = "R" + rindex + "_cur"; _regsCur[rindex] = _binder.GetSignal(EPortUsage.Default, name, null, target.Desc.InitialValue); name = "R" + rindex + "_next"; _regsNext[rindex] = _binder.GetSignal(EPortUsage.Default, name, null, target.Desc.InitialValue); } var syncTempl = new SyncTemplate(this); var syncFunc = syncTempl.GetAlgorithm(); Signal <StdLogic> clkInst = _binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); _host.Descriptor.CreateProcess(SystemSharp.Components.Process.EProcessKind.Triggered, syncFunc, clkInst.Descriptor); }
public override void Establish(IAutoBinder binder) { var divider = _host; divider.CLK = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); divider.DIVIDEND = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "dividend", null, StdLogicVector._0s(divider.DividendAndQuotientWidth)); divider.DIVISOR = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "divisor", null, StdLogicVector._0s(divider.DivisorWidth)); divider.QUOTIENT = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "quotient", null, StdLogicVector._0s(divider.DividendAndQuotientWidth)); if (divider.FractionWidth != 0) divider.FRACTIONAL = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "fractional", null, StdLogicVector._0s(divider.FractionWidth)); divider.RDY = binder.GetSignal<StdLogic>(EPortUsage.Default, "rdy", null, '0'); divider.RFD = binder.GetSignal<StdLogic>(EPortUsage.Default, "rfd", null, '0'); divider.ND = binder.GetSignal<StdLogic>(EPortUsage.Default, "nd", null, '0'); }
public override void Establish(IAutoBinder binder) { if (_host.Latency > 0) _host.CLK = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); _host.A = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "A", null, StdLogicVector._0s(_host.Awidth)); _host.B = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "B", null, StdLogicVector._0s(_host.Bwidth)); _host.S = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "S", null, StdLogicVector._0s(_host.OutWidth)); if (_host.HasBypass) _host.BYPASS = binder.GetSignal<StdLogic>(EPortUsage.Default, "bypass", null, '0'); if (_host.HasCarryIn) _host.C_in = binder.GetSignal<StdLogic>(EPortUsage.Default, "c_in", null, '0'); if (_host.HasCarryOut) _host.C_out = binder.GetSignal<StdLogic>(EPortUsage.Default, "c_out", null, '0'); if (_host.HasCE) _host.CE = binder.GetSignal<StdLogic>(EPortUsage.Default, "ce", null, '0'); if (_host.HasSCLR) _host.SCLR = binder.GetSignal<StdLogic>(EPortUsage.Default, "sclr", null, '0'); if (_host.HasSSET) _host.SSET = binder.GetSignal<StdLogic>(EPortUsage.Default, "sset", null, '0'); //FIXME: What about SINIT? }
public override void Establish(IAutoBinder binder) { var fpu = _host; bool haveClk = fpu.Latency > 0; if (fpu.Function == EFunction.Multiply) haveClk = true; if (fpu.Latency > 0) { fpu.Clk = binder.GetSignal<StdLogic>(EPortUsage.Clock, "Clk", null, '0'); } if ((fpu.Function == FloatingPointCore.EFunction.AddSubtract && fpu.AddSubSel == FloatingPointCore.EAddSub.Both) || (fpu.Function == FloatingPointCore.EFunction.Compare && fpu.CompareSel == FloatingPointCore.ECompareOp.Programmable)) fpu.Operation = binder.GetSignal<StdLogicVector>(EPortUsage.Default, "Operation", null, StdLogicVector._0s(6)); fpu.A = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "A", null, StdLogicVector._0s(fpu.OperandWidth)); if (fpu.Arity > 1) fpu.B = binder.GetSignal<StdLogicVector>(EPortUsage.Operand, "B", null, StdLogicVector._0s(fpu.OperandWidth)); fpu.Result = binder.GetSignal<StdLogicVector>(EPortUsage.Result, "R", null, StdLogicVector._0s(fpu.ResultWidth)); if (fpu.HasCE) fpu.CE = binder.GetSignal<StdLogic>(EPortUsage.Default, "CE", null, '0'); if (fpu.HasDivideByZero) fpu.DivideByZero = binder.GetSignal<StdLogic>(EPortUsage.Result, "DivideByZero", null, '0'); if (fpu.HasInvalidOp) fpu.InvalidOp = binder.GetSignal<StdLogic>(EPortUsage.Result, "InvalidOp", null, '0'); if (fpu.HasOperationND) fpu.OperationND = binder.GetSignal<StdLogic>(EPortUsage.Default, "OperationND", null, '0'); if (fpu.HasOperationRFD) fpu.OperationRFD = binder.GetSignal<StdLogic>(EPortUsage.Default, "OperationRFD", null, '0'); if (fpu.HasOverflow) fpu.Overflow = binder.GetSignal<StdLogic>(EPortUsage.Result, "Overflow", null, '0'); if (fpu.HasRdy) fpu.Rdy = binder.GetSignal<StdLogic>(EPortUsage.Default, "Rdy", null, '0'); if (fpu.HasSCLR) fpu.SCLR = binder.GetSignal<StdLogic>(EPortUsage.Reset, "SCLR", null, '0'); }
public override void Establish(IAutoBinder binder) { if (_established) return; if (_host.Latency > 0) _host.Clk = (SLSignal)binder.GetSignal(EPortUsage.Clock, null, null, null); _host.Operand = (SLVSignal)binder.GetSignal(EPortUsage.Operand, "Operand", null, StdLogicVector._0s(_host.InputWidth)); _host.Result = (SLVSignal)binder.GetSignal(EPortUsage.Result, "Result", null, StdLogicVector._0s(_host.OutputWidth)); _established = true; }
private void InstantiateControlLogic() { if (_memLookup == null) { // All registers unused, nothing to instantiate return; } int rcount = 0; int mcount = 0; var regsCur = new List <SignalBase>(); var regsNext = new List <SignalBase>(); var memInstances = new List <SimpleDPRAM>(); var memAddrRSignals = new List <SignalBase>(); var memAddrWSignals = new List <SignalBase>(); var memDInSignals = new List <SignalBase>(); var memDOutSignals = new List <SignalBase>(); var memWrEnSignals = new List <SignalBase>(); int scount = _tempRegTypes.Length; _idxMap = Arrays.Same(-1, scount); _isMemMap = Arrays.Same(false, scount); foreach (var grp in _memLookup) { if (grp.Count() <= 800000) { // Implement as register foreach (int slot in grp) { if (IsUnused(slot)) { continue; } _idxMap[slot] = rcount; var regType = _tempRegTypes[slot]; string name = "R" + rcount + "_cur"; var regCur = _binder.GetSignal(EPortUsage.Default, name, null, regType.GetSampleInstance()); //regCur.Descriptor.TagTemporary(rcount); name = "R" + rcount + "_next"; var regNext = _binder.GetSignal(EPortUsage.Default, name, null, regType.GetSampleInstance()); //regNext.Descriptor.TagTemporary(rcount); regsCur.Add(regCur); regsNext.Add(regNext); ++rcount; } } else { // Implement as memory foreach (int slot in grp) { _isMemMap[slot] = true; _idxMap[slot] = mcount; } int rep = grp.Key; string name = "M" + rcount + "_AddrR"; var sigAddrR = _binder.GetSignal <StdLogicVector>(EPortUsage.Default, name, null, _memAddrs[rep]); name = "M" + rcount + "_AddrW"; var sigAddrW = _binder.GetSignal <StdLogicVector>(EPortUsage.Default, name, null, _memAddrs[rep]); name = "M" + rcount + "_DIn"; var regType = _tempRegTypes[rep]; var sigDIn = _binder.GetSignal <StdLogicVector>(EPortUsage.Default, name, null, (StdLogicVector)regType.GetSampleInstance()); name = "M" + rcount + "_DOut"; var sigDOut = _binder.GetSignal <StdLogicVector>(EPortUsage.Default, name, null, (StdLogicVector)regType.GetSampleInstance()); name = "M" + rcount + "_WrEn"; var sigWrEn = _binder.GetSignal <StdLogic>(EPortUsage.Default, name, null, StdLogic._0); var mem = new SimpleDPRAM( (uint)grp.Count(), (uint)TypeLowering.Instance.GetWireWidth(regType)) { Clk = _binder.GetSignal <StdLogic>(EPortUsage.Clock, null, null, StdLogic._0), RdAddr = sigAddrR, WrAddr = sigAddrW, DataIn = sigDIn, DataOut = sigDOut, WrEn = sigWrEn }; _host.Descriptor.AddChild(mem.Descriptor, "Mem" + rcount); memInstances.Add(mem); memAddrRSignals.Add(sigAddrR); memAddrWSignals.Add(sigAddrW); memDInSignals.Add(sigDIn); memDOutSignals.Add(sigDOut); memWrEnSignals.Add(sigWrEn); ++mcount; } } _regsCur = regsCur.ToArray(); _regsNext = regsNext.ToArray(); _memInstances = memInstances.ToArray(); _memAddrRSignals = memAddrRSignals.ToArray(); _memAddrWSignals = memAddrWSignals.ToArray(); _memDInSignals = memDInSignals.ToArray(); _memDOutSignals = memDOutSignals.ToArray(); _memWrSignals = memWrEnSignals.ToArray(); var syncTempl = new SyncTemplate(this); var syncFunc = syncTempl.GetAlgorithm(); Signal <StdLogic> clkInst = _binder.GetSignal <StdLogic>(EPortUsage.Clock, "Clk", null, '0'); _binder.CreateProcess(SystemSharp.Components.Process.EProcessKind.Triggered, syncFunc, clkInst.Descriptor); }