• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Register类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Register的典型用法代码示例。如果您正苦于以下问题:C# Register类的具体用法?C# Register怎么用?C# Register使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Register类属于命名空间,在下文中一共展示了Register类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddModuloQFTPhi

        public static void AddModuloQFTPhi(this QuantumComputer comp, ulong a, ulong N, RegisterRef ctrl, Register b, params RegisterRef[] controls)
        {
            if (comp.Group)
            {
                object[] parameters = new object[] { comp, a, N, ctrl, b, controls };
                comp.AddParametricGate("AddModuloQFTPhi", parameters);
                return;
            }
            else
            {
                comp.Group = true;
            }

            comp.AddQFTPhi(a, b, controls);
            comp.InverseAddQFTPhi(N, b);

            comp.InverseQFT(b);
            comp.CNot(ctrl, b[b.Width - 1]);
            comp.QFT(b);

            comp.AddQFTPhi(N, b, ctrl);
            comp.InverseAddQFTPhi(a, b, controls);

            comp.InverseQFT(b);
            comp.SigmaX(b[b.Width - 1]);
            comp.CNot(ctrl, b[b.Width - 1]);
            comp.SigmaX(b[b.Width - 1]);
            comp.QFT(b);

            comp.AddQFTPhi(a, b, controls);
        }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:31,代码来源:AddModuloQFTExtension.cs


示例2: CanSetTheValueOfARegister

 public void CanSetTheValueOfARegister()
 {
     var register = new Register(8);
       const int expectedValue = 42;
       register.SetValue(expectedValue);
       Assert.That(register.GetValue(), Is.EqualTo(expectedValue));
 }
开发者ID:joshpeterson,项目名称:mos,代码行数:7,代码来源:RegisterTests.cs


示例3: RegisterTaskPanes

 public void RegisterTaskPanes(Register register)
 {
     myAddinTaskPane = register(() =>
         {
             var button = new System.Windows.Controls.Button
             {
                 Content = "Insert Quote"
             };
             button.Click += InsertQuote;
             var host = new WpfPanelHost
             {
                 Child = new UserControl
                 {
                     Content = new StackPanel
                     {
                         Children =
                         {
                             button
                         }
                     }
                 }
             };
             return host;
         }, "Quotes!");
     myAddinTaskPane.Visible = true;
     myAddinTaskPane.VisibleChanged += TaskPaneVisibleChanged;
     TaskPaneVisibleChanged(this, EventArgs.Empty);
 }
开发者ID:JoyPeterson,项目名称:VSTOContrib,代码行数:28,代码来源:DocumentViewModel.cs


示例4: InverseAddModuloQFT

 public static void InverseAddModuloQFT(this QuantumComputer comp, ulong a, ulong N, RegisterRef ctrl, Register b, params RegisterRef[] controls)
 {
     Validate(a, b, N);
     comp.QFT(b);
     comp.InverseAddModuloQFTPhi(a, N, ctrl, b, controls);
     comp.InverseQFT(b);
 }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:7,代码来源:AddModuloQFTExtension.cs


示例5: cmdRegister_Click

 private void cmdRegister_Click(object sender, EventArgs e)
 {
     Register reg = new Register();
     reg.UserName = txtName.Text;
     reg.EMail = txtEMail.Text;
     mChannel.Send(reg);
 }
开发者ID:hdxhan,项目名称:IKendeLib,代码行数:7,代码来源:FrmMain.cs


示例6: BitOperation

 public BitOperation(short _targetAddress, short _bitNumber, BitOperator _op, Register.RegisterFileMap _registerFileMap, short _address)
     : base(_registerFileMap, CYCLES, _address)
 {
     this.targetAddress = _targetAddress;
     this.bitNumber = _bitNumber;
     this.op = _op;
 }
开发者ID:hipsterfister,项目名称:PIC16F84-Emulator,代码行数:7,代码来源:BitOperation.cs


示例7: RegisterSelf

 public void RegisterSelf(Register register)
 {
     contentTaskPane = register(() => new WpfPanelHost
     {
         Child = this
     }, "GitHub for Outlook", false);
 }
开发者ID:huangchao-shanghai,项目名称:VSTOContrib,代码行数:7,代码来源:TaskPaneContentHost.xaml.cs


