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

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 102 to Rev 103
    Reverse comparison

Rev 102 → Rev 103

/trunk/or1ksim/configure
1919,7 → 1919,8
 
INCLUDES="-I\${top_srcdir}/cpu/common -I\${top_srcdir}/cpu/or1k \
-I\${top_srcdir}/cpu/$CPU_ARCH -I\${top_srcdir}/cache -I\${top_srcdir}/mmu \
-I\${top_srcdir}/bpb -I\${top_srcdir}/peripheral -I\${top_srcdir}/tick"
-I\${top_srcdir}/bpb -I\${top_srcdir}/peripheral -I\${top_srcdir}/tick \
-I\${top_srcdir}/pm -I\${top_srcdir}/pic"
 
 
 
2027,7 → 2028,8
trap 'rm -fr `echo "Makefile bpb/Makefile cache/Makefile cpu/Makefile
cpu/common/Makefile cpu/or32/Makefile cpu/or16/Makefile
cpu/or1k/Makefile cpu/dlx/Makefile
support/Makefile mmu/Makefile peripheral/Makefile tick/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
support/Makefile mmu/Makefile peripheral/Makefile tick/Makefile
pm/Makefile pic/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
 
2143,7 → 2145,8
CONFIG_FILES=\${CONFIG_FILES-"Makefile bpb/Makefile cache/Makefile cpu/Makefile
cpu/common/Makefile cpu/or32/Makefile cpu/or16/Makefile
cpu/or1k/Makefile cpu/dlx/Makefile
support/Makefile mmu/Makefile peripheral/Makefile tick/Makefile"}
support/Makefile mmu/Makefile peripheral/Makefile tick/Makefile
pm/Makefile pic/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
/trunk/or1ksim/sim-config.h
31,6 → 31,10
struct {
int tagtype;
} ic;
struct {
int bpb_sim;
int btic_sim;
} bp; /* Branch prediction */
int clkcycle_ns; /* Clock cycle in nanoseconds */
struct {
char *rxfile; /* File for RX */
42,6 → 46,12
unsigned long endaddr;
} ram;
int simdebug; /* Simulator debugging */
int iprompt; /* Interactive prompt */
int dependstats;/* Calculation of dependency statistics */
int dependency; /* Calculation of dependency (implied by dependstats) */
int history; /* Instruction stream history remembered by the simulator */
int superscalar;/* "Superscalar" simulation */
int slp;
};
extern struct config config;
/trunk/or1ksim/Makefile.in
90,12 → 90,12
host_cpu = @host_cpu@
host_os = @host_os@
 
SUBDIRS = cpu bpb support cache mmu peripheral tick
SUBDIRS = cpu bpb support cache mmu peripheral tick pm pic
 
noinst_PROGRAMS = sim
 
sim_SOURCES = toplevel.c sim-config.c
sim_LDADD = cpu/common/libcommon.a cpu/$(CPU_ARCH)/libarch.a cpu/or1k/libor1k.a support/libsupport.a mmu/libmmu.a bpb/libbpb.a cache/libcache.a peripheral/libperipheral.a tick/libtick.a
sim_LDADD = cpu/common/libcommon.a cpu/$(CPU_ARCH)/libarch.a cpu/or1k/libor1k.a support/libsupport.a mmu/libmmu.a bpb/libbpb.a cache/libcache.a peripheral/libperipheral.a tick/libtick.a pm/libpm.a pic/libpic.a
 
