OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/or1ksim
    from Rev 472 to Rev 483
    Reverse comparison

Rev 472 → Rev 483

/toplevel-mprofile.c
36,12 → 36,13
/* Package includes */
#include "sim-config.h"
#include "mprofiler.h"
#include "toplevel-support.h"
 
 
int main (int argc,
char *argv[])
{
srand(getpid());
init_randomness ();
init_defconfig();
reg_config_secs();
 
/cpu/or32/insnset.c
546,7 → 546,8
}
INSTRUCTION (l_nop) {
uint32_t k = PARAM0;
switch (k) {
switch (k)
{
case NOP_NOP:
break;
case NOP_EXIT:
568,6 → 569,13
sim_done();
}
break;
case NOP_REPORT:
PRINTF("report(0x%"PRIxREG");\n", evalsim_reg(3));
break;
case NOP_PUTC: /*JPB */
printf( "%c", (char)(evalsim_reg( 3 ) & 0xff));
fflush( stdout );
break;
case NOP_CNT_RESET:
PRINTF("****************** counters reset ******************\n");
PRINTF("cycles %lld, insn #%lld\n", runtime.sim.cycles, runtime.cpu.instructions);
575,10 → 583,6
runtime.sim.reset_cycles = runtime.sim.cycles;
runtime.cpu.reset_instructions = runtime.cpu.instructions;
break;
case NOP_PUTC: /*JPB */
printf( "%c", (char)(evalsim_reg( 3 ) & 0xff));
fflush( stdout );
break;
case NOP_GET_TICKS:
cpu_state.reg[11] = runtime.sim.cycles & 0xffffffff;
cpu_state.reg[12] = runtime.sim.cycles >> 32;
592,12 → 596,13
case NOP_TRACE_OFF:
runtime.sim.hush = 1;
break;
case NOP_REPORT:
PRINTF("report(0x%"PRIxREG");\n", evalsim_reg(3));
case NOP_RANDOM:
cpu_state.reg[11] = (unsigned int) (random () & 0xffffffff);
break;
case NOP_OR1KSIM:
cpu_state.reg[11] = 1;
break;
default:
if (k >= NOP_REPORT_FIRST && k <= NOP_REPORT_LAST)
PRINTF("report %" PRIdREG " (0x%"PRIxREG");\n", k - NOP_REPORT_FIRST,
evalsim_reg(3));
break;
}
}
/cpu/or1k/spr-defs.h
625,7 → 625,7
#define NOP_GET_PS 0x0007 /* JPB: Get picosecs/cycle */
#define NOP_TRACE_ON 0x0008 /* Turn on tracing */
#define NOP_TRACE_OFF 0x0009 /* Turn off tracing */
#define NOP_REPORT_FIRST 0x0400 /* Report with number */
#define NOP_REPORT_LAST 0x03ff /* Report with number */
#define NOP_RANDOM 0x000a /* Return 4 random bytes */
#define NOP_OR1KSIM 0x000b /* Return non-zero if this is Or1ksim */
 
#endif /* SPR_DEFS__H */
/configure.ac
28,7 → 28,7
 
# Use a full version number (x.y.z, possibly with "rcn" as a suffix) when
# preparing a release, otherwise use a the date version (yyyy-mm-dd).
AC_INIT([or1ksim], [2011-01-05], [openrisc@opencores.org])
AC_INIT([or1ksim], [2011-01-27], [openrisc@opencores.org])
AC_CONFIG_MACRO_DIR([m4])
 
# Generically use extensions such as _GNU_SOURCE if available.
/doc/or1ksim.info
64,7 → 64,7
Unpack the software and create a _separate_ directory in which to build
it:
 
tar jxf or1ksim-2011-01-05.tar.bz2
tar jxf or1ksim-2011-01-27.tar.bz2
mkdir builddir_or1ksim
cd builddir_or1ksim
 
81,7 → 81,7
OpenRISC 1000 32-bit architecture. If this argument is omitted, it will
default to OpenRISC 1000 32-bit with a warning
 
../or1ksim-2011-01-05/configure --target=or32-elf ...
../or1ksim-2011-01-27/configure --target=or32-elf ...
 
