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

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /or1k/tags/stable_0_2_0_rc3/or1ksim/support
    from Rev 1648 to Rev 1765
    Reverse comparison

Rev 1648 → Rev 1765

/dumpverilog.h
0,0 → 1,47
#define DW 32 /* Data width of memory model generated by dumpverilog in bits */
#define DWQ (DW/8) /* Same as DW but units are bytes */
#define DISWIDTH 25 /* Width of disassembled message in bytes */
 
#define OR1K_MEM_VERILOG_HEADER(MODNAME, FROMADDR, TOADDR, DISWIDTH) "\n"\
"include \"general.h\"\n\n"\
"`timescale 1ns/100ps\n\n"\
"// Simple dw-wide Sync SRAM with initial content generated by or1ksim.\n"\
"// All control, data in and addr signals are sampled at rising clock edge \n"\
"// Data out is not registered. Address bits specify dw-word (narrowest \n"\
"// addressed data is not byte but dw-word !). \n"\
"// There are still some bugs in generated output (dump word aligned regions)\n\n"\
"module %s(clk, data, addr, ce, we, disout);\n\n"\
"parameter dw = 32;\n"\
"parameter amin = %d;\n\n"\
"parameter amax = %d;\n\n"\
"input clk;\n"\
"inout [dw-1:0] data;\n"\
"input [31:0] addr;\n"\
"input ce;\n"\
"input we;\n"\
"output [%d:0] disout;\n\n"\
"reg [%d:0] disout;\n"\
"reg [dw-1:0] mem [amax:amin];\n"\
"reg [%d:0] dis [amax:amin];\n"\
"reg [dw-1:0] dataout;\n"\
"tri [dw-1:0] data = (ce && ~we) ? dataout : 'bz;\n\n"\
"initial begin\n", MODNAME, FROMADDR, TOADDR, DISWIDTH-1, DISWIDTH-1, DISWIDTH-1
 
