Ejemplo n.º 1
0
        public IEnumerable <IXILMapping> TryMap(ITransactionSite taSite, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes)
        {
            var       fu     = taSite.Host;
            FixFPMod1 fpmod1 = fu as FixFPMod1;

            if (fpmod1 == null)
            {
                yield break;
            }
            if (instr.Name != InstructionCodes.Mod2 &&
                instr.Name != InstructionCodes.Rempow2)
            {
                yield break;
            }

            if (instr.Name == InstructionCodes.Rempow2)
            {
                int n = (int)instr.Operand;
                if (n != 0)
                {
                    yield break;
                }
            }

            FixFormat infmt  = GetFixFormat(operandTypes[0]);
            FixFormat outfmt = GetFixFormat(resultTypes[0]);

            if (infmt == null || outfmt == null)
            {
                yield break;
            }

            if (infmt.IntWidth < 2 || outfmt.IntWidth < 2)
            {
                yield break;
            }
            if (infmt.FracWidth != outfmt.FracWidth)
            {
                yield break;
            }

            if (infmt.IntWidth != fpmod1.InIntWidth)
            {
                yield break;
            }
            if (infmt.FracWidth != fpmod1.FracWidth)
            {
                yield break;
            }
            if (outfmt.IntWidth != fpmod1.OutIntWidth)
            {
                yield break;
            }

            yield return(new FPMod1XILMapping(fpmod1));
        }
Ejemplo n.º 2
0
        public Mod2TestDesign(int inIntWidth, int fracWidth, int outIntWidth)
        {
            _clk = new SLSignal();
            _x = new SLVSignal(inIntWidth + fracWidth) { InitialValue = StdLogicVector._0s(inIntWidth + fracWidth) };
            _r = new SLVSignal(outIntWidth + fracWidth) { InitialValue = StdLogicVector._0s(outIntWidth + fracWidth) };

            _clkGen = new Clock(new Time(10.0, ETimeUnit.ns));
            Bind(() => _clkGen.Clk = _clk);

            _mod2 = new FixFPMod1(inIntWidth, fracWidth, outIntWidth)
            {
                X = _x,
                R = _r
            };
        }
Ejemplo n.º 3
0
        public IXILMapping TryAllocate(Component host, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, IProject proj)
        {
            if (instr.Name != InstructionCodes.Mod2 &&
                instr.Name != InstructionCodes.Rempow2)
            {
                return(null);
            }

            if (instr.Name == InstructionCodes.Rempow2)
            {
                int n = (int)instr.Operand;
                if (n != 0)
                {
                    return(null);
                }
            }

            FixFormat infmt  = GetFixFormat(operandTypes[0]);
            FixFormat outfmt = GetFixFormat(resultTypes[0]);

            if (infmt == null || outfmt == null)
            {
                return(null);
            }

            if (infmt.IntWidth < 2 || outfmt.IntWidth < 2)
            {
                return(null);
            }
            if (infmt.FracWidth != outfmt.FracWidth)
            {
                return(null);
            }

            FixFPMod1 slicer = new FixFPMod1(infmt.IntWidth, infmt.FracWidth, outfmt.IntWidth);

            return(new FPMod1XILMapping(slicer));
        }
Ejemplo n.º 4
0
 public FPMod1TransactionSite(FixFPMod1 host) :
     base(host)
 {
     _host = host;
 }
Ejemplo n.º 5
0
 public FPMod1XILMapping(FixFPMod1 host)
 {
     _host = host;
 }
Ejemplo n.º 6
0
 public FPMod1TransactionSite(FixFPMod1 host) :
     base(host)
 {
     _host = host;
 }
Ejemplo n.º 7
0
        public IXILMapping TryAllocate(Component host, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, IProject proj)
        {
            if (instr.Name != InstructionCodes.Mod2 &&
                instr.Name != InstructionCodes.Rempow2)
                return null;

            if (instr.Name == InstructionCodes.Rempow2 )
            {
                int n = (int)instr.Operand;
                if (n != 0)
                    return null;
            }

            FixFormat infmt = GetFixFormat(operandTypes[0]);
            FixFormat outfmt = GetFixFormat(resultTypes[0]);
            if (infmt == null || outfmt == null)
                return null;

            if (infmt.IntWidth < 2 || outfmt.IntWidth < 2)
                return null;
            if (infmt.FracWidth != outfmt.FracWidth)
                return null;

            FixFPMod1 slicer = new FixFPMod1(infmt.IntWidth, infmt.FracWidth, outfmt.IntWidth);

            return new FPMod1XILMapping(slicer);
        }
Ejemplo n.º 8
0
 public FPMod1XILMapping(FixFPMod1 host)
 {
     _host = host;
 }