OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/or1ksim/or1ksim-0.5.0rc2/testsuite/test-code
    from Rev 346 to Rev 388
    Reverse comparison

Rev 346 → Rev 388

/Makefile.in
0,0 → 1,606
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
 
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
 
@SET_MAKE@
 
# Makefile.am for or1ksim testsuite test-code
 
# Copyright (C) Embecosm Limited, 2010
 
# Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
 
# This file is part of OpenRISC 1000 Architectural Simulator.
 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
 
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
 
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http:#www.gnu.org/licenses/>. */
 
# -----------------------------------------------------------------------------
# This code is commented throughout for use with Doxygen.
# -----------------------------------------------------------------------------
 
# Subdirs for each test program.
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = testsuite/test-code
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ARFLAGS = @ARFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_DIR = @BUILD_DIR@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPU_ARCH = @CPU_ARCH@
CYGPATH_W = @CYGPATH_W@
DEBUGFLAGS = @DEBUGFLAGS@
DEFS = @DEFS@
DEJAGNU = @DEJAGNU@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INCLUDES = @INCLUDES@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
LOCAL_DEFS = @LOCAL_DEFS@
LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POW_LIB = @POW_LIB@
RANLIB = @RANLIB@
RUNTESTDEFAULTFLAGS = @RUNTESTDEFAULTFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SUMVERSION = @SUMVERSION@
TERMCAP_LIB = @TERMCAP_LIB@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = lib-iftest \
lib-inttest \
lib-jtag \
lib-upcalls
 
all: all-recursive
 
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu testsuite/test-code/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu testsuite/test-code/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
 
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
 
mostlyclean-libtool:
-rm -f *.lo
 
clean-libtool:
-rm -rf .libs _libs
 
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
 
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
 
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
 
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
 
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
 
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
 
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
 
clean-generic:
 
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
 
clean-am: clean-generic clean-libtool mostlyclean-am
 
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
 
dvi: dvi-recursive
 
dvi-am:
 
html: html-recursive
 
html-am:
 
info: info-recursive
 
info-am:
 
install-data-am:
 
install-dvi: install-dvi-recursive
 
install-dvi-am:
 
install-exec-am:
 
install-html: install-html-recursive
 
install-html-am:
 
install-info: install-info-recursive
 
install-info-am:
 
install-man:
 
install-pdf: install-pdf-recursive
 
install-pdf-am:
 
install-ps: install-ps-recursive
 
install-ps-am:
 
installcheck-am:
 
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
 
mostlyclean: mostlyclean-recursive
 
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
 
pdf: pdf-recursive
 
pdf-am:
 
ps: ps-recursive
 
ps-am:
 
uninstall-am:
 
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
 
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am
 
 
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
/lib-iftest/Makefile.in
0,0 → 1,519
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
 
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
 
@SET_MAKE@
 
# Makefile.am for libor1ksim test program: lib-iftest
 
# Copyright (C) Embecosm Limited, 2010
 
# Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
 
# This file is part of OpenRISC 1000 Architectural Simulator.
 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
 
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
 
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http:#www.gnu.org/licenses/>. */
 
# -----------------------------------------------------------------------------
# This code is commented throughout for use with Doxygen.
# -----------------------------------------------------------------------------
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = lib-iftest$(EXEEXT)
subdir = testsuite/test-code/lib-iftest
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am_lib_iftest_OBJECTS = lib-iftest.$(OBJEXT)
lib_iftest_OBJECTS = $(am_lib_iftest_OBJECTS)
lib_iftest_DEPENDENCIES = $(top_builddir)/libsim.la
lib_iftest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(lib_iftest_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(lib_iftest_SOURCES)
DIST_SOURCES = $(lib_iftest_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ARFLAGS = @ARFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_DIR = @BUILD_DIR@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPU_ARCH = @CPU_ARCH@
CYGPATH_W = @CYGPATH_W@
DEBUGFLAGS = @DEBUGFLAGS@
DEFS = @DEFS@
DEJAGNU = @DEJAGNU@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INCLUDES = @INCLUDES@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
LOCAL_DEFS = @LOCAL_DEFS@
LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POW_LIB = @POW_LIB@
RANLIB = @RANLIB@
RUNTESTDEFAULTFLAGS = @RUNTESTDEFAULTFLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SUMVERSION = @SUMVERSION@
TERMCAP_LIB = @TERMCAP_LIB@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
lib_iftest_SOURCES = lib-iftest.c
lib_iftest_LDFLAGS = -lm
lib_iftest_LDADD = $(top_builddir)/libsim.la
all: all-am
 
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu testsuite/test-code/lib-iftest/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu testsuite/test-code/lib-iftest/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
 
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
 
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
lib-iftest$(EXEEXT): $(lib_iftest_OBJECTS) $(lib_iftest_DEPENDENCIES)
@rm -f lib-iftest$(EXEEXT)
$(lib_iftest_LINK) $(lib_iftest_OBJECTS) $(lib_iftest_LDADD) $(LIBS)
 
mostlyclean-compile:
-rm -f *.$(OBJEXT)
 
distclean-compile:
-rm -f *.tab.c
 
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-iftest.Po@am__quote@
 
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
 
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
 
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
 
mostlyclean-libtool:
-rm -f *.lo
 
clean-libtool:
-rm -rf .libs _libs
 
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
 
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
 
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
 
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
 
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
 
clean-generic:
 
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
 
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
mostlyclean-am
 
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
 
dvi: dvi-am
 
dvi-am:
 
html: html-am
 
html-am:
 
info: info-am
 
info-am:
 
install-data-am:
 
install-dvi: install-dvi-am
 
install-dvi-am:
 
install-exec-am:
 
install-html: install-html-am
 
install-html-am:
 
install-info: install-info-am
 
install-info-am:
 
install-man:
 
install-pdf: install-pdf-am
 
install-pdf-am:
 
install-ps: install-ps-am
 
install-ps-am:
 
installcheck-am:
 
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
 
mostlyclean: mostlyclean-am
 
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
 
pdf: pdf-am
 
pdf-am:
 
ps: ps-am
 
ps-am:
 
uninstall-am:
 
.MAKE: check-am install-am install-strip
 
.PHONY: CTAGS GTAGS all all-am check check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am
 
 
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
/lib-iftest/lib-iftest.c
0,0 → 1,158
/* lib-iftest.c. Test of Or1ksim library interface functions.
 
Copyright (C) 1999-2006 OpenCores
Copyright (C) 2010 Embecosm Limited
 
Contributors various OpenCores participants
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
 
This file is part of OpenRISC 1000 Architectural Simulator.
 
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.
 
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
 
You should have received a copy of the GNU General Public License along
with this program. If not, see <http: www.gnu.org/licenses/>. */
 
/* ----------------------------------------------------------------------------
This code is commented throughout for use with Doxygen.
--------------------------------------------------------------------------*/
 
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
 
#include "or1ksim.h"
 
 
/* --------------------------------------------------------------------------*/
/*!Main program
 
Build an or1ksim program using the library which loads a program and config
from the command line. Usage:
 
lib-iftest <config-file> <image> <duration_ms>
 
Run that test for a <duration_ms> milliseconds of simulated time. The test
the various interface functions.
 
@param[in] argc Number of elements in argv
@param[in] argv Vector of program name and arguments
 
@return Return code for the program. */
/* --------------------------------------------------------------------------*/
int
main (int argc,
char *argv[])
{
/* Parse args */
if (4 != argc)
{
fprintf (stderr,
"usage: lib-iftest <config-file> <image> <duration_ms>\n");
return 1;
}
 
int duration_ms = atoi (argv[3]);
double duration = (double) duration_ms / 1.0e3;
 
if (duration_ms <= 0)
{
fprintf (stderr, "ERROR. Duration must be positive number of ms\n");
return 1;
}
 
/* Dummy argv array to pass arguments to or1ksim_init. Varies depending on
whether an image file is specified. */
int dummy_argc;
char *dummy_argv[5];
 
dummy_argv[0] = "libsim";
dummy_argv[1] = "-q";
dummy_argv[2] = "-f";
dummy_argv[3] = argv[1];
dummy_argv[4] = argv[2];
 
dummy_argc = 5;
 
/* Put the initialization message afterwards, or it will get swamped by the
Or1ksim header. */
if (0 == or1ksim_init (dummy_argc, dummy_argv, NULL, NULL, NULL))
{
printf ("Initalization succeeded.\n");
}
else
{
printf ("Initalization failed.\n");
return 1;
}
 
/* Test of running */
printf ("Running code...");
switch (or1ksim_run (duration))
{
case OR1KSIM_RC_OK: printf ("done.\n"); break;
case OR1KSIM_RC_BRKPT: printf ("hit breakpoint.\n"); break;
default: printf ("failed.\n"); return 1;
}
 
 
/* Test of timing. Set a time point, run for the duration, then check the
timing matches. */
or1ksim_set_time_point ();
printf ("Set time point.\n");
printf ("Running code...");
switch (or1ksim_run (duration))
{
case OR1KSIM_RC_OK: printf ("done.\n"); break;
case OR1KSIM_RC_BRKPT: printf ("hit breakpoint.\n"); break;
default: printf ("failed.\n"); return 1;
}
/* All done OK (within 1ps) */
double measured_duration = or1ksim_get_time_period ();
 
if (fabs (duration - measured_duration) < 1e-12)
{
printf ("Measured time period correctly.\n");
}
else
{
printf ("Failed. Requested period %.12f, but measured %.12f\n", duration,
measured_duration);
return 1;
}
 
/* Test endianness */
if (or1ksim_is_le ())
{
printf ("Little endian architecture.\n");
}
else
{
printf ("Big endian architecture.\n");
}
 
/* Check for clock rate */
unsigned long int clock_rate = or1ksim_clock_rate ();
 
if (clock_rate > 0)
{
printf ("Clock rate %ld Hz.\n", clock_rate);
}
else
{
printf ("Invalid clock rate %ld Hz.\n", clock_rate);
return 1;
}
 
printf ("Test completed successfully.\n");
return 0;
 
} /* main () */
lib-iftest/lib-iftest.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-iftest/Makefile.am =================================================================== --- lib-iftest/Makefile.am (nonexistent) +++ lib-iftest/Makefile.am (revision 388) @@ -0,0 +1,34 @@ +# Makefile.am for libor1ksim test program: lib-iftest + +# Copyright (C) Embecosm Limited, 2010 + +# Contributor Jeremy Bennett + +# This file is part of OpenRISC 1000 Architectural Simulator. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . */ + +# ----------------------------------------------------------------------------- +# This code is commented throughout for use with Doxygen. +# ----------------------------------------------------------------------------- + + +# A test program of the library interface functions +check_PROGRAMS = lib-iftest + +lib_iftest_SOURCES = lib-iftest.c + +lib_iftest_LDFLAGS = -lm + +lib_iftest_LDADD = $(top_builddir)/libsim.la
lib-iftest/Makefile.am Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-upcalls/Makefile.in =================================================================== --- lib-upcalls/Makefile.in (nonexistent) +++ lib-upcalls/Makefile.in (revision 388) @@ -0,0 +1,517 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am for libor1ksim test program: lib-upcalls + +# Copyright (C) Embecosm Limited, 2010 + +# Contributor Jeremy Bennett + +# This file is part of OpenRISC 1000 Architectural Simulator. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . */ + +# ----------------------------------------------------------------------------- +# This code is commented throughout for use with Doxygen. +# ----------------------------------------------------------------------------- +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +check_PROGRAMS = lib-upcalls$(EXEEXT) +subdir = testsuite/test-code/lib-upcalls +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_lib_upcalls_OBJECTS = lib-upcalls.$(OBJEXT) +lib_upcalls_OBJECTS = $(am_lib_upcalls_OBJECTS) +lib_upcalls_DEPENDENCIES = $(top_builddir)/libsim.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(lib_upcalls_SOURCES) +DIST_SOURCES = $(lib_upcalls_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARFLAGS = @ARFLAGS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_DIR = @BUILD_DIR@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_ARCH = @CPU_ARCH@ +CYGPATH_W = @CYGPATH_W@ +DEBUGFLAGS = @DEBUGFLAGS@ +DEFS = @DEFS@ +DEJAGNU = @DEJAGNU@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INCLUDES = @INCLUDES@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCAL_CFLAGS = @LOCAL_CFLAGS@ +LOCAL_DEFS = @LOCAL_DEFS@ +LOCAL_LDFLAGS = @LOCAL_LDFLAGS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ +RANLIB = @RANLIB@ +RUNTESTDEFAULTFLAGS = @RUNTESTDEFAULTFLAGS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SUMVERSION = @SUMVERSION@ +TERMCAP_LIB = @TERMCAP_LIB@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# Edge based interrupt +lib_upcalls_SOURCES = lib-upcalls.c +lib_upcalls_LDADD = $(top_builddir)/libsim.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu testsuite/test-code/lib-upcalls/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu testsuite/test-code/lib-upcalls/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +lib-upcalls$(EXEEXT): $(lib_upcalls_OBJECTS) $(lib_upcalls_DEPENDENCIES) + @rm -f lib-upcalls$(EXEEXT) + $(LINK) $(lib_upcalls_OBJECTS) $(lib_upcalls_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-upcalls.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: lib-upcalls/lib-upcalls.c =================================================================== --- lib-upcalls/lib-upcalls.c (nonexistent) +++ lib-upcalls/lib-upcalls.c (revision 388) @@ -0,0 +1,386 @@ +/* lib-upcalls.c. Test of Or1ksim library upcall interface. + + Copyright (C) 1999-2006 OpenCores + Copyright (C) 2010 Embecosm Limited + + Contributors various OpenCores participants + Contributor Jeremy Bennett + + This file is part of OpenRISC 1000 Architectural Simulator. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . */ + +/* ---------------------------------------------------------------------------- + This code is commented throughout for use with Doxygen. + --------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include + +#include "or1ksim.h" + + +/*! Memory mapped register memory */ +static unsigned char *regv; + +/*! Number of bytes of register memory */ +static int regc; + +/*! Number of times each upcall has been called */ +static int upcall_count; + + +/* --------------------------------------------------------------------------*/ +/*!Read upcall + + Upcall from Or1ksim to read a word from an external peripheral. Read the + specified bytes from the peripheral if available. + + We only ever expect to get 4 byte reads here (modeling Wishbone). + + @note We receive the full address, since there is a single upcall routine, + and this allows us to decode between potentially multiple devices. + + @todo We assume that the register memory size is a power of 2, making + address shortening a simple modulo exercise. We should use a more + generic solution. + + @note The mask is a byte mask. Since this is testing, we warn if any byte + is not either 0xff or 0x00. + + @param[in] class_ptr A handle pass back from the initalization. Intended + for C++ callers, not used here. + @param[in] addr Address to read from. + @param[in] mask Byte mask for the read. + @param[out] rdata Buffer for the data read. + @param[in] data_len Number of bytes in mask and rdata. + + @return Zero on success, non-zero on failure. */ +/* --------------------------------------------------------------------------*/ +static int +read_upcall (void *class_ptr, + unsigned long int addr, + unsigned char mask[], + unsigned char rdata[], + int data_len) +{ + unsigned long int devaddr = addr % regc; + + upcall_count--; /* One less upcall to do */ + + if (4 != data_len) + { + printf ("Warning: 4-byte reads only supported for this device.\n"); + return -1; + } + + if (devaddr > regc - data_len) + { + printf ("Warning: read from 0x%08lx out of range: zero result.\n", + devaddr); + return -1; + } + + /* Read the data */ + int i; + + for (i = 0; i < 4; i++) + { + switch (mask[i]) + { + case 0x00: rdata[i] = 0; break; + case 0xff: rdata[i] = regv[devaddr + i]; break; + + default: + printf ("Warning: invalid mask byte %d for read 0x%02x: " + "treated as 0xff.\n", i, mask[i]); + rdata[i] = regv[devaddr + i]; + break; + } + } + + /* printf ("Read from 0x%08lx: vector [%02x %02x %02x %02x ], " */ + /* "mask [%02x %02x %02x %02x ].\n", devaddr, rdata[0], rdata[1], */ + /* rdata[2], rdata[3], mask[0], mask[1], mask[2], mask[3]); */ + + return 0; /* Success */ + +} /* read_upcall () */ + + +/* --------------------------------------------------------------------------*/ +/*!Write upcall + + Upcall from Or1ksim to write a word to an external peripheral. Read the + specified bytes from the peripheral if available. + + We only ever expect to get 4 byte reads here (modeling Wishbone). + + @note We receive the full address, since there is a single upcall routine, + and this allows us to decode between potentially multiple devices. + + @todo We assume that the register memory size is a power of 2, making + address shortening a simple modulo exercise. We should use a more + generic solution. + + @note The mask is a byte mask. Since this is testing, we warn if any byte + is not either 0xff or 0x00. + + @param[in] class_ptr A handle pass back from the initalization. Intended + for C++ callers, not used here. + @param[in] addr Address to write to. + @param[in] mask Byte mask for the write. + @param[in] wdata The data to write. + @param[in] data_len Number of bytes in mask and rdata. + + @return Zero on success, non-zero on failure. */ +/* --------------------------------------------------------------------------*/ +static int +write_upcall (void *class_ptr, + unsigned long int addr, + unsigned char mask[], + unsigned char wdata[], + int data_len) +{ + unsigned long int devaddr = addr % regc; + + upcall_count--; /* One less upcall to do */ + + if (4 != data_len) + { + printf ("Warning: 4-byte writes only supported for this device.\n"); + return -1; + } + + if (devaddr > regc - data_len) + { + printf ("Warning: write to 0x%08lx out of range: ignored.\n", + devaddr); + return -1; + } + + /* printf ("Write to 0x%08lx: vector [%02x %02x %02x %02x ], " */ + /* "mask [%02x %02x %02x %02x ].\n", devaddr, wdata[0], wdata[1], */ + /* wdata[2], wdata[3], mask[0], mask[1], mask[2], mask[3]); */ + + /* Write the data */ + int i; + + for (i = 0; i < 4; i++) + { + switch (mask[i]) + { + case 0x00: break; + case 0xff: regv[devaddr + i] = wdata[i]; break; + + default: + printf ("Warning: invalid mask byte %d for write 0x%02x: " + "treated as 0xff.\n", i, mask[i]); + regv[devaddr + i] = wdata[i]; + break; + } + } + + return 0; /* Success */ + +} /* write_upcall () */ + + +/* --------------------------------------------------------------------------*/ +/*!Main program + + Build an or1ksim program using the library which loads a program and config + from the command line which will drive upcalls. + + lib-upcalls [] + + A register memory of bytes is initalized from if + present, or zeroed if not. is run continuously, making upcalls, + which are satisfied using the register memory. The program exits + successfully when upcalls have been made. + + @param[in] argc Number of elements in argv + @param[in] argv Vector of program name and arguments + + @return Return code for the program. */ +/* --------------------------------------------------------------------------*/ +int +main (int argc, + char *argv[]) +{ + char *reg_file; + + /* Parse args */ + switch (argc) + { + case 5: + reg_file = NULL; + break; + + case 6: + reg_file = argv[5]; + break; + + default: + printf ("usage: lib-upcalls " + " []\n"); + return 1; + } + + upcall_count = atoi (argv[3]); + + if (upcall_count <= 0) + { + printf ("ERROR: Upcall count must be positive\n"); + return 1; + } + + regc = atoi (argv[4]); + + if (regc < 0) + { + printf ("ERROR: Register memory size must be positive\n"); + return 1; + } + + /* Read the register file if provided. */ + regv = malloc (regc * sizeof (unsigned char)); + + if (NULL == regv) + { + printf ("ERROR: Failed to allocate register memory\n"); + return 1; + } + + int next_free_byte = 0; + + if (NULL != reg_file) + { + FILE *fd = fopen (reg_file, "r"); + + if (NULL == fd) + { + printf ("ERROR: Failed to open register file: %s\n", + strerror (errno)); + free (regv); + return 1; + } + + for (; next_free_byte < regc; next_free_byte++) + { + unsigned char byte; + + if (1 == fscanf (fd, "%2hhx ", &byte)) + { + regv[next_free_byte] = byte; + } + else + { + break; + } + } + + /* Should have read the whole file successfully. */ + if (ferror (fd)) + { + printf ("ERROR: Reading register file: %s\n", strerror (errno)); + free (regv); + return 1; + } + + if (!feof (fd)) + { + printf ("Warning: additional register file data ignored.\n"); + } + + if (0 != fclose (fd)) + { + printf ("ERROR: Failed to close register file: %s\n", + strerror (errno)); + free (regv); + return 1; + } + } + + /* Fill in any remaining bytes with zero */ + if (next_free_byte < regc) + { + (void)memset (&(regv[next_free_byte]), 0, regc - next_free_byte); + } + + /* Dummy argv array to pass arguments to or1ksim_init. Varies depending on + whether an image file is specified. */ + int dummy_argc; + char *dummy_argv[5]; + + dummy_argv[0] = "libsim"; + dummy_argv[1] = "-q"; + dummy_argv[2] = "-f"; + dummy_argv[3] = argv[1]; + dummy_argv[4] = argv[2]; + + dummy_argc = 5; + + /* Initialize the program. Put the initialization message afterwards, or it + will get swamped by the Or1ksim header. */ + if (0 == or1ksim_init (dummy_argc, dummy_argv, NULL, &read_upcall, + &write_upcall)) + { + printf ("Initalization succeeded.\n"); + } + else + { + printf ("Initalization failed.\n"); + return 1; + } + + /* Run repeatedly for 1 millisecond until we hit a breakpoint or all upcalls + are done. */ + do + { + switch (or1ksim_run (1.0e-3)) + { + case OR1KSIM_RC_OK: + break; + + case OR1KSIM_RC_BRKPT: + printf ("Test completed successfully: hit breakpoint.\n"); + return 0; + + default: + printf ("ERROR: run failed\n"); + return 1; + } + } + while (upcall_count > 0); + + /* A little longer to allow response to last upcall to be handled. */ + switch (or1ksim_run (1.0e-3)) + { + case OR1KSIM_RC_OK: + printf ("Test completed successfully: All upcalls processed.\n"); + return 0; + + case OR1KSIM_RC_BRKPT: + printf ("Test completed successfully: hit breakpoint.\n"); + return 0; + + default: + printf ("ERROR: run failed\n"); + return 1; + } +} /* main () */
lib-upcalls/lib-upcalls.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-upcalls/Makefile.am =================================================================== --- lib-upcalls/Makefile.am (nonexistent) +++ lib-upcalls/Makefile.am (revision 388) @@ -0,0 +1,33 @@ +# Makefile.am for libor1ksim test program: lib-upcalls + +# Copyright (C) Embecosm Limited, 2010 + +# Contributor Jeremy Bennett + +# This file is part of OpenRISC 1000 Architectural Simulator. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . */ + +# ----------------------------------------------------------------------------- +# This code is commented throughout for use with Doxygen. +# ----------------------------------------------------------------------------- + + +# A generic program to handle upcalls. +check_PROGRAMS = lib-upcalls + +# Edge based interrupt +lib_upcalls_SOURCES = lib-upcalls.c + +lib_upcalls_LDADD = $(top_builddir)/libsim.la
lib-upcalls/Makefile.am Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-jtag/Makefile.in =================================================================== --- lib-jtag/Makefile.in (nonexistent) +++ lib-jtag/Makefile.in (revision 388) @@ -0,0 +1,528 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am for libor1ksim test programs for JTAG + +# Copyright (C) Embecosm Limited, 2010 + +# Contributor Jeremy Bennett + +# This file is part of OpenRISC 1000 Architectural Simulator. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . */ + +# ----------------------------------------------------------------------------- +# This code is commented throughout for use with Doxygen. +# ----------------------------------------------------------------------------- +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +check_PROGRAMS = lib-jtag$(EXEEXT) lib-jtag-full$(EXEEXT) +subdir = testsuite/test-code/lib-jtag +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_lib_jtag_OBJECTS = lib-jtag.$(OBJEXT) +lib_jtag_OBJECTS = $(am_lib_jtag_OBJECTS) +lib_jtag_DEPENDENCIES = $(top_builddir)/libsim.la +am_lib_jtag_full_OBJECTS = lib-jtag-full.$(OBJEXT) +lib_jtag_full_OBJECTS = $(am_lib_jtag_full_OBJECTS) +lib_jtag_full_DEPENDENCIES = $(top_builddir)/libsim.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(lib_jtag_SOURCES) $(lib_jtag_full_SOURCES) +DIST_SOURCES = $(lib_jtag_SOURCES) $(lib_jtag_full_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARFLAGS = @ARFLAGS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_DIR = @BUILD_DIR@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_ARCH = @CPU_ARCH@ +CYGPATH_W = @CYGPATH_W@ +DEBUGFLAGS = @DEBUGFLAGS@ +DEFS = @DEFS@ +DEJAGNU = @DEJAGNU@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INCLUDES = @INCLUDES@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCAL_CFLAGS = @LOCAL_CFLAGS@ +LOCAL_DEFS = @LOCAL_DEFS@ +LOCAL_LDFLAGS = @LOCAL_LDFLAGS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ +RANLIB = @RANLIB@ +RUNTESTDEFAULTFLAGS = @RUNTESTDEFAULTFLAGS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SUMVERSION = @SUMVERSION@ +TERMCAP_LIB = @TERMCAP_LIB@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# Simple JTAG handling +lib_jtag_SOURCES = lib-jtag.c +lib_jtag_LDADD = $(top_builddir)/libsim.la + +# Simple JTAG handling +lib_jtag_full_SOURCES = lib-jtag-full.c +lib_jtag_full_LDADD = $(top_builddir)/libsim.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu testsuite/test-code/lib-jtag/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu testsuite/test-code/lib-jtag/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +lib-jtag$(EXEEXT): $(lib_jtag_OBJECTS) $(lib_jtag_DEPENDENCIES) + @rm -f lib-jtag$(EXEEXT) + $(LINK) $(lib_jtag_OBJECTS) $(lib_jtag_LDADD) $(LIBS) +lib-jtag-full$(EXEEXT): $(lib_jtag_full_OBJECTS) $(lib_jtag_full_DEPENDENCIES) + @rm -f lib-jtag-full$(EXEEXT) + $(LINK) $(lib_jtag_full_OBJECTS) $(lib_jtag_full_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-jtag-full.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-jtag.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: lib-jtag/lib-jtag-full.c =================================================================== --- lib-jtag/lib-jtag-full.c (nonexistent) +++ lib-jtag/lib-jtag-full.c (revision 388) @@ -0,0 +1,1522 @@ +/* lib-jtag-full.c. Comprehensive test of Or1ksim library JTAG interface. + + Copyright (C) 1999-2006 OpenCores + Copyright (C) 2010 Embecosm Limited + + Contributors various OpenCores participants + Contributor Jeremy Bennett + + This file is part of OpenRISC 1000 Architectural Simulator. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . */ + +/* ---------------------------------------------------------------------------- + This code is commented throughout for use with Doxygen. + --------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include + +#include "or1ksim.h" + + +/* --------------------------------------------------------------------------*/ +/*!Compute a IEEE 802.3 CRC-32. + + Print an error message if we get a duff argument, but we really should + not. + + @param[in] value The value to shift into the CRC + @param[in] num_bits The number of bits in the value. + @param[in] crc_in The existing CRC + + @return The computed CRC. */ +/* --------------------------------------------------------------------------*/ +static unsigned long int +crc32 (unsigned long long int value, + int num_bits, + unsigned long int crc_in) +{ + if ((1 > num_bits) || (num_bits > 64)) + { + printf ("ERROR: Max 64 bits of CRC can be computed. Ignored\n"); + return crc_in; + } + + static const unsigned long int CRC32_POLY = 0x04c11db7; + int i; + + /* Compute the CRC, MS bit first */ + for (i = num_bits - 1; i >= 0; i--) + { + unsigned long int d; + unsigned long int t; + + d = (1 == ((value >> i) & 1)) ? 0xfffffff : 0x0000000; + t = (1 == ((crc_in >> 31) & 1)) ? 0xfffffff : 0x0000000; + + crc_in <<= 1; + crc_in ^= (d ^ t) & CRC32_POLY; + } + + return crc_in; + +} /* crc32 () */ + + +/* --------------------------------------------------------------------------*/ +/*!Reverse a value's bits + + @param[in] val The value to reverse (up to 64 bits). + @param[in] len The number of bits to reverse. + + @return The reversed value */ +/* --------------------------------------------------------------------------*/ +static unsigned long long +reverse_bits (unsigned long long val, + int len) +{ + if ((1 > len) || (len > 64)) + { + printf ("ERROR: Cannot reverse %d bits. Returning zero\n", len); + return 0; + } + + /* Reverse the string */ + val = (((val & 0xaaaaaaaaaaaaaaaaULL) >> 1) | + ((val & 0x5555555555555555ULL) << 1)); + val = (((val & 0xccccccccccccccccULL) >> 2) | + ((val & 0x3333333333333333ULL) << 2)); + val = (((val & 0xf0f0f0f0f0f0f0f0ULL) >> 4) | + ((val & 0x0f0f0f0f0f0f0f0fULL) << 4)); + val = (((val & 0xff00ff00ff00ff00ULL) >> 8) | + ((val & 0x00ff00ff00ff00ffULL) << 8)); + val = (((val & 0xffff0000ffff0000ULL) >> 16) | + ((val & 0x0000ffff0000ffffULL) << 16)); + + return ((val >> 32) | (val << 32)) >> (64 - len); + +} /* reverse_bits () */ + + +/* --------------------------------------------------------------------------*/ +/*!Dump a JTAG register + + Prefix with the supplied string and add a newline afterwards. + + @param[in] prefix Prefix string to print out + @param[in] jreg The JTAG register + @param[in] num_bytes The number of bytes in the register */ +/* --------------------------------------------------------------------------*/ +static void +dump_jreg (const char *prefix, + unsigned char *jreg, + int num_bytes) +{ + int i; + + printf ("%s: 0x", prefix); + + /* Dump each byte in turn */ + for (i = num_bytes - 1; i >=0; i--) + { + printf ("%02x", jreg[i]); + } + + printf ("\n"); + +} /* dump_jreg () */ + + +/* --------------------------------------------------------------------------*/ +/*!Process a JTAG instruction register + + Usage: + + INSTRUCTION + + The single argument is a single hex digit, specifying the instruction + value. + + Like all the JTAG instructions, it must be reversed, so it is shifted MS + bit first. + + @param[in] next_jreg Offset into argv of the next JTAG register hex + string. + @param[in] argc argc from the main program (for checking next_jreg). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_instruction (int next_jreg, + int argc, + char *argv[]) +{ + printf ("Shifting instruction.\n"); + + /* Do we have the arg? */ + if (next_jreg >= argc) + { + printf ("ERROR: no instruction register value found.\n"); + return 0; + } + + /* Is the argument in range? */ + unsigned long int ival = strtoul (argv[next_jreg], NULL, 16); + + if (ival > 0xf) + { + printf ("ERROR: instruction value 0x%lx too large\n", ival); + return 0; + } + + /* Reverse the bits of the value */ + ival = reverse_bits (ival, 4); + + /* Allocate space and populate the register */ + unsigned char *jreg = malloc (1); + + if (NULL == jreg) + { + printf ("ERROR: malloc for instruction register failed.\n"); + return 0; + } + + jreg[0] = ival; + + dump_jreg (" shifting in", jreg, 1); + + double t = or1ksim_jtag_shift_ir (jreg, 4); + + dump_jreg (" shifted out", jreg, 1); + printf (" time taken: %.12fs\n", t); + + free (jreg); + return 1; /* Completed successfully */ + +} /* process_instruction () */ + + +/* --------------------------------------------------------------------------*/ +/*!Process a JTAG SELECT_MODULE debug data register + + Usage: + + SELECT_MODULE + + The one argument is a single hex digit, specifying the module value. + + Like all the JTAG fields, it must be reversed, so it is shifted MS + bit first. It also requires a 32-bit CRC. + + On return we get a status register and CRC. + + @param[in] next_jreg Offset into argv of the next JTAG register hex + string. + @param[in] argc argc from the main program (for checking next_jreg). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_select_module (int next_jreg, + int argc, + char *argv[]) +{ + printf ("Selecting module.\n"); + + /* Do we have the arg? */ + if (next_jreg >= argc) + { + printf ("ERROR: no module specified.\n"); + return 0; + } + + /* Is the argument in range? */ + unsigned long int module_id = strtoul (argv[next_jreg], NULL, 16); + + if (module_id > 0xf) + { + printf ("ERROR: module value 0x%lx too large\n", module_id); + return 0; + } + + /* Compute the CRC */ + unsigned long int crc_in; + + crc_in = crc32 (1, 1, 0xffffffff); + crc_in = crc32 (module_id, 4, crc_in); + + /* Reverse the fields */ + module_id = reverse_bits (module_id, 4); + crc_in = reverse_bits (crc_in, 32); + + /* Allocate space and initialize the register + - 1 indicator bit + - 4 module bits in + - 32 bit CRC in + - 4 bits status out + - 32 bits CRC out + + Total 73 bits = 10 bytes */ + int num_bytes = 10; + unsigned char *jreg = malloc (num_bytes); + + if (NULL == jreg) + { + printf ("ERROR: malloc for SELECT_MODULE register failed.\n"); + return 0; + } + + memset (jreg, 0, num_bytes); + + jreg[0] = 0x01; + jreg[0] |= module_id << 1; + jreg[0] |= crc_in << 5; + jreg[1] = crc_in >> 3; + jreg[2] = crc_in >> 11; + jreg[3] = crc_in >> 19; + jreg[4] = crc_in >> 27; + + /* Note what we are shifting in and shift it. */ + dump_jreg (" shifting in", jreg, num_bytes); + double t = or1ksim_jtag_shift_dr (jreg, 32 + 4 + 32 + 4 + 1); + + /* Diagnose what we are shifting out. */ + dump_jreg (" shifted out", jreg, num_bytes); + + /* Break out fields */ + unsigned char status; + unsigned long int crc_out; + + status = ((jreg[4] >> 5) | (jreg[5] << 3)) & 0xf ; + + crc_out = ((unsigned long int) jreg[5] >> 1) | + ((unsigned long int) jreg[6] << 7) | + ((unsigned long int) jreg[7] << 15) | + ((unsigned long int) jreg[8] << 23) | + ((unsigned long int) jreg[9] << 31); + + /* Reverse the fields */ + status = reverse_bits (status, 4); + crc_out = reverse_bits (crc_out, 32); + + /* Compute our own CRC */ + unsigned long int crc_computed = crc32 (status, 4, 0xffffffff); + + /* Log the results */ + printf (" status: 0x%01x\n", status); + + if (crc_out != crc_computed) + { + printf (" CRC mismatch\n"); + printf (" CRC out: 0x%08lx\n", crc_out); + printf (" CRC computed: 0x%08lx\n", crc_computed); + } + + printf (" time taken: %.12fs\n", t); + + free (jreg); + return 1; /* Completed successfully */ + +} /* process_select_module () */ + + +/* --------------------------------------------------------------------------*/ +/*!Process a JTAG WRITE_COMMAND debug data register + + Usage: + + WRITE_COMMAND
+ + The argumens are all hex values: + - access_type Access type - 4 bits + - address 32-bit address + - length number of bytes to transer up to 2^16. + + Like all the JTAG fields these must be reversed, so they are shifted MS bit + first. They also require a 32-bit CRC. + + On return we get a status register and CRC. + + @param[in] next_jreg Offset into argv of the next JTAG register hex + string. + @param[in] argc argc from the main program (for checking next_jreg). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_write_command (int next_jreg, + int argc, + char *argv[]) +{ + printf ("Processing WRITE_COMMAND.\n"); + + /* Do we have the args */ + if (next_jreg + 3 > argc) + { + printf ("WRITE_COMMAND usage: WRITE_COMMAND
" + "\n"); + return 0; + } + + /* Are the arguments in range? Remember the length we actually put in has 1 + subtracted. */ + unsigned long int cmd = 2; /* WRITE_COMMAND */ + + unsigned long int access_type = strtoul (argv[next_jreg ], NULL, 16); + unsigned long int addr = strtoul (argv[next_jreg + 1], NULL, 16); + unsigned long int len = strtoul (argv[next_jreg + 2], NULL, 16) - 1; + + if (access_type > 0xf) + { + printf ("ERROR: WRITE_COMMAND access type 0x%lx too large\n", + access_type); + return 0; + } + + if (addr > 0xffffffff) + { + printf ("ERROR: WRITE_COMMAND address 0x%lx too large\n", addr); + return 0; + } + + if ((len + 1) < 0x1) + { + printf ("ERROR: WRITE_COMMAND length 0x%lx too small\n", len + 1); + return 0; + } + else if ((len + 1) > 0x10000) + { + printf ("ERROR: WRITE_COMMAND length 0x%lx too large\n", len + 1); + return 0; + } + + /* Compute the CRC */ + unsigned long int crc_in; + + crc_in = crc32 (0, 1, 0xffffffff); + crc_in = crc32 (cmd, 4, crc_in); + crc_in = crc32 (access_type, 4, crc_in); + crc_in = crc32 (addr, 32, crc_in); + crc_in = crc32 (len, 16, crc_in); + + /* Reverse the fields */ + cmd = reverse_bits (cmd, 4); + access_type = reverse_bits (access_type, 4); + addr = reverse_bits (addr, 32); + len = reverse_bits (len, 16); + crc_in = reverse_bits (crc_in, 32); + + /* Allocate space and initialize the register + - 1 indicator bit + - 4 bits command in + - 4 bits access type in + - 32 bits address in + - 16 bits length in + - 32 bits CRC in + - 4 bits status out + - 32 bits CRC out + + Total 125 bits = 16 bytes */ + int num_bytes = 16; + unsigned char *jreg = malloc (num_bytes); + + if (NULL == jreg) + { + printf ("ERROR: malloc for WRITE_COMMAND register failed.\n"); + return 0; + } + + memset (jreg, 0, num_bytes); + + jreg[ 0] = 0x0; + + jreg[ 0] |= cmd << 1; + + jreg[ 0] |= access_type << 5; + jreg[ 1] = access_type >> 3; + + jreg[ 1] |= addr << 1; + jreg[ 2] = addr >> 7; + jreg[ 3] = addr >> 15; + jreg[ 4] = addr >> 23; + jreg[ 5] = addr >> 31; + + jreg[ 5] |= len << 1; + jreg[ 6] = len >> 7; + jreg[ 7] = len >> 15; + + jreg[ 7] |= crc_in << 1; + jreg[ 8] = crc_in >> 7; + jreg[ 9] = crc_in >> 15; + jreg[10] = crc_in >> 23; + jreg[11] = crc_in >> 31; + + /* Note what we are shifting in and shift it. */ + dump_jreg (" shifting in", jreg, num_bytes); + double t = or1ksim_jtag_shift_dr (jreg, 32 + 4 + 32 + 16 + 32 + 4 + 4 + 1); + + /* Diagnose what we are shifting out. */ + dump_jreg (" shifted out", jreg, num_bytes); + + /* Break out fields */ + unsigned char status; + unsigned long int crc_out; + + status = (jreg[11] >> 1) & 0xf ; + + crc_out = ((unsigned long int) jreg[11] >> 5) | + ((unsigned long int) jreg[12] << 3) | + ((unsigned long int) jreg[13] << 11) | + ((unsigned long int) jreg[14] << 19) | + ((unsigned long int) jreg[15] << 27); + + /* Reverse the fields */ + status = reverse_bits (status, 4); + crc_out = reverse_bits (crc_out, 32); + + /* Compute our own CRC */ + unsigned long int crc_computed = crc32 (status, 4, 0xffffffff); + + /* Log the results */ + printf (" status: 0x%01x\n", status); + + if (crc_out != crc_computed) + { + printf (" CRC mismatch\n"); + printf (" CRC out: 0x%08lx\n", crc_out); + printf (" CRC computed: 0x%08lx\n", crc_computed); + } + + printf (" time taken: %.12fs\n", t); + + free (jreg); + return 1; /* Completed successfully */ + +} /* process_write_command () */ + + +/* --------------------------------------------------------------------------*/ +/*!Process a JTAG READ_COMMAND debug data register + + Usage: + + READ_COMMAND + + There are no arguments. It is used to read back the values used in a prior + WRITE_COMMAND. + + On return we get the access type, address, length, status register and CRC. + + @param[in] next_jreg Offset into argv of the next JTAG register hex + string. + @param[in] argc argc from the main program (for checking next_jreg). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_read_command (int next_jreg, + int argc, + char *argv[]) +{ + printf ("Processing READ_COMMAND.\n"); + + /* The only value on input is the READ_COMMAND command */ + unsigned long int cmd = 1; /* READ_COMMAND */ + + /* Compute the CRC */ + unsigned long int crc_in; + + crc_in = crc32 (0, 1, 0xffffffff); + crc_in = crc32 (cmd, 4, crc_in); + + /* Reverse the fields */ + cmd = reverse_bits (cmd, 4); + crc_in = reverse_bits (crc_in, 32); + + /* Allocate space and initialize the register + - 1 indicator bit + - 4 bits command in + - 32 bits CRC in + - 4 bits access type out + - 32 bits address out + - 16 bits length out + - 4 bits status out + - 32 bits CRC out + + Total 125 bits = 16 bytes */ + int num_bytes = 16; + unsigned char *jreg = malloc (num_bytes); + + if (NULL == jreg) + { + printf ("ERROR: malloc for READ_COMMAND register failed.\n"); + return 0; + } + + memset (jreg, 0, num_bytes); + + jreg[ 0] = 0x0; + + jreg[0] |= cmd << 1; + + jreg[0] |= crc_in << 5; + jreg[1] = crc_in >> 3; + jreg[2] = crc_in >> 11; + jreg[3] = crc_in >> 19; + jreg[4] = crc_in >> 27; + + /* Note what we are shifting in and shift it. */ + dump_jreg (" shifting in", jreg, num_bytes); + double t = or1ksim_jtag_shift_dr (jreg, 32 + 4 + 16 + 32 + 4 + 32 + 4 + 1); + + /* Diagnose what we are shifting out. */ + dump_jreg (" shifted out", jreg, num_bytes); + + /* Break out fields */ + unsigned char access_type; + unsigned long int addr; + unsigned long int len; + unsigned char status; + unsigned long int crc_out; + + access_type = ((jreg[4] >> 5) | (jreg[5] << 3)) & 0xf ; + addr = ((unsigned long int) jreg[ 5] >> 1) | + ((unsigned long int) jreg[ 6] << 7) | + ((unsigned long int) jreg[ 7] << 15) | + ((unsigned long int) jreg[ 8] << 23) | + ((unsigned long int) jreg[ 9] << 31); + + len = ((unsigned long int) jreg[ 9] >> 1) | + ((unsigned long int) jreg[10] << 7) | + ((unsigned long int) (jreg[11] & 0x1) << 15); + + status = (jreg[11] >> 1) & 0xf ; + + crc_out = ((unsigned long int) jreg[11] >> 5) | + ((unsigned long int) jreg[12] << 3) | + ((unsigned long int) jreg[13] << 11) | + ((unsigned long int) jreg[14] << 19) | + ((unsigned long int) jreg[15] << 27); + + /* Reverse the fields */ + + access_type = reverse_bits (access_type, 4); + addr = reverse_bits (addr, 32); + len = reverse_bits (len, 16); + status = reverse_bits (status, 4); + crc_out = reverse_bits (crc_out, 32); + + /* Compute our own CRC */ + unsigned long int crc_computed; + + crc_computed = crc32 (access_type, 4, 0xffffffff); + crc_computed = crc32 (addr, 32, crc_computed); + crc_computed = crc32 (len, 16, crc_computed); + crc_computed = crc32 (status, 4, crc_computed); + + /* Log the results. Remember the length is 1 greater than the value + returned. */ + printf (" access_type: 0x%x\n", access_type); + printf (" address: 0x%lx\n", addr); + printf (" length: 0x%lx\n", len + 1); + printf (" status: 0x%x\n", status); + + if (crc_out != crc_computed) + { + printf (" CRC mismatch\n"); + printf (" CRC out: 0x%08lx\n", crc_out); + printf (" CRC computed: 0x%08lx\n", crc_computed); + } + + printf (" time taken: %.12fs\n", t); + + free (jreg); + return 1; /* Completed successfully */ + +} /* process_read_command () */ + + +/* --------------------------------------------------------------------------*/ +/*!Process a JTAG GO_COMMAND_WRITE debug data register + + Usage: + + GO_COMMAND_WRITE + + The one argument is a string of bytes to be written, LS byte first. + + Like all the JTAG fields, each data byte must be reversed, so it is shifted + MS bit first. It also requires a 32-bit CRC. + + On return we get a status register and CRC. + + @param[in] next_jreg Offset into argv of the next JTAG register hex + string. + @param[in] argc argc from the main program (for checking next_jreg). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_go_command_write (int next_jreg, + int argc, + char *argv[]) +{ + printf ("Processing GO_COMMAND_WRITE.\n"); + + /* Do we have the arg */ + if (next_jreg >= argc) + { + printf ("GO_COMMAND_WRITE usage: GO_COMMAND_WRITE .\n"); + return 0; + } + + /* Break out the fields, including the data string into a vector of bytes. */ + unsigned long int cmd = 0; /* GO_COMMAND */ + + char *data_str = argv[next_jreg]; + int data_len = strlen (data_str); + int data_bytes = data_len / 2; + unsigned char *data = malloc (data_bytes); + + if (NULL == data) + { + printf ("ERROR: data malloc for GO_COMMAND_WRITE register failed.\n"); + return 0; + } + + if (1 == (data_len % 2)) + { + printf ("Warning: GO_COMMAND_WRITE odd char ignored\n"); + } + + int i; + + for (i = 0; i < data_bytes; i++) + { + int ch_off_ms = i * 2; + int ch_off_ls = i * 2 + 1; + + /* Get each nybble in turn, remembering that we may not have a MS nybble + if the data string has an odd number of chars. */ + data[i] = 0; + + int j; + + for (j = ch_off_ms; j <= ch_off_ls; j++) + { + char c = data_str[j]; + int dig_val = (('0' <= c) && (c <= '9')) ? c - '0' : + (('a' <= c) && (c <= 'f')) ? c - 'a' + 10 : + (('A' <= c) && (c <= 'F')) ? c - 'A' + 10 : -1; + + if (dig_val < 0) + { + printf ("ERROR: Non-hex digit in data: %c\n", c); + free (data); + return 0; + } + + data[i] = (data[i] << 4) | dig_val; + } + } + + /* Are the arguments in range? Remember the length we actually put in has 1 + subtracted. */ + + /* Compute the CRC */ + unsigned long int crc_in; + + crc_in = crc32 (0, 1, 0xffffffff); + crc_in = crc32 (cmd, 4, crc_in); + + for (i = 0; i < data_bytes; i++) + { + crc_in = crc32 (data[i], 8, crc_in); + } + + /* Reverse the fields */ + cmd = reverse_bits (cmd, 4); + + for (i = 0; i < data_bytes; i++) + { + data[i] = reverse_bits (data[i], 8); + } + + crc_in = reverse_bits (crc_in, 32); + + /* Allocate space and initialize the register + - 1 indicator bit + - 4 bits command in + - data_bytes * 8 bits access type in + - 32 bits CRC in + - 4 bits status out + - 32 bits CRC out + + Total 73 + data_bytes * 8 bits = 10 + data_bytes bytes */ + int num_bytes = 10 + data_bytes; + unsigned char *jreg = malloc (num_bytes); + + if (NULL == jreg) + { + printf ("ERROR: jreg malloc for GO_COMMAND_WRITE register failed.\n"); + free (data); + return 0; + } + + memset (jreg, 0, num_bytes); + + jreg[ 0] = 0x0; + jreg[ 0] |= cmd << 1; + + for (i = 0; i < data_bytes; i++) + { + jreg[i] |= data[i] << 5; + jreg[i + 1] = data[i] >> 3; + } + + jreg[data_bytes ] |= crc_in << 5; + jreg[data_bytes + 1] = crc_in >> 3; + jreg[data_bytes + 2] = crc_in >> 11; + jreg[data_bytes + 3] = crc_in >> 19; + jreg[data_bytes + 4] = crc_in >> 27; + + /* Note what we are shifting in and shift it. */ + dump_jreg (" shifting in", jreg, num_bytes); + double t = or1ksim_jtag_shift_dr (jreg, + 32 + 4 + 32 + data_bytes * 8 + 4 + 1); + + /* Diagnose what we are shifting out. */ + dump_jreg (" shifted out", jreg, num_bytes); + + /* Break out fields */ + unsigned char status; + unsigned long int crc_out; + + status = ((jreg[data_bytes + 4] >> 5) | (jreg[data_bytes + 5] << 3)) & 0xf ; + + crc_out = ((unsigned long int) jreg[data_bytes + 5] >> 1) | + ((unsigned long int) jreg[data_bytes + 6] << 7) | + ((unsigned long int) jreg[data_bytes + 7] << 15) | + ((unsigned long int) jreg[data_bytes + 8] << 23) | + ((unsigned long int) jreg[data_bytes + 9] << 31); + + /* Reverse the fields */ + status = reverse_bits (status, 4); + crc_out = reverse_bits (crc_out, 32); + + /* Compute our own CRC */ + unsigned long int crc_computed = crc32 (status, 4, 0xffffffff); + + /* Log the results */ + printf (" status: 0x%01x\n", status); + + if (crc_out != crc_computed) + { + printf (" CRC mismatch\n"); + printf (" CRC out: 0x%08lx\n", crc_out); + printf (" CRC computed: 0x%08lx\n", crc_computed); + } + + printf (" time taken: %.12fs\n", t); + + free (data); + free (jreg); + return 1; /* Completed successfully */ + +} /* process_go_command_write () */ + + +/* --------------------------------------------------------------------------*/ +/*!Process a JTAG GO_COMMAND_READ debug data register + + Usage: + + GO_COMMAND_READ + + The one argument is a length in hex, specifying the number of bytes to be + read. + + On return we get a status register and CRC. + + Like all JTAG fields, the CRC shifted in, the data read back, the status + and CRC shifted out, must be reversed, since they are shifted in MS bit + first and out LS bit first. + + @param[in] next_jreg Offset into argv of the next JTAG register hex + string. + @param[in] argc argc from the main program (for checking next_jreg). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_go_command_read (int next_jreg, + int argc, + char *argv[]) +{ + printf ("Processing GO_COMMAND_READ.\n"); + + /* Do we have the args */ + if (next_jreg >= argc) + { + printf ("GO_COMMAND_READ usage: GO_COMMAND_READ \n"); + return 0; + } + + /* Is the argument in range? Remember the length we actually put in has 1 + subtracted, so although it is a 16-bit field, it can be up to 2^16. */ + unsigned long int cmd = 0; /* GO_COMMAND */ + unsigned long int data_bytes = strtoul (argv[next_jreg], NULL, 16); + + if (data_bytes < 0) + { + printf ("ERROR: GO_COMMAND_READ length 0x%lx too small\n", data_bytes); + return 0; + } + else if (data_bytes > 0x10000) + { + printf ("ERROR: GO_COMMAND_READ length 0x%lx too large\n", data_bytes); + return 0; + } + + /* Compute the CRC */ + unsigned long int crc_in; + + crc_in = crc32 (0, 1, 0xffffffff); + crc_in = crc32 (cmd, 4, crc_in); + + /* Reverse the fields */ + cmd = reverse_bits (cmd, 4); + crc_in = reverse_bits (crc_in, 32); + + /* Allocate space and initialize the register + - 1 indicator bit + - 4 bits command in + - 32 bits CRC in + - data_bytes * 8 bits access type out + - 4 bits status out + - 32 bits CRC out + + Total 73 + data_bytes * 8 bits = 10 + data_bytes bytes */ + int num_bytes = 10 + data_bytes; + unsigned char *jreg = malloc (num_bytes); + + if (NULL == jreg) + { + printf ("ERROR: malloc forGO_COMMAND_READ register failed.\n"); + return 0; + } + + memset (jreg, 0, num_bytes); + + jreg[0] = 0x0; + jreg[0] |= cmd << 1; + + jreg[0] |= crc_in << 5; + jreg[1] = crc_in >> 3; + jreg[2] = crc_in >> 11; + jreg[3] = crc_in >> 19; + jreg[4] = crc_in >> 27; + + /* Note what we are shifting in and shift it. */ + dump_jreg (" shifting in", jreg, num_bytes); + double t = or1ksim_jtag_shift_dr (jreg, + 32 + 4 + data_bytes * 8 + 32 + 4 + 1); + + /* Diagnose what we are shifting out. */ + dump_jreg (" shifted out", jreg, num_bytes); + + /* Break out fields */ + unsigned char *data = malloc (data_bytes); + unsigned char status; + unsigned long int crc_out; + + if (NULL == data) + { + printf ("ERROR: data malloc for GO_COMMAND_READ register failed.\n"); + free (jreg); + return 0; + } + + int i; + + for (i = 0; i < data_bytes; i++) + { + data[i] = ((jreg[i + 4] >> 5) | (jreg[i + 5] << 3)) & 0xff; + } + + status = ((jreg[data_bytes + 4] >> 5) | (jreg[data_bytes + 5] << 3)) & 0xf ; + + crc_out = ((unsigned long int) jreg[data_bytes + 5] >> 1) | + ((unsigned long int) jreg[data_bytes + 6] << 7) | + ((unsigned long int) jreg[data_bytes + 7] << 15) | + ((unsigned long int) jreg[data_bytes + 8] << 23) | + ((unsigned long int) jreg[data_bytes + 9] << 31); + + /* Reverse the fields */ + for (i = 0; i < data_bytes; i++) + { + data[i] = reverse_bits (data[i], 8); + } + + status = reverse_bits (status, 4); + crc_out = reverse_bits (crc_out, 32); + + /* Compute our own CRC */ + unsigned long int crc_computed = 0xffffffff; + + for (i = 0; i < data_bytes; i++) + { + crc_computed = crc32 (data[i], 8, crc_computed); + } + + crc_computed = crc32 (status, 4, crc_computed); + + /* Log the results, remembering these are bytes, so endianness is not a + factor here. Since the OR1K is big endian, the lowest numbered byte will + be the least significant, and the first printed */ + printf (" data: "); + + for (i = 0; i < data_bytes; i++) + { + printf ("%02x", data[i]); + } + + printf ("\n"); + printf (" status: 0x%01x\n", status); + + if (crc_out != crc_computed) + { + printf (" CRC mismatch\n"); + printf (" CRC out: 0x%08lx\n", crc_out); + printf (" CRC computed: 0x%08lx\n", crc_computed); + } + + printf (" time taken: %.12fs\n", t); + + free (data); + free (jreg); + return 1; /* Completed successfully */ + +} /* process_go_command_read () */ + + +/* --------------------------------------------------------------------------*/ +/*!Process a JTAG WRITE_CONTROL debug data register + + Usage: + + WRITE_CONTROL + + The arguments should be either zero or one. + + The arguments are used to construct the 52-bit CPU control register. Like + all JTAG fields, it must be reversed, so it is shifted MS bit first. It + also requires a 32-bit CRC. + + On return we get a status register and CRC. + + @param[in] next_jreg Offset into argv of the next JTAG register hex + string. + @param[in] argc argc from the main program (for checking next_jreg). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_write_control (int next_jreg, + int argc, + char *argv[]) +{ + printf ("Processing WRITE_CONTROL.\n"); + + /* Do we have the args */ + if (next_jreg + 2 > argc) + { + printf ("WRITE_CONTROL usage: WRITE_CONTROL \n"); + return 0; + } + + /* Are the arguments in range? */ + unsigned long int cmd = 4; /* WRITE_CONTROL */ + + unsigned long int reset = strtoul (argv[next_jreg ], NULL, 16); + unsigned long int stall = strtoul (argv[next_jreg + 1], NULL, 16); + + if (reset > 0x1) + { + printf ("ERROR: invalid WRITE_CONTROL reset value 0x%lx.\n", reset); + return 0; + } + + if (stall > 0x1) + { + printf ("ERROR: invalid WRITE_CONTROL stall value 0x%lx.\n", stall); + return 0; + } + + /* Construct the control register */ + unsigned long long int creg = ((unsigned long long int) reset << 51) | + ((unsigned long long int) stall << 50); + + /* Compute the CRC */ + unsigned long int crc_in; + + crc_in = crc32 (0, 1, 0xffffffff); + crc_in = crc32 (cmd, 4, crc_in); + crc_in = crc32 (creg, 52, crc_in); + + /* Reverse the fields */ + cmd = reverse_bits (cmd, 4); + creg = reverse_bits (creg, 52); + crc_in = reverse_bits (crc_in, 32); + + /* Allocate space and initialize the register + - 1 indicator bit + - 4 bits command in + - 52 bits control register + - 32 bits CRC in + - 4 bits status out + - 32 bits CRC out + + Total 125 bits = 16 bytes */ + int num_bytes = 16; + unsigned char *jreg = malloc (num_bytes); + + if (NULL == jreg) + { + printf ("ERROR: malloc for WRITE_CONTROL register failed.\n"); + return 0; + } + + memset (jreg, 0, num_bytes); + + jreg[ 0] = 0x0; + + jreg[ 0] |= cmd << 1; + + jreg[ 0] |= creg << 5; + jreg[ 1] = creg >> 3; + jreg[ 2] = creg >> 11; + jreg[ 3] = creg >> 19; + jreg[ 4] = creg >> 27; + jreg[ 5] = creg >> 35; + jreg[ 6] = creg >> 43; + jreg[ 7] = creg >> 51; + + jreg[ 7] |= crc_in << 1; + jreg[ 8] = crc_in >> 7; + jreg[ 9] = crc_in >> 15; + jreg[10] = crc_in >> 23; + jreg[11] = crc_in >> 31; + + /* Note what we are shifting in and shift it. */ + dump_jreg (" shifting in", jreg, num_bytes); + double t = or1ksim_jtag_shift_dr (jreg, 32 + 4 + 32 + 52 + 4 + 1); + + /* Diagnose what we are shifting out. */ + dump_jreg (" shifted out", jreg, num_bytes); + + /* Break out fields */ + unsigned char status; + unsigned long int crc_out; + + status = (jreg[11] >> 1) & 0xf ; + + crc_out = ((unsigned long int) jreg[11] >> 5) | + ((unsigned long int) jreg[12] << 3) | + ((unsigned long int) jreg[13] << 11) | + ((unsigned long int) jreg[14] << 19) | + ((unsigned long int) jreg[15] << 27); + + /* Reverse the fields */ + status = reverse_bits (status, 4); + crc_out = reverse_bits (crc_out, 32); + + /* Compute our own CRC */ + unsigned long int crc_computed = crc32 (status, 4, 0xffffffff); + + /* Log the results */ + printf (" status: 0x%01x\n", status); + + if (crc_out != crc_computed) + { + printf (" CRC mismatch\n"); + printf (" CRC out: 0x%08lx\n", crc_out); + printf (" CRC computed: 0x%08lx\n", crc_computed); + } + + printf (" time taken: %.12fs\n", t); + + free (jreg); + return 1; /* Completed successfully */ + +} /* process_write_control () */ + + +/* --------------------------------------------------------------------------*/ +/*!Process a JTAG READ_CONTROL debug data register + + Usage: + + READ_CONTROL + + There are no arguments. It requires a 32-bit CRC. + + On return we get the control register, status and CRC. + + Like all the JTAG fields, they must be reversed, as resutl is shifted out + LS bit first. + + @param[in] next_jreg Offset into argv of the next JTAG register hex + string. + @param[in] argc argc from the main program (for checking next_jreg). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_read_control (int next_jreg, + int argc, + char *argv[]) +{ + printf ("Processing READ_CONTROL.\n"); + + /* Only input field is cmd. */ + unsigned long int cmd = 3; /* READ_CONTROL */ + + /* Compute the CRC */ + unsigned long int crc_in; + + crc_in = crc32 (0, 1, 0xffffffff); + crc_in = crc32 (cmd, 4, crc_in); + + /* Reverse the fields */ + cmd = reverse_bits (cmd, 4); + crc_in = reverse_bits (crc_in, 32); + + /* Allocate space and initialize the register + - 1 indicator bit + - 4 bits command in + - 32 bits CRC in + - 52 bits control register out + - 4 bits status out + - 32 bits CRC out + + Total 125 bits = 16 bytes */ + int num_bytes = 16; + unsigned char *jreg = malloc (num_bytes); + + if (NULL == jreg) + { + printf ("ERROR: malloc for READ_CONTROL register failed.\n"); + return 0; + } + + memset (jreg, 0, num_bytes); + + jreg[0] = 0x0; + + jreg[0] |= cmd << 1; + + jreg[0] |= crc_in << 5; + jreg[1] = crc_in >> 3; + jreg[2] = crc_in >> 11; + jreg[3] = crc_in >> 19; + jreg[4] = crc_in >> 27; + + /* Note what we are shifting in and shift it. */ + dump_jreg (" shifting in", jreg, num_bytes); + double t = or1ksim_jtag_shift_dr (jreg, 32 + 4 + 52 + 32 + 4 + 1); + + /* Diagnose what we are shifting out. */ + dump_jreg (" shifted out", jreg, num_bytes); + + /* Break out fields */ + unsigned long long int creg; + unsigned char status; + unsigned long int crc_out; + + creg = ((unsigned long long int) jreg[ 4] >> 5) | + ((unsigned long long int) jreg[ 5] << 3) | + ((unsigned long long int) jreg[ 6] << 11) | + ((unsigned long long int) jreg[ 7] << 19) | + ((unsigned long long int) jreg[ 8] << 27) | + ((unsigned long long int) jreg[ 9] << 35) | + ((unsigned long long int) jreg[10] << 43) | + ((unsigned long long int) (jreg[11] & 0x1) << 51); + + status = (jreg[11] >> 1) & 0xf ; + + crc_out = ((unsigned long int) jreg[11] >> 5) | + ((unsigned long int) jreg[12] << 3) | + ((unsigned long int) jreg[13] << 11) | + ((unsigned long int) jreg[14] << 19) | + ((unsigned long int) jreg[15] << 27); + + /* Reverse the fields */ + creg = reverse_bits (creg, 52); + status = reverse_bits (status, 4); + crc_out = reverse_bits (crc_out, 32); + + /* Compute our own CRC */ + unsigned long int crc_computed; + + crc_computed = crc32 (creg, 52, 0xffffffff); + crc_computed = crc32 (status, 4, crc_computed); + + const char *reset = (1 == ((creg >> 51) & 1)) ? "enabled" : "disabled"; + const char *stall = (1 == ((creg >> 50) & 1)) ? "stalled" : "unstalled"; + + /* Log the results */ + printf (" reset: %s\n", reset); + printf (" stall: %s\n", stall); + printf (" status: 0x%01x\n", status); + + if (crc_out != crc_computed) + { + printf (" CRC mismatch\n"); + printf (" CRC out: 0x%08lx\n", crc_out); + printf (" CRC computed: 0x%08lx\n", crc_computed); + } + + printf (" time taken: %.12fs\n", t); + + free (jreg); + return 1; /* Completed successfully */ + +} /* process_read_control () */ + + +/* --------------------------------------------------------------------------*/ +/*!Main program + + Build an or1ksim program using the library which loads a program and config + from the command line and then drives JTAG. + + lib-jtag-full [] + [ []] ... + + - config-file An Or1ksim configuration file. + - image A OpenRISC binary image to load into Or1ksim + - jregtype One of RESET, INSTRUCTION, SELECT_MODULE, WRITE_COMMAND, + READ_COMMAND, GO_COMMAND_WRITE, GO_COMMAND_READ, + WRITE_CONTROL or READ_CONTROL. + - args Arguments required by the jregtype. RESET, READ_COMMAND and + READ_CONTROL require none. + + The target program is run in bursts of 1ms execution, and the type of + return (OK, hit breakpoint) noted. Between each burst of execution, the + JTAG interface is reset (for RESET) or the next register is submitted to + the corresponding Or1ksim JTAG interface and the resulting register noted. + + @param[in] argc Number of elements in argv + @param[in] argv Vector of program name and arguments + + @return Return code for the program, zero on success. */ +/* --------------------------------------------------------------------------*/ +int +main (int argc, + char *argv[]) +{ + const double QUANTUM = 5.0e-3; /* Time in sec for each step. */ + + /* Check we have minimum number of args. */ + if (argc < 4) + { + printf ("usage: lib-jtag [] " + "[ []] ...\n"); + return 1; + } + + /* Dummy argv array to pass arguments to or1ksim_init. Varies depending on + whether an image file is specified. */ + int dummy_argc; + char *dummy_argv[5]; + + dummy_argv[0] = "libsim"; + dummy_argv[1] = "-q"; + dummy_argv[2] = "-f"; + dummy_argv[3] = argv[1]; + dummy_argv[4] = argv[2]; + + dummy_argc = 5; + + /* Initialize the program. Put the initialization message afterwards, or it + will get swamped by the Or1ksim header. */ + if (0 == or1ksim_init (dummy_argc, dummy_argv, NULL, NULL, NULL)) + { + printf ("Initalization succeeded.\n"); + } + else + { + printf ("Initalization failed.\n"); + return 1; + } + + /* Run repeatedly for 10 milliseconds until we have processed all JTAG + registers */ + int next_jreg = 3; /* Offset to next JTAG register */ + + do + { + switch (or1ksim_run (QUANTUM)) + { + case OR1KSIM_RC_OK: + printf ("Execution step completed OK.\n"); + break; + + case OR1KSIM_RC_BRKPT: + printf ("Execution step completed with breakpoint.\n"); + break; + + default: + printf ("ERROR: run failed.\n"); + return 1; + } + + /* Process the next register appropriately, skipping any args after + processing. */ + char *jregtype = argv[next_jreg++]; + + if (0 == strcasecmp ("RESET", jregtype)) + { + printf ("Resetting JTAG.\n"); + or1ksim_jtag_reset (); + } + else if (0 == strcasecmp ("INSTRUCTION", jregtype)) + { + if (process_instruction (next_jreg, argc, argv)) + { + next_jreg++; /* succeeded */ + } + else + { + return 1; /* failed */ + } + } + else if (0 == strcasecmp ("SELECT_MODULE", jregtype)) + { + if (process_select_module (next_jreg, argc, argv)) + { + next_jreg++; /* succeeded */ + } + else + { + return 1; /* failed */ + } + } + else if (0 == strcasecmp ("WRITE_COMMAND", jregtype)) + { + if (process_write_command (next_jreg, argc, argv)) + { + next_jreg += 3; /* succeeded */ + } + else + { + return 1; /* failed */ + } + } + else if (0 == strcasecmp ("READ_COMMAND", jregtype)) + { + if (process_read_command (next_jreg, argc, argv)) + { + /* succeeded (no args) */ + } + else + { + return 1; /* failed */ + } + } + else if (0 == strcasecmp ("GO_COMMAND_WRITE", jregtype)) + { + if (process_go_command_write (next_jreg, argc, argv)) + { + next_jreg++; /* succeeded */ + } + else + { + return 1; /* failed */ + } + } + else if (0 == strcasecmp ("GO_COMMAND_READ", jregtype)) + { + if (process_go_command_read (next_jreg, argc, argv)) + { + next_jreg++; /* succeeded */ + } + else + { + return 1; /* failed */ + } + } + else if (0 == strcasecmp ("WRITE_CONTROL", jregtype)) + { + if (process_write_control (next_jreg, argc, argv)) + { + next_jreg += 2; /* succeeded */ + } + else + { + return 1; /* failed */ + } + } + else if (0 == strcasecmp ("READ_CONTROL", jregtype)) + { + if (process_read_control (next_jreg, argc, argv)) + { + /* succeeded (no args) */ + } + else + { + return 1; /* failed */ + } + } + else + { + printf ("ERROR: Unrecognized JTAG register '%s'.\n", jregtype); + return 1; + } + } + while (next_jreg < argc); + + /* A little longer to allow response to last upcall to be handled. */ + switch (or1ksim_run (QUANTUM)) + { + case OR1KSIM_RC_OK: + printf ("Execution step completed OK.\n"); + break; + + case OR1KSIM_RC_BRKPT: + printf ("Execution step completed with breakpoint.\n"); + break; + + default: + printf ("ERROR: run failed.\n"); + return 1; + } + + printf ("Test completed successfully.\n"); + return 0; + +} /* main () */
lib-jtag/lib-jtag-full.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-jtag/lib-jtag.c =================================================================== --- lib-jtag/lib-jtag.c (nonexistent) +++ lib-jtag/lib-jtag.c (revision 388) @@ -0,0 +1,357 @@ +/* lib-jtag.c. Basic test of Or1ksim library JTAG interface. + + Copyright (C) 1999-2006 OpenCores + Copyright (C) 2010 Embecosm Limited + + Contributors various OpenCores participants + Contributor Jeremy Bennett + + This file is part of OpenRISC 1000 Architectural Simulator. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . */ + +/* ---------------------------------------------------------------------------- + This code is commented throughout for use with Doxygen. + --------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include + +#include "or1ksim.h" + + +/* --------------------------------------------------------------------------*/ +/*!Dump a JTAG register + + Prefix with the supplied string and add a newline afterwards. + + @param[in] prefix Prefix string to print out + @param[in] jreg The JTAG register + @param[in] num_bytes The number of bytes in the register */ +/* --------------------------------------------------------------------------*/ +static void +dump_jreg (const char *prefix, + unsigned char *jreg, + int num_bytes) +{ + int i; + + printf ("%s: ", prefix); + + /* Dump each byte in turn */ + for (i = num_bytes - 1; i >=0; i--) + { + printf ("%02x", jreg[i]); + } + + printf ("\n"); + +} /* dump_jreg () */ + + +/* --------------------------------------------------------------------------*/ +/*!Convert a hex char into its value. + + @param[in] c The char to convert + + @return The value represented by the char, or -1 if it's not a valid + char. */ +/* --------------------------------------------------------------------------*/ +static int +hexch2val (char c) +{ + switch (c) + { + case '0': return 0; + case '1': return 1; + case '2': return 2; + case '3': return 3; + case '4': return 4; + case '5': return 5; + case '6': return 6; + case '7': return 7; + case '8': return 8; + case '9': return 9; + + case 'a': case 'A': return 10; + case 'b': case 'B': return 11; + case 'c': case 'C': return 12; + case 'd': case 'D': return 13; + case 'e': case 'E': return 14; + case 'f': case 'F': return 15; + + default: + return -1; + } +} /* hexch2val () */ + + +/* --------------------------------------------------------------------------*/ +/*!Shift a JTAG register. + + Almost all this code is common between the instruction and data + registers. All that varies is the library function called and the error + message if anything goes wrong. So we common things up here. + + @param[in] type 'D' if this is a data register, 'I' if an instruction + register. + @param[in] next_jreg Offset into argv of the next JTAG register length + field. + @param[in] argc argc from the main program (for checking next_jref). + @param[in] argv argv from the main program. + + @return 1 (TRUE) on success, 0 (FALSE) on failure. */ +/* --------------------------------------------------------------------------*/ +static int +process_jreg (const char type, + int next_jreg, + int argc, + char *argv[]) +{ + const char *long_name = ('D' == type) ? "data" : "instruction"; + + /* Do we have the arg (length and value)? */ + if ((next_jreg + 1) > argc) + { + printf ("ERROR: no %s register found.\n", long_name); + return 0; + } + + /* Get the length field */ + int bit_len = strtol (argv[next_jreg++], NULL, 0); + + if (0 == bit_len) + { + printf ("ERROR: invalid register length\n"); + return 0; + } + + /* Is the reg an exact number of bytes? */ + char *hex_str = argv[next_jreg]; + int num_chars = strlen (hex_str); + int num_bytes = (bit_len + 7) / 8; + + if (num_chars > (2 * num_bytes)) + { + printf ("Warning: Too many digits for register: truncated.\n"); + } + + /* Allocate and clear space */ + unsigned char *jreg = malloc (num_bytes); + + if (NULL == jreg) + { + printf ("ERROR: malloc for %s register failed.\n", long_name); + return 0; + } + + memset (jreg, 0, num_bytes); + + /* Initialize the register. The hex presentation is MS byte of the string on + the left (i.e. at offset 0), but the internal representation is LS byte + at the lowest address. */ + int i; + + for (i = num_chars - 1; i >= 0; i--) + { + int dig_num = num_chars - 1 - i; /* Which digit */ + int dig_val = hexch2val (hex_str[i]); + + if (dig_val < 0) + { + printf ("ERROR: %c not valid hex digit.\n", hex_str[i]); + free (jreg); + return 0; + } + + /* MS digits are the odd numbered ones */ + jreg[dig_num / 2] |= (0 == (dig_num % 2)) ? dig_val : dig_val << 4; + } + + /* Note what we are doing */ + dump_jreg (" shifting in", jreg, num_bytes); + + double t; + + if ('D' == type) + { + t = or1ksim_jtag_shift_dr (jreg, bit_len); + } + else + { + t = or1ksim_jtag_shift_ir (jreg, bit_len); + } + + dump_jreg (" shifted out", jreg, num_bytes); + printf (" time taken %.12fs\n", t); + + free (jreg); + return 1; /* Completed successfully */ + +} /* process_jreg () */ + + +/* --------------------------------------------------------------------------*/ +/*!Main program + + Build an or1ksim program using the library which loads a program and config + from the command line which will drive JTAG. + + lib-jtag [ ] + [ [ ]] ... + + - config-file An Or1ksim configuration file. + - image A OpenRISC binary image to load into Or1ksim + - jtype One of 'R' (JTAG reset), 'I' (JTAG instruction register) or + 'D' (JTAG data register). + - bitlen If jtype is 'D' or 'I', the number of bits in the JTAG + register. + - reg If jtype is 'D' or 'I', a JTAG register specified in + hex. Specified LS digit on the right, and leading zeros may + be omitted. + + The target program is run in bursts of 1ms execution, and the type of + return (OK, hit breakpoint) noted. Between each burst of execution, the + next register is submitted to the corresponding Or1ksim JTAG interface + function, and the resulting register (for 'I' and 'D') noted. + + @param[in] argc Number of elements in argv + @param[in] argv Vector of program name and arguments + + @return Return code for the program. */ +/* --------------------------------------------------------------------------*/ +int +main (int argc, + char *argv[]) +{ + /* Check we have minimum number of args. */ + if (argc < 4) + { + printf ("usage: lib-jtag [ ] " + "[ [ ]] ...\n"); + return 1; + } + + /* Dummy argv array to pass arguments to or1ksim_init. Varies depending on + whether an image file is specified. */ + int dummy_argc; + char *dummy_argv[5]; + + dummy_argv[0] = "libsim"; + dummy_argv[1] = "-q"; + dummy_argv[2] = "-f"; + dummy_argv[3] = argv[1]; + dummy_argv[4] = argv[2]; + + dummy_argc = 5; + + /* Initialize the program. Put the initialization message afterwards, or it + will get swamped by the Or1ksim header. */ + if (0 == or1ksim_init (dummy_argc, dummy_argv, NULL, NULL, NULL)) + { + printf ("Initalization succeeded.\n"); + } + else + { + printf ("Initalization failed.\n"); + return 1; + } + + /* Run repeatedly for 1 millisecond until we have processed all JTAG + registers */ + int next_jreg = 3; /* Offset to next JTAG register */ + + do + { + switch (or1ksim_run (1.0e-3)) + { + case OR1KSIM_RC_OK: + printf ("Execution step completed OK.\n"); + break; + + case OR1KSIM_RC_BRKPT: + printf ("Execution step completed with breakpoint.\n"); + break; + + default: + printf ("ERROR: run failed.\n"); + return 1; + } + + /* Process the next arg appropriately. */ + switch (argv[next_jreg++][0]) + { + case 'R': + printf ("Resetting JTAG.\n"); + or1ksim_jtag_reset (); + break; + + case 'I': + printf ("Shifting instruction register.\n"); + + if (process_jreg ('I', next_jreg, argc, argv)) + { + next_jreg += 2; + } + else + { + return 1; /* Something went wrong */ + } + + break; + + case 'D': + printf ("Shifting data register.\n"); + + if (process_jreg ('D', next_jreg, argc, argv)) + { + next_jreg += 2; + } + else + { + return 1; /* Something went wrong */ + } + + break; + + default: + printf ("ERROR: unknown JTAG request type.\n"); + return 1; + } + } + while (next_jreg < argc); + + /* A little longer to allow response to last upcall to be handled. */ + switch (or1ksim_run (1.0e-3)) + { + case OR1KSIM_RC_OK: + printf ("Execution step completed OK.\n"); + break; + + case OR1KSIM_RC_BRKPT: + printf ("Execution step completed with breakpoint.\n"); + break; + + default: + printf ("ERROR: run failed.\n"); + return 1; + } + + printf ("Test completed successfully.\n"); + return 0; + +} /* main () */
lib-jtag/lib-jtag.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-jtag/Makefile.am =================================================================== --- lib-jtag/Makefile.am (nonexistent) +++ lib-jtag/Makefile.am (revision 388) @@ -0,0 +1,39 @@ +# Makefile.am for libor1ksim test programs for JTAG + +# Copyright (C) Embecosm Limited, 2010 + +# Contributor Jeremy Bennett + +# This file is part of OpenRISC 1000 Architectural Simulator. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . */ + +# ----------------------------------------------------------------------------- +# This code is commented throughout for use with Doxygen. +# ----------------------------------------------------------------------------- + + +# Programs to handle the JTAG interface +check_PROGRAMS = lib-jtag \ + lib-jtag-full + +# Simple JTAG handling +lib_jtag_SOURCES = lib-jtag.c + +lib_jtag_LDADD = $(top_builddir)/libsim.la + +# Simple JTAG handling +lib_jtag_full_SOURCES = lib-jtag-full.c + +lib_jtag_full_LDADD = $(top_builddir)/libsim.la
lib-jtag/Makefile.am Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-inttest/Makefile.in =================================================================== --- lib-inttest/Makefile.in (nonexistent) +++ lib-inttest/Makefile.in (revision 388) @@ -0,0 +1,529 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am for libor1ksim test program: lib-inttest + +# Copyright (C) Embecosm Limited, 2010 + +# Contributor Jeremy Bennett + +# This file is part of OpenRISC 1000 Architectural Simulator. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . */ + +# ----------------------------------------------------------------------------- +# This code is commented throughout for use with Doxygen. +# ----------------------------------------------------------------------------- +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +check_PROGRAMS = lib-inttest-edge$(EXEEXT) lib-inttest-level$(EXEEXT) +subdir = testsuite/test-code/lib-inttest +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_lib_inttest_edge_OBJECTS = lib-inttest-edge.$(OBJEXT) +lib_inttest_edge_OBJECTS = $(am_lib_inttest_edge_OBJECTS) +lib_inttest_edge_DEPENDENCIES = $(top_builddir)/libsim.la +am_lib_inttest_level_OBJECTS = lib-inttest-level.$(OBJEXT) +lib_inttest_level_OBJECTS = $(am_lib_inttest_level_OBJECTS) +lib_inttest_level_DEPENDENCIES = $(top_builddir)/libsim.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(lib_inttest_edge_SOURCES) $(lib_inttest_level_SOURCES) +DIST_SOURCES = $(lib_inttest_edge_SOURCES) \ + $(lib_inttest_level_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARFLAGS = @ARFLAGS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_DIR = @BUILD_DIR@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_ARCH = @CPU_ARCH@ +CYGPATH_W = @CYGPATH_W@ +DEBUGFLAGS = @DEBUGFLAGS@ +DEFS = @DEFS@ +DEJAGNU = @DEJAGNU@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INCLUDES = @INCLUDES@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOCAL_CFLAGS = @LOCAL_CFLAGS@ +LOCAL_DEFS = @LOCAL_DEFS@ +LOCAL_LDFLAGS = @LOCAL_LDFLAGS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ +RANLIB = @RANLIB@ +RUNTESTDEFAULTFLAGS = @RUNTESTDEFAULTFLAGS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SUMVERSION = @SUMVERSION@ +TERMCAP_LIB = @TERMCAP_LIB@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# Edge based interrupt +lib_inttest_edge_SOURCES = lib-inttest-edge.c +lib_inttest_edge_LDADD = $(top_builddir)/libsim.la + +# Level based interrupt +lib_inttest_level_SOURCES = lib-inttest-level.c +lib_inttest_level_LDADD = $(top_builddir)/libsim.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu testsuite/test-code/lib-inttest/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu testsuite/test-code/lib-inttest/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +lib-inttest-edge$(EXEEXT): $(lib_inttest_edge_OBJECTS) $(lib_inttest_edge_DEPENDENCIES) + @rm -f lib-inttest-edge$(EXEEXT) + $(LINK) $(lib_inttest_edge_OBJECTS) $(lib_inttest_edge_LDADD) $(LIBS) +lib-inttest-level$(EXEEXT): $(lib_inttest_level_OBJECTS) $(lib_inttest_level_DEPENDENCIES) + @rm -f lib-inttest-level$(EXEEXT) + $(LINK) $(lib_inttest_level_OBJECTS) $(lib_inttest_level_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-inttest-edge.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-inttest-level.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: lib-inttest/lib-inttest-edge.c =================================================================== --- lib-inttest/lib-inttest-edge.c (nonexistent) +++ lib-inttest/lib-inttest-edge.c (revision 388) @@ -0,0 +1,230 @@ +/* lib-inttest-edge.c. Test of Or1ksim library edge triggered interrupt funcs. + + Copyright (C) 1999-2006 OpenCores + Copyright (C) 2010 Embecosm Limited + + Contributors various OpenCores participants + Contributor Jeremy Bennett + + This file is part of OpenRISC 1000 Architectural Simulator. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . */ + +/* ---------------------------------------------------------------------------- + This code is commented throughout for use with Doxygen. + --------------------------------------------------------------------------*/ + +#include +#include + +#include "or1ksim.h" + + +/*! Number of interrupts in PIC */ +#define NUM_INTS 32 + +/*! Globally shared pointer to the interrupts */ +char **intv; + +/*! Number of interrupts to process */ +int intc; + + +/* --------------------------------------------------------------------------*/ +/*!Trigger the next interrupt + + Generate the next edge triggered interrupt. Put out a message if doing so, + and warn if the interrupt would be invalid. + + @return 1 (true) if an interrupt was triggered, 0 (false) otherwise. */ +/* --------------------------------------------------------------------------*/ +static int +do_next_int () +{ + static int next_int = 0; /* Next interrupt to process */ + + while (next_int < intc) + { + int inum = atoi (intv[next_int++]); + + if ((0 <= inum) && (inum < NUM_INTS)) + { + printf ("Triggering interrupt %d\n", inum); + or1ksim_interrupt (inum); + return 1; + } + else + { + printf ("Warning: Invalid interrupt # %d - ignored\n", inum); + } + } + + return 0; /* No more interrupts to trigger */ + +} /* do_next_int () */ + + +/* --------------------------------------------------------------------------*/ +/*!Read upcall + + Upcall from Or1ksim to read a word from an external peripheral. If called + this will trigger an interrupt. + + @param[in] class_ptr A handle pass back from the initalization. Intended + for C++ callers, not used here. + @param[in] addr Address to read from. Ignored here. + @param[in] mask Byte mask for the read. Ignored here. + @param[out] rdata Buffer for the data read. Ignored here. + @param[in] data_len Number of bytes in mask and rdata. + + @return Zero on success, non-zero on failure. Always zero here. */ +/* --------------------------------------------------------------------------*/ +static int +read_upcall (void *class_ptr, + unsigned long int addr, + unsigned char mask[], + unsigned char rdata[], + int data_len) +{ + do_next_int (); + + return 0; /* Success */ + +} /* read_upcall () */ + + +/* --------------------------------------------------------------------------*/ +/*!Write upcall + + Upcall from Or1ksim to write a word to an external peripheral. If called + this will trigger an interrupt. + + @param[in] class_ptr A handle pass back from the initalization. Intended + for C++ callers, not used here. + @param[in] addr Address to write to. Ignored here. + @param[in] mask Byte mask for the write. Ignored here. + @param[in] wdata The data to write. Ignored here. + @param[in] data_len Number of bytes in mask and rdata. + + @return Zero on success, non-zero on failure. Always zero here. */ +/* --------------------------------------------------------------------------*/ +static int +write_upcall (void *class_ptr, + unsigned long int addr, + unsigned char mask[], + unsigned char wdata[], + int data_len) +{ + do_next_int (); + + return 0; /* Success */ + +} /* write_upcall () */ + + +/* --------------------------------------------------------------------------*/ +/*!Main program + + Build an or1ksim program using the library which loads a program and config + from the command line, and then drives interrupts. Usage: + + lib-inttest-edge ... + + is run for repeated perios of , during which it + will make upcalls. Between each period and during each upcall an edge based + interrupt will be triggered, until all interrupts listed have been + triggered. + + @param[in] argc Number of elements in argv + @param[in] argv Vector of program name and arguments + + @return Return code for the program. */ +/* --------------------------------------------------------------------------*/ +int +main (int argc, + char *argv[]) +{ + /* Parse args */ + if (argc < 5) + { + fprintf (stderr, + "usage: lib-inttest-edge " + " ...\n"); + return 1; + } + + int duration_ms = atoi (argv[3]); + double duration = (double) duration_ms / 1.0e3; + + if (duration_ms <= 0) + { + fprintf (stderr, "ERROR. Duration must be positive number of ms\n"); + return 1; + } + + /* Dummy argv array to pass arguments to or1ksim_init. Varies depending on + whether an image file is specified. */ + int dummy_argc; + char *dummy_argv[5]; + + dummy_argv[0] = "libsim"; + dummy_argv[1] = "-q"; + dummy_argv[2] = "-f"; + dummy_argv[3] = argv[1]; + dummy_argv[4] = argv[2]; + + dummy_argc = 5; + + /* Initialize the program. Put the initialization message afterwards, or it + will get swamped by the Or1ksim header. */ + if (0 == or1ksim_init (dummy_argc, dummy_argv, NULL, &read_upcall, + &write_upcall)) + { + printf ("Initalization succeeded.\n"); + } + else + { + printf ("Initalization failed.\n"); + return 1; + } + + /* Do each interrupt in turn. Set up the shared pointer to the interrupts + and counter. */ + intv = &(argv[4]); + intc = argc - 4; + + do + { + /* Run the code */ + if (OR1KSIM_RC_OK != or1ksim_run (duration)) + { + printf ("ERROR: run failed\n"); + return 1; + } + } + while (do_next_int ()); + + /* One more run, to allow interrupt handler enough time to finish + processing. */ + if (OR1KSIM_RC_OK != or1ksim_run (duration)) + { + printf ("ERROR: run failed\n"); + return 1; + } + + /* All interrupts should have been handled. */ + printf ("Test completed successfully.\n"); + return 0; + +} /* main () */
lib-inttest/lib-inttest-edge.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-inttest/lib-inttest-level.c =================================================================== --- lib-inttest/lib-inttest-level.c (nonexistent) +++ lib-inttest/lib-inttest-level.c (revision 388) @@ -0,0 +1,309 @@ +/* lib-inttest-level.c. Test of Or1ksim library level triggered interrupt funcs. + + Copyright (C) 1999-2006 OpenCores + Copyright (C) 2010 Embecosm Limited + + Contributors various OpenCores participants + Contributor Jeremy Bennett + + This file is part of OpenRISC 1000 Architectural Simulator. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . */ + +/* ---------------------------------------------------------------------------- + This code is commented throughout for use with Doxygen. + --------------------------------------------------------------------------*/ + +#include +#include +#include + +#include "or1ksim.h" + + +/*! Number of interrupts in PIC */ +#define NUM_INTS 32 + +/*! Vector of interrupts to be raised */ +static int *raisev; + +/*! Count of interrupts to be raised */ +static int raisec = 0; + +/*! Next interrupt to be raised */ +static int next_raise = 0; + +/*! Vector of interrupts to be cleared */ +static int *clearv; + +/*! Count of interrupts to be cleared */ +static int clearc = 0; + +/*! Next interrupt to be cleared */ +static int next_clear = 0; + + +/* --------------------------------------------------------------------------*/ +/*!Read upcall + + Upcall from Or1ksim to read a word from an external peripheral. If called + this will raise the next interrupt. + + @param[in] class_ptr A handle pass back from the initalization. Intended + for C++ callers, not used here. + @param[in] addr Address to read from. Ignored here. + @param[in] mask Byte mask for the read. Ignored here. + @param[out] rdata Buffer for the data read. Ignored here. + @param[in] data_len Number of bytes in mask and rdata. + + @return Zero on success, non-zero on failure. Always zero here. */ +/* --------------------------------------------------------------------------*/ +static int +read_upcall (void *class_ptr, + unsigned long int addr, + unsigned char mask[], + unsigned char rdata[], + int data_len) +{ + /* Raise an interrupt if there is one left to raise. */ + if ((NULL != raisev) && (next_raise < raisec)) + { + printf ("Raising interrupt %d\n", raisev[next_raise]); + or1ksim_interrupt_set (raisev[next_raise++]); + } + + return 0; /* Success */ + +} /* read_upcall () */ + + +/* --------------------------------------------------------------------------*/ +/*!Write upcall + + Upcall from Or1ksim to write a word to an external peripheral. If called + this will clear the next interrupt. + + @param[in] class_ptr A handle pass back from the initalization. Intended + for C++ callers, not used here. + @param[in] addr Address to write to. Ignored here. + @param[in] mask Byte mask for the write. Ignored here. + @param[in] wdata The data to write. Ignored here. + @param[in] data_len Number of bytes in mask and rdata. + + @return Zero on success, non-zero on failure. Always zero here. */ +/* --------------------------------------------------------------------------*/ +static int +write_upcall (void *class_ptr, + unsigned long int addr, + unsigned char mask[], + unsigned char wdata[], + int data_len) +{ + /* Clear an interrupt if there is one left to clear. */ + if ((NULL != clearv) && (next_clear < clearc)) + { + printf ("Clearing interrupt %d\n", clearv[next_clear]); + or1ksim_interrupt_clear (clearv[next_clear++]); + } + + return 0; /* Success */ + +} /* write_upcall () */ + + +/* --------------------------------------------------------------------------*/ +/*!Main program + + Build an or1ksim program using the library which loads a program and config + from the command line, and then drives interrupts. Usage: + + lib-inttest-level +|- +|- ... + + is run continuously. It requests that an interrupt be raised by a + read upcall and cleared by a write upcall. The sequence of interrupts is + specified to be raised (if preceded by '+') or cleared (if preceded by + '-'). This allows the program to test the effect of clearing the wrong + interrupt. + + @param[in] argc Number of elements in argv + @param[in] argv Vector of program name and arguments + + @return Return code for the program. */ +/* --------------------------------------------------------------------------*/ +int +main (int argc, + char *argv[]) +{ + /* Parse args */ + if (argc < 4) + { + fprintf (stderr, + "usage: lib-inttest-level " + "+|- +|- ...\n"); + return 1; + } + + /* Get all the interrupts sorted out. Count them, then place them in a + vector. */ + int i; + + for (i = 3; i < argc; i++) + { + int inum; + + switch (argv[i][0]) + { + case '+': + inum = atoi (&(argv[i][1])); + + if ((0 <= inum) && (inum < NUM_INTS)) + { + raisec++; + } + else + { + printf ("Warning: Invalid interrupt # %d to raise.\n", inum); + } + + break; + + case '-': + inum = atoi (&(argv[i][1])); + + if ((0 <= inum) && (inum < NUM_INTS)) + { + clearc++; + } + else + { + printf ("Warning: Invalid interrupt # %d to clear.\n", inum); + } + + break; + + + default: + printf ("Warning: No raise/clear specified - ignored\n"); + break; + } + } + + if ((0 == raisec) && (0 == clearc)) + { + printf ("ERROR: No interrupts specified.\n"); + return 1; + } + + /* Allocate space and populate the vectors. */ + raisev = (raisec > 0) ? calloc (raisec, sizeof (int)) : NULL; + clearv = (clearc > 0) ? calloc (clearc, sizeof (int)) : NULL; + + raisec = 0; + clearc = 0; + + for (i = 3; i < argc; i++) + { + int inum; + + switch (argv[i][0]) + { + case '+': + inum = atoi (&(argv[i][1])); + + if ((0 <= inum) && (inum < NUM_INTS)) + { + raisev[raisec++] = inum; + } + + break; + + case '-': + inum = atoi (&(argv[i][1])); + + if ((0 <= inum) && (inum < NUM_INTS)) + { + clearv[clearc++] = inum; + } + + break; + + + default: + printf ("Warning: No raise/clear specified - ignored\n"); + break; + } + } + + /* Start the counts */ + next_raise = 0; + next_clear = 0; + + /* Dummy argv array to pass arguments to or1ksim_init. Varies depending on + whether an image file is specified. */ + int dummy_argc; + char *dummy_argv[5]; + + dummy_argv[0] = "libsim"; + dummy_argv[1] = "-q"; + dummy_argv[2] = "-f"; + dummy_argv[3] = argv[1]; + dummy_argv[4] = argv[2]; + + dummy_argc = 5; + + /* Initialize the program. Put the initialization message afterwards, or it + will get swamped by the Or1ksim header. */ + if (0 == or1ksim_init (dummy_argc, dummy_argv, NULL, &read_upcall, + &write_upcall)) + { + printf ("Initalization succeeded.\n"); + } + else + { + printf ("Initalization failed.\n"); + free (raisev); + free (clearv); + return 1; + } + + /* Run in bursts of 1ms until all interrupts have been set and cleared. */ + do + { + if (OR1KSIM_RC_OK != or1ksim_run (1.0e-3)) + { + printf ("ERROR: run failed\n"); + free (raisev); + free (clearv); + return 1; + } + } + while ((next_raise < raisec) || (next_clear < clearc)); + + /* One more burst to allow the device driver time to complete. */ + if (OR1KSIM_RC_OK != or1ksim_run (1.0e-3)) + { + printf ("ERROR: run failed\n"); + free (raisev); + free (clearv); + return 1; + } + + /* All interrupts should have been handled. */ + free (raisev); + free (clearv); + + printf ("Test completed successfully.\n"); + return 0; + +} /* main () */
lib-inttest/lib-inttest-level.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: lib-inttest/Makefile.am =================================================================== --- lib-inttest/Makefile.am (nonexistent) +++ lib-inttest/Makefile.am (revision 388) @@ -0,0 +1,40 @@ +# Makefile.am for libor1ksim test program: lib-inttest + +# Copyright (C) Embecosm Limited, 2010 + +# Contributor Jeremy Bennett + +# This file is part of OpenRISC 1000 Architectural Simulator. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . */ + +# ----------------------------------------------------------------------------- +# This code is commented throughout for use with Doxygen. +# ----------------------------------------------------------------------------- + + +# Test programs of the library interrupt driving functions. Two versions, one +# to drive edge based interrupts, one to drive level based interrupts. +check_PROGRAMS = lib-inttest-edge \ + lib-inttest-level + +# Edge based interrupt +lib_inttest_edge_SOURCES = lib-inttest-edge.c + +lib_inttest_edge_LDADD = $(top_builddir)/libsim.la + +# Level based interrupt +lib_inttest_level_SOURCES = lib-inttest-level.c + +lib_inttest_level_LDADD = $(top_builddir)/libsim.la
lib-inttest/Makefile.am Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Makefile.am =================================================================== --- Makefile.am (nonexistent) +++ Makefile.am (revision 388) @@ -0,0 +1,32 @@ +# Makefile.am for or1ksim testsuite test-code + +# Copyright (C) Embecosm Limited, 2010 + +# Contributor Jeremy Bennett + +# This file is part of OpenRISC 1000 Architectural Simulator. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . */ + +# ----------------------------------------------------------------------------- +# This code is commented throughout for use with Doxygen. +# ----------------------------------------------------------------------------- + + +# Subdirs for each test program. + +SUBDIRS = lib-iftest \ + lib-inttest \ + lib-jtag \ + lib-upcalls
Makefile.am Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.