There are several other options available, many of which are standard
to GNU `configure' scripts. Use `configure --help' to see all the
1058,7 → 1058,25
`l.nop 9'
Instruction tracing is turned off.
 
`l.nop 10'
A 32-bit random number is returned in `r11'.
 
The random numbers are generated using `random', which in turn is
seeded through `srandom' using the host `/dev/urandom' if
available, or else the process ID of the Or1ksim instance.
 
This opcode is particularly useful for situations where a target
program running on Or1ksim needs to obtain genuine system entropy
to generate random numbers.
 
`l.nop 11'
Return a non-zero value in `r11'.
 
This opcode can be used to detect if a target is running under
Or1ksim. Set `r11' to zero, issue this opcode, and look to see if
`r11' is non-zero.
 
 

File: or1ksim.info, Node: Configuration, Next: Interactive Command Line, Prev: Usage, Up: Top
 
4375,6 → 4393,8
(line 6)
* l.nop 0: l.nop Support. (line 12)
* l.nop 1 (end simulation): l.nop Support. (line 15)
* l.nop 10 (return a random number): l.nop Support. (line 51)
* l.nop 11 (return a non-zero value): l.nop Support. (line 62)
* l.nop 2 (report): l.nop Support. (line 19)
* l.nop 3 (printf, now obsolete): l.nop Support. (line 22)
* l.nop 4 (putc): l.nop Support. (line 29)
4845,45 → 4865,45
Node: Networking from OpenRISC Linux and BusyBox34613
Node: Tearing Down a Bridge36275
Node: l.nop Support37018
Node: Configuration38528
Node: Configuration File Format39140
Node: Configuration File Preprocessing39525
Node: Configuration File Syntax39822
Node: Simulator Configuration42607
Node: Simulator Behavior42898
Node: Verification API Configuration47479
Node: CUC Configuration49419
Node: Core OpenRISC Configuration51411
Node: CPU Configuration51913
Node: Memory Configuration56032
Node: Memory Management Configuration62754
Node: Cache Configuration65131
Node: Interrupt Configuration67517
Node: Power Management Configuration69350
Node: Branch Prediction Configuration70627
Node: Debug Interface Configuration71987
Node: Peripheral Configuration74330
Node: Memory Controller Configuration74956
Node: UART Configuration78736
Node: DMA Configuration82255
Node: Ethernet Configuration84122
Node: GPIO Configuration89401
Node: Display Interface Configuration91034
Node: Frame Buffer Configuration93343
Node: Keyboard Configuration95207
Node: Disc Interface Configuration97445
Node: Generic Peripheral Configuration102549
Node: Interactive Command Line104844
Node: Verification API111818
Node: Code Internals116248
Node: Coding Conventions116831
Node: Global Data Structures121258
Node: Concepts123915
Ref: Output Redirection124060
Ref: Interrupts Internal124598
Node: Internal Debugging125751
Node: Regression Testing126275
Node: GNU Free Documentation License130064
Node: Index152471
Node: Configuration39180
Node: Configuration File Format39792
Node: Configuration File Preprocessing40177
Node: Configuration File Syntax40474
Node: Simulator Configuration43259
Node: Simulator Behavior43550
Node: Verification API Configuration48131
Node: CUC Configuration50071
Node: Core OpenRISC Configuration52063
Node: CPU Configuration52565
Node: Memory Configuration56684
Node: Memory Management Configuration63406
Node: Cache Configuration65783
Node: Interrupt Configuration68169
Node: Power Management Configuration70002
Node: Branch Prediction Configuration71279
Node: Debug Interface Configuration72639
Node: Peripheral Configuration74982
Node: Memory Controller Configuration75608
Node: UART Configuration79388
Node: DMA Configuration82907
Node: Ethernet Configuration84774
Node: GPIO Configuration90053
Node: Display Interface Configuration91686
Node: Frame Buffer Configuration93995
Node: Keyboard Configuration95859
Node: Disc Interface Configuration98097
Node: Generic Peripheral Configuration103201
Node: Interactive Command Line105496
Node: Verification API112470
Node: Code Internals116900
Node: Coding Conventions117483
Node: Global Data Structures121910
Node: Concepts124567
Ref: Output Redirection124712
Ref: Interrupts Internal125250
Node: Internal Debugging126403
Node: Regression Testing126927
Node: GNU Free Documentation License130716
Node: Index153123

End Tag Table
/doc/or1ksim.texi
1304,6 → 1304,28
 
Instruction tracing is turned off.
 
