summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Gaisler <jiri@gaisler.se>2019-05-28 00:02:40 +0200
committerJiri Gaisler <jiri@gaisler.se>2019-05-28 00:09:27 +0200
commit9277f1913aa341efbf6d111ec25e1dc863158cf5 (patch)
tree71fd2e77837ad5cd15d732ec208bfeca990ed275
parentAdd emulated L1 cache to SMP configurations (diff)
downloadsis-9277f1913aa341efbf6d111ec25e1dc863158cf5.tar.bz2
Made L1 cache optional through --enable-l1cache
* Removed stale config.h * Updated autoconf script with relevant checks * Re-implemented leon3/grlib timer with less events * Bumped version to 2.15
-rw-r--r--Makefile.in2
-rw-r--r--README3
-rw-r--r--config.h252
-rw-r--r--config.h.in21
-rwxr-xr-xconfigure261
-rw-r--r--configure.ac10
-rw-r--r--exec.c5
-rw-r--r--func.c32
-rw-r--r--leon3.c93
-rw-r--r--riscv.c21
-rw-r--r--sis.c4
-rw-r--r--sis.h4
-rw-r--r--sis.info4
-rw-r--r--sparc.c24
-rw-r--r--version.texi4
15 files changed, 434 insertions, 306 deletions
diff --git a/Makefile.in b/Makefile.in
index 61c5c15..dec5550 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -50,7 +50,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = sis$(EXEEXT)
subdir = .
-DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/stamp-vti $(srcdir)/version.texi \
$(top_srcdir)/build-aux/depcomp \
diff --git a/README b/README
index 5bfad59..f53217b 100644
--- a/README
+++ b/README
@@ -14,3 +14,6 @@ To build a PDF version of the manual, do
make sis.pdf.
+
+To enable emulation of an L1 cache, run configure with --enable-l1cache. This option
+only improves timing accuracy, it does not affect simulation behaviour.
diff --git a/config.h b/config.h
deleted file mode 100644
index 1edad07..0000000
--- a/config.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/* config.h. Generated from config.in by configure. */
-/* config.in. Generated from configure.ac by autoheader. */
-
-/* Define if building universal (internal helper macro) */
-/* #undef AC_APPLE_UNIVERSAL_BUILD */
-
-/* Sim debug setting */
-/* #undef DEBUG */
-
-/* Define to 1 if translation of program messages to the user's native
- language is requested. */
-#define ENABLE_NLS 1
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the <errno.h> header file. */
-#define HAVE_ERRNO_H 1
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define to 1 if you have the <fpu_control.h> header file. */
-#define HAVE_FPU_CONTROL_H 1
-
-/* Define to 1 if you have the `ftruncate' function. */
-#define HAVE_FTRUNCATE 1
-
-/* Define to 1 if you have the `getrusage' function. */
-#define HAVE_GETRUSAGE 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the `nsl' library (-lnsl). */
-#define HAVE_LIBNSL 1
-
-/* Define to 1 if you have the `socket' library (-lsocket). */
-/* #undef HAVE_LIBSOCKET */
-
-/* Define to 1 if you have the `lstat' function. */
-#define HAVE_LSTAT 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `mmap' function. */
-#define HAVE_MMAP 1
-
-/* Define to 1 if you have the `munmap' function. */
-#define HAVE_MUNMAP 1
-
-/* Define to 1 if you have the `posix_fallocate' function. */
-#define HAVE_POSIX_FALLOCATE 1
-
-/* Define to 1 if you have the `sigaction' function. */
-#define HAVE_SIGACTION 1
-
-/* Define to 1 if the system has the type `socklen_t'. */
-#define HAVE_SOCKLEN_T 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if `struct stat' is a member of `st_atime'. */
-#define HAVE_STRUCT_STAT_ST_ATIME 1
-
-/* Define to 1 if `struct stat' is a member of `st_blksize'. */
-#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
-
-/* Define to 1 if `struct stat' is a member of `st_blocks'. */
-#define HAVE_STRUCT_STAT_ST_BLOCKS 1
-
-/* Define to 1 if `struct stat' is a member of `st_ctime'. */
-#define HAVE_STRUCT_STAT_ST_CTIME 1
-
-/* Define to 1 if `struct stat' is a member of `st_dev'. */
-#define HAVE_STRUCT_STAT_ST_DEV 1
-
-/* Define to 1 if `struct stat' is a member of `st_gid'. */
-#define HAVE_STRUCT_STAT_ST_GID 1
-
-/* Define to 1 if `struct stat' is a member of `st_ino'. */
-#define HAVE_STRUCT_STAT_ST_INO 1
-
-/* Define to 1 if `struct stat' is a member of `st_mode'. */
-#define HAVE_STRUCT_STAT_ST_MODE 1
-
-/* Define to 1 if `struct stat' is a member of `st_mtime'. */
-#define HAVE_STRUCT_STAT_ST_MTIME 1
-
-/* Define to 1 if `struct stat' is a member of `st_nlink'. */
-#define HAVE_STRUCT_STAT_ST_NLINK 1
-
-/* Define to 1 if `struct stat' is a member of `st_rdev'. */
-#define HAVE_STRUCT_STAT_ST_RDEV 1
-
-/* Define to 1 if `struct stat' is a member of `st_size'. */
-#define HAVE_STRUCT_STAT_ST_SIZE 1
-
-/* Define to 1 if `struct stat' is a member of `st_uid'. */
-#define HAVE_STRUCT_STAT_ST_UID 1
-
-/* Define to 1 if you have the <sys/mman.h> header file. */
-#define HAVE_SYS_MMAN_H 1
-
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#define HAVE_SYS_RESOURCE_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/times.h> header file. */
-#define HAVE_SYS_TIMES_H 1
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <termios.h> header file. */
-#define HAVE_TERMIOS_H 1
-
-/* Define to 1 if you have the `time' function. */
-#define HAVE_TIME 1
-
-/* Define to 1 if you have the <time.h> header file. */
-#define HAVE_TIME_H 1
-
-/* Define to 1 if you have the `truncate' function. */
-#define HAVE_TRUNCATE 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the <windows.h> header file. */
-/* #undef HAVE_WINDOWS_H */
-
-/* Define to 1 if you have the `__setfpucw' function. */
-/* #undef HAVE___SETFPUCW */
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
-#define LT_OBJDIR ".libs/"
-
-/* Name of this package. */
-#define PACKAGE "sim"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME ""
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
-
-/* Define to the home page for this package. */
-#define PACKAGE_URL ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION ""
-
-/* Additional package description */
-#define PKGVERSION "(SIM) "
-
-/* Sim profile settings */
-#define PROFILE 1
-
-/* Bug reporting address */
-#define REPORT_BUGS_TO "<http://www.gnu.org/software/gdb/bugs/>"
-
-/* Define as the return type of signal handlers (`int' or `void'). */
-#define RETSIGTYPE void
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Enable extensions on AIX 3, Interix. */
-#ifndef _ALL_SOURCE
-# define _ALL_SOURCE 1
-#endif
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-/* Enable threading extensions on Solaris. */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# define _POSIX_PTHREAD_SEMANTICS 1
-#endif
-/* Enable extensions on HP NonStop. */
-#ifndef _TANDEM_SOURCE
-# define _TANDEM_SOURCE 1
-#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# define __EXTENSIONS__ 1
-#endif
-
-
-/* Sim assert settings */
-#define WITH_ASSERT 1
-
-/* Sim debug setting */
-#define WITH_DEBUG 0
-
-/* Sim default environment */
-#define WITH_ENVIRONMENT ALL_ENVIRONMENT
-
-/* Sim profile settings */
-#define WITH_PROFILE -1
-
-/* How to route I/O */
-#define WITH_STDIO 0
-
-/* Sim trace settings */
-#define WITH_TRACE ~TRACE_debug
-
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-/* # undef WORDS_BIGENDIAN */
-# endif
-#endif
-
-/* Define to 1 if on MINIX. */
-/* #undef _MINIX */
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
- this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-/* #undef _POSIX_SOURCE */
diff --git a/config.h.in b/config.h.in
index 6884775..eccb2d8 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,5 +1,11 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* "enable L1 cache emulation" */
+#undef ENABLE_L1CACHE
+
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
@@ -33,6 +39,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
+/* Define to 1 if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
@@ -62,3 +71,15 @@
/* Version number of package */
#undef VERSION
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
diff --git a/configure b/configure
index 16b696e..2b11127 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sis 2.14.
+# Generated by GNU Autoconf 2.69 for sis 2.15.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sis'
PACKAGE_TARNAME='sis'
-PACKAGE_VERSION='2.14'
-PACKAGE_STRING='sis 2.14'
+PACKAGE_VERSION='2.15'
+PACKAGE_STRING='sis 2.15'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -709,6 +709,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_dependency_tracking
+enable_l1cache
'
ac_precious_vars='build_alias
host_alias
@@ -1259,7 +1260,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures sis 2.14 to adapt to many kinds of systems.
+\`configure' configures sis 2.15 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1325,7 +1326,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sis 2.14:";;
+ short | recursive ) echo "Configuration of sis 2.15:";;
esac
cat <<\_ACEOF
@@ -1337,6 +1338,7 @@ Optional Features:
do not reject slow dependency extractors
--disable-dependency-tracking
speeds up one-time build
+ --enable-l1cache enable L1 cache emulation
Some influential environment variables:
CC C compiler command
@@ -1414,7 +1416,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sis configure 2.14
+sis configure 2.15
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1712,7 +1714,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by sis $as_me 2.14, which was
+It was created by sis $as_me 2.15, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2539,7 +2541,7 @@ fi
# Define the identity of the package.
PACKAGE='sis'
- VERSION='2.14'
+ VERSION='2.15'
cat >>confdefs.h <<_ACEOF
@@ -3963,7 +3965,7 @@ fi
done
-for ac_header in fcntl.h stddef.h stdlib.h string.h sys/time.h unistd.h
+for ac_header in fcntl.h stddef.h stdlib.h string.h sys/time.h unistd.h termios.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -4023,6 +4025,242 @@ fi
+# Check whether --enable-l1cache was given.
+if test "${enable_l1cache+set}" = set; then :
+ enableval=$enable_l1cache;
+fi
+
+if test "x$enable_l1cache" = "xyes"; then :
+
+$as_echo "#define ENABLE_L1CACHE 1" >>confdefs.h
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_bigendian=unknown
+ # See if we're dealing with a universal compiler.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __APPLE_CC__
+ not a universal capable compiler
+ #endif
+ typedef int dummy;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ # Check for potential -arch flags. It is not universal unless
+ # there are at least two -arch flags with different values.
+ ac_arch=
+ ac_prev=
+ for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+ if test -n "$ac_prev"; then
+ case $ac_word in
+ i?86 | x86_64 | ppc | ppc64)
+ if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+ ac_arch=$ac_word
+ else
+ ac_cv_c_bigendian=universal
+ break
+ fi
+ ;;
+ esac
+ ac_prev=
+ elif test "x$ac_word" = "x-arch"; then
+ ac_prev=arch
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/param.h>
+
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+ && LITTLE_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to _BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+ not big endian
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # Compile a test program.
+ if test "$cross_compiling" = yes; then :
+ # Try to guess by grepping values from an object file.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+short int ascii_mm[] =
+ { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+ short int ascii_ii[] =
+ { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+ int use_ascii (int i) {
+ return ascii_mm[i] + ascii_ii[i];
+ }
+ short int ebcdic_ii[] =
+ { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+ short int ebcdic_mm[] =
+ { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+ int use_ebcdic (int i) {
+ return ebcdic_mm[i] + ebcdic_ii[i];
+ }
+ extern int foo;
+
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+ ac_cv_c_bigendian=yes
+ fi
+ if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_bigendian=no
+else
+ ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+ yes)
+ $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+ no)
+ ;; #(
+ universal)
+
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+
+ ;; #(
+ *)
+ as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
+
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -4157,6 +4395,7 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
@@ -4553,7 +4792,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by sis $as_me 2.14, which was
+This file was extended by sis $as_me 2.15, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4619,7 +4858,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-sis config.status 2.14
+sis config.status 2.15
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index f2627cc..c7c5083 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,15 +1,21 @@
-AC_INIT([sis], [2.14])
+AC_INIT([sis], [2.15])
AC_CONFIG_SRCDIR([sis.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
-AC_CHECK_HEADERS([fcntl.h stddef.h stdlib.h string.h sys/time.h unistd.h])
+AC_CHECK_HEADERS([fcntl.h stddef.h stdlib.h string.h sys/time.h unistd.h termios.h])
AC_CONFIG_FILES([Makefile])
AC_CHECK_LIB(readline, readline, READLINE=-lreadline,
AC_ERROR([the required "readline" library is missing]), $READLINE)
AC_SUBST(READLINE)
+AC_ARG_ENABLE([l1cache], [ --enable-l1cache enable L1 cache emulation])
+AS_IF([test "x$enable_l1cache" = "xyes"],
+ [AC_DEFINE([ENABLE_L1CACHE], [1], ["enable L1 cache emulation"])])
+
+AC_C_BIGENDIAN
+
AC_OUTPUT
diff --git a/exec.c b/exec.c
index 433ab0d..d35533a 100644
--- a/exec.c
+++ b/exec.c
@@ -176,6 +176,7 @@ init_regs(sregs)
}
}
+#ifdef ENABLE_L1CACHE
void
l1data_snoop(uint32 address, uint32 cpu)
{
@@ -196,8 +197,8 @@ l1data_update(uint32 address, uint32 cpu)
if (sregs[cpu].l1dtags[address >> L1DLINEBITS & L1DMASK] != (address >> L1DLINEBITS))
{
sregs[cpu].l1dtags[(address >> L1DLINEBITS) & L1DMASK] = (address >> L1DLINEBITS);
- sregs[cpu].hold += 17;
+ sregs[cpu].hold += T_L1DMISS;
sregs[cpu].l1dmiss++;
}
}
-
+#endif
diff --git a/func.c b/func.c
index 23c3481..d5eb83f 100644
--- a/func.c
+++ b/func.c
@@ -46,7 +46,7 @@ struct evcell evbuf[EVENT_MAX];
int ctrl_c = 0;
int sis_verbose = 0;
-char *sis_version = "2.14";
+char *sis_version = PACKAGE_VERSION;
int nfp = 0;
int ift = 0;
int wrp = 0;
@@ -544,7 +544,12 @@ show_stat(sregs)
printf(" Simulator perf. : %.2f MIPS\n",
(double)(ninst / ebase.tottime / 1E6));
printf(" Wall time : %.2f s\n\n", ebase.tottime);
- printf (" Core MIPS MFLOPS CPI Util IHit DHit\n");
+ printf (" Core MIPS MFLOPS CPI Util"
+#ifdef ENABLE_L1CACHE
+ " IHit DHit"
+#endif
+ "\n"
+ );
for (i=0; i<ncpu; i++) {
#ifdef STAT
iinst = sregs[i].ninst - sregs[i].finst - sregs[i].nload - sregs[i].nstore -
@@ -552,16 +557,22 @@ show_stat(sregs)
#endif
stime = sregs[i].simtime - ebase.simstart + 1; /* Core simulated time */
- printf (" %d %5.2f %5.2f %5.2f %5.2f%% %5.2f%% %5.2f%%\n", i,
+ printf (" %d %5.2f %5.2f %5.2f %5.2f%%"
+#ifdef ENABLE_L1CACHE
+ " %5.2f%% %5.2f%%"
+#endif
+ "\n", i,
ebase.freq * (double) (sregs[i].ninst - sregs[i].finst) /
(double) (stime - sregs[i].pwdtime),
ebase.freq * (double) sregs[i].finst / (double) (stime - sregs[i].pwdtime),
(double) (stime - sregs[i].pwdtime) / (double) (sregs[i].ninst + 1),
- 100.0 * (1.0 - ((double) sregs[i].pwdtime / (double) stime)),
- (double) (sregs[i].ninst - sregs[i].l1imiss + 1) /
+ 100.0 * (1.0 - ((double) sregs[i].pwdtime / (double) stime))
+#ifdef ENABLE_L1CACHE
+ ,(double) (sregs[i].ninst - sregs[i].l1imiss + 1) /
(double) (sregs[i].ninst + 1) * 100.0,
(double) (sregs[i].nload + sregs[i].nstore - sregs[i].l1dmiss + 1) /
(double) (sregs[i].nload + sregs[i].nstore + 1) * 100.0
+#endif
) ;
}
@@ -781,14 +792,15 @@ event(cfunc, arg, delta)
/* remove event from event queue */
void
-remove_event(cfunc)
+remove_event(cfunc, arg)
void (*cfunc) ();
+ int32 arg;
{
struct evcell *ev1, *evdel;
ev1 = &ebase.eq;
while (ev1->nxt != NULL) {
- if (ev1->nxt->cfunc == cfunc) {
+ if ((ev1->nxt->cfunc == cfunc) && ((arg == ev1->nxt->arg) || (arg < 0))){
evdel = ev1->nxt;
ev1->nxt = ev1->nxt->nxt;
evdel->nxt = ebase.freeq;
@@ -1072,11 +1084,13 @@ run_sim_core(sregs, ntime, deb, dis)
sregs->inst = *((uint32 *) &ramb[sregs->pc & RAM_MASK]);
sregs->hold = 0;
#endif
+#ifdef ENABLE_L1CACHE
if (sregs->l1itags[(sregs->pc >> L1ILINEBITS) & L1IMASK] != (sregs->pc >> L1ILINEBITS)) {
- sregs->hold = 17;
+ sregs->hold = T_L1IMISS;
sregs->l1itags[(sregs->pc >> L1ILINEBITS) & L1IMASK] = (sregs->pc >> L1ILINEBITS);
sregs->l1imiss++;
}
+#endif
sregs->fhold = 0;
if (!irq) {
if (mexc) {
@@ -1222,7 +1236,7 @@ run_sim(icount, dis)
res = run_sim_un(&sregs[cpu], icount, dis);
else
res = run_sim_mp(icount, dis);
- remove_event(sim_timeout);
+ remove_event(sim_timeout, -1);
ebase.tottime += get_time() - ebase.starttime;
ms->restore_stdio ();
if ((res == CTRL_C) && (ctrl_c == 2))
diff --git a/leon3.c b/leon3.c
index a765ce1..b770cb4 100644
--- a/leon3.c
+++ b/leon3.c
@@ -109,9 +109,10 @@ static uint32 irqmp_ifr[NCPU];
#define GPTIMER_IRQ 8
static uint32 gpt_scaler;
-static uint32 gpt_scaler_start;
+static uint64 gpt_scaler_start;
static uint32 gpt_counter[NGPTIMERS];
static uint32 gpt_reload[NGPTIMERS];
+static uint64 gpt_counter_start[NGPTIMERS];
static uint32 gpt_ctrl[NGPTIMERS];
/* UART support variables. */
@@ -169,6 +170,7 @@ static void timer_ctrl (uint32 val, int i);
static unsigned char *get_mem_ptr (uint32 addr, uint32 size);
static void store_bytes (unsigned char *mem, uint32 waddr,
uint32 * data, int sz, int32 * ws);
+static void gpt_add_intr (int i);
/* One-time init. */
@@ -320,6 +322,20 @@ set_irq (int32 level)
chk_irq ();
}
+static uint32
+gpt_counter_read (int i)
+{
+ if (gpt_ctrl[i] & 1)
+ return gpt_counter[i] - ((now() - gpt_counter_start[i]) / (gpt_scaler + 1));
+ else
+ return gpt_counter[i];
+}
+static uint32
+gpt_scaler_read ()
+{
+ return gpt_scaler - ((now () - gpt_scaler_start) % (gpt_scaler + 1));
+}
+
static int32
apb_read (uint32 addr, uint32 * data)
{
@@ -387,7 +403,7 @@ apb_read (uint32 addr, uint32 * data)
break;
case GPTIMER_SCALER: /* 0x300 */
- *data = gpt_scaler - (now () - gpt_scaler_start);
+ *data = gpt_scaler_read();
break;
case GPTIMER_SCLOAD: /* 0x304 */
@@ -399,7 +415,7 @@ apb_read (uint32 addr, uint32 * data)
break;
case GPTIMER_TIMER1: /* 0x310 */
- *data = gpt_counter[0];
+ *data = gpt_counter_read(0);
break;
case GPTIMER_RELOAD1: /* 0x314 */
@@ -411,7 +427,7 @@ apb_read (uint32 addr, uint32 * data)
break;
case GPTIMER_TIMER2: /* 0x320 */
- *data = gpt_counter[1];
+ *data = gpt_counter_read(1);
break;
case GPTIMER_RELOAD2: /* 0x324 */
@@ -530,7 +546,9 @@ apb_write (uint32 addr, uint32 data)
break;
case GPTIMER_TIMER1: /* 0x310 */
- gpt_counter[0] = data;
+ gpt_counter[0] = data;
+ remove_event (gpt_intr, 0);
+ gpt_add_intr (0);
break;
case GPTIMER_RELOAD1: /* 0x314 */
@@ -543,6 +561,8 @@ apb_write (uint32 addr, uint32 data)
case GPTIMER_TIMER2: /* 0x320 */
gpt_counter[1] = data;
+ remove_event (gpt_intr, 1);
+ gpt_add_intr (1);
break;
case GPTIMER_RELOAD2: /* 0x324 */
@@ -862,26 +882,31 @@ uart_irq_start (void)
/* GPTIMER. */
static void
-gpt_intr (int32 arg)
+gpt_add_intr (int i)
{
- int i;
-
- for (i = 0; i < NGPTIMERS; i++)
- {
if (gpt_ctrl[i] & 1)
+ {
+ event (gpt_intr, i, (uint64) (gpt_scaler + 1) * (uint64) ((uint64) gpt_counter[i] + (uint64) 1));
+ gpt_counter_start[i] = now();
+ }
+}
+
+static void
+gpt_intr (int32 i)
+{
+ gpt_counter[i] = -1;
+ if (gpt_ctrl[i] & 1)
+ {
+ if (gpt_ctrl[i] & 2)
{
- gpt_counter[i] -= 1;
- if (gpt_counter[i] == -1)
- {
- if (gpt_ctrl[i] & 8)
- set_irq (GPTIMER_IRQ + i);
- if (gpt_ctrl[i] & 2)
- gpt_counter[i] = gpt_reload[i];
- }
+ gpt_counter[i] = gpt_reload[i];
}
+ if (gpt_ctrl[i] & 8)
+ {
+ set_irq (GPTIMER_IRQ + i);
+ }
+ gpt_add_intr (i);
}
- event (gpt_intr, 0, gpt_scaler + 1);
- gpt_scaler_start = now ();
}
static void
@@ -897,15 +922,33 @@ gpt_init (void)
static void
gpt_reset (void)
{
- event (gpt_intr, 0, gpt_scaler + 1);
+// event (gpt_intr, 0, gpt_scaler + 1);
+ remove_event (gpt_intr, -1);
gpt_scaler_start = now ();
}
static void
+gpt_add_intr_all ()
+{
+ int i;
+
+ for (i = 0; i < NGPTIMERS; i++)
+ {
+ gpt_add_intr (i);
+ }
+}
+
+static void
gpt_scaler_set (uint32 val)
{
/* Mask for 16-bit scaler. */
- gpt_scaler = val & 0x0ffff;
+ if (gpt_scaler != val & 0x0ffff)
+ {
+ gpt_scaler = val & 0x0ffff;
+ remove_event (gpt_intr, -1);
+ gpt_scaler_start = now ();
+ gpt_add_intr_all();
+ }
}
static void
@@ -916,6 +959,12 @@ timer_ctrl (uint32 val, int i)
/* Reload. */
gpt_counter[i] = gpt_reload[i];
}
+ if (val & 1)
+ {
+ gpt_ctrl[i] = val & 0xb;
+ remove_event (gpt_intr, i);
+ gpt_add_intr (i);
+ }
gpt_ctrl[i] = val & 0xb;
}
diff --git a/riscv.c b/riscv.c
index 68e9f85..326fc3b 100644
--- a/riscv.c
+++ b/riscv.c
@@ -866,7 +866,9 @@ riscv_dispatch_instruction (sregs)
break;
case OP_STORE: /* store instructions */
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nstore++;
+#endif
offset = EXTRACT_STYPE_IMM (sregs->inst);
address = op1 + offset;
wdata = &(sregs->g[rs2]);
@@ -924,15 +926,19 @@ riscv_dispatch_instruction (sregs)
default:
sregs->trap = TRAP_ILLEG;
}
+#ifdef ENABLE_L1CACHE
if (ncpu > 1)
{
l1data_update(address, sregs->cpu);
l1data_snoop(address, sregs->cpu);
}
+#endif
break;
case OP_FSW: /* F store instructions */
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nstore++;
+#endif
offset = EXTRACT_STYPE_IMM (sregs->inst);
address = op1 + offset;
wdata = &sregs->fsi[rs2 << 1];
@@ -981,14 +987,18 @@ riscv_dispatch_instruction (sregs)
default:
sregs->trap = TRAP_ILLEG;
}
+#ifdef ENABLE_L1CACHE
if (ncpu > 1)
{
l1data_update(address, sregs->cpu);
l1data_snoop(address, sregs->cpu);
}
+#endif
break;
case OP_LOAD: /* load instructions */
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nload++;
+#endif
offset = EXTRACT_ITYPE_IMM (sregs->inst);
address = op1 + offset;
if (ebase.wprnum)
@@ -1092,16 +1102,20 @@ riscv_dispatch_instruction (sregs)
default:
sregs->trap = TRAP_ILLEG;
}
+#ifdef ENABLE_L1CACHE
if (ncpu > 1)
{
l1data_update(address, sregs->cpu);
}
+#endif
break;
case OP_AMO: /* atomic instructions */
address = op1;
funct5 = (sregs->inst >> 27) & 0x1f;
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nstore++;
sregs->nload++;
+#endif
sregs->icnt = T_AMO;
switch (funct5)
{
@@ -1317,7 +1331,9 @@ riscv_dispatch_instruction (sregs)
}
break;
case OP_FLOAD: /* float load instructions */
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nload++;
+#endif
offset = EXTRACT_ITYPE_IMM (sregs->inst);
address = op1 + offset;
if (ebase.wprnum)
@@ -1380,10 +1396,12 @@ riscv_dispatch_instruction (sregs)
default:
sregs->trap = TRAP_ILLEG;
}
+#ifdef ENABLE_L1CACHE
if (ncpu > 1)
{
l1data_update(address, sregs->cpu);
}
+#endif
break;
#ifdef FPU_ENABLED
case OP_FPU:
@@ -1951,7 +1969,8 @@ riscv_execute_trap (sregs)
}
*/
- sregs->icnt = TRAP_C;
+ /* Increase simulator time and add some jitter */
+ sregs->icnt = TRAP_C + (sregs->ninst ^ sregs->simtime) & 0x7;
sregs->trap = 0;
if (sregs->err_mode)
diff --git a/sis.c b/sis.c
index a1411ae..72466c6 100644
--- a/sis.c
+++ b/sis.c
@@ -26,6 +26,7 @@
#include <fcntl.h>
#include "sis.h"
#include <inttypes.h>
+#include <libgen.h>
/* Structures and functions from readline library */
@@ -184,9 +185,12 @@ main(argc, argv)
if (!freq) freq = 14;
}
+#ifdef ENABLE_L1CACHE
if (ncpu > 1)
printf(" L1 cache: %dK/%dK, %d bytes/line \n",
(1 << (L1IBITS - 10)), (1 << (L1DBITS - 10)), (1 << L1ILINEBITS));
+#endif
+
if (nfp)
printf(" FPU disabled\n");
ebase.freq = freq;
diff --git a/sis.h b/sis.h
index ba90440..f4e2dab 100644
--- a/sis.h
+++ b/sis.h
@@ -58,6 +58,8 @@
#define L1DTAGBITS (L1DBITS - L1DLINEBITS)
#define L1DTAGS (1 << (L1DTAGBITS))
#define L1DMASK (L1DTAGS -1)
+#define T_L1IMISS 17
+#define T_L1DMISS 17
/* type definitions */
@@ -295,7 +297,7 @@ extern int cpu; /* active debug cpu */
extern int ncpu; /* number of online cpus */
extern int delta; /* time slice for MP simulation */
extern void pwd_enter(struct pstate *sregs);
-extern void remove_event(void (*cfunc) ());
+extern void remove_event(void (*cfunc) (), int32 arg);
extern int run_sim (uint64 icount, int dis);
void flush_windows (struct pstate *sregs);
void cov_start(int address);
diff --git a/sis.info b/sis.info
index a192d76..8b4e941 100644
--- a/sis.info
+++ b/sis.info
@@ -1,6 +1,6 @@
This is sis.info, produced by makeinfo version 6.5 from sis.texi.
-This manual is for SIS (version 2.14, 21 May 2019).
+This manual is for SIS (version 2.15, 21 May 2019).
Copyright (C) 2019 Free Software Foundation, Inc.
@@ -21,7 +21,7 @@ File: sis.info, Node: Top, Next: Introduction, Up: (dir)
SIS
***
-This manual is for SIS (version 2.14, 21 May 2019).
+This manual is for SIS (version 2.15, 21 May 2019).
* Menu:
diff --git a/sparc.c b/sparc.c
index 1adb709..229fac1 100644
--- a/sparc.c
+++ b/sparc.c
@@ -969,7 +969,9 @@ sparc_dispatch_instruction (sregs)
break;
}
}
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nstore++;
+#endif
}
else
{
@@ -982,7 +984,9 @@ sparc_dispatch_instruction (sregs)
break;
}
}
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nload++;
+#endif
}
/* Decode load/store instructions */
@@ -1019,7 +1023,9 @@ sparc_dispatch_instruction (sregs)
{
rdd[0] = ddata[0];
rdd[1] = ddata[1];
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nload++; /* Double load counts twice */
+#endif
}
break;
@@ -1078,7 +1084,9 @@ sparc_dispatch_instruction (sregs)
{
sregs->trap = TRAP_DEXC;
}
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nload++;
+#endif
break;
case LDSBA:
case LDUBA:
@@ -1192,7 +1200,9 @@ sparc_dispatch_instruction (sregs)
rd ^= 1;
#endif
sregs->fsi[rd] = ddata[0];
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nload++; /* Double load counts twice */
+#endif
rd ^= 1;
sregs->fsi[rd] = ddata[1];
sregs->ltime = sregs->simtime + sregs->icnt + FLSTHOLD +
@@ -1309,7 +1319,9 @@ sparc_dispatch_instruction (sregs)
mexc = ms->memory_write (address, rdd, 3, &ws);
sregs->hold += ws;
sregs->icnt = T_STD;
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nstore++; /* Double store counts twice */
+#endif
if (mexc)
{
sregs->trap = TRAP_DEXC;
@@ -1341,7 +1353,9 @@ sparc_dispatch_instruction (sregs)
mexc = ms->memory_write (address, rdd, 3, &ws);
sregs->hold += ws;
sregs->icnt = T_STD;
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nstore++; /* Double store counts twice */
+#endif
if (mexc)
{
sregs->trap = TRAP_DEXC;
@@ -1422,7 +1436,9 @@ sparc_dispatch_instruction (sregs)
mexc = ms->memory_write (address, ddata, 3, &ws);
sregs->hold += ws;
sregs->icnt = T_STD;
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nstore++; /* Double store counts twice */
+#endif
if (mexc)
{
sregs->trap = TRAP_DEXC;
@@ -1454,7 +1470,9 @@ sparc_dispatch_instruction (sregs)
}
else
*rdd = data;
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nload++;
+#endif
break;
case CASA:
asi = (sregs->inst >> 5) & 0x0ff;
@@ -1487,7 +1505,9 @@ sparc_dispatch_instruction (sregs)
}
else
*rdd = data;
+#if defined(STAT) || defined(ENABLE_L1CACHE)
sregs->nload++;
+#endif
break;
default:
@@ -1506,6 +1526,7 @@ sparc_dispatch_instruction (sregs)
* last */
}
#endif
+#ifdef ENABLE_L1CACHE
if (ncpu > 1)
{
l1data_update(address, sregs->cpu);
@@ -1514,6 +1535,7 @@ sparc_dispatch_instruction (sregs)
l1data_snoop(address, sregs->cpu);
}
}
+#endif
break;
default:
@@ -1896,7 +1918,7 @@ sparc_execute_trap (sregs)
}
/* Increase simulator time and add some jitter */
- sregs->icnt = TRAP_C;
+ sregs->icnt = TRAP_C + (sregs->ninst ^ sregs->simtime) & 0x7;
}
diff --git a/version.texi b/version.texi
index cf69af6..1a5a276 100644
--- a/version.texi
+++ b/version.texi
@@ -1,4 +1,4 @@
@set UPDATED 21 May 2019
@set UPDATED-MONTH May 2019
-@set EDITION 2.14
-@set VERSION 2.14
+@set EDITION 2.15
+@set VERSION 2.15