示例8: Add

        // Add(a, b, 0) -> (a, a+b, 0)
        // Registers a, b and c must not overlap
        // Registers a and b have the same width
        // Register c is used for storing carries and must be minimum one bit wider than register a (or b)
        // Initial value of c must be 0
        public static void Add(this QuantumComputer comp,
            Register a, Register b, Register c)
        {
            if (comp.Group)
            {
                object[] parameters = new object[] { comp, a, b, c };
                comp.AddParametricGate("Add", parameters);
                return;
            }
            else
            {
                comp.Group = true;
            }

            int width = a.Width;
            int i = 0;
            for (; i < width - 1; i++)
            {
                comp.Carry(c[i], a[i], b[i], c[i + 1]);
            }
            comp.Carry(c[i], a[i], b[i], b[i + 1]);

            comp.CNot(b[i], a[i]);
            comp.Sum(c[i], a[i], b[i]);
            i--;
            for (; i >= 0; i--)
            {
                comp.InverseCarry(c[i], a[i], b[i], c[i + 1]);
                comp.Sum(c[i], a[i], b[i]);
            }
        }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:36,代码来源:AddExtension.cs


示例9: AddQFTPhi

        public static void AddQFTPhi(this QuantumComputer comp, Register a, Register b, params RegisterRef[] controls)
        {
            if (comp.Group)
            {
                object[] parameters = new object[] { comp, a, b, controls };
                comp.AddParametricGate("AddQFTPhi", parameters);
                return;
            }
            else
            {
                comp.Group = true;
            }

            Validate(a, b);

            for (int j = b.Width - 1; j >= 0; j--)
            {
                for (int i = j; i >= 0; i--)
                {
                    List<RegisterRef> list = controls.ToList<RegisterRef>();
                    list.Add(a[i]);
                    RegisterRef[] controls2 = list.ToArray();
                    comp.CPhaseShift(Math.Abs(j-i), b[j], controls2);
                }
            }
        }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:26,代码来源:AddQFTExtension.cs


示例10: AddQFT

 public static void AddQFT(this QuantumComputer comp, ulong a, Register b, params RegisterRef[] controls)
 {
     Validate(a, b);
     comp.QFT(b);
     comp.AddQFTPhi(a, b, controls);
     comp.InverseQFT(b);
 }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:7,代码来源:AddQFTExtension.cs


示例11: RotateOperation

 public RotateOperation(short _sourceAddress, short _targetAddress, RotationDirection _direction, Register.RegisterFileMap _registerFileMap, short _address)
     : base(_registerFileMap, CYCLES, _address)
 {
     this.data = _registerFileMap.Get(_sourceAddress);
     this.targetAddress = _targetAddress;
     this.direction = _direction;
 }
开发者ID:hipsterfister,项目名称:PIC16F84-Emulator,代码行数:7,代码来源:RotateOperation.cs


示例12: updateRegisterState

 private void updateRegisterState(TextBox txt, Register register)
 {
     txt.Invoke((MethodInvoker)(() =>
     {
         txt.Text = _vm.cpu.Registers[register].ToString();
     }));
 }
开发者ID:claassen,项目名称:RIVM,代码行数:7,代码来源:Debugger.cs


示例13: EmitMOV

 public void EmitMOV(Register regDst, int imm32)
 {
     AddrMode rexAddrMode = new AddrMode(regDst, null, 0, 0, AddrModeSize.Int32);
     EmitRexPrefix(regDst, ref rexAddrMode);
     Builder.EmitByte((byte)(0xB8 | ((int)regDst & 0x07)));
     Builder.EmitInt(imm32);
 }
开发者ID:justinvp,项目名称:corert,代码行数:7,代码来源:X64Emitter.cs


示例14: triggerInterrupt

 /// <summary>
 /// Pushes the current value of our programmCounter to the operationStack and sets programmCounter to INTERRUPT_VECTOR_ADDRESS
 /// </summary>
 public void triggerInterrupt(Data.OperationStack operationStack, Register.ProgramCounter programCounter)
 {
     operationStack.push(programCounter.value);
     programCounter.value = Register.RegisterConstants.INTERRUPT_VECTOR_ADDRESS;
     registerFileMap.clearBit(Register.RegisterConstants.INTCON_ADDRESS, Register.RegisterConstants.INTCON_GIE_MASK);
     pic.setInterruptIsNext(false);
 }
开发者ID:hipsterfister,项目名称:PIC16F84-Emulator,代码行数:10,代码来源:InterruptHandler.cs


示例15: EmitMOV

 public void EmitMOV(Register regDst, Register regSrc)
 {
     AddrMode rexAddrMode = new AddrMode(regSrc, null, 0, 0, AddrModeSize.Int64);
     EmitRexPrefix(regDst, ref rexAddrMode);
     Builder.EmitByte(0x89);
     Builder.EmitByte((byte)(0xC0 | (((int)regSrc & 0x07) << 3) | (((int)regDst & 0x07))));
 }