@item l.nop 10
@cindex @code{l.nop 10} (return a random number)
 
A 32-bit random number is returned in @code{r11}.
 
The random numbers are generated using @code{random}, which in turn is
seeded through @code{srandom} using the host @file{/dev/urandom} if
available, or else the process ID of the @value{OR1KSIM} instance.
 
This opcode is particularly useful for situations where a target
program running on Or1ksim needs to obtain genuine system entropy to
generate random numbers.
 
@item l.nop 11
@cindex @code{l.nop 11} (return a non-zero value)
 
Return a non-zero value in @code{r11}.
 
This opcode can be used to detect if a target is running under
Or1ksim. Set @code{r11} to zero, issue this opcode, and look to see
if @code{r11} is non-zero.
 
@end table
 
@node Configuration
/NEWS
19,7 → 19,16
"l.nop 1", which will cause the simulator to exit. Good for tracking pointer
corruption.
 
New l.nop opcodes to turn instruction tracing on and off. Good for debugging
applications.
 
New l.nop opcode to return a random number. Good for applications (like the
Linux kernel) which need access to the host entropy to ensure randomness.
 
New l.nop opcode to identify that this is an Or1ksim session. Allows
applications to determine if they are running on Or1ksim or hardware.
 
 
New in release 0.5.0rc2
=======================
 
/ChangeLog
1,3 → 1,24
2011-01-27 Jeremy Bennett <jeremy.bennett@embecosm.com>
 
* configure: Regenerated.
* configure.ac: Updated version.
* cpu/or32/insnset.c <l_nop>: Added behavior for NOP_RANDOM and
NOP_OR1KSIM. Removed default behavior.
* cpu/or1k/spr-defs.h: Added definition of NOP_RANDOM and
NOP_OR1KSIM. Removed definitions of NOP_REPORT_FIRST and
NOP_REPORT_LAST.
* doc/or1ksim.texi <l.nop Opcode Support>: Document l.nop 10 and
l.nop 11.
* libtoplevel.c (or1ksim_init): Replaced srand () by
init_randomness ().
* peripheral/memory.c (mem_reset): Do not allow general reset of
random number generator.
* sim_config.c (parse_args): Change use of rand () to random ().
* toplevel.c (main): Replaced srand () by init_randomness ().
* toplevel-profile.c (main): Replaced srand () by init_randomness ().
* toplevel-support.c (init_randomness): Created.
* toplevel-support.h <init_randomness>: Added.
 
2011-01-05 Jeremy Bennett <jeremy@jeremybennett.com>
 
* cpu/common/abstract.c (diassemble_instr): Added instruction
/testsuite/test-code-or1k/configure
1,6 → 1,6
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for or1ksim-testsuite 2011-01-05.
# Generated by GNU Autoconf 2.65 for or1ksim-testsuite 2011-01-27.
#
# Report bugs to <openrisc@opencores.org>.
#
701,8 → 701,8
# Identity of this package.
PACKAGE_NAME='or1ksim-testsuite'
PACKAGE_TARNAME='or1ksim-testsuite'
PACKAGE_VERSION='2011-01-05'
PACKAGE_STRING='or1ksim-testsuite 2011-01-05'
PACKAGE_VERSION='2011-01-27'
PACKAGE_STRING='or1ksim-testsuite 2011-01-27'
PACKAGE_BUGREPORT='openrisc@opencores.org'
PACKAGE_URL=''
 
