vram/VRAMCore: cycle using prime numbers in tests
VRAMs are powers of two, so if memory wiring is wrong and we end up with ram blocks mirrored at several points in the address space, we want a write pattern that doesn't repeat cleanly on power of two blocks. That way, a mirrored memory block cannot contain values that are valid for all its locations.
This commit is contained in:
parent
719339e69f
commit
b46d70fa07
|
@ -38,8 +38,16 @@ module mkIncrementingValue(ValFn);
|
||||||
|
|
||||||
function ActionValue#(Bit#(8)) next();
|
function ActionValue#(Bit#(8)) next();
|
||||||
return (actionvalue
|
return (actionvalue
|
||||||
|
// Cycle through 101 values. 101 is prime, so the
|
||||||
|
// pattern it generates doesn't align to a power of
|
||||||
|
// two and should detect any memory mapping errors.
|
||||||
|
if (val == 100)
|
||||||
|
val <= 0;
|
||||||
|
else
|
||||||
val <= val+1;
|
val <= val+1;
|
||||||
return val;
|
// Add another number to get all nonzero values, to
|
||||||
|
// detect writes that don't stick.
|
||||||
|
return 23+val;
|
||||||
endactionvalue);
|
endactionvalue);
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue