3
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5
* See file CREDITS for list of people who contributed to this
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License as
10
* published by the Free Software Foundation; either version 2 of
11
* the License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28
* Integer compare instructions: cmpw, cmplw
30
* To verify these instructions the test runs them with
31
* different combinations of operands, reads the condition
32
* register value and compares it with the expected one.
33
* The test contains a pre-built table
34
* containing the description of each test case: the instruction,
35
* the values of the operands, the condition field to save
36
* the result in and the expected result.
42
#if CONFIG_POST & CONFIG_SYS_POST_CPU
44
extern void cpu_post_exec_12 (ulong *code, ulong *res, ulong op1, ulong op2);
46
static struct cpu_post_cmp_s
53
} cpu_post_cmp_table[] =
98
static unsigned int cpu_post_cmp_size =
99
sizeof (cpu_post_cmp_table) / sizeof (struct cpu_post_cmp_s);
101
int cpu_post_test_cmp (void)
105
int flag = disable_interrupts();
107
for (i = 0; i < cpu_post_cmp_size && ret == 0; i++)
109
struct cpu_post_cmp_s *test = cpu_post_cmp_table + i;
110
unsigned long code[] =
112
ASM_2C(test->cmd, test->cr, 3, 4),
118
cpu_post_exec_12 (code, & res, test->op1, test->op2);
120
ret = ((res >> (28 - 4 * test->cr)) & 0xe) == test->res ? 0 : -1;
124
post_log ("Error at cmp test %d !\n", i);