本文整理汇总了C#中Register类的典型用法代码示例。如果您正苦于以下问题:C# Register类的具体用法?C# Register怎么用?C# Register使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Register类属于命名空间,在下文中一共展示了Register类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: CanSetTheValueOfARegister
public void CanSetTheValueOfARegister()
{
var register = new Register(8);
const int expectedValue = 42;
register.SetValue(expectedValue);
Assert.That(register.GetValue(), Is.EqualTo(expectedValue));
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例7: RegisterSelf
public void RegisterSelf(Register register)
{
contentTaskPane = register(() => new WpfPanelHost
{
Child = this
}, "GitHub for Outlook", false);
}
示例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]);
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
示例12: updateRegisterState
private void updateRegisterState(TextBox txt, Register register)
{
txt.Invoke((MethodInvoker)(() =>
{
txt.Text = _vm.cpu.Registers[register].ToString();
}));
}
示例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);
}
示例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);
}
示例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))));
}