#define OR1K_MEM_VERILOG_FOOTER "\n\
end\n\n\
always @(posedge clk) begin\n\
if (ce && ~we) begin\n\
dataout <= #1 mem[addr];\n\
disout <= #1 dis[addr];\n\
$display(\"or1k_mem: reading mem[%%0d]:%%h dis: %%0s\", addr, dataout, dis[addr]);\n\
end else\n\
if (ce && we) begin\n\
mem[addr] <= #1 data;\n\
dis[addr] <= #1 \"(data)\";\n\
$display(\"or1k_mem: writing mem[%%0d]:%%h dis: %%0s\", addr, mem[addr], dis[addr]);\n\
end\n\
end\n\n\
endmodule\n"
 
void dumpverilog(char *verilog_modname, oraddr_t from, oraddr_t to);
void dumphex(oraddr_t from, oraddr_t to);
/dumpverilog.c
0,0 → 1,134
/* dumpverilog.c -- Dumps memory region as Verilog representation
or as hex code
Copyright (C) 2000 Damjan Lampret, lampret@opencores.org
 
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 2 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Verilog dump can be used for stimulating OpenRISC Verilog RTL models. */
 
#include <stdio.h>
#include <ctype.h>
#include <string.h>
 
#include "config.h"
 
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
 
#include "port.h"
#include "arch.h"
#include "sim-config.h"
#include "parse.h"
#include "abstract.h"
#include "opcode/or32.h"
#include "spr_defs.h"
#include "labels.h"
#include "execute.h"
#include "sprs.h"
#include "stats.h"
#include "except.h"
#include "dumpverilog.h"
 
extern char *or1ksim_ver;
extern char *disassembled;
 
void dumpverilog(char *verilog_modname, oraddr_t from, oraddr_t to)
{
unsigned int i, done = 0;
struct label_entry *tmp;
char dis[DISWIDTH + 100];
uint32_t insn;
int index;
PRINTF("// This file was generated by or1ksim version %s\n", or1ksim_ver);
PRINTF(OR1K_MEM_VERILOG_HEADER(verilog_modname, from/DWQ, to/DWQ, (DISWIDTH*8)));
for(i = from; i < to; i++) {
if(!(i & 3)) {
insn = eval_direct32(i, 0, 0);
index = insn_decode(insn);
if (index >= 0) {
if (verify_memoryarea(i) && (tmp = get_label(i)))
if (tmp)
PRINTF("\n//\t%s%s", tmp->name, LABELEND_CHAR);
PRINTF("\n\tmem['h%x] = %d'h%.8"PRIx32";", i/DWQ, DW,
eval_direct32(i, 0, 0));
disassemble_insn (insn);
strcpy (dis, disassembled);
if (strlen(dis) < DISWIDTH)
memset(dis + strlen(dis), ' ', DISWIDTH);
dis[DISWIDTH] = '\0';
PRINTF("\n\tdis['h%x] = {\"%s\"};", i/DWQ, dis);
dis[0] = '\0';
i += insn_len(index) - 1;
done = 1;
continue;
}
}
 
if (i % 64 == 0)
PRINTF("\n");
PRINTF("\n\tmem['h%x] = 'h%.2x;", i/DWQ, eval_direct8(i, 0, 0));
done = 1;
}
if (done)
{
PRINTF(OR1K_MEM_VERILOG_FOOTER);
return;
}
/* this needs to be fixed */
for(i = from; i < to; i++)
{
if (i % 8 == 0)
PRINTF("\n%.8x: ", i);
/* don't print ascii chars below 0x20. */
if (eval_direct32(i, 0, 0) < 0x20)
PRINTF("0x%.2x ", (uint8_t)eval_direct32(i, 0, 0));
else
PRINTF("0x%.2x'%c' ", (uint8_t)eval_direct32(i, 0, 0),
(char)eval_direct32(i, 0, 0));
}
PRINTF(OR1K_MEM_VERILOG_FOOTER);
}
 
void dumphex(oraddr_t from, oraddr_t to)
{
oraddr_t i;
uint32_t insn;
int index;
for(i = from; i < to; i++) {
if(!(i & 3)) {
insn = eval_direct32(i, 0, 0);
index = insn_decode(insn);
if(index >= 0) {
PRINTF("%.8"PRIx32"\n", eval_direct32(i, 0, 0));
i += insn_len(index) - 1;
continue;
}
}
PRINTF("%.2x\n", eval_direct8(i, 0, 0));
}
}
/misc.c
0,0 → 1,39
/* misc.c -- Misc. routines that just don't fit anywhere else
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
Copyright (C) 2002 Marko Mlinar, markom@opencores.org
 
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 2 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
/* returns log2(x) */
/* Call this log2_int, because there is a library function named log2 */
int log2_int (unsigned long x)
{
int c = 0;
if (!x) return 0; /* not by the book, but practical */
while (x != 1) x >>= 1, c++;
return c;
}
 
int is_power2 (int x)
{
if(!x)
return 0;
while (!(x & 1))
x >>= 1;
return x == 1;
}
 
/debug.c
0,0 → 1,142
/* debug.c -- Debug channel support code
 
 
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 2 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
 
#include "config.h"
 
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
 
#include "port.h"
#include "arch.h"
#include "sim-config.h"
 
#define __ORSIM_NO_DEC_DBCH
#include "debug.h"
 
#define DECLARE_DEBUG_CHANNEL(dbch) char __orsim_dbch_##dbch[] = "\0"#dbch;
#include "dbchs.h"
#undef DECLARE_DEBUG_CHANNEL
 
#define DECLARE_DEBUG_CHANNEL(dbch) __orsim_dbch_##dbch,
static char *__orsim_dbchs[] = {
#include "dbchs.h"
NULL };
#undef DECLARE_DEBUG_CHANNEL
 
static const char *debug_classes[] = { "trace", "fixme", "warn", "err" };
 
void orsim_dbg_log(enum __ORSIM_DEBUG_CLASS dbcl, const char *dbch,
const char *function, const char *format, ...)
{
va_list ap;
static int last_lf = 1; /* There *has* to be a better way */
 
if(last_lf) {
if(!TRACE_ON(cycles))
fprintf(stderr, "%s:%s:%s: ", debug_classes[dbcl], dbch + 1, function);
else
fprintf(stderr, "%lld:%s:%s:%s: ", runtime.sim.cycles,
debug_classes[dbcl], dbch + 1, function);
}
last_lf = format[strlen(format) - 1] == '\n'; /* This is wrong... */
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
}
 
void orsim_dbcl_set(enum __ORSIM_DEBUG_CLASS dbcl, char *dbch, int on)
{
if(on)
dbch[0] |= 1 << dbcl;
else
dbch[0] &= ~(1 << dbcl);
}
 
