SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
memtester.c File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <log.h>
#include <mmu.h>
#include <common.h>
Include dependency graph for memtester.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  test
 

Macros

#define rand_ul()   rand32()
 
#define UL_ONEBITS   0xffffffff
 
#define UL_LEN   32
 
#define CHECKERBOARD1   0x55555555
 
#define CHECKERBOARD2   0xaaaaaaaa
 
#define UL_BYTE(x)   ((x | x << 8 | x << 16 | x << 24))
 
#define PROGRESSLEN   4
 
#define PROGRESSOFTEN   2500
 
#define ONE   0x00000001L
 

Typedefs

typedef unsigned int ul
 
typedef unsigned long long ull
 
typedef unsigned int volatile ulv
 
typedef unsigned char volatile u8v
 
typedef unsigned short volatile u16v
 

Functions

uint32_t rand32 ()
 
int compare_regions (ulv *bufa, ulv *bufb, size_t count)
 
int test_stuck_address (ulv *bufa, size_t count)
 
int test_random_value (ulv *bufa, ulv *bufb, size_t count)
 
int test_xor_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_sub_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_mul_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_div_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_or_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_and_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_seqinc_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_solidbits_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_checkerboard_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_blockseq_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_walkbits0_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_walkbits1_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_bitspread_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_bitflip_comparison (ulv *bufa, ulv *bufb, size_t count)
 
int test_8bit_wide_random (ulv *bufa, ulv *bufb, size_t count)
 
int test_16bit_wide_random (ulv *bufa, ulv *bufb, size_t count)
 
static int do_memtester (uint64_t start_addr, uint32_t dram_size, uint64_t test_size, uint32_t loops)
 

Variables

union { 
 
   unsigned char   bytes [UL_LEN/8] 
 
   ul   val 
 
mword8 
 
union { 
 
   unsigned short   u16s [UL_LEN/16] 
 
   ul   val 
 
mword16 
 
char progress [] = "-\\|/"
 
static struct test tests []
 

Macro Definition Documentation

◆ CHECKERBOARD1

#define CHECKERBOARD1   0x55555555

◆ CHECKERBOARD2

#define CHECKERBOARD2   0xaaaaaaaa

◆ ONE

#define ONE   0x00000001L

◆ PROGRESSLEN

#define PROGRESSLEN   4

◆ PROGRESSOFTEN

#define PROGRESSOFTEN   2500

◆ rand_ul

#define rand_ul ( )    rand32()

◆ UL_BYTE

#define UL_BYTE (   x)    ((x | x << 8 | x << 16 | x << 24))

◆ UL_LEN

#define UL_LEN   32

◆ UL_ONEBITS

#define UL_ONEBITS   0xffffffff

Typedef Documentation

◆ u16v

typedef unsigned short volatile u16v

◆ u8v

typedef unsigned char volatile u8v

◆ ul

typedef unsigned int ul

◆ ull

typedef unsigned long long ull

◆ ulv

typedef unsigned int volatile ulv

Function Documentation

◆ compare_regions()

int compare_regions ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ do_memtester()

static int do_memtester ( uint64_t  start_addr,
uint32_t  dram_size,
uint64_t  test_size,
uint32_t  loops 
)
static

◆ rand32()

uint32_t rand32 ( )

◆ test_16bit_wide_random()

int test_16bit_wide_random ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_8bit_wide_random()

int test_8bit_wide_random ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_and_comparison()

int test_and_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_bitflip_comparison()

int test_bitflip_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_bitspread_comparison()

int test_bitspread_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_blockseq_comparison()

int test_blockseq_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_checkerboard_comparison()

int test_checkerboard_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_div_comparison()

int test_div_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_mul_comparison()

int test_mul_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_or_comparison()

int test_or_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_random_value()

int test_random_value ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_seqinc_comparison()

int test_seqinc_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_solidbits_comparison()

int test_solidbits_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_stuck_address()

int test_stuck_address ( ulv bufa,
size_t  count 
)

◆ test_sub_comparison()

int test_sub_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_walkbits0_comparison()

int test_walkbits0_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_walkbits1_comparison()

int test_walkbits1_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

◆ test_xor_comparison()

int test_xor_comparison ( ulv bufa,
ulv bufb,
size_t  count 
)

Variable Documentation

◆ bytes

unsigned char bytes[UL_LEN/8]

◆ [union]

union { ... } mword16

◆ [union]

union { ... } mword8

◆ progress

char progress[] = "-\\|/"

◆ tests

struct test tests[]
static
Initial value:
= {{"Random Value", test_random_value},
{"Compare XOR", test_xor_comparison},
{"Compare SUB", test_sub_comparison},
{"Compare MUL", test_mul_comparison},
{"Compare DIV", test_div_comparison},
{"Compare OR", test_or_comparison},
{"Compare AND", test_and_comparison},
{"Sequential Increment", test_seqinc_comparison},
{"Solid Bits", test_solidbits_comparison},
{"Block Sequential", test_blockseq_comparison},
{"Checkerboard", test_checkerboard_comparison},
{"Bit Spread", test_bitspread_comparison},
{"Bit Flip", test_bitflip_comparison},
{"Walking Ones", test_walkbits1_comparison},
{"Walking Zeroes", test_walkbits0_comparison},
{"8-bit Writes", test_8bit_wide_random},
{"16-bit Writes", test_16bit_wide_random},
{NULL, NULL}}
int test_bitspread_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:346
int test_walkbits1_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:317
int test_solidbits_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:215
int test_or_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:179
int test_mul_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:150
int test_bitflip_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:376
int test_walkbits0_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:288
int test_seqinc_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:205
int test_and_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:192
int test_16bit_wide_random(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:437
int test_random_value(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:106
int test_checkerboard_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:240
int test_8bit_wide_random(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:404
int test_div_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:163
int test_xor_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:124
int test_sub_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:137
int test_blockseq_comparison(ulv *bufa, ulv *bufb, size_t count)
Definition memtester.c:265
#define NULL
Definition stddef.h:7

◆ u16s

unsigned short u16s[UL_LEN/16]

◆ val

ul val