Skip to content

Commit

Permalink
Merge 0361cf7 into 279641a
Browse files Browse the repository at this point in the history
  • Loading branch information
snim2 committed Aug 17, 2016
2 parents 279641a + 0361cf7 commit 08607cf
Show file tree
Hide file tree
Showing 31 changed files with 60,244 additions and 67 deletions.
20 changes: 12 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,28 @@ install:
- mv pydgin-master pydgin
- cd ${HOME}
- wget https://bitbucket.org/pypy/pypy/get/default.tar.gz
- tar xf default.tar.gz --transform 's/pypy-pypy-[0-9a-f]\+/pypy/' --exclude 'pypy-pypy-*/pytest_cov.py'
- cd $TRAVIS_BUILD_DIR
- export PYTHONPATH=${PYTHONPATH}:${HOME}/pydgin/
- tar xf default.tar.gz --transform 's/pypy-pypy-[0-9a-f]\+/pypy/'
--exclude 'pypy-pypy-*/pytest_cov.py'
- mkdir ${HOME}/rpythonlib
- cd ${HOME}/rpythonlib
- ln -s ${HOME}/pypy/rpython/ rpython
- cd ${TRAVIS_BUILD_DIR}
script:
- py.test -n 4 -rxs --color=yes --cov-config .coveragerc --cov-report term-missing
--cov=revelation revelation/test/
- PYTHONPATH=${PYTHONPATH}:${HOME}/rpythonlib/:${HOME}/pydgin/:. py.test -n 4 -rxs
--color=yes --cov-config .coveragerc --cov-report term-missing --cov=revelation
revelation/test/
- python -m doctest scripts/diff_trace.py
- python -m doctest scripts/get_instructions_used.py
- cd docs
- make html
- make linkcheck
- cd ..
- PYTHONPATH=${HOME}/pydgin/:. ${HOME}/pypy/rpython/bin/rpython --no-pdb --opt=jit revelation/sim.py
- PYTHONPATH=${HOME}/pydgin/:${HOME}/pypy/:. ${HOME}/pypy/rpython/bin/rpython --no-pdb --opt=jit revelation/sim.py
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ] && [ "${TRAVIS_BRANCH}" == "master" ] ;
then PYTHONPATH=${HOME}/pydgin/:. ${HOME}/pypy/rpython/bin/rpython --no-pdb --opt=jit revelation/sim.py --debug ;
then PYTHONPATH=${HOME}/pydgin/:${HOME}/pypy/:. ${HOME}/pypy/rpython/bin/rpython --no-pdb --opt=jit revelation/sim.py --debug ;
fi
- if [ "${TRAVIS_PULL_REQUEST}" == "false" ] && [ "${TRAVIS_BRANCH}" == "master" ] ;
then PYTHONPATH=${HOME}/pydgin/:. ${HOME}/pypy/rpython/bin/rpython --no-pdb -O2 revelation/sim.py ;
then PYTHONPATH=${HOME}/pydgin/:${HOME}/pypy/:. ${HOME}/pypy/rpython/bin/rpython --no-pdb -O2 revelation/sim.py ;
fi
- mkdir bin
- mv pydgin-revelation-* bin/
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ The following OPTIONS are supported:
--time, -t Print approximate timing information
--jit FLAGS Set flags to tune the JIT (see
rpython.rlib.jit.PARAMETER_DOCS)
--gdb, -g Wait for input on start (e.g. when running via gdb)
--debug,-d FLAGS Enable debug flags in a comma-separated form. The
following flags are supported:
trace pc, decoded instructions
Expand Down Expand Up @@ -99,6 +100,7 @@ There are a small number of unimplemented features in Revelation:
* Work-groups and loading more than one binary
* The `DEBUGSTATUS` and `DEBUGCMD` registers (you can read and write to these but they don't have any special effects)
* The `MESHCONFIG` registers (you can read and write to these but they don't have any special effects)
* The `MEMPROTECT` register (you can read and write to this but it doesn't have any special effect)
* Event timers other than IALU and FPU valid instructions


Expand Down
9 changes: 6 additions & 3 deletions docs/_templates/links.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<h3>Useful Links</h3>
<ul>
<li><a href="{{ pathto('index') }}">Revelation documentation</a></li>
<li><a href="{{ pathto('contributing') }}">Contribution Guide</a></li>
<li><a href="{{ pathto('contributing') }}">Contribution guide</a></li>
<li><a href="https://github.com/futurecore/revelation/">Revelation @GitHub</a></li>
<li><a href="https://github.com/futurecure/revelation/issues">Issue Tracker</a></li>
<li><a href="https://github.com/futurecure/revelation/issues">Revelation issue tracker</a></li>
<li><a href="http://www.adapteva.com/epiphanyiii/">Epiphany III</a></li>
<li><a href="http://www.adapteva.com/epiphanyiv/">Epiphany IV</a></li>
<li><a href="http://adapteva.com/docs/epiphany_arch_ref.pdf">Epiphany Architecture Reference</a></li>
<li><a href="http://adapteva.com/docs/epiphany_arch_ref.pdf">Epiphany architecture reference</a></li>
<li><a href="https://github.com/cornell-brg/pydgin">Pydgin project</a></li>
<li><a href="http://www.csl.cornell.edu/~berkin/lockhart-pydgin-ispass2015.pdf">Pydgin paper</a></li>
<li><a href="http://rpython.readthedocs.io/en/latest/">RPython documentation</a></li>
</ul>

2 changes: 2 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ The full list of command-line options is:
--time, -t Print approximate timing information
--jit FLAGS Set flags to tune the JIT (see
rpython.rlib.jit.PARAMETER_DOCS)
--gdb, -g Wait for input on start (e.g. when running via gdb).
--debug,-d FLAGS Enable debug flags in a comma-separated form. The
following flags are supported:
trace pc, decoded instructions
Expand Down Expand Up @@ -136,6 +137,7 @@ There are a small number of unimplemented features in Revelation:
- Work-groups and loading more than one binary
- The ``DEBUGSTATUS`` and ``DEBUGCMD`` registers (you can read and write to these but they don't have any special effects)
- The ``MESHCONFIG`` registers (you can read and write to these but they don't have any special effects)
- The ``MEMPROTECT`` register (you can read and write to this but it doesn't have any special effect)
- Event timers other than IALU and FPU valid instructions


Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ pytest-cov==2.2.1
pytest-xdist==1.14
requests==2.9.1
Sphinx==1.4.5
sphinx-rtd-theme==0.1.9

7 changes: 6 additions & 1 deletion revelation/argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
--time, -t Print approximate timing information
--jit FLAGS Set flags to tune the JIT (see
rpython.rlib.jit.PARAMETER_DOCS)
--gdb, -g Wait for input on start (e.g. when running via gdb).
--debug,-d FLAGS Enable debug flags in a comma-separated form. The
following flags are supported:
trace pc, decoded instructions
Expand Down Expand Up @@ -58,6 +59,8 @@ def cli_parser(argv, simulator, debug_enabled):
print (USAGE_TEXT % (simulator.arch_name, argv[0], argv[0],
argv[0], argv[0], argv[0]))
raise DoNotInterpretError
elif token == '--gdb' or token == '-g':
simulator.run_from_gdb = True
elif token == '--profile' or token == '-p': # Undocumented.
simulator.profile = True
elif token == '--time' or token == '-t':
Expand Down Expand Up @@ -104,7 +107,9 @@ def cli_parser(argv, simulator, debug_enabled):
elif prev_token == '--switch':
simulator.switch_interval = int(token)
prev_token = ''
if filename_index == 0:
if filename_index == 0 and not simulator.run_from_gdb:
print 'You must supply a file name'
raise SyntaxError
if simulator.run_from_gdb:
return None, jit, debug_flags
return argv[filename_index], jit, debug_flags
6 changes: 4 additions & 2 deletions revelation/execute_interrupt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def execute_bkpt16(s, inst):
GDB and should not be user software. The instruction is included here
only for the purpose of reference.
"""
raise NotImplementedInstError('bkpt instruction not implemented.')
s.rf[reg_map['DEBUGSTATUS']] |= 1
s.pc += 2
s.ACTIVE = False


def execute_mbkpt16(s, inst):
Expand Down Expand Up @@ -190,7 +192,7 @@ def execute_wand16(s, inst):
raise NotImplementedInstError('wand instruction not implemented.')


def execute_unimpl(s, inst):
def execute_unimpl32(s, inst):
"""Not implemented exception.
STATUS[16-19] = 0100 [Epiphany III]
STATUS[16-19] = 1111 [Epiphany IV]
Expand Down
Empty file added revelation/gdb/__init__.py
Empty file.
50 changes: 50 additions & 0 deletions revelation/gdb/breakpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from revelation.isa import decode

BKPT16 = 0b0000000111000010
NOP16 = 0b0000000110100010


class BreakPointManager(object):
"""Manage breakpoints during GDB execution.
"""

def __init__(self, simulator):
self.target = simulator
self.breakpoints = {} # Address -> (opcode, size in bytes)

def _get_global_address(self, address, coreid=0x808):
"""Remap any local addresses to global address.
"""
if (address & 0xfff00000) == 0x0:
return (coreid << 20) | address
return address

def is_breakpoint_set(self, address, coreid=0x808):
global_address = self._get_global_address(address, coreid)
return global_address in self.breakpoints

def set_breakpoint(self, address, coreid=0x808):
"""Set a breakpoint at a given address.
1. Read 32 bit current instructions at address, save in dictionary.
2. If current instruction is 16 bit, replace with bkpt16.
3. If current instruction is 32 bit, replace with bkpt16, nop16.
"""
global_address = self._get_global_address(address, coreid)
opcode = self.target.memory.iread(global_address, 4)
mnemonic, _ = decode(opcode)
if mnemonic.endswith('16'):
self.breakpoints[global_address] = (opcode & 0xffff, 2)
self.target.memory.write(global_address, 2, BKPT16)
else:
self.breakpoints[global_address] = (opcode, 4)
self.target.memory.write(global_address, 2, BKPT16)
self.target.memory.write(global_address + 2, 2, NOP16)

def remove_breakpoint(self, address, coreid=0x808):
"""Remove a breakpoint at a given address."""
global_address = self._get_global_address(address, coreid)
if global_address not in self.breakpoints:
return
opcode, size = self.breakpoints[global_address]
self.target.memory.write(global_address, size, opcode)
del self.breakpoints[global_address]

0 comments on commit 08607cf

Please sign in to comment.