private async void Computation() { await Tick; Rdy.Next = '0'; while (true) { ProgramFlow.DoNotUnroll(); int a = A.Cur.IntValue; int b = B.Cur.IntValue; int sum = a + b; int diff = a - b; int prod = a * b; int quot = a / b; ProgramFlow.IOBarrier(); Rdy.Next = '1'; Sum.Next = StdLogicVector.FromInt(sum, 32); Diff.Next = StdLogicVector.FromInt(diff, 32); Prod.Next = StdLogicVector.FromInt(prod, 32); Quot.Next = StdLogicVector.FromInt(quot, 32); await Tick; ProgramFlow.IOBarrier(); Rdy.Next = '0'; await Tick; } }
private async void Computation() { await Tick; while (true) { ProgramFlow.DoNotUnroll(); ProgramFlow.IOBarrier(); Rdy.Next = '0'; int i = 0; int j = 0; while (i++ < 10) { ProgramFlow.DoNotUnroll(); j += i; if (j < 8) { continue; } else { break; } } Z.Next = StdLogicVector.FromInt(j, 32); await 63.Ticks(); ProgramFlow.IOBarrier(); Rdy.Next = '1'; ProgramFlow.IOBarrier(); await Tick; } }
private async void Computation() { await Tick; while (true) { ProgramFlow.DoNotUnroll(); Rdy.Next = '0'; ProgramFlow.IOBarrier(); // y^('')-mu(1-y^2)y^'+y=0. double dt = Dt.Cur.ToDouble(); double mu = Mu.Cur.ToDouble(); _y[2] = mu * (1 - _y[0] * _y[0]) * _y[1] - _y[0]; _y[0] += _y[1] * dt; _y[1] += _y[2] * dt; await 39.Ticks(); Y.Next = _y[0].ToSLV(); Ydot.Next = _y[1].ToSLV(); Ydotdot.Next = _y[2].ToSLV(); ProgramFlow.IOBarrier(); Rdy.Next = '1'; await Tick; ProgramFlow.IOBarrier(); } }
private async void Computation() { await Tick; while (true) { ProgramFlow.DoNotUnroll(); DOut.Next = DIn.Cur; await Tick; } }
private async void Computation() { await Tick; while (true) { ProgramFlow.DoNotUnroll(); Sum.Next = (A.Cur.ToDouble() + B.Cur.ToDouble()).ToSLV(); Diff.Next = (A.Cur.ToDouble() - B.Cur.ToDouble()).ToSLV(); Prod.Next = (A.Cur.ToDouble() * B.Cur.ToDouble()).ToSLV(); Quot.Next = (A.Cur.ToDouble() / B.Cur.ToDouble()).ToSLV(); Neg.Next = (-A.Cur.ToDouble()).ToSLV(); Abs.Next = Math.Abs(A.Cur.ToDouble()).ToSLV(); await 30.Ticks(); } }
private async void Computation() { await Tick; while (true) { ProgramFlow.DoNotUnroll(); ProgramFlow.IOBarrier(); Rdy.Next = '0'; Sin.Next = (Math.Sin(X.Cur.ToDouble())).ToSLV(); Cos.Next = (Math.Cos(X.Cur.ToDouble())).ToSLV(); await 63.Ticks(); ProgramFlow.IOBarrier(); Rdy.Next = '1'; ProgramFlow.IOBarrier(); await Tick; } }
private async void Computation() { await Tick; while (true) { ProgramFlow.DoNotUnroll(); ProgramFlow.IOBarrier(); Rdy.Next = '0'; Sqrt1.Next = MathExt.Sqrt(UFix.FromUnsigned(X1.Cur.UnsignedValue, _fracWidth)).SLVValue; Sqrt2.Next = MathExt.Sqrt(UFix.FromUnsigned(X2.Cur.UnsignedValue, _fracWidth)).SLVValue; await NTicks(63); ProgramFlow.IOBarrier(); Rdy.Next = '1'; ProgramFlow.IOBarrier(); await Tick; } }
private async void Computation() { await Tick; while (true) { ProgramFlow.DoNotUnroll(); ProgramFlow.IOBarrier(); Rdy.Next = '0'; var sincos = MathExt.ScSinCos(SFix.FromSigned(X.Cur.SignedValue, _xFracWidth), _yFracWidth); Cos.Next = sincos.Item1.SLVValue; Sin.Next = sincos.Item2.SLVValue; await 12.Ticks(); ProgramFlow.IOBarrier(); Rdy.Next = '1'; ProgramFlow.IOBarrier(); await Tick; } }
private async void Computation() { await Tick; while (true) { ProgramFlow.DoNotUnroll(); ProgramFlow.IOBarrier(); Rdy.Next = '0'; int x = X.Cur.IntValue; int y = Y.Cur.IntValue; int z; if (x == 0) { z = y; } else { while (y != 0) { ProgramFlow.DoNotUnroll(); if (x > y) { x -= y; } else { y -= x; } } z = x; } Z.Next = StdLogicVector.FromInt(z, 32); await 63.Ticks(); ProgramFlow.IOBarrier(); Rdy.Next = '1'; ProgramFlow.IOBarrier(); await Tick; } }
private async void DivideProcess() { _rdy = true; while (true) { ProgramFlow.DoNotUnroll(); while (!_nxt) { ProgramFlow.DoNotUnroll(); await Tick; } _rdy = false; ProgramFlow.Barrier(); _quotient = _dividend / _divisor; ProgramFlow.Barrier(); await 10.Ticks(); _rdy = true; } }