开发者ID:tijoytom,项目名称:corert,代码行数:7,代码来源:X64Emitter.cs


示例16: AddModulo

        // register A - initially loaded with a
        // register B - initially loaded with b
        // register C - initially 0, exactly one bit wider than A, stores overflow bit
        // register N - initially loaded with N
        // after computation in register B: (a+b) mod N
        // other registers dont change their states
        // register B must be exactly one bit wider than A to store carry bit
        // register B must be exactly one bit wider than N to store carry bit
        // registers A, N must be the same length
        // Insecure version: registers widths etc. are not checked
        public static void AddModulo(
            this QuantumComputer comp,
            Register a,
            Register b,
            Register c,
            Register N,
            ulong valueN)
        {
            RegisterRef carry = b[b.Width - 1];
            RegisterRef overflow = c[c.Width - 1];

            comp.Add(a, b, c);
            comp.InverseAdd(N, b, c);
            comp.SigmaX(carry);
            comp.CNot(overflow, carry);
            comp.SigmaX(carry);

            //resetting N
            comp.LoadNumber(N, valueN, overflow);

            comp.Add(N, b, c);

            // now we have [(a+b) mod N] in B register
            // next steps lead to recover the initial state of registers N and overflow bit

            //setting N back
            comp.LoadNumber(N, valueN, overflow);

            comp.InverseAdd(a, b, c);
            comp.CNot(overflow, carry);
            comp.Add(a, b, c);
        }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:42,代码来源:AddModuloExtension.cs


示例17: EEPROMHandler

 /// <summary>
 /// Crates a new EEPROM Handler to enable EEPROM functionality.
 /// IMPORTANT: call dispose(); when it's no longer needed.
 /// </summary>
 /// <param name="_registerFileMap"></param>
 /// <param name="_eepromMemory"></param>
 public EEPROMHandler(Register.RegisterFileMap _registerFileMap, Data.EEPROMMemory _eepromMemory)
 {
     this.registerFileMap = _registerFileMap;
     this.eepromMemory = _eepromMemory;
     this.valueChangeListener = new Data.DataAdapter<byte>.OnDataChanged(onValueChange);
     registerSelfWithRegisterFileMap();
 }
开发者ID:hipsterfister,项目名称:PIC16F84-Emulator,代码行数:13,代码来源:EEPROMHandler.cs


示例18: CMultModulo

        // register x - initially loaded with x
        // register N - initially loaded with N
        // control - control bit
        // other registers - initially 0
        // after computation register B changes and contains: [(a*x) mod N]
        // Insecure version: registers widths etc. are not checked
        public static void CMultModulo(
            this QuantumComputer comp,
            Register a,
            Register b,
            Register c,
            Register N,
            Register x,
            RegisterRef control,
            ulong valueA,
            ulong valueN)
        {
            ulong power2 = 1;
            for (int i = 0; i < x.Width; i++, power2 *= 2)
            {
                // loading A register with (2^i * a) mod N
                ulong toLoad = (valueA * power2) % valueN;
                comp.LoadNumber(a, toLoad, control, x[i]);

                // adding [(2^i * a) + B] modulo N
                comp.AddModulo(a, b, c, N, valueN);

                // unloading [(2^i * a) mod N] from A register
                comp.LoadNumber(a, toLoad, control, x[i]);
            }

            // if control == 0
            // then B register contains still 0
            // so we copy X register into B register
            comp.SigmaX(control);
            for (int i = 0; i < x.Width; i++)
            {
                comp.Toffoli(b[i], control, x[i]);
            }
            comp.SigmaX(control);
        }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:41,代码来源:MultModuloExtension.cs


示例19: Reverse

 public static void Reverse(this QuantumComputer comp, Register a)
 {
     for (int i = 0; i < a.Width / 2; i++)
     {
         comp.Swap(a[i], a[a.Width - 1 - i]);
     }
 }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:7,代码来源:SwapExtension.cs


示例20: VariableStartEntry

 /// <summary>
 /// Default ctor
 /// </summary>
 public VariableStartEntry(int offset, Register register, IVariable variable, TypeReference type) : base(offset)
 {
     this.register = register;
     Variable = variable;
     name = variable.OriginalName;
     this.type = type;
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:10,代码来源:DebugInfoBuilder.VariableStartEntry.cs



注:本文中的Register类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RegisterModel类代码示例发布时间:2022-05-24
下一篇:
C# RegionTimer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap