URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 409 to Rev 410
- ↔ Reverse comparison
Rev 409 → Rev 410
/trunk/or1ksim/testbench/mmu.c
0,0 → 1,191
/* This is MMU test for OpenRISC 1200 */ |
|
#include "spr_defs.h" |
#include "support.h" |
|
/* Define RAM physical location and size |
Bottom half will be used for this program, the rest |
will be used for testing */ |
#define RAM_START 0x40000000 |
#define RAM_SIZE 0x00200000 |
|
/* What is the last address in ram that is used by this program */ |
#define CODE_END_ADD (RAM_START + (RAM_SIZE / 2)) |
|
/* MMU page size */ |
#define PAGE_SIZE 4096 |
|
/* Number of DTLB sets used (power of 2, max is 256) */ |
#define DTLB_SETS 16 |
|
/* Number of DTLB ways (1, 2, 3 etc., max is 4). */ |
#define DTLB_WAYS 2 |
|
/* Number of ITLB sets used (power of 2, max is 256) */ |
#define ITLB_SETS 16 |
|
/* Number of ITLB ways (1, 2, 3 etc., max is 4). */ |
#define ITLB_WAYS 2 |
|
/* TLB mode codes */ |
#define TLB_CODE_ONE_TO_ONE 0x00000000 |
#define TLB_CODE_PLUS_ONE_PAGE 0x10000000 |
#define TLB_CODE_MINUS_ONE_PAGE 0x20000000 |
|
#define TLB_CODE_MASK 0xfffff000 |
#define TLB_PR_MASK 0x00000fff |
|
/* Extern functions */ |
extern void lo_dmmu_en (void); |
extern void lo_immu_en (void); |
|
/* Global variables */ |
extern unsigned long ram_end; |
|
/* DTLB mode status */ |
unsigned long dtlb_val; |
|
/* ITLB mode status */ |
unsigned long itlb_val; |
|
/*inline static |
unsigned int dtlb_write_entry (int way, int entry, unsigned int val) |
{ |
mtspr (SPR_DTLBMR_BASE(way) + entry, val); |
} |
*/ |
|
/* DTLB miss exception handler */ |
void dtlb_miss_handler (void) |
{ |
unsigned long ea, ta, tlbtr; |
int set, way = 0; |
int i; |
|
/* Get EA that cause the exception */ |
ea = mfspr (SPR_EEAR_BASE); |
printf("ea = %.8lx\n", ea); |
/* Find TLB set and LRU way */ |
set = (ea / PAGE_SIZE) % DTLB_SETS; |
for (i = 0; i < DTLB_WAYS; i++) { |
if ((mfspr (SPR_DTLBMR_BASE(i) + set) & SPR_DTLBMR_LRU) == 0) { |
way = i; |
break; |
} |
} |
|
printf("set = %.8lx\n", set); |
if (RAM_START < ea < CODE_END_ADD) { |
|
printf("RAM_START< ea < CODE_END_ADD\n", ea); |
/* If this is acces to data of this program set one to one translation */ |
mtspr (SPR_DTLBMR_BASE(way) + set, (ea & SPR_DTLBMR_VPN) | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(way) + set, (ea & SPR_DTLBTR_PPN) | SPR_DTLBTR_CI | SPR_DTLBTR_URE | SPR_DTLBTR_UWE | SPR_DTLBTR_SRE | SPR_DTLBTR_SWE); |
return; |
} |
|
/* Whatever access is in progress, translated address have to point to physical RAM */ |
ta = (ea & ((RAM_SIZE/2) - 1)) + RAM_START; |
|
/* Set appropriate TLB entry */ |
switch (dtlb_val & TLB_CODE_MASK) { |
case TLB_CODE_ONE_TO_ONE: |
tlbtr = (ta & SPR_DTLBTR_PPN) | (dtlb_val | TLB_PR_MASK); |
break; |
case TLB_CODE_PLUS_ONE_PAGE: |
if ((ta + PAGE_SIZE) >= (RAM_START + RAM_SIZE)) |
/* Wrapp last page */ |
tlbtr = (((ta & ((RAM_SIZE/2) - 1)) + RAM_START + (RAM_SIZE/2)) & SPR_DTLBTR_PPN) | (dtlb_val | TLB_PR_MASK); |
else |
tlbtr = ((ta + PAGE_SIZE) & SPR_DTLBTR_PPN) | (dtlb_val | TLB_PR_MASK); |
break; |
case TLB_CODE_MINUS_ONE_PAGE: |
if ((ta - PAGE_SIZE) < (RAM_START + (RAM_SIZE/2))) |
/* Wrapp first page */ |
tlbtr = ((ta - PAGE_SIZE + (RAM_SIZE/2)) & SPR_DTLBTR_PPN) | (dtlb_val | TLB_PR_MASK); |
else |
tlbtr = ((ta - PAGE_SIZE) & SPR_DTLBTR_PPN) | (dtlb_val | TLB_PR_MASK); |
break; |
} |
|
/* Set DTLB entry */ |
mtspr (SPR_DTLBMR_BASE(way) + set, (ea & SPR_DTLBMR_VPN) | SPR_DTLBMR_V); |
mtspr (SPR_DTLBTR_BASE(way) + set, tlbtr); |
} |
|
|
/* ITLB miss exception handler */ |
void itlb_miss_handler (void) |
{ |
|
|
} |
|
/* Invalidate all entries in DTLB and enable DMMU */ |
void dmmu_enable (void) |
{ |
int i, j; |
|
/* Invalidate all entries in DTLB */ |
for (i = 0; i < DTLB_WAYS; i++) { |
for (j = 0; j < DTLB_SETS; j++) { |
mtspr (SPR_DTLBMR_BASE(i) + j, 0); |
mtspr (SPR_DTLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Register DTLB miss handler */ |
excpt_dtlbmiss = (unsigned long)dtlb_miss_handler; |
|
/* Enable DMMU */ |
lo_dmmu_en (); |
} |
|
/* Invalidate all entries in ITLB and enable IMMU */ |
void immu_enable (void) |
{ |
int i, j; |
|
/* Invalidate all entries in ITLB */ |
for (i = 0; i < ITLB_WAYS; i++) { |
for (j = 0; j < ITLB_SETS; i++) { |
mtspr (SPR_ITLBMR_BASE(i) + j, 0); |
mtspr (SPR_ITLBTR_BASE(i) + j, 0); |
} |
} |
|
/* Register ITLB miss handler */ |
excpt_itlbmiss = (unsigned long)itlb_miss_handler; |
|
/* Enable IMMU */ |
lo_immu_en (); |
} |
|
void write_pattern(unsigned long start, unsigned long end) |
{ |
unsigned long add; |
|
add = start; |
while (add < end) { |
REG32(add) = add; |
add += PAGE_SIZE; |
} |
|
} |
|
int main (void) |
{ |
|
dtlb_val = SPR_DTLBTR_CI | SPR_DTLBTR_URE | SPR_DTLBTR_UWE | SPR_DTLBTR_SRE | SPR_DTLBTR_SWE; |
/* Enable DMMU */ |
dmmu_enable(); |
|
/* Write pattern */ |
write_pattern(0x40000000, 0x40100000); |
|
/* Enable IMMU */ |
// immu_enable(); |
|
exit(0); |
return 0; |
} |
/trunk/or1ksim/testbench/xess.ld
1,31 → 1,35
MEMORY |
{ |
reset : ORIGIN = 0x00000100, LENGTH = 0x00001f00 |
ram : ORIGIN = 0x80000000, LENGTH = 0x00200000 |
except : ORIGIN = 0x00000000, LENGTH = 0x00002000 |
flash : ORIGIN = 0x00002000, LENGTH = 0x001fe000 |
ram : ORIGIN = 0x40000000, LENGTH = 0x00200000 |
} |
|
SECTIONS |
{ |
.reset : |
AT ( 0x00000100 ) |
.except : |
{ |
*(.reset) |
_src_beg = .; |
} > reset |
.text : |
AT ( ADDR (.reset) + SIZEOF (.reset) ) |
*(.except) |
} > except |
.text : |
{ |
_dst_beg = .; |
*(.text) |
} > ram |
.data : |
AT ( ADDR (.reset) + SIZEOF (.reset) + SIZEOF (.text)) |
_src_beg = .; |
} > flash |
.data : |
AT ( ADDR (.text) + SIZEOF (.text) ) |
{ |
_dst_beg = .; |
*(.data) |
_dst_end = .; |
_dst_end = .; |
} > ram |
.bss : |
.bss : |
{ |
*(.bss) |
} > reset |
} > ram |
.stack : |
{ |
*(.stack) |
_ram_end = .; |
} > ram |
} |
/trunk/or1ksim/testbench/configure
37,6 → 37,8
ac_help= |
ac_default_prefix=/usr/local |
# Any additions from configure.in: |
ac_help="$ac_help |
--enable-copysec generate section copy code" |
|
# Initialize some variables set by options. |
# The variables have the same names as the options, with |
573,7 → 575,7
fi |
|
echo $ac_n "checking host system type""... $ac_c" 1>&6 |
echo "configure:577: checking host system type" >&5 |
echo "configure:579: checking host system type" >&5 |
|
host_alias=$host |
case "$host_alias" in |
605,7 → 607,7
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" |
# ./install, which can be erroneously created by make from ./install.sh. |
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 |
echo "configure:609: checking for a BSD compatible install" >&5 |
echo "configure:611: checking for a BSD compatible install" >&5 |
if test -z "$INSTALL"; then |
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
658,7 → 660,7
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' |
|
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 |
echo "configure:662: checking whether build environment is sane" >&5 |
echo "configure:664: checking whether build environment is sane" >&5 |
# Just in case |
sleep 1 |
echo timestamp > conftestfile |
715,7 → 717,7
test "$program_transform_name" = "" && program_transform_name="s,x,x," |
|
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 |
echo "configure:719: checking whether ${MAKE-make} sets \${MAKE}" >&5 |
echo "configure:721: checking whether ${MAKE-make} sets \${MAKE}" >&5 |
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` |
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
761,7 → 763,7
|
missing_dir=`cd $ac_aux_dir && pwd` |
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 |
echo "configure:765: checking for working aclocal" >&5 |
echo "configure:767: checking for working aclocal" >&5 |
# Run test in a subshell; some versions of sh will print an error if |
# an executable is not found, even if stderr is redirected. |
# Redirect stdin to placate older versions of autoconf. Sigh. |
774,7 → 776,7
fi |
|
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 |
echo "configure:778: checking for working autoconf" >&5 |
echo "configure:780: checking for working autoconf" >&5 |
# Run test in a subshell; some versions of sh will print an error if |
# an executable is not found, even if stderr is redirected. |
# Redirect stdin to placate older versions of autoconf. Sigh. |
787,7 → 789,7
fi |
|
echo $ac_n "checking for working automake""... $ac_c" 1>&6 |
echo "configure:791: checking for working automake" >&5 |
echo "configure:793: checking for working automake" >&5 |
# Run test in a subshell; some versions of sh will print an error if |
# an executable is not found, even if stderr is redirected. |
# Redirect stdin to placate older versions of autoconf. Sigh. |
800,7 → 802,7
fi |
|
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 |
echo "configure:804: checking for working autoheader" >&5 |
echo "configure:806: checking for working autoheader" >&5 |
# Run test in a subshell; some versions of sh will print an error if |
# an executable is not found, even if stderr is redirected. |
# Redirect stdin to placate older versions of autoconf. Sigh. |
813,7 → 815,7
fi |
|
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 |
echo "configure:817: checking for working makeinfo" >&5 |
echo "configure:819: checking for working makeinfo" >&5 |
# Run test in a subshell; some versions of sh will print an error if |
# an executable is not found, even if stderr is redirected. |
# Redirect stdin to placate older versions of autoconf. Sigh. |
828,7 → 830,7
|
|
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 |
echo "configure:832: checking whether ${MAKE-make} sets \${MAKE}" >&5 |
echo "configure:834: checking whether ${MAKE-make} sets \${MAKE}" >&5 |
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` |
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
866,7 → 868,7
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" |
# ./install, which can be erroneously created by make from ./install.sh. |
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 |
echo "configure:870: checking for a BSD compatible install" >&5 |
echo "configure:872: checking for a BSD compatible install" >&5 |
if test -z "$INSTALL"; then |
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
919,7 → 921,7
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' |
|
echo $ac_n "checking build system type""... $ac_c" 1>&6 |
echo "configure:923: checking build system type" >&5 |
echo "configure:925: checking build system type" >&5 |
|
build_alias=$build |
case "$build_alias" in |
945,7 → 947,7
# Extract the first word of "${ac_tool_prefix}$target-gcc", so it can be a program name with args. |
set dummy ${ac_tool_prefix}$target-gcc; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:949: checking for $ac_word" >&5 |
echo "configure:951: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
977,7 → 979,7
# Extract the first word of "$target-gcc", so it can be a program name with args. |
set dummy $target-gcc; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:981: checking for $ac_word" >&5 |
echo "configure:983: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1012,7 → 1014,7
# Extract the first word of "${ac_tool_prefix}$target-ranlib", so it can be a program name with args. |
set dummy ${ac_tool_prefix}$target-ranlib; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1016: checking for $ac_word" >&5 |
echo "configure:1018: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1044,7 → 1046,7
# Extract the first word of "$target-ranlib", so it can be a program name with args. |
set dummy $target-ranlib; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1048: checking for $ac_word" >&5 |
echo "configure:1050: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1079,7 → 1081,7
# Extract the first word of "${ac_tool_prefix}$target-ld", so it can be a program name with args. |
set dummy ${ac_tool_prefix}$target-ld; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1083: checking for $ac_word" >&5 |
echo "configure:1085: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1111,7 → 1113,7
# Extract the first word of "$target-ld", so it can be a program name with args. |
set dummy $target-ld; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1115: checking for $ac_word" >&5 |
echo "configure:1117: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1146,7 → 1148,7
# Extract the first word of "${ac_tool_prefix}$target-sim", so it can be a program name with args. |
set dummy ${ac_tool_prefix}$target-sim; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1150: checking for $ac_word" >&5 |
echo "configure:1152: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_SIM'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1178,7 → 1180,7
# Extract the first word of "$target-sim", so it can be a program name with args. |
set dummy $target-sim; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1182: checking for $ac_word" >&5 |
echo "configure:1184: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_SIM'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1213,7 → 1215,7
# Extract the first word of "gcc", so it can be a program name with args. |
set dummy gcc; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1217: checking for $ac_word" >&5 |
echo "configure:1219: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1243,7 → 1245,7
# Extract the first word of "cc", so it can be a program name with args. |
set dummy cc; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1247: checking for $ac_word" >&5 |
echo "configure:1249: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1294,7 → 1296,7
# Extract the first word of "cl", so it can be a program name with args. |
set dummy cl; ac_word=$2 |
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
echo "configure:1298: checking for $ac_word" >&5 |
echo "configure:1300: checking for $ac_word" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1326,7 → 1328,7
fi |
|
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 |
echo "configure:1330: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 |
echo "configure:1332: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 |
|
ac_ext=c |
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. |
1337,12 → 1339,12
|
cat > conftest.$ac_ext << EOF |
|
#line 1341 "configure" |
#line 1343 "configure" |
#include "confdefs.h" |
|
main(){return(0);} |
EOF |
if { (eval echo configure:1346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
if { (eval echo configure:1348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
ac_cv_prog_cc_works=yes |
# If we can't run a trivial program, we are probably using a cross compiler. |
if (./conftest; exit) 2>/dev/null; then |
1368,12 → 1370,12
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } |
fi |
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 |
echo "configure:1372: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 |
echo "configure:1374: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 |
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 |
cross_compiling=$ac_cv_prog_cc_cross |
|
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 |
echo "configure:1377: checking whether we are using GNU C" >&5 |
echo "configure:1379: checking whether we are using GNU C" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1382,7 → 1384,7
yes; |
#endif |
EOF |
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then |
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1388: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then |
ac_cv_prog_gcc=yes |
else |
ac_cv_prog_gcc=no |
1401,7 → 1403,7
ac_save_CFLAGS="$CFLAGS" |
CFLAGS= |
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 |
echo "configure:1405: checking whether ${CC-cc} accepts -g" >&5 |
echo "configure:1407: checking whether ${CC-cc} accepts -g" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1433,7 → 1435,7
fi |
|
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 |
echo "configure:1437: checking for POSIXized ISC" >&5 |
echo "configure:1439: checking for POSIXized ISC" >&5 |
if test -d /etc/conf/kconfig.d && |
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 |
then |
1454,7 → 1456,7
fi |
|
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 |
echo "configure:1458: checking how to run the C preprocessor" >&5 |
echo "configure:1460: checking how to run the C preprocessor" >&5 |
# On Suns, sometimes $CPP names a directory. |
if test -n "$CPP" && test -d "$CPP"; then |
CPP= |
1469,13 → 1471,13
# On the NeXT, cc -E runs the code through the compiler's parser, |
# not just through cpp. |
cat > conftest.$ac_ext <<EOF |
#line 1473 "configure" |
#line 1475 "configure" |
#include "confdefs.h" |
#include <assert.h> |
Syntax Error |
EOF |
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
{ (eval echo configure:1479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
{ (eval echo configure:1481: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
if test -z "$ac_err"; then |
: |
1486,13 → 1488,13
rm -rf conftest* |
CPP="${CC-cc} -E -traditional-cpp" |
cat > conftest.$ac_ext <<EOF |
#line 1490 "configure" |
#line 1492 "configure" |
#include "confdefs.h" |
#include <assert.h> |
Syntax Error |
EOF |
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
{ (eval echo configure:1496: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
{ (eval echo configure:1498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
if test -z "$ac_err"; then |
: |
1503,13 → 1505,13
rm -rf conftest* |
CPP="${CC-cc} -nologo -E" |
cat > conftest.$ac_ext <<EOF |
#line 1507 "configure" |
#line 1509 "configure" |
#include "confdefs.h" |
#include <assert.h> |
Syntax Error |
EOF |
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
{ (eval echo configure:1513: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
{ (eval echo configure:1515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
if test -z "$ac_err"; then |
: |
1534,12 → 1536,12
echo "$ac_t""$CPP" 1>&6 |
|
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 |
echo "configure:1538: checking for ANSI C header files" >&5 |
echo "configure:1540: checking for ANSI C header files" >&5 |
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
cat > conftest.$ac_ext <<EOF |
#line 1543 "configure" |
#line 1545 "configure" |
#include "confdefs.h" |
#include <stdlib.h> |
#include <stdarg.h> |
1547,7 → 1549,7
#include <float.h> |
EOF |
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
{ (eval echo configure:1551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
{ (eval echo configure:1553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
if test -z "$ac_err"; then |
rm -rf conftest* |
1564,7 → 1566,7
if test $ac_cv_header_stdc = yes; then |
# SunOS 4.x string.h does not declare mem*, contrary to ANSI. |
cat > conftest.$ac_ext <<EOF |
#line 1568 "configure" |
#line 1570 "configure" |
#include "confdefs.h" |
#include <string.h> |
EOF |
1582,7 → 1584,7
if test $ac_cv_header_stdc = yes; then |
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. |
cat > conftest.$ac_ext <<EOF |
#line 1586 "configure" |
#line 1588 "configure" |
#include "confdefs.h" |
#include <stdlib.h> |
EOF |
1603,7 → 1605,7
: |
else |
cat > conftest.$ac_ext <<EOF |
#line 1607 "configure" |
#line 1609 "configure" |
#include "confdefs.h" |
#include <ctype.h> |
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') |
1614,7 → 1616,7
exit (0); } |
|
EOF |
if { (eval echo configure:1618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null |
if { (eval echo configure:1620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null |
then |
: |
else |
1643,13 → 1645,13
|
if test $ac_cv_prog_gcc = yes; then |
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 |
echo "configure:1647: checking whether ${CC-cc} needs -traditional" >&5 |
echo "configure:1649: checking whether ${CC-cc} needs -traditional" >&5 |
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
ac_pattern="Autoconf.*'x'" |
cat > conftest.$ac_ext <<EOF |
#line 1653 "configure" |
#line 1655 "configure" |
#include "confdefs.h" |
#include <sgtty.h> |
Autoconf TIOCGETP |
1667,7 → 1669,7
|
if test $ac_cv_prog_gcc_traditional = no; then |
cat > conftest.$ac_ext <<EOF |
#line 1671 "configure" |
#line 1673 "configure" |
#include "confdefs.h" |
#include <termio.h> |
Autoconf TCGETA |
1713,18 → 1715,35
OR1K_EXCEPT_TRUE='#' |
OR1K_EXCEPT_FALSE= |
fi |
CFLAGS="$CFLAGS -Wall" |
|
copysec= |
echo $ac_n "checking whether to enable section copying""... $ac_c" 1>&6 |
echo "configure:1722: checking whether to enable section copying" >&5 |
# Check whether --enable-copysec or --disable-copysec was given. |
if test "${enable_copysec+set}" = set; then |
enableval="$enable_copysec" |
|
case "$enableval" in |
yes) copysec="-DCOPY_SECTIONS" ;; |
esac |
|
fi |
|
echo "$ac_t""${enable_copysec-no}" 1>&6 |
|
|
CFLAGS="$CFLAGS -Wall $copysec" |
|
|
INCLUDES="-I\${top_srcdir}/support" |
|
echo $ac_n "checking for working const""... $ac_c" 1>&6 |
echo "configure:1723: checking for working const" >&5 |
echo "configure:1742: checking for working const" >&5 |
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
cat > conftest.$ac_ext <<EOF |
#line 1728 "configure" |
#line 1747 "configure" |
#include "confdefs.h" |
|
int main() { |
1773,7 → 1792,7
|
; return 0; } |
EOF |
if { (eval echo configure:1777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then |
if { (eval echo configure:1796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then |
rm -rf conftest* |
ac_cv_c_const=yes |
else |
1794,7 → 1813,7
fi |
|
echo $ac_n "checking for inline""... $ac_c" 1>&6 |
echo "configure:1798: checking for inline" >&5 |
echo "configure:1817: checking for inline" >&5 |
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then |
echo $ac_n "(cached) $ac_c" 1>&6 |
else |
1801,7 → 1820,7
ac_cv_c_inline=no |
for ac_kw in inline __inline__ __inline; do |
cat > conftest.$ac_ext <<EOF |
#line 1805 "configure" |
#line 1824 "configure" |
#include "confdefs.h" |
|
int main() { |
1808,7 → 1827,7
} $ac_kw foo() { |
; return 0; } |
EOF |
if { (eval echo configure:1812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then |
if { (eval echo configure:1831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then |
rm -rf conftest* |
ac_cv_c_inline=$ac_kw; break |
else |
/trunk/or1ksim/testbench/Makefile.in
93,8 → 93,8
TESTS_ENV = @TESTS_ENV@ |
VERSION = @VERSION@ |
|
OR1K_TESTS = basic cache excpt cfg dmatest eth mmu # pic |
IND_TESTS = exit cbasic local_global mul mycompress dhry functest |
OR1K_TESTS = basic cache excpt cfg dmatest eth # pic |
ACV_TESTS = acv_uart |
# Subdirectory tests |
SUB_TESTS = |
138,6 → 138,9
@OR1K_EXCEPT_FALSE@eth_SOURCES = |
@OR1K_EXCEPT_TRUE@acv_uart_SOURCES = $(OR1K_SUPPORT_S) support.h acv_uart.c |
@OR1K_EXCEPT_FALSE@acv_uart_SOURCES = |
@OR1K_EXCEPT_TRUE@mmu_SOURCES = $(OR1K_SUPPORT_S) support.h mmu.c mmu_asm.S -DCOPY_SECTIONS |
@OR1K_EXCEPT_FALSE@mmu_SOURCES = |
@OR1K_EXCEPT_TRUE@mmu_LDFLAGS = -Txess.ld |
@OR1K_EXCEPT_TRUE@SUBDIRS = support $(SUB_TESTS) $(OR1K_SUB_TESTS) |
@OR1K_EXCEPT_FALSE@SUBDIRS = support $(SUB_TESTS) |
@OR1K_EXCEPT_TRUE@OR1K_SUPPORT_S = except.S |
214,6 → 217,10
eth_LDADD = $(LDADD) |
eth_DEPENDENCIES = support/libsupport.a |
eth_LDFLAGS = |
@OR1K_EXCEPT_TRUE@mmu_OBJECTS = except.o mmu.o mmu_asm.o |
@OR1K_EXCEPT_FALSE@mmu_OBJECTS = |
mmu_LDADD = $(LDADD) |
mmu_DEPENDENCIES = support/libsupport.a |
@OR1K_EXCEPT_TRUE@acv_uart_OBJECTS = except.o acv_uart.o |
@OR1K_EXCEPT_FALSE@acv_uart_OBJECTS = |
acv_uart_LDADD = $(LDADD) |
233,10 → 240,10
DIST_SUBDIRS = support uos support |
DEP_FILES = .deps/acv_uart.P .deps/basic.P .deps/cache.P .deps/cbasic.P \ |
.deps/cfg.P .deps/dhry.P .deps/dmatest.P .deps/eth.P .deps/except.P \ |
.deps/excpt.P .deps/exit.P .deps/functest.P .deps/local_global.P \ |
.deps/mul.P .deps/mycompress.P |
SOURCES = $(exit_SOURCES) $(cbasic_SOURCES) $(local_global_SOURCES) $(mul_SOURCES) $(mycompress_SOURCES) $(dhry_SOURCES) $(functest_SOURCES) $(basic_SOURCES) $(cache_SOURCES) $(excpt_SOURCES) $(cfg_SOURCES) $(dmatest_SOURCES) $(eth_SOURCES) $(acv_uart_SOURCES) |
OBJECTS = $(exit_OBJECTS) $(cbasic_OBJECTS) $(local_global_OBJECTS) $(mul_OBJECTS) $(mycompress_OBJECTS) $(dhry_OBJECTS) $(functest_OBJECTS) $(basic_OBJECTS) $(cache_OBJECTS) $(excpt_OBJECTS) $(cfg_OBJECTS) $(dmatest_OBJECTS) $(eth_OBJECTS) $(acv_uart_OBJECTS) |
.deps/excpt.P .deps/exit.P .deps/local_global.P .deps/mmu.P \ |
.deps/mmu_asm.P .deps/mul.P .deps/mycompress.P |
SOURCES = $(exit_SOURCES) $(cbasic_SOURCES) $(local_global_SOURCES) $(mul_SOURCES) $(mycompress_SOURCES) $(dhry_SOURCES) $(basic_SOURCES) $(cache_SOURCES) $(excpt_SOURCES) $(cfg_SOURCES) $(dmatest_SOURCES) $(eth_SOURCES) $(mmu_SOURCES) $(acv_uart_SOURCES) |
OBJECTS = $(exit_OBJECTS) $(cbasic_OBJECTS) $(local_global_OBJECTS) $(mul_OBJECTS) $(mycompress_OBJECTS) $(dhry_OBJECTS) $(basic_OBJECTS) $(cache_OBJECTS) $(excpt_OBJECTS) $(cfg_OBJECTS) $(dmatest_OBJECTS) $(eth_OBJECTS) $(mmu_OBJECTS) $(acv_uart_OBJECTS) |
|
all: all-redirect |
.SUFFIXES: |
349,6 → 356,10
@rm -f eth |
$(LINK) $(eth_LDFLAGS) $(eth_OBJECTS) $(eth_LDADD) $(LIBS) |
|
mmu: $(mmu_OBJECTS) $(mmu_DEPENDENCIES) |
@rm -f mmu |
$(LINK) $(mmu_LDFLAGS) $(mmu_OBJECTS) $(mmu_LDADD) $(LIBS) |
|
acv_uart: $(acv_uart_OBJECTS) $(acv_uart_DEPENDENCIES) |
@rm -f acv_uart |
$(LINK) $(acv_uart_LDFLAGS) $(acv_uart_OBJECTS) $(acv_uart_LDADD) $(LIBS) |
/trunk/or1ksim/testbench/except.S
1,5 → 1,10
/* Support file for c based tests */ |
#include "spr_defs.h" |
|
.section .stack |
.space 0x1000 |
_stack: |
|
.section .except |
.extern _reset_support |
.extern _c_reset |
22,11 → 27,40
_reset_vector: |
l.nop |
l.nop |
l.movhi r1,hi(0x40007f00) |
l.ori r1,r1,lo(0x40007f00) |
l.jal _reset |
l.movhi r1,hi(_stack) |
l.ori r1,r1,lo(_stack) |
|
.if COPY_SECTIONS |
|
l.movhi r3,hi(_src_beg) |
l.ori r3,r3,lo(_src_beg) |
l.movhi r4,hi(_dst_beg) |
l.ori r4,r4,lo(_dst_beg) |
l.sfeq r3,r4 |
l.bf 2f |
l.movhi r5,hi(_dst_end) |
l.ori r5,r5,lo(_dst_end) |
l.sub r5,r5,r4 |
l.sfeqi r5,0 |
l.bf 2f |
l.nop |
1: l.lwz r6,0(r3) |
l.sw 0(r4),r6 |
l.addi r3,r3,4 |
l.addi r4,r4,4 |
l.addi r5,r5,-4 |
l.sfgtsi r5,0 |
l.bf 1b |
l.nop |
|
2: |
.endif |
|
l.movhi r2,hi(_reset) |
l.ori r2,r2,lo(_reset) |
l.jr r2 |
l.nop |
|
.org 0x200 |
_buserr_vector: |
l.addi r1,r1,-116 |
34,7 → 68,7
l.jal store_regs |
l.nop |
l.movhi r9,hi(end_except) |
l.ori r9,r0,lo(end_except) |
l.ori r9,r9,lo(end_except) |
l.movhi r10,hi(_excpt_buserr) |
l.ori r10,r10,lo(_excpt_buserr) |
l.lwz r10,0x0(r10) |
48,7 → 82,7
l.jal store_regs |
l.nop |
l.movhi r9,hi(end_except) |
l.ori r9,r0,lo(end_except) |
l.ori r9,r9,lo(end_except) |
l.movhi r10,hi(_excpt_dpfault) |
l.ori r10,r10,lo(_excpt_dpfault) |
l.lwz r10,0(r10) |
62,7 → 96,7
l.jal store_regs |
l.nop |
l.movhi r9,hi(end_except) |
l.ori r9,r0,lo(end_except) |
l.ori r9,r9,lo(end_except) |
l.movhi r10,hi(_excpt_ipfault) |
l.ori r10,r10,lo(_excpt_ipfault) |
l.lwz r10,0(r10) |
131,6 → 165,11
l.sw 0x18(r1),r9 |
l.jal store_regs |
l.nop |
|
l.mfspr r3,r0,SPR_EPCR_BASE |
l.addi r3,r3,-4 |
l.mtspr r0,r3,SPR_EPCR_BASE |
|
l.movhi r9,hi(end_except) |
l.ori r9,r9,lo(end_except) |
l.movhi r10,hi(_excpt_dtlbmiss) |
/trunk/or1ksim/testbench/mmu_asm.S
0,0 → 1,23
#include "spr_defs.h" |
|
.global _lo_dmmu_en |
.global _lo_immu_en |
|
_lo_dmmu_en: |
l.mfspr r3,r0,SPR_SR |
l.ori r3,r3,SPR_SR_EXR |
l.ori r3,r3,SPR_SR_DME |
l.mtspr r0,r3,SPR_ESR_BASE |
l.mtspr r0,r9,SPR_EPCR_BASE |
l.rfe |
l.nop |
|
_lo_immu_en: |
l.mfspr r3,r0,SPR_SR |
l.ori r3,r3,SPR_SR_EXR |
l.ori r3,r3,SPR_SR_DME |
l.mtspr r0,r3,SPR_ESR_BASE |
l.mtspr r0,r9,SPR_EPCR_BASE |
l.rfe |
l.nop |
|
/trunk/or1ksim/testbench/except.ld
13,13 → 13,20
.text : |
{ |
*(.text) |
_src_beg = .; |
} > ram |
.data : |
{ |
_dst_beg = .; |
*(.data) |
_dst_end = .; |
} > ram |
.bss : |
{ |
*(.bss) |
} > ram |
.stack : |
{ |
*(.stack) |
} > ram |
} |
/trunk/or1ksim/testbench/configure.in
62,8 → 62,20
esac |
echo $TESTS_ENV |
AM_CONDITIONAL(OR1K_EXCEPT, test x$COMPILE = xor1k) |
CFLAGS="$CFLAGS -Wall" |
|
copysec= |
AC_MSG_CHECKING(whether to enable section copying) |
AC_ARG_ENABLE(copysec, |
[ --enable-copysec generate section copy code], [ |
case "$enableval" in |
yes) copysec="-DCOPY_SECTIONS" ;; |
esac |
]) |
AC_MSG_RESULT(${enable_copysec-no}) |
|
|
CFLAGS="$CFLAGS -Wall $copysec" |
|
AC_SUBST(INCLUDES) |
INCLUDES="-I\${top_srcdir}/support" |
|
/trunk/or1ksim/testbench/Makefile.am
21,8 → 21,8
|
################### Tests ##################### |
# tests in this directory |
OR1K_TESTS = basic cache excpt cfg dmatest eth mmu # pic |
IND_TESTS = exit cbasic local_global mul mycompress dhry functest |
OR1K_TESTS = basic cache excpt cfg dmatest eth # pic |
ACV_TESTS = acv_uart |
# Subdirectory tests |
SUB_TESTS = |
60,6 → 60,8
dmatest_SOURCES = $(OR1K_SUPPORT_S) support.h dmatest.c |
eth_SOURCES = $(OR1K_SUPPORT_S) support.h eth.c |
acv_uart_SOURCES = $(OR1K_SUPPORT_S) support.h acv_uart.c |
mmu_SOURCES = $(OR1K_SUPPORT_S) support.h mmu.c mmu_asm.S -DCOPY_SECTIONS |
mmu_LDFLAGS = -Txess.ld |
################################################ |
|
else |
73,6 → 75,7
dmatest_SOURCES = |
eth_SOURCES = |
acv_uart_SOURCES = |
mmu_SOURCES = |
############################################### |
|
endif |
/trunk/or1ksim/testbench/support/support.h
12,6 → 12,11
#if OR1K |
#include <_ansi.h> |
|
/* Register access macros */ |
#define REG8(add) *((volatile unsigned char *)(add)) |
#define REG16(add) *((volatile unsigned short *)(add)) |
#define REG32(add) *((volatile unsigned long *)(add)) |
|
void printf(const char *fmt, ...); |
|
/* For writing into SPR. */ |