public FPUWrapper(EISEVersion iseVer)
 {
     var a = new SLVSignal(32);
     var b = new SLVSignal(32);
     var r = new SLVSignal(32);
     var clk = new SLSignal();
     _fpu = new FloatingPointCore()
     {
         A = a,
         B = b,
         Clk = clk,
         Result = r,
         DSP48EUsage = FloatingPointCore.EDSP48EUsage.FullUsage,
         Function = FloatingPointCore.EFunction.AddSubtract,
         TargetDeviceFamily = SystemSharp.Interop.Xilinx.EDeviceFamily.Virtex6,
         UseMaximumLatency = true,
         Precision = FloatingPointCore.EPrecision.Single,
         ResultPrecision = FloatingPointCore.EPrecision.Single,
         AddSubSel = FloatingPointCore.EAddSub.Add,
         TargetISEVersion = iseVer
     };
     Clk = clk;
     A = a;
     B = b;
     R = r;
 }
Exemplo n.º 2
0
                public static object CreateMap([NotNull]BlockParam/*!*/ block, Out/*!*/ self, [DefaultProtocol]MutableString taguri, object yamlStyle) {
                    var rep = self._representer;
                    var map = new MappingNode(rep.ToTag(taguri), new Dictionary<Node, Node>(), RubyYaml.ToYamlFlowStyle(yamlStyle));
                    
                    object blockResult;
                    if (block.Yield(map, out blockResult)) {
                        return blockResult;
                    }

                    return map;
                }
Exemplo n.º 3
0
                public static object CreateSequence([NotNull]BlockParam/*!*/ block, Out/*!*/ self, [DefaultProtocol]MutableString taguri, object yamlStyle) {
                    var rep = self._representer;
                    var seq = new SequenceNode(rep.ToTag(taguri), new List<Node>(), RubyYaml.ToYamlFlowStyle(yamlStyle));

                    object blockResult;
                    if (block.Yield(seq, out blockResult)) {
                        return blockResult;
                    }

                    return seq;
                }
Exemplo n.º 4
0
        /// <summary>
        /// Constructs an instance.
        /// </summary>
        /// <param name="numRegs">number of registers</param>
        /// <param name="slvDWidth">data width</param>
        public AXILiteSlaveUserLogic(int numRegs, int slvDWidth)
        {
            NumRegs = numRegs;
            SLVDWidth = slvDWidth;

            _writeBits = new Out<StdLogic>[NumRegs, SLVDWidth];
            _readBits = new In<StdLogic>[NumRegs, SLVDWidth];
        }
Exemplo n.º 5
0
 /// <summary>Write the string representation of an object to the current result followed by a line terminator</summary>
 public static void WriteLine(object value)
 {
     Out.WriteLine(value);
 }
Exemplo n.º 6
0
 /// <summary>Write the string representation of an Int64 value to the current result followed by a line terminator</summary>
 public static void WriteLine(Int64 value)
 {
     Out.WriteLine(value);
 }
Exemplo n.º 7
0
 /// <summary>Write a char array to the current result followed by a line terminator</summary>
 public static void WriteLine(char[] value)
 {
     Out.WriteLine(value);
 }
Exemplo n.º 8
0
 /// <summary>Write a line terminator to the current result</summary>
 public static void WriteLine()
 {
     Out.WriteLine();
 }
Exemplo n.º 9
0
 /// <summary>Write a formatted string to the current result</summary>
 public static void Write(string format, object arg1, object arg2, object arg3)
 {
     Out.Write(format, arg1, arg2, arg3);
 }