void orsim_dbcl_set_name(enum __ORSIM_DEBUG_CLASS dbcl, const char *dbch, int on)
{
char **dbchs = __orsim_dbchs;
 
for(dbchs = __orsim_dbchs; *dbchs; dbchs++) {
if(!strcmp(*dbchs + 1, dbch)) {
orsim_dbcl_set(dbcl, *dbchs, on);
break;
}
}
}
 
void parse_dbchs(const char *str)
{
enum __ORSIM_DEBUG_CLASS dbcl = 0;
int i;
int disen;
int all;
const char *cend;
const char *chan_end;
 
while(*str) {
cend = strpbrk(str, "+-");
chan_end = strchr(str, ',');
if(!chan_end)
chan_end = str + strlen(str);
 
if(!cend || (cend > chan_end)) {
disen = 1;
cend = --str;
} else
disen = *cend == '+' ? 1 : 0;
 
if(cend == str) {
all = 1;
} else {
for(i = 0; i < 4; i++) {
if(!strncmp(str, debug_classes[i], cend - str)) {
dbcl = i;
break;
}
}
if(i >= 4)
fprintf(stderr, "Unknown class specified\n");
all = 0;
}
cend++;
 
for(i = 0; __orsim_dbchs[i]; i++)
if(!strncmp(cend, __orsim_dbchs[i] + 1, chan_end - cend))
break;
 
if(!__orsim_dbchs[i])
fprintf(stderr, "Unknown channel specified\n");
else if(all) {
orsim_dbcl_set(__ORSIM_DBCL_TRACE, __orsim_dbchs[i], disen);
orsim_dbcl_set(__ORSIM_DBCL_FIXME, __orsim_dbchs[i], disen);
orsim_dbcl_set(__ORSIM_DBCL_WARN, __orsim_dbchs[i], disen);
orsim_dbcl_set(__ORSIM_DBCL_ERR, __orsim_dbchs[i], disen);
} else
orsim_dbcl_set(dbcl, __orsim_dbchs[i], disen);
if(*chan_end)
str = chan_end + 1;
else
str = chan_end;
}
}
/Makefile.in
0,0 → 1,426
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
 
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 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 -- Makefile for cpu architecture independent simulation
# Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
#
# 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 2 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, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
 
