public void StallControlPipelineModuleTest_IdleRun() { var t = Module <StallControlPipelineModule>(); Action <StallControlOutput> assert = (expected) => Assert.IsTrue(DeepDiff.DeepEquals(expected, t.outResult)); var idle = new StallControlInputs() { inProcessed = true, inReady = true }; t.Cycle(idle); assert(new StallControlOutput() { result = 0 }); t.Cycle(idle); assert(new StallControlOutput() { result = 1 }); t.Cycle(idle); assert(new StallControlOutput() { result = 2, ready = true }); t.Cycle(idle); assert(new StallControlOutput() { result = 3, ready = true }); }
public void StallControlPipelineModuleTest_StallPrev() { var t = new RTLSimulator <StallControlPipelineModule, StallControlInputs>(); t.TraceToVCD(VCDOutputPath()); Action <StallControlOutput> assert = (expected) => Assert.IsTrue(DeepDiff.DeepEquals(expected, t.TopLevel.outResult)); t.ClockCycle(new StallControlInputs() { inProcessed = true, inData = 3, inReady = true }); assert(new StallControlOutput()); t.ClockCycle(new StallControlInputs { inProcessed = true }); assert(new StallControlOutput() { result = 1, stage0Stalled = true }); t.ClockCycle(new StallControlInputs { inProcessed = true }); assert(new StallControlOutput() { result = 5, stage0Stalled = true }); t.ClockCycle(new StallControlInputs { inProcessed = true }); assert(new StallControlOutput() { result = 9, stage0Stalled = true }); t.ClockCycle(new StallControlInputs { inProcessed = true, inReady = true }); assert(new StallControlOutput() { result = 13 }); t.ClockCycle(new StallControlInputs { inProcessed = true, inReady = true }); assert(new StallControlOutput() { result = 17, ready = true }); t.ClockCycle(new StallControlInputs { inProcessed = true }); }
public virtual bool DeepEquals(object lhs, object rhs) => DeepDiff.DeepEquals(lhs, rhs);