本文整理汇总了C#中System.Machine.GetCore方法的典型用法代码示例。如果您正苦于以下问题:C# Machine.GetCore方法的具体用法?C# Machine.GetCore怎么用?C# Machine.GetCore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Machine
的用法示例。
在下文中一共展示了Machine.GetCore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RealMain
//.........这里部分代码省略.........
}
if (help)
{
ShowHelp(set);
return 0;
}
if (plat)
{
Console.Error.WriteLine("The hardware platform is not currently supported");
return 1;
}
if (rows < Machine.MinRows || rows > Machine.MaxRows ||
cols < Machine.MinColumns || cols > Machine.MaxColumns)
{
Console.Error.WriteLine("{0} * {1} grid specification is invalid", rows, cols);
return 1;
}
if (new CoreId(rows - 1, cols - 1).ToAddress() >= Memory.ExternalBaseAddress)
{
Console.Error.WriteLine("A {0} * {1} grid would overlap external memory", rows, cols);
return 1;
}
if (emem < Memory.MinMemorySize || emem > Memory.MaxMemorySize)
{
Console.Error.WriteLine("External memory segment size {0} is invalid", emem);
return 1;
}
Kernel kernel;
switch (kern)
{
case "null":
kernel = new NullKernel();
break;
case "unix":
kernel = new UnixKernel();
break;
default:
Console.Error.WriteLine("{0} is not a known kernel", kern);
return 1;
}
_machine = new Machine(arch, new ConsoleLogger(), kernel, rows, cols, emem);
var cores = new List<Core>();
while (args.Length != 0)
{
if (args.Length < 3)
{
Console.Error.WriteLine("Expected <file> <row> <column> arguments");
return 1;
}
var file = args[0];
int row;
int column;
if (!int.TryParse(args[1], out row) ||
!int.TryParse(args[2], out column))
{
Console.Error.WriteLine("Invalid row/column numbers given for {0}", file);
return 1;
}
if (row < 0 || row >= rows ||
column < 0 || column >= cols)
{
Console.Error.WriteLine("Coordinates {0} * {1} for {2} are invalid", row, column, file);
return 1;
}
using (var stream = File.OpenRead(file))
{
var core = _machine.GetCore(new CoreId(row, column));
Loader.LoadCode(core, stream);
cores.Add(core);
}
args = args.Skip(3).ToArray();
}
// Set all cores to active.
foreach (var core in cores)
core.Registers.CoreStatus = Bits.Set(core.Registers.CoreStatus, 0);
while (cores.Any(x => Bits.Check(x.Registers.CoreStatus, 0)))
Thread.Sleep(10);
return cores.Any(x => x.TestFailed) ? 1 : 0;
}