Improved own addr test (#219)

* For 64-bit images, use the physical address as the test pattern in test 2.

This will make it easier to diagnose faults.

* Disable test 1 by default (issue #155).

Test 2 provides the same test coverage. Test 1 may make it slightly easier
to diagnose faults with a 32-bit image, so leave it as an option.

* For 32 bit images, use the physical address to generate the offset in test 2.

Detecting a stage change and using that to reset the offset counter
could fail when the config menu was used to skip to the next test
(issue #224).
This commit is contained in:
martinwhitaker 2023-01-04 22:26:22 +00:00 committed by GitHub
parent d0399fd287
commit 186ef6e913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 8 deletions

View File

@ -483,8 +483,9 @@ selected by the user.
### Test 2 : Address test, own address + window
Across all memory regions, each address is written with its own address plus
the window number and then each address is checked for consistency. This
Across all memory regions, each address is written with its own virtual
address plus the window number (for 32-bit images) or own physical address
(for 64-bit images) and then each address is checked for consistency. This
catches any errors in the high order address bits that would be missed when
testing each window in turn. This test is performed sequentially with each
available CPU, regardless of the CPU sequencing mode selected by the user.

View File

@ -16,6 +16,8 @@
#include <stdbool.h>
#include <stdint.h>
#include "vmem.h"
#include "display.h"
#include "error.h"
#include "test.h"
@ -127,12 +129,20 @@ int test_own_addr1(int my_cpu)
int test_own_addr2(int my_cpu, int stage)
{
static testword_t offset = 0;
static int last_stage = -1;
int ticks = 0;
offset = (stage == last_stage) ? offset + 1 : 1;
testword_t offset;
// Calculate the offset (in pages) between the virtual address and the physical address.
offset = (vm_map[0].pm_base_addr / VM_WINDOW_SIZE) * VM_WINDOW_SIZE;
offset = (offset >= VM_PINNED_SIZE) ? offset - VM_PINNED_SIZE : 0;
#ifdef __x86_64__
// Convert to a byte address offset. This will translate the virtual address into a physical address.
offset *= PAGE_SIZE;
#else
// Convert to a VM window offset. This will get added into the LSBs of the virtual address.
offset /= VM_WINDOW_SIZE;
#endif
switch (stage) {
case 0:
@ -145,6 +155,5 @@ int test_own_addr2(int my_cpu, int stage)
break;
}
last_stage = stage;
return ticks;
}

View File

@ -51,7 +51,7 @@
test_pattern_t test_list[NUM_TEST_PATTERNS] = {
// ena, cpu, stgs, itrs, errs, description
{ true, SEQ, 1, 6, 0, "[Address test, walking ones, no cache] "},
{ true, SEQ, 1, 6, 0, "[Address test, own address in window] "},
{false, SEQ, 1, 6, 0, "[Address test, own address in window] "},
{ true, SEQ, 2, 6, 0, "[Address test, own address + window] "},
{ true, PAR, 1, 6, 0, "[Moving inversions, 1s & 0s] "},
{ true, PAR, 1, 3, 0, "[Moving inversions, 8 bit pattern] "},