From 495625b99d45bfa7fdc300b01bcf748fd79c3e14 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Tue, 20 Mar 2018 09:56:02 +0000 Subject: [PATCH] bootloader: repeat memory test 4 times --- artiq/firmware/bootloader/main.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/artiq/firmware/bootloader/main.rs b/artiq/firmware/bootloader/main.rs index 7173ef86d..8f65e3a66 100644 --- a/artiq/firmware/bootloader/main.rs +++ b/artiq/firmware/bootloader/main.rs @@ -64,18 +64,19 @@ fn memory_test(total: &mut usize, wrong: &mut usize) -> bool { fn prng32(seed: &mut u32) -> u32 { *seed = 1664525 * *seed + 1013904223; *seed } fn prng16(seed: &mut u16) -> u16 { *seed = 25173 * *seed + 13849; *seed } - // Test data bus - test!((); for i in (0..0x100) { MEMORY[i] = 0xAAAAAAAA }); - test!((); for i in (0..0x100) { MEMORY[i] = 0x55555555 }); + for _ in 0..4 { + // Test data bus + test!((); for i in (0..0x100) { MEMORY[i] = 0xAAAAAAAA }); + test!((); for i in (0..0x100) { MEMORY[i] = 0x55555555 }); - // Test counter addressing with random data - test!(let mut seed = 0; - for i in (0..0x100000) { MEMORY[i] = prng32(&mut seed) }); - - // Test random addressing with counter data - test!(let mut seed = 0; - for i in (0..0x10000) { MEMORY[prng16(&mut seed)] = i }); + // Test counter addressing with random data + test!(let mut seed = 0; + for i in (0..0x100000) { MEMORY[i] = prng32(&mut seed) }); + // Test random addressing with counter data + test!(let mut seed = 0; + for i in (0..0x10000) { MEMORY[prng16(&mut seed)] = i }); + } *wrong == 0 }