Exemplo n.º 10
0
        public void Judge()
        {
            try
            {
                //string CodePath = "E:\\tmp\\tmp"+Language;
                //string BinaryPath = "E:\\tmp\\tmp.exe";
                //File.WriteAllText(CodePath, Source);

                using (Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                {
                    bool con = false;
                    while(!con)
                        try
                        {
                            sock.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 6000));
                            con = true;
                        }
                        catch
                        {
                            con = false;
                        }

                    string Compile = "";
                    if (Language == ".cpp")
                        Compile = "g++ -o {Execute}{.cpp} {Source}";
                    if (Language==".c")
                        Compile = "gcc -o {Execute}{.c} {Source}";
                    if (Language==".pas")
                        Compile = "fpc -o{Execute}{.pas} {Source}";

                    sock.Send(new Message()
                    {
                        Type = Message.MessageType.Compile,
                        Content = new CompileIn()
                        {
                            Code = Source,
                            Command = Compile,
                            Memory = 1024 * 1024 * 60,
                            Time = 5 * 1000
                        }
                    }.ToBytes());

                    Out ret = new Out(sock);

                    Response.Write("<div class=\"style2\" style=\"text-align:left; padding-top:20px; padding-left:20px;\">编译信息:</div>");
                    Response.Write("<div style=\"color:green; text-align:left; padding-left:30px;\"" + ret.CompileMessage() + "</div>");

                    if (ret.ErrorCode == 0)
                    {
                        Response.Write("<div class=\"style2\" style=\"text-align:left; padding-top:20px; padding-left:20px;\">测试点信息:</div>");
                        for (int i = 0; i < TestNum; ++i)
                        {
                            //Response.Write("??:"+FilePath+"\\input\\"+InFile[i]+" "+FilePath+"\\output\\"+OutFile[i]);
                            sock.Send(new Message()
                            {
                                Type = Message.MessageType.Test,
                                Content = new TestIn()
                                {
                                    CmpPath = "E:\\tmp\\Special_Judge.exe",
                                    ExecPath = ret.Message,
                                    Memory = 1024 * 1024 * 30,
                                    Time = 1000,
                                    Input = File.ReadAllBytes(FilePath + "\\input\\" + InFile[i]),
                                    Output = File.ReadAllBytes(FilePath + "\\output\\" + OutFile[i])
                                }
                            }.ToBytes());

                            ret = new Out(sock);
                            Response.Write("<div style=\"color:green; text-align:left; padding-left:30px;\">");
                            Response.Write("#"+(i+1).ToString()+": "+ret.RunMessage()+"</div>");
                        }
                    }
                }
            }
            catch (Exception exp)
            {

            }
        }
Exemplo n.º 11
0
        static void Dispatcher(int RUN_UNROLL, int SUM_UNROLL, bool withTrafo)
        {
            string mod          = withTrafo ? "WTrafo" : "";
            string params_types = withTrafo ? PARAMS_TYPES_WTRF : PARAMS_TYPES;
            string params_only  = withTrafo ? PARAMS_ONLY_WTRF : PARAMS_ONLY;


            Out.WriteLine("/// <summary>");
            Out.WriteLine("/// Selects an optimized implementation for this particular case");
            Out.WriteLine("/// </summary>");
            Out.WriteLine("unsafe static private void Multiply{1}_Dispatch({0}) {{", params_types, mod);

            // ###################################################################################################################
            Out.WriteLine("if (SumDim == 0) {");  // 0 SUMMATION CYCLE ###############################################
            Out.WriteLine("switch (RunDim) {");
            Out.WriteLine("case 0: throw new NotSupportedException();");
            for (int l = 1; l <= RUN_UNROLL; l++)
            {
                Out.WriteLine("case {0}: Multiply{2}_Sum0_FOR{0}({1}); break;", l, params_only, mod);
            }
            if (withTrafo)
            {
                Out.WriteLine("throw new NotImplementedException();");
            }
            else
            {
                Out.WriteLine("default: Multiply{1}_Sum0_GOTO({0}); break;", params_only, mod);
            }
            Out.WriteLine("}");
            // ###################################################################################################################
            Out.WriteLine("} else if (SumDim == 1) {");  // 1 SUMMATION CYCLE ###############################################

            Out.WriteLine("switch (RunDim) {");
            Out.WriteLine("case 0: throw new NotSupportedException();");
            for (int l = 1; l <= RUN_UNROLL; l++)
            {
                Out.WriteLine("case {0}: {{", l);

                Out.WriteLine("switch(lenSum[0]) {");
                Out.WriteLine("case 0: return;");

                for (int k = 1; k <= SUM_UNROLL; k++)
                {
                    Out.WriteLine("case {0}: Multiply{3}_Sum1Unroll{0}_FOR{1}({2}); break;", k, l, params_only, mod);
                }

                Out.WriteLine("default: Multiply{2}_Sum1_FOR{0}({1}); break;", l, params_only, mod);
                Out.WriteLine("}");
                Out.WriteLine("} break;");
            }
            if (withTrafo)
            {
                Out.WriteLine("throw new NotImplementedException();");
            }
            else
            {
                Out.WriteLine("default: Multiply{1}_Sum1_GOTO({0}); break;", params_only, mod);
            }
            Out.WriteLine("}");

            // ###################################################################################################################
            Out.WriteLine("} else if (SumDim == 2) {");  // >2 SUMMATION CYCLE (GOTO) #####################################

            Out.WriteLine("switch (RunDim) {");
            Out.WriteLine("case 0: throw new NotSupportedException();");
            for (int l = 1; l <= RUN_UNROLL; l++)
            {
                Out.WriteLine("case {0}: {{", l);

                Out.WriteLine("switch(lenSum[1]) {");
                Out.WriteLine("case 0: return;");

                for (int k = 1; k <= SUM_UNROLL; k++)
                {
                    Out.WriteLine("case {0}: Multiply{3}_Sum2Unroll{0}_FOR{1}({2}); break;", k, l, params_only, mod);
                }

                Out.WriteLine("default: Multiply{2}_Sum2_FOR{0}({1}); break;", l, params_only, mod);
                Out.WriteLine("}");
                Out.WriteLine("} break;");
            }
            if (withTrafo)
            {
                Out.WriteLine("throw new NotImplementedException();");
            }
            else
            {
                Out.WriteLine("default: Multiply{1}_Sum2_GOTO({0}); break;", params_only, mod);
            }
            Out.WriteLine("}");

            // ###################################################################################################################
            Out.WriteLine("} else {");  // >2 SUMMATION CYCLE (GOTO) ###############################################
            if (withTrafo)
            {
                Out.WriteLine("throw new NotImplementedException();");
            }
            else
            {
                Out.WriteLine("Multiply{1}_SumGOTO_GOTO({0});", params_only, mod);
            }
            Out.WriteLine("}");


            Out.WriteLine("}");
        }