SOURCES = $(libsupport_a_SOURCES)
 
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
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 = support
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
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 =
LIBRARIES = $(noinst_LIBRARIES)
libsupport_a_AR = $(AR) $(ARFLAGS)
libsupport_a_LIBADD =
am_libsupport_a_OBJECTS = simprintf.$(OBJEXT) dumpverilog.$(OBJEXT) \
profile.$(OBJEXT) sched.$(OBJEXT) debug.$(OBJEXT) \
misc.$(OBJEXT)
libsupport_a_OBJECTS = $(am_libsupport_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libsupport_a_SOURCES)
DIST_SOURCES = $(libsupport_a_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ARFLAGS = @ARFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_DIR = @BUILD_DIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPU_ARCH = @CPU_ARCH@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DYNAMIC_EXECUTION_FALSE = @DYNAMIC_EXECUTION_FALSE@
DYNAMIC_EXECUTION_TRUE = @DYNAMIC_EXECUTION_TRUE@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GENERATE_NEEDED_FALSE = @GENERATE_NEEDED_FALSE@
GENERATE_NEEDED_TRUE = @GENERATE_NEEDED_TRUE@
INCLUDES = @INCLUDES@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
LOCAL_DEFS = @LOCAL_DEFS@
LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MAKE_SHELL = @MAKE_SHELL@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SUMVERSION = @SUMVERSION@
TERMCAP_LIB = @TERMCAP_LIB@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
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@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
noinst_LIBRARIES = libsupport.a
libsupport_a_SOURCES = simprintf.c dumpverilog.c profile.c sched.c debug.c misc.c
all: all-am
 
.SUFFIXES:
.SUFFIXES: .c .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 \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu support/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu support/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
 
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libsupport.a: $(libsupport_a_OBJECTS) $(libsupport_a_DEPENDENCIES)
-rm -f libsupport.a
$(libsupport_a_AR) libsupport.a $(libsupport_a_OBJECTS) $(libsupport_a_LIBADD)
$(RANLIB) libsupport.a
 
mostlyclean-compile:
-rm -f *.$(OBJEXT)
 
distclean-compile:
-rm -f *.tab.c
 
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpverilog.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/profile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simprintf.Po@am__quote@
 
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@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@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@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) '$<'`
uninstall-info-am:
 
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; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
 
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
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; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
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; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
 
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& 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)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$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
check: check-am
all-am: Makefile $(LIBRARIES)
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)
 
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-generic clean-noinstLIBRARIES 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
 
info: info-am
 
info-am:
 
install-data-am:
 
install-exec-am:
 
install-info: install-info-am
 
install-man:
 
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
 
pdf: pdf-am
 
pdf-am:
 
ps: ps-am
 
ps-am:
 
uninstall-am: uninstall-info-am
 
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-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:
/sched.h
0,0 → 1,166
/* sched.h -- Abstract entities header file handling job scheduler
Copyright (C) 2001 Marko Mlinar, markom@opencores.org
 
 
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 2 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
#ifndef _SCHED_H_
#define _SCHED_H_
 
#if DYNAMIC_EXECUTION
#include "sched_i386.h"
#endif
 
#include "debug.h"
 
#define SCHED_HEAP_SIZE 128
#define SCHED_TIME_MAX INT32_MAX
 
DECLARE_DEBUG_CHANNEL(sched);
DECLARE_DEBUG_CHANNEL(sched_jobs);
 
/* Structure for holding one job entry */
struct sched_entry {
int32_t time; /* Clock cycles before job starts */
void *param; /* Parameter to pass to the function */
void (*func)(void *); /* Function to call when time reaches 0 */
struct sched_entry *next;
};
 
/* Heap of jobs */
struct scheduler_struct {
struct sched_entry *free_job_queue;
struct sched_entry *job_queue;
};
 
void sched_init(void);
void sched_reset(void);
void sched_next_insn(void (*func)(void *), void *dat);
 
extern struct scheduler_struct scheduler;
 
static inline void sched_print_jobs(void)
{
struct sched_entry *cur;
int i;
 
for (cur = scheduler.job_queue, i = 0; cur; cur = cur->next, i++)
TRACE_(sched)("\t%i: %p $%p @ %"PRIi32"\n", i, cur->func, cur->param,
cur->time);
}
 
/* Adds new job to the queue */
static inline void sched_add(void (*job_func)(void *), void *job_param,
int32_t job_time, const char *func)
{
struct sched_entry *cur, *prev, *new_job;
int32_t alltime;
 
TRACE_(sched)("%s@%lli:SCHED_ADD(time %"PRIi32")\n", func, runtime.sim.cycles,
job_time);
if(TRACE_ON(sched_jobs))
sched_print_jobs();
 
if(TRACE_ON(sched_jobs))
TRACE_(sched) ("--------\n");
 
cur = scheduler.job_queue;
prev = NULL;
alltime = cur->time;
while(cur && (alltime < job_time)) {
prev = cur;
cur = cur->next;
if(cur)
alltime += cur->time;
}
 
new_job = scheduler.free_job_queue;
scheduler.free_job_queue = new_job->next;
new_job->next = cur;
 
new_job->func = job_func;
new_job->param = job_param;
 
if(prev) {
new_job->time = job_time - (alltime - (cur ? cur->time : 0));
prev->next = new_job;
TRACE_(sched)("Scheduled job not going to head of queue, relative time: %"
PRIi32"\n", new_job->time);
} else {
scheduler.job_queue = new_job;
new_job->time = job_time >= 0 ? job_time : cur->time;
#if DYNAMIC_EXECUTION
/* If we are replaceing the first job in the queue, then update the
* recompiler's internal cycle counter */
set_sched_cycle(job_time);
#endif
TRACE_(sched)("Setting to-go cycles to %"PRIi32" at %lli\n", job_time,
runtime.sim.cycles);
}
 
if(cur)
cur->time -= new_job->time;
 
if(TRACE_ON(sched_jobs))
sched_print_jobs();
}
 
#define SCHED_ADD(job_func, job_param, job_time) sched_add(job_func, job_param, job_time, __FUNCTION__)
 
/* Returns a job with specified function and param, NULL if not found */
static inline void sched_find_remove(void (*job_func)(void *), void *dat,
const char *func)
{
struct sched_entry *cur;
struct sched_entry *prev = NULL;
 
TRACE_(sched)("%s@%lli:SCHED_REMOVE()\n", func, runtime.sim.cycles);
 
for (cur = scheduler.job_queue; cur; prev = cur, cur = cur->next) {
if ((cur->func == job_func) && (cur->param == dat)) {
if(cur->next)
cur->next->time += cur->time;
 
if(prev) {
prev->next = cur->next;
} else {
scheduler.job_queue = cur->next;
#if DYNAMIC_EXECUTION
if(cur->next)
set_sched_cycle(cur->next->time);
#endif
if(cur->next)
TRACE_(sched)("Setting to-go cycles to %"PRIi32" at %lli\n",
cur->next->time, runtime.sim.cycles);
}
cur->next = scheduler.free_job_queue;
scheduler.free_job_queue = cur;
break;
}
}
}
 
/* Deletes job with specified function and param */
#define SCHED_FIND_REMOVE(f, p) sched_find_remove(f, p, __FUNCTION__)
 
/* If we are not running with dynamic execution, then do_scheduler will be
* inlined and this declaration will be useless (it will also fail to compile)*/
#if DYNAMIC_EXECUTION
void do_scheduler (void);
#endif
 
#endif /* _SCHED_H_ */
sched.h Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: misc.h =================================================================== --- misc.h (nonexistent) +++ misc.h (revision 1765) @@ -0,0 +1,26 @@ +/* misc.h -- Misc. routines that just don't fit anywhere else + Copyright (C) 1999 Damjan Lampret, lampret@opencores.org + Copyright (C) 2002 Marko Mlinar, markom@opencores.org + +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 2 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, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* returns log2(x) */ +int log2_int (unsigned long x); +int is_power2 (int x); + + +void simprintf(oraddr_t stackaddr, unsigned long regparam); Index: sched.c =================================================================== --- sched.c (nonexistent) +++ sched.c (revision 1765) @@ -0,0 +1,112 @@ +/* sched.c -- Abstract entities, handling job scheduling + Copyright (C) 2001 Marko Mlinar, markom@opencores.org + +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 2 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, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* Abstract memory and routines that go with this. I need to +add all sorts of other abstract entities. Currently we have +only memory. */ + +#include +#include +#include +#include +#include + +#include "config.h" + +#ifdef HAVE_INTTYPES_H +#include +#endif + +#include "port.h" +#include "arch.h" +#include "sim-config.h" +#include "config.h" +#include "sched.h" + +/* FIXME: Scheduler should continue from previous cycles not current ones */ + +struct scheduler_struct scheduler; + +/* Dummy function, representing a guard, which protects heap from + emptying */ +void sched_guard (void *dat) +{ + if(scheduler.job_queue) + SCHED_ADD(sched_guard, dat, SCHED_TIME_MAX); + else { + scheduler.job_queue = scheduler.free_job_queue; + scheduler.free_job_queue = scheduler.free_job_queue->next; + scheduler.job_queue->next = NULL; + scheduler.job_queue->func = sched_guard; + scheduler.job_queue->time = SCHED_TIME_MAX; +#if DYNAMIC_EXECUTION + set_sched_cycle(SCHED_TIME_MAX); +#endif + } +} + +void sched_reset(void) +{ + struct sched_entry *cur, *next; + + for(cur = scheduler.job_queue; cur; cur = next) { + next = cur->next; + cur->next = scheduler.free_job_queue; + scheduler.free_job_queue = cur; + } + scheduler.job_queue = NULL; + sched_guard(NULL); +} + +void sched_init(void) +{ + int i; + struct sched_entry *new; + + scheduler.free_job_queue = NULL; + + for(i = 0; i < SCHED_HEAP_SIZE; i++) { + if(!(new = malloc(sizeof(struct sched_entry)))) { + fprintf(stderr, "Out-of-memory while allocateing scheduler queue\n"); + exit(1); + } + new->next = scheduler.free_job_queue; + scheduler.free_job_queue = new; + } + scheduler.job_queue = NULL; + sched_guard(NULL); +} + +/* Schedules the next job so that it will run after the next instruction */ +void sched_next_insn(void (*func)(void *), void *dat) +{ + int32_t cycles = 1; + struct sched_entry *cur = scheduler.job_queue; + + /* The cycles count of the jobs may go into negatives. If this happens, func + * will get called before the next instruction has executed. */ + while(cur && (cur->time < 0)) { + cycles -= cur->time; + cur = cur->next; + } + + SCHED_ADD(func, dat, cycles); +} + +
sched.c Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: simprintf.c =================================================================== --- simprintf.c (nonexistent) +++ simprintf.c (revision 1765) @@ -0,0 +1,165 @@ +/* simprintf.c -- Simulator printf implementation + Copyright (C) 1999 Damjan Lampret, lampret@opencores.org + +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 2 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, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* Debugger LIBC functions. Working, but VERY, VERY ugly written. +I wrote following code when basic simulator started to work and I was +desperate to use some PRINTFs in my debugged code. And it was +also used to get some output from Dhrystone MIPS benchmark. */ + +#include +#include +#include +#include +#include + +#include "config.h" + +#ifdef HAVE_INTTYPES_H +#include +#endif + +#include "port.h" +#include "arch.h" +#include "abstract.h" +#include "sim-config.h" +#include "opcode/or32.h" +#include "spr_defs.h" +#include "execute.h" +#include "debug.h" + +DEFAULT_DEBUG_CHANNEL(simprintf); + +/* Length of PRINTF format string */ +#define FMTLEN 2000 + +char fmtstr[FMTLEN]; + +char *simgetstr(oraddr_t stackaddr, unsigned long regparam) +{ + oraddr_t fmtaddr; + int i; + + fmtaddr = regparam; + + i = 0; + while (eval_direct8(fmtaddr,1,0) != '\0') { + fmtstr[i++] = eval_direct8(fmtaddr,1,0); + fmtaddr++; + if (i == FMTLEN - 1) + break; + } + fmtstr[i] = '\0'; + + return fmtstr; +} + +void simprintf(oraddr_t stackaddr, unsigned long regparam) +{ + FILE *f; + + simgetstr(stackaddr, regparam); + + TRACE("simprintf: stackaddr: 0x%"PRIxADDR"\n", stackaddr); + if ((f = fopen(config.sim.fstdout, "a+"))) { + uint32_t arg; + oraddr_t argaddr; + char *fmtstrend; + char *fmtstrpart = fmtstr; + int tee_exe_log; + +#if STACK_ARGS + argaddr = stackaddr; +#else + argaddr = 3; +#endif + tee_exe_log = (config.sim.exe_log && (config.sim.exe_log_type == EXE_LOG_SOFTWARE || config.sim.exe_log_type == EXE_LOG_SIMPLE) + && config.sim.exe_log_start <= runtime.cpu.instructions && (config.sim.exe_log_end <= 0 || runtime.cpu.instructions <= config.sim.exe_log_end)); + + if (tee_exe_log) fprintf (runtime.sim.fexe_log, "SIMPRINTF: "); + TRACE("simprintf: %s\n", fmtstrpart); + while(strlen(fmtstrpart)) { + TRACE("simprintf(): 1"); + if ((fmtstrend = strstr(fmtstrpart + 1, "%"))) + *fmtstrend = '\0'; + TRACE(" 2"); + if (strstr(fmtstrpart, "%")) { + char *tmp; + int string = 0; + TRACE(" 3"); +#if STACK_ARGS + arg = eval_direct32(argaddr,1,0); + argaddr += 4; +#else + { + char regstr[5]; + + sprintf(regstr, "r%"PRIxADDR, ++argaddr); + arg = evalsim_reg(atoi(regstr)); + } +#endif + TRACE(" 4: fmtstrpart=%p fmtstrpart=%s arg=0x%08"PRIx32"\n", + fmtstrpart, fmtstrpart, arg); + tmp = fmtstrpart; + if (*tmp == '%') { + tmp++; + while (*tmp == '-' || (*tmp >= '0' && *tmp <= '9')) tmp++; + if (*tmp == 's') string = 1; + } + if (string) { + int len = 0; + char *str; + for(; eval_direct8(arg++,1,0); len++); + len++; /* for null char */ + arg -= len; + str = (char *)malloc(len); + len = 0; + for(; eval_direct8(arg,1,0); len++) + *(str+len) = eval_direct8(arg++,1,0); + *(str+len) = eval_direct8(arg,1,0); /* null ch */ + TRACE("4a: len=%d str=%s\n", len, str); + TRACE("4b:"); + fprintf(f, fmtstrpart, str); + if (tee_exe_log) fprintf(runtime.sim.fexe_log, fmtstrpart, str); + free(str); + } else { + fprintf(f, fmtstrpart, arg); + if (tee_exe_log) fprintf(runtime.sim.fexe_log, fmtstrpart, arg); + } + } else { + TRACE(" 5"); + fprintf(f, fmtstrpart); + if (tee_exe_log) fprintf(runtime.sim.fexe_log, fmtstrpart); + TRACE(fmtstrpart); + } + if (!fmtstrend) + break; + TRACE(" 6"); + fmtstrpart = fmtstrend; + *fmtstrpart = '%'; + TRACE(" 7"); + } + + TRACE(" 8\n"); + if (fclose(f)) + perror(strerror(errno)); + } + else + perror(strerror(errno)); + +} Index: Makefile.am =================================================================== --- Makefile.am (nonexistent) +++ Makefile.am (revision 1765) @@ -0,0 +1,22 @@ +# Makefile -- Makefile for cpu architecture independent simulation +# Copyright (C) 1999 Damjan Lampret, lampret@opencores.org +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +noinst_LIBRARIES = libsupport.a +libsupport_a_SOURCES = simprintf.c dumpverilog.c profile.c sched.c debug.c misc.c Index: dbchs.h =================================================================== --- dbchs.h (nonexistent) +++ dbchs.h (revision 1765) @@ -0,0 +1,40 @@ +/* dbchs.h -- Debug channel declarations + Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org + +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 2 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, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + +/* Declatrations of all debug channels */ +DECLARE_DEBUG_CHANNEL(sched) +DECLARE_DEBUG_CHANNEL(except) +DECLARE_DEBUG_CHANNEL(cycles) +DECLARE_DEBUG_CHANNEL(sched_jobs) +DECLARE_DEBUG_CHANNEL(spr) +DECLARE_DEBUG_CHANNEL(immu) +DECLARE_DEBUG_CHANNEL(dmmu) +DECLARE_DEBUG_CHANNEL(pic) +DECLARE_DEBUG_CHANNEL(tick) +DECLARE_DEBUG_CHANNEL(uart) +DECLARE_DEBUG_CHANNEL(eth) +DECLARE_DEBUG_CHANNEL(config) +DECLARE_DEBUG_CHANNEL(ata) +DECLARE_DEBUG_CHANNEL(gpio) +DECLARE_DEBUG_CHANNEL(mc) +DECLARE_DEBUG_CHANNEL(dma) +DECLARE_DEBUG_CHANNEL(vapi) +DECLARE_DEBUG_CHANNEL(simprintf) +DECLARE_DEBUG_CHANNEL(jtag) Index: debug.h =================================================================== --- debug.h (nonexistent) +++ debug.h (revision 1765) @@ -0,0 +1,83 @@ +/* debug.h -- Trace function declarations + Copyright 1999 Patrik Stridvall (for the wine project: www.winehq.com) + Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org + +This file is part of OpenRISC 1000 Architectural Simulator. +(Most of it is ripped from the wine project's wine/include/wine/debug.h) + +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 2 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, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef __DEBUG_H_INCLUDED +#define __DEBUG_H_INCLUDED + +enum __ORSIM_DEBUG_CLASS { + __ORSIM_DBCL_TRACE, + __ORSIM_DBCL_FIXME, + __ORSIM_DBCL_WARN, + __ORSIM_DBCL_ERR, +}; + +void orsim_dbg_log(enum __ORSIM_DEBUG_CLASS dbcl, const char *dbch, + const char *function, const char *format, ...) + __attribute__((format(printf, 4, 5))); +void orsim_dbcl_set_name(enum __ORSIM_DEBUG_CLASS dbcl, const char *dbch, int on); +void parse_dbchs(const char *str); + +#ifndef __ORSIM_DBG_USE_FUNC +#define __ORSIM_DBG_USE_FUNC __FUNCTION__ +#endif + +#define __ORSIM_GET_DEBUGGING_TRACE(dbch) ((dbch)[0] & (1 << __ORSIM_DBCL_TRACE)) +#define __ORSIM_GET_DEBUGGING_WARN(dbch) ((dbch)[0] & (1 << __ORSIM_DBCL_WARN)) +#define __ORSIM_GET_DEBUGGING_FIXME(dbch) ((dbch)[0] & (1 << __ORSIM_DBCL_FIXME)) +#define __ORSIM_GET_DEBUGGING_ERR(dbch) ((dbch)[0] & (1 << __ORSIM_DBCL_ERR)) + +#define __ORSIM_GET_DEBUGGING(dbcl,dbch) __ORSIM_GET_DEBUGGING##dbcl(dbch) + +#define __ORSIM_DPRINTF(dbcl, dbch) \ + do { if(__ORSIM_GET_DEBUGGING(dbcl,(dbch))) { \ + const char * const __dbch = dbch; \ + const enum __ORSIM_DEBUG_CLASS __dbcl = __ORSIM_DBCL##dbcl; \ + __ORSIM_DEBUG_LOG + +#define __ORSIM_DEBUG_LOG(args...) \ + orsim_dbg_log(__dbcl, __dbch, __ORSIM_DBG_USE_FUNC, args); } } while(0) + +#define TRACE_(ch) __ORSIM_DPRINTF(_TRACE, __orsim_dbch_##ch) +#define FIXME_(ch) __ORSIM_DPRINTF(_FIXME, __orsim_dbch_##ch) +#define WARN_(ch) __ORSIM_DPRINTF(_WARN, __orsim_dbch_##ch) +#define ERR_(ch) __ORSIM_DPRINTF(_ERR, __orsim_dbch_##ch) + +#define TRACE __ORSIM_DPRINTF(_TRACE, __orsim_dbch___default) +#define FIXME __ORSIM_DPRINTF(_FIXME, __orsim_dbch___default) +#define WARN __ORSIM_DPRINTF(_WARN, __orsim_dbch___default) +#define ERR __ORSIM_DPRINTF(_ERR, __orsim_dbch___default) + +#define TRACE_ON(ch) __ORSIM_GET_DEBUGGING(_TRACE,__orsim_dbch_##ch) +#define WARN_ON(ch) __ORSIM_GET_DEBUGGING(_WARN,__orsim_dbch_##ch) +#define FIXME_ON(ch) __ORSIM_GET_DEBUGGING(_FIXME,__orsim_dbch_##ch) +#define ERR_ON(ch) __ORSIM_GET_DEBUGGING(_ERR,__orsim_dbch_##ch) + +#define DEFAULT_DEBUG_CHANNEL(dbch) \ + extern char __orsim_dbch_##dbch[]; \ + static char * const __orsim_dbch___default = __orsim_dbch_##dbch; + +#ifndef __ORSIM_NO_DEC_DBCH +#define DECLARE_DEBUG_CHANNEL(dbch) extern char __orsim_dbch_##dbch[]; +#endif + +void debug(int level, const char *format,...) __attribute__((format(printf, 2, 3))); + +#endif Index: profile.c =================================================================== --- profile.c (nonexistent) +++ profile.c (revision 1765) @@ -0,0 +1,41 @@ +/* profile.c -- functions for profiling + Copyright (C) 2002 Marko Mlinar, markom@opencores.org + +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 2 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, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include + +#include "config.h" + +#ifdef HAVE_INTTYPES_H +#include +#endif + +#include "port.h" +#include "arch.h" +#include "profile.h" +#include "sim-config.h" + +/* Adds a new entry to the memory profile file */ +void mprofile (oraddr_t memaddr, unsigned char type) +{ + struct mprofentry_struct mp; + mp.addr = memaddr; + mp.type = type; + if(!fwrite (&mp, sizeof (struct mprofentry_struct), 1, runtime.sim.fmprof)) + config.sim.mprofile = 0; +}
profile.c Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: profile.h =================================================================== --- profile.h (nonexistent) +++ profile.h (revision 1765) @@ -0,0 +1,33 @@ +/* profile.c -- definitions for profiling + Copyright (C) 2002 Marko Mlinar, markom@opencores.org + +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 2 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, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#define MPROF_READ 1 +#define MPROF_WRITE 2 +#define MPROF_FETCH 4 +#define MPROF_8 8 +#define MPROF_16 16 +#define MPROF_32 32 + +/* Adds a new entry to the memory profile file */ +void mprofile (oraddr_t memaddr, unsigned char type); + +struct mprofentry_struct { + oraddr_t addr; + unsigned char type; +};
profile.h Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: . =================================================================== --- . (nonexistent) +++ . (revision 1765)
. Property changes : Added: svn:ignore ## -0,0 +1,2 ## +Makefile +.deps

powered by: WebSVN 2.1.0

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