sim_LDFLAGS = -lreadline
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
112,13 → 112,14
sim_OBJECTS = toplevel.o sim-config.o
sim_DEPENDENCIES = cpu/common/libcommon.a cpu/$(CPU_ARCH)/libarch.a \
cpu/or1k/libor1k.a support/libsupport.a mmu/libmmu.a bpb/libbpb.a \
cache/libcache.a peripheral/libperipheral.a tick/libtick.a
cache/libcache.a peripheral/libperipheral.a tick/libtick.a pm/libpm.a \
pic/libpic.a
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
Makefile.am Makefile.in NEWS TODO aclocal.m4 config.guess config.h.in \
config.sub configure configure.in install-sh missing mkinstalldirs
DIST_COMMON = README ./stamp-h.in COPYING Makefile.am Makefile.in \
aclocal.m4 config.guess config.h.in config.sub configure configure.in \
install-sh missing mkinstalldirs
 
 
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
/trunk/or1ksim/configure.in
99,7 → 99,8
dnl yuck
INCLUDES="-I\${top_srcdir}/cpu/common -I\${top_srcdir}/cpu/or1k \
-I\${top_srcdir}/cpu/$CPU_ARCH -I\${top_srcdir}/cache -I\${top_srcdir}/mmu \
-I\${top_srcdir}/bpb -I\${top_srcdir}/peripheral -I\${top_srcdir}/tick"
-I\${top_srcdir}/bpb -I\${top_srcdir}/peripheral -I\${top_srcdir}/tick \
-I\${top_srcdir}/pm -I\${top_srcdir}/pic"
AC_SUBST(INCLUDES)
 
 
106,7 → 107,8
AC_OUTPUT([Makefile bpb/Makefile cache/Makefile cpu/Makefile
cpu/common/Makefile cpu/or32/Makefile cpu/or16/Makefile
cpu/or1k/Makefile cpu/dlx/Makefile
support/Makefile mmu/Makefile peripheral/Makefile tick/Makefile],
support/Makefile mmu/Makefile peripheral/Makefile tick/Makefile
pm/Makefile pic/Makefile],
[
# Makefile uses this timestamp file to record whether config.h is up to date.
echo > stamp-h
/trunk/or1ksim/Makefile.am
4,7 → 4,7
#
#
 
SUBDIRS = cpu bpb support cache mmu peripheral tick
SUBDIRS = cpu bpb support cache mmu peripheral tick pm pic
 
noinst_PROGRAMS = sim
 
12,5 → 12,5
sim_LDADD = cpu/common/libcommon.a cpu/$(CPU_ARCH)/libarch.a \
cpu/or1k/libor1k.a support/libsupport.a mmu/libmmu.a \
bpb/libbpb.a cache/libcache.a peripheral/libperipheral.a \
tick/libtick.a
tick/libtick.a pm/libpm.a pic/libpic.a
sim_LDFLAGS = -lreadline
/trunk/or1ksim/toplevel.c
41,11 → 41,12
#include "trace.h"
#include "execute.h"
#include "sim-config.h"
#include "spr_defs.h"
 
#include "coff.h"
 
/* CVS revision number. */
const char rcsrev[] = "$Revision: 1.14 $";
const char rcsrev[] = "$Revision: 1.15 $";
 
/* Continuos run versus single step tracing switch. */
int cont_run;
189,23 → 190,34
int hush;
unsigned long endaddr;
if (argc != 2)
{
printf("Usage: %s <filename>\n", argv[0]);
exit(-1);
}
srand(getpid());
init_defconfig();
if ((argc < 2) || parse_args(argc, argv)) {
printf("Usage: %s [options] <filename>\n", argv[0]);
printf("Options:\n");
printf(" -v: version and copyright note\n");
printf(" -i: enable interactive command prompt\n");
printf(" -bpb: disable branch prediction buffer analysis\n");
printf(" -btic: disable branch prediction target insn cache analysis\n");
printf(" -hazards: disable dependency hazards analysis\n");
printf(" -history: disable instruction stream history analysis\n");
printf(" -superscalar: disable superscalar analysis\n");
printf(" -fast: disable BPB, BTIC, SLP, dependency hazards, history analysis etc.\n");
printf(" -upr <n>: set UPR to n\n");
printf(" -ver <n>: set VR[VER] to n\n");
printf(" -rev <n>: set VR[REV] to n\n");
exit(-1);
}
 
#ifdef HAVE_LIBREADLINE
initialize_readline (); /* Bind our completer. */
#endif
 
srand(getpid());
version();
init_defconfig();
print_config();
signal(SIGINT, ctrl_c);
initstats();
memset(mem, 0, sizeof(mem));
endaddr = loadcode(argv[1], MEMORY_START, 0);
endaddr = loadcode(argv[argc-1], MEMORY_START, 0);
if (endaddr == -1) {
printf("Problems loading boot code.\n");
exit(1);
212,48 → 224,46
}
uart_reset();
tick_reset();
pm_reset();
pic_reset();
reset();
set_reg32("r3", endaddr);
 
while(1)
{
while(1) {
if (config.iprompt) {
#ifdef HAVE_LIBREADLINE
linestr = readline("(sim) ");
linestr = readline("(sim) ");
#else
printf ("(sim) ");
linestr = fgets(b2, sizeof b2, stdin);
printf ("(sim) ");
linestr = fgets(b2, sizeof b2, stdin);
#endif
} else
strcpy(linestr = b2, "run 100000000 hush");
 
if (!linestr)
{
break;
}
linestr = stripwhite (linestr);
if (!linestr)
break;
linestr = stripwhite (linestr);
 
#ifdef HAVE_LIBREADLINE
if (strlen(linestr) == 0)
{
char *l = repeat_last_command ();
if (strlen(linestr) == 0) {
char *l = repeat_last_command ();
 
if (l)
{
free (linestr);
linestr = l;
}
}
if (l) {
free (linestr);
linestr = l;
}
}
if (*linestr)
{
add_history (linestr);
}
if (*linestr) {
add_history (linestr);
}
#endif /* HAVE_LIBREADLINE */
if (redirstr = strstr(linestr, ">"))
{
*redirstr = '\0';
strtoken(&redirstr[1], item1, 1);
freopen(item1, "w+", stdout);
}
if (redirstr = strstr(linestr, ">")) {
*redirstr = '\0';
strtoken(&redirstr[1], item1, 1);
freopen(item1, "w+", stdout);
}
strtoken(linestr, item1, 1);
if (strcmp(item1, "q") == 0) /* quit */
372,6 → 382,8
if (strcmp(item1, "reset") == 0) { /* reset simulator */
uart_reset();
tick_reset();
pm_reset();
pic_reset();
reset();
} else
if (strcmp(item1, "debug") == 0) { /* debug mode */
418,18 → 430,25
uart_status();
sprs_status();
} else {
printf("%s: Unknown command.\n", linestr);
}
printf("%s: Unknown command.\n", linestr);
}
 
while(cont_run) {
cont_run--;
fetch();
decode(&iqueue[0]);
execute();
if (!getsprbits(SPR_PMR, SPR_PMR_DME | SPR_PMR_SME)) {
fetch();
decode_execute(&iqueue[0]);
analysis();
if (!hush)
dumpreg();
pic_clock();
dc_clock();
ic_clock();
}
if (!getsprbits(SPR_PMR, SPR_PMR_SME))
tick_clock();
pm_clock();
uart_clock();
tick_clock();
if (!hush)
dumpreg();
}
 
hush = 0;
436,9 → 455,12
fflush(stdout);
freopen("/dev/fd/0", "w+", stdout);
 
if (!config.iprompt) /* non-interactive quit */
exit(0);
 
#ifdef HAVE_LIBREADLINE
if (linestr)
free (linestr);
if (linestr)
free (linestr);
#endif
 
}
/trunk/or1ksim/sim-config.c
19,29 → 19,151
 
/* Simulator configuration. Eventually this one will be a lot bigger. */
 
#include <stdio.h>
#include "sim-config.h"
#include "abstract.h"
#include "spr_defs.h"
 
struct config config;
 
void init_defconfig()
{
printf("Machine initialization...\n");
unsigned long val;
memset(&config, 0, sizeof(config));
config.dc.tagtype = VIRTUAL;
printf("Data cache tag: %s\n", config.dc.tagtype == VIRTUAL ? "virtual" : "physical");
config.ic.tagtype = VIRTUAL;
printf("Insn cache tag: %s\n", config.ic.tagtype == VIRTUAL ? "virtual" : "physical");
config.bp.bpb_sim = 1;
config.bp.btic_sim = 1;
config.clkcycle_ns = 4; /* 4 for 4ns (250MHz) */
printf("Clock cycle: %d ns\n", config.clkcycle_ns);
config.uarts[0].rxfile = "/tmp/uart0.rx";
config.uarts[0].txfile = "/tmp/uart0.tx";
config.uarts[0].baseaddr = 0x80000000;
config.ram.startaddr = MEMORY_START;
config.ram.endaddr = MEMORY_START + MEMORY_LEN;
config.simdebug = 0;
config.iprompt = 0;
config.dependstats = 1;
config.dependency = 1;
config.history = 1;
config.superscalar = 1;
config.slp = 1;
 
mtspr(SPR_VR, SPR_VR_VER & 0x1200);
 
val = SPR_UPR_UP | SPR_UPR_DCP | SPR_UPR_ICP | SPR_UPR_DMP |
SPR_UPR_IMP | SPR_UPR_OB32P | SPR_UPR_DUP | SPR_UPR_PICP |
SPR_UPR_PMP | SPR_UPR_TTP;
 
mtspr(SPR_UPR, val);
}
 
int parse_args(int argc, char *argv[])
{
unsigned long val;
argv++; argc--;
while (argc) {
if (argc && (*argv[0] != '-'))
return 0;
if (strcmp(*argv, "-i") == 0) {
config.iprompt = 1;
argv++; argc--;
} else
if (strcmp(*argv, "-v") == 0) {
version();
exit(0);
} else
if (strcmp(*argv, "-bpb") == 0) {
config.bp.bpb_sim = 0;
argv++; argc--;
} else
if (strcmp(*argv, "-hazards") == 0) {
config.dependstats = 0;
config.dependency = 0;
argv++; argc--;
} else
if (strcmp(*argv, "-history") == 0) {
config.history = 0;
argv++; argc--;
} else
if (strcmp(*argv, "-superscalar") == 0) {
config.superscalar = 0;
argv++; argc--;
} else
if (strcmp(*argv, "-fast") == 0) {
config.superscalar = 0;
config.history = 0;
config.dependstats = 0;
config.dependency = 0;
config.bp.bpb_sim = 0;
config.bp.btic_sim = 0;
config.slp = 0;
argv++; argc--;
} else
if (strcmp(*argv, "-btic") == 0) {
config.bp.btic_sim = 0;
argv++; argc--;
} else
if (strcmp(*argv, "-upr") == 0) {
argv++; argc--;
val = strtoul(*argv, NULL, 0);
mtspr(SPR_UPR, val);
argv++; argc--;
} else
if (strcmp(*argv, "-ver") == 0) {
argv++; argc--;
val = strtoul(*argv, NULL, 0);
setsprbits(SPR_VR, SPR_VR_VER, val);
argv++; argc--;
} else
if (strcmp(*argv, "-rev") == 0) {
argv++; argc--;
val = strtoul(*argv, NULL, 0);
setsprbits(SPR_VR, SPR_VR_REV, val);
argv++; argc--;
} else {
printf("Unknown option: %s\n", *argv);
return 1;
}
}
if (!argc)
return 0;
return 0;
}
 
void print_config()
{
printf("Machine initialization...\n");
if (getsprbits(SPR_UPR, SPR_UPR_DCP))
printf("Data cache tag: %s\n", config.dc.tagtype == VIRTUAL ? "virtual" : "physical");
else
printf("No data cache.\n");
if (getsprbits(SPR_UPR, SPR_UPR_ICP))
printf("Insn cache tag: %s\n", config.ic.tagtype == VIRTUAL ? "virtual" : "physical");
else
printf("No instruction cache.\n");
if (config.bp.bpb_sim)
printf("BPB simulation on.\n");
else
printf("BPB simulation off.\n");
if (config.bp.btic_sim)
printf("BTIC simulation on.\n");
else
printf("BTIC simulation off.\n");
printf("Clock cycle: %d ns\n", config.clkcycle_ns);
printf("RAM: 0x%x to ", config.ram.startaddr);
printf("0x%x (", config.ram.endaddr);
printf("%d KB)\n\n", (config.ram.endaddr - config.ram.startaddr) / 1024);
config.simdebug = 0;
printf("simdebug off\n");
if (config.simdebug)
printf("simdebug on, ");
else
printf("simdebug off, ");
if (config.iprompt)
printf("interactive prompt on\n");
else
printf("interactive prompt off\n");
}

powered by: WebSVN 2.1.0

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