Exemplo n.º 12
0
 public void Flush() => Out.Flush();
Exemplo n.º 13
0
 static void Main()
 {
     //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
     new Program().solve();
     Out.Flush();
 }
Exemplo n.º 14
0
 public static void Write(Object value)
 {
     Out.Write(value);
 }
Exemplo n.º 15
0
 public static void Write(ulong value)
 {
     Out.Write(value);
 }
Exemplo n.º 16
0
 public static void Write(uint value)
 {
     Out.Write(value);
 }
Exemplo n.º 17
0
 public static void Write(float value)
 {
     Out.Write(value);
 }
Exemplo n.º 18
0
 public void Close()
 {
     Out.Flush();
     connected = false;
 }
Exemplo n.º 19
0
        public override void Execute()
        {
            bool exists = true;

            while (exists)
            {
                var sql =
                    string.Format(
                        "select {0}InvPrefix as Prefix, {0}InvSuffix as Suffix, {0}InvSize as Length from PosimRegisters where RegisterId = '{1}'",
                        InvoiceStatus == InvoiceStatus.Posted ? "P" : "W", RegisterId);
                Out = SharedDb.PosimDb.Get <SuffixPrefix>(sql).StringValue;
                sql =
                    string.Format("update PosimRegisters set  {0}InvSuffix =  {0}InvSuffix + 1 where RegisterId = '{1}'",
                                  InvoiceStatus == InvoiceStatus.Posted ? "P" : "W", RegisterId);
                SharedDb.PosimDb.Execute(sql);
                string existsString = string.Format("select count(InvoiceId) from {0}InvHeaders where InvoiceID = {1}",
                                                    InvoiceStatus == InvoiceStatus.Posted ? "P" : "W", Out.GetSqlCompatible());
                exists = SharedDb.PosimDb.GetInt(existsString) > 0;
            }
        }
Exemplo n.º 20
0
 public static void Write(char[] buffer)
 {
     Out.Write(buffer);
 }
Exemplo n.º 21
0
 public override void OnScannedRobot(ScannedRobotEvent evnt)
 {
     Out.WriteLine("Scanned!!!"); // a robot was Scanned -> success!
 }
Exemplo n.º 22
0
 /// <summary>Write a formatted string to the current result</summary>
 public static void Write(string format, params object[] args)
 {
     Out.Write(format, args);
 }
Exemplo n.º 23
0
 public void before()
 {
     Out.init();
 }
Exemplo n.º 24
0
 /// <summary>Write the string representation of a boolean value to the current result followed by a line terminator</summary>
 public static void WriteLine(bool value)
 {
     Out.WriteLine(value);
 }
Exemplo n.º 25
0
 public void after()
 {
     Out.restore();
 }
Exemplo n.º 26
0
 /// <summary>Write the string representation of a double to the current result followed by a line terminator</summary>
 public static void WriteLine(double value)
 {
     Out.WriteLine(value);
 }
Exemplo n.º 27
0
 private void buildOut(ColumnOrSuperColumn columnOrSupercolumn)
 {
     Out outResponse = new Out();
     if (columnOrSupercolumn.Column != null)
     {
         outResponse.Column = this.buildAquilesColumn(columnOrSupercolumn.Column);
     }
     if (columnOrSupercolumn.Super_column != null)
     {
         outResponse.SuperColumn = this.buildAquilesSuperColumn(columnOrSupercolumn.Super_column);
     }
     this.Output = outResponse;
 }
Exemplo n.º 28
0
 /// <summary>Write the string representation of a decimal value to the current result followed by a line terminator</summary>
 public static void WriteLine(decimal value)
 {
     Out.WriteLine(value);
 }
Exemplo n.º 29
0
        private void buildOut(List<KeySlice> output)
        {
            List<GetCommand.Out> columnOrSuperColumnList = null;
            Out returnObj = new Out();
            returnObj.Results = new Dictionary<string, List<GetCommand.Out>>();

            foreach(KeySlice keySlice in output)
            {
                columnOrSuperColumnList = new List<GetCommand.Out>(keySlice.Columns.Count);
                foreach (ColumnOrSuperColumn columnOrSuperColumn in keySlice.Columns)
                {
                    columnOrSuperColumnList.Add(new GetCommand.Out()
                    {
                        Column = this.BuildColumn(columnOrSuperColumn.Column),
                        SuperColumn = this.buildSuperColumn(columnOrSuperColumn.Super_column)
                    });
                }
                returnObj.Results.Add(keySlice.Key, columnOrSuperColumnList);
            }

            this.Output = returnObj;
        }
Exemplo n.º 30
0
 /// <summary>Write the string representation of a Single value to the current result followed by a line terminator</summary>
 public static void WriteLine(Single value)
 {
     Out.WriteLine(value);
 }
Exemplo n.º 31
0
 public static RubyRepresenter/*!*/ SetEmitter(Out/*!*/ self, [NotNull]RubyRepresenter/*!*/ emitter) {
     return self._representer = emitter;
 }
Exemplo n.º 32
0
 /// <summary>Write a char to the current result</summary>
 public static void Write(char value)
 {
     Out.Write(value);
 }
Exemplo n.º 33
0
 public static void Write(char[] buffer, int index, int count)
 {
     Out.Write(buffer, index, count);
 }
Exemplo n.º 34
0
 public static RubyRepresenter/*!*/ GetEmitter(Out/*!*/ self) {
     return self._representer;
 }
Exemplo n.º 35
0
 /// <summary>Write the string representation of an Int32 value to the current result</summary>
 public static void Write(Int32 value)
 {
     Out.Write(value);
 }
Exemplo n.º 36
0
 /// <summary>Write a string to the current result</summary>
 public static void Write(string value)
 {
     Out.Write(value);
 }
Exemplo n.º 37
0
 public static void Write(UInt64 value)
 {
     Out.Write(value);
 }
Exemplo n.º 38
0
        private void buildOut(Dictionary<string, List<ColumnOrSuperColumn>> output)
        {
            List<GetCommand.Out> columnOrSuperColumnList = null;
            Out returnObj = new Out();
            returnObj.Results = new Dictionary<string, List<GetCommand.Out>>();
            Dictionary<string, List<ColumnOrSuperColumn>>.Enumerator outputEnum = output.GetEnumerator();
            while (outputEnum.MoveNext())
            {
                columnOrSuperColumnList = new List<GetCommand.Out>();
                foreach (ColumnOrSuperColumn columnOrSuperColumn in outputEnum.Current.Value)
                {
                    columnOrSuperColumnList.Add(new GetCommand.Out()
                    {
                        Column = this.BuildColumn(columnOrSuperColumn.Column),
                        SuperColumn = this.buildSuperColumn(columnOrSuperColumn.Super_column)
                    });
                }
                returnObj.Results.Add(outputEnum.Current.Key, columnOrSuperColumnList);
            }

            this.Output = returnObj;
        }
Exemplo n.º 39
0
 /// <summary>Write a formatted string to the current result</summary>
 public static void Write(string format, object arg1)
 {
     Out.Write(format, arg1);
 }
Exemplo n.º 40
0
        /// <summary>
        /// Constructs an instance.
        /// </summary>
        /// <param name="numRegs">number of registers</param>
        /// <param name="slvDWidth">data width</param>
        public AXIMasterUserLogic(int numRegs, int slvDWidth)
        {
            NumRegs = numRegs;
            SLVDWidth = slvDWidth;
            SlaveAXIDataWidth = SLVDWidth;
            SlaveAXIAddrWidth = 32;
            AXIMinSize = "000001FF";
            UseWRSTRB = 0;
            DPhaseTimeout = 8;
            BaseAddr = "FFFFFFFF";
            HighAddr = "00000000";
            NumMem = 1;
            SLVAWidth = 32;
            UserSLVNumReg = NumRegs;
            MasterAXIAddrWidth = SlaveAXIAddrWidth;
            MasterAXIDataWidth = SlaveAXIDataWidth;
            MaxBurstLen = 16;
            NativeDataWidth = SlaveAXIDataWidth;
            LengthWidth = 12;
            AddrPipeDepth = 1;
            UserPorts = new List<UserPort>();

            _writeBits = new Out<StdLogic>[NumRegs, SLVDWidth];
            _readBits = new In<StdLogic>[NumRegs, SLVDWidth];
        }
Exemplo n.º 41
0
 public static void Write(String format, Object arg0, Object arg1, Object arg2)
 {
     Out.Write(format, arg0, arg1, arg2);
 }