public void StackPointerAtInstantiate() { ulong defaultSize = 1024 * 1024 * 128; // 128MB Assert.AreEqual(cpu.MemorySize, defaultSize, "Default size not 128MB"); Assert.AreEqual(defaultSize - 1, cpu.registers.getR(Register.sp), "Stack Pointer not set to Default size"); int seed = 234682399; Random r = new Random(seed); for (int i = 0; i < 20; i++) { ulong amountOfRam = (ulong)r.Next(1024, 1024 * 1024 * 256); // Instantiate with anywhere from 1024B to 256MB of ram Kore.CPU cpuTest = new Kore.CPU(bus, amountOfRam); Assert.AreEqual(cpuTest.MemorySize, amountOfRam, "memory size not correctly"); Assert.AreEqual(amountOfRam - 1, cpuTest.registers.getR(Register.sp), "Stack Pointer not set to max ram address"); } }
public void Setup() { bus = new Kore.MainBus(); cpu = new Kore.CPU(bus); ram = new Kore.RamController(bus, cpu.MemorySize); }