1424,7 → 1424,7
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures or1ksim-testsuite 2011-01-05 to adapt to many kinds of systems.
\`configure' configures or1ksim-testsuite 2011-01-27 to adapt to many kinds of systems.
 
Usage: $0 [OPTION]... [VAR=VALUE]...
 
1495,7 → 1495,7
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of or1ksim-testsuite 2011-01-05:";;
short | recursive ) echo "Configuration of or1ksim-testsuite 2011-01-27:";;
esac
cat <<\_ACEOF
 
1600,7 → 1600,7
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
or1ksim-testsuite configure 2011-01-05
or1ksim-testsuite configure 2011-01-27
generated by GNU Autoconf 2.65
 
Copyright (C) 2009 Free Software Foundation, Inc.
2025,7 → 2025,7
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
 
It was created by or1ksim-testsuite $as_me 2011-01-05, which was
It was created by or1ksim-testsuite $as_me 2011-01-27, which was
generated by GNU Autoconf 2.65. Invocation command line was
 
$ $0 $@
10315,7 → 10315,7
 
# Define the identity of the package.
PACKAGE='or1ksim-testsuite'
VERSION='2011-01-05'
VERSION='2011-01-27'
 
 
cat >>confdefs.h <<_ACEOF
11742,7 → 11742,7
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by or1ksim-testsuite $as_me 2011-01-05, which was
This file was extended by or1ksim-testsuite $as_me 2011-01-27, which was
generated by GNU Autoconf 2.65. Invocation command line was
 
CONFIG_FILES = $CONFIG_FILES
11808,7 → 11808,7
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
or1ksim-testsuite config.status 2011-01-05
or1ksim-testsuite config.status 2011-01-27
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
 
/testsuite/test-code-or1k/configure.ac
24,7 → 24,7
# directory. This uses a different tool chain, so has its own configuration
# script. Process this file with autoconf to produce a configure script.
 
AC_INIT([or1ksim-testsuite], [2011-01-05], [openrisc@opencores.org])
AC_INIT([or1ksim-testsuite], [2011-01-27], [openrisc@opencores.org])
AC_CONFIG_MACRO_DIR([m4])
 
AC_PROG_LIBTOOL
/testsuite/test-code-or1k/ChangeLog
1,3 → 1,11
2011-01-27 Jeremy Bennett <jeremy.bennett@embecosm.com>
 
* configure: Regenerated.
* configure.ac: Updated version.
* support/spr-defs.h: Added definition of NOP_RANDOM and
NOP_OR1KSIM. Removed definitions of NOP_REPORT_FIRST and
NOP_REPORT_LAST.
 
2011-01-05 Jeremy Bennett <jeremy.bennett@embecosm.com>
 
* configure: Regenerated.
/testsuite/test-code-or1k/support/spr-defs.h
625,7 → 625,7
#define NOP_GET_PS 0x0007 /* JPB: Get picosecs/cycle */
#define NOP_TRACE_ON 0x0008 /* Turn on tracing */
#define NOP_TRACE_OFF 0x0009 /* Turn off tracing */
#define NOP_REPORT_FIRST 0x0400 /* Report with number */
#define NOP_REPORT_LAST 0x03ff /* Report with number */
#define NOP_RANDOM 0x000a /* Return 4 random bytes */
#define NOP_OR1KSIM 0x000b /* Return non-zero if this is Or1ksim */
 
#endif /* SPR_DEFS__H */
/peripheral/memory.c
191,13 → 191,16
case MT_RANDOM:
if (mem->random_seed == -1)
{
seed = time (NULL);
/* Print out the seed just in case we ever need to debug */
PRINTF ("Seeding random generator with value %d\n", seed);
/* seed = time (NULL); */
/* srandom (seed); */
/* /\* Print out the seed just in case we ever need to debug *\/ */
/* PRINTF ("Seeding random generator with value %d\n", seed); */
}
else
seed = mem->random_seed;
srandom (seed);
{
seed = mem->random_seed;
srandom (seed);
}
 
for (i = 0; i < mem->size; i++, mem_area++)
*mem_area = random () & 0xFF;
/toplevel.c
63,7 → 63,7
main (int argc,
char *argv[])
{
srand (getpid ());
init_randomness ();
init_defconfig ();
reg_config_secs ();
 
/configure
1,7 → 1,7
#! /bin/sh
# From configure.ac Id: configure.ac 1374 2011-01-05 09:38:49Z jeremy using automake version AC_ACVERSION.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for or1ksim 2011-01-05.
# Generated by GNU Autoconf 2.65 for or1ksim 2011-01-27.
#
# Report bugs to <openrisc@opencores.org>.
#
722,8 → 722,8
# Identity of this package.
PACKAGE_NAME='or1ksim'
PACKAGE_TARNAME='or1ksim'
PACKAGE_VERSION='2011-01-05'
PACKAGE_STRING='or1ksim 2011-01-05'
PACKAGE_VERSION='2011-01-27'
PACKAGE_STRING='or1ksim 2011-01-27'
PACKAGE_BUGREPORT='openrisc@opencores.org'
PACKAGE_URL=''
 
1476,7 → 1476,7
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures or1ksim 2011-01-05 to adapt to many kinds of systems.
\`configure' configures or1ksim 2011-01-27 to adapt to many kinds of systems.
 
Usage: $0 [OPTION]... [VAR=VALUE]...
 
1547,7 → 1547,7
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of or1ksim 2011-01-05:";;
short | recursive ) echo "Configuration of or1ksim 2011-01-27:";;
esac
cat <<\_ACEOF
 
1654,7 → 1654,7
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
or1ksim configure 2011-01-05
or1ksim configure 2011-01-27
generated by GNU Autoconf 2.65
 
Copyright (C) 2009 Free Software Foundation, Inc.
2316,7 → 2316,7
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
 
It was created by or1ksim $as_me 2011-01-05, which was
It was created by or1ksim $as_me 2011-01-27, which was
generated by GNU Autoconf 2.65. Invocation command line was
 
$ $0 $@
10717,7 → 10717,7
 
# Define the identity of the package.
PACKAGE='or1ksim'
VERSION='2011-01-05'
VERSION='2011-01-27'
 
 
cat >>confdefs.h <<_ACEOF
13736,7 → 13736,7
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by or1ksim $as_me 2011-01-05, which was
This file was extended by or1ksim $as_me 2011-01-27, which was
generated by GNU Autoconf 2.65. Invocation command line was
 
CONFIG_FILES = $CONFIG_FILES
13802,7 → 13802,7
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
or1ksim config.status 2011-01-05
or1ksim config.status 2011-01-27
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
 
/toplevel-support.c
34,6 → 34,9
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
 
/* Package includes */
#include "toplevel-support.h"
69,6 → 72,48
 
 
/*---------------------------------------------------------------------------*/
/*!Random number initialization
 
This has become more important, since we rely on randomness to generate
different MACs in Linux running on Or1ksim.
 
We take our seed from /dev/urandom.
 
If /dev/urandom is not available, we use srandom with the PID instead. */
/*---------------------------------------------------------------------------*/
void
init_randomness ()
{
unsigned int seed;
int fd;
 
fd = open ("/dev/urandom", O_RDONLY);
 
if (fd >= 0)
{
if (sizeof (seed) != read (fd, (void *) &seed, sizeof (seed)))
{
fprintf (stderr, "Warning: Unable to read /dev/random, using PID.\n");
seed = getpid ();
}
}
else
{
fprintf (stderr, "Warning: Unable to open /dev/random, using PID.\n");
seed = getpid ();
}
 
srandom (seed);
 
/* Print out the seed just in case we ever need to debug. Note that we
cannot use PRINTF here, since the file handle will not yet have been set
up. */
printf ("Seeding random generator with value 0x%08x\n", seed);
 
} /* init_randomness () */
 
 
/*---------------------------------------------------------------------------*/
/*!Signal handler for ctrl-C
 
Sets the iprompt flag, so the simulator will stop next time round the
/toplevel-support.h
32,6 → 32,7
#define TOPLEVEL_SUPPORT__H
 
/* Prototypes for external use */
extern void init_randomness ();
extern void ctrl_c (int signum);
extern void toggle_trace (int signum);
extern void reg_sim_reset (void (*reset_hook) (void *), void *dat);
/libtoplevel.c
83,7 → 83,7
int data_len))
{
/* Initialization copied from existing main() */
srand (getpid ());
init_randomness ();
init_defconfig ();
reg_config_secs ();
 
/toplevel-profile.c
34,12 → 34,13
/* Package includes */
#include "sim-config.h"
#include "profiler.h"
#include "toplevel-support.h"
 
 
int main (int argc,
char *argv[])
{
srand(getpid());
init_randomness ();
init_defconfig();
reg_config_secs();
 
/sim-config.c
962,7 → 962,7
nosrv = arg_lit0 (NULL, "nosrv", "do not launch debug server");
srv = arg_int0 (NULL, "srv", "<n>",
"launch debug server on port (default random)");
srv->ival[0] = rand () % (65536 - 49152) + 49152;
srv->ival[0] = random () % (65536 - 49152) + 49152;
srv->hdr.flag |= ARG_HASOPTVALUE;
mem = arg_str0 ("m", "memory", "<n>", "add memory block of <n> bytes");
dbg = arg_str0 ("d", "debug-config", "<str>", "Debug config string");

powered by: WebSVN 2.1.0

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