mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
got it to work
This commit is contained in:
parent
1bdfe5ab97
commit
13ede7255e
@ -38,6 +38,7 @@ from join import join
|
|||||||
from _Waiter import _Waiter
|
from _Waiter import _Waiter
|
||||||
from util import StopSimulation, SuspendSimulation
|
from util import StopSimulation, SuspendSimulation
|
||||||
import simrun
|
import simrun
|
||||||
|
import simrunc
|
||||||
|
|
||||||
schedule = _futureEvents.append
|
schedule = _futureEvents.append
|
||||||
|
|
||||||
@ -86,7 +87,10 @@ class Simulation(object):
|
|||||||
os.close(cosim._wf)
|
os.close(cosim._wf)
|
||||||
os.waitpid(cosim._child_pid, 0)
|
os.waitpid(cosim._child_pid, 0)
|
||||||
|
|
||||||
run = simrun.run
|
def run(self, duration=0, quiet=0):
|
||||||
|
simrunc.run(sim=self, duration=duration, quiet=quiet)
|
||||||
|
|
||||||
|
runpy = simrun.run
|
||||||
|
|
||||||
|
|
||||||
def printExcInfo():
|
def printExcInfo():
|
||||||
|
@ -27,6 +27,8 @@ from __future__ import generators
|
|||||||
|
|
||||||
from join import join
|
from join import join
|
||||||
|
|
||||||
|
from _simulator import _siglist, _futureEvents;
|
||||||
|
|
||||||
|
|
||||||
class _Waiter(object):
|
class _Waiter(object):
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ from types import GeneratorType
|
|||||||
from join import join
|
from join import join
|
||||||
from _Waiter import _Waiter
|
from _Waiter import _Waiter
|
||||||
from util import StopSimulation, SuspendSimulation
|
from util import StopSimulation, SuspendSimulation
|
||||||
|
from util import printExcInfo
|
||||||
|
|
||||||
schedule = _futureEvents.append
|
schedule = _futureEvents.append
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
static PyObject *_simulator;
|
static PyObject *_simulator;
|
||||||
static PyObject *_siglist;
|
static PyObject *_siglist;
|
||||||
@ -42,10 +43,8 @@ run(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||||||
t = PyLong_AsLongLong(tO);
|
t = PyLong_AsLongLong(tO);
|
||||||
Py_DECREF(tO);
|
Py_DECREF(tO);
|
||||||
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
|
|
||||||
len = PyList_Size(_siglist);
|
len = PyList_Size(_siglist);
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
s = PyList_GetItem(_siglist, i);
|
s = PyList_GetItem(_siglist, i);
|
||||||
@ -108,6 +107,7 @@ run(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||||||
ev = PyTuple_New(2);
|
ev = PyTuple_New(2);
|
||||||
newtO = PyLong_FromLongLong(t + ct);
|
newtO = PyLong_FromLongLong(t + ct);
|
||||||
PyTuple_SetItem(ev, 0, newtO);
|
PyTuple_SetItem(ev, 0, newtO);
|
||||||
|
Py_INCREF(clone);
|
||||||
PyTuple_SetItem(ev, 1, clone);
|
PyTuple_SetItem(ev, 1, clone);
|
||||||
PyList_Append(_futureEvents, ev);
|
PyList_Append(_futureEvents, ev);
|
||||||
Py_DECREF(ev);
|
Py_DECREF(ev);
|
||||||
|
@ -33,6 +33,7 @@ __version__ = "$Revision$"
|
|||||||
__date__ = "$Date$"
|
__date__ = "$Date$"
|
||||||
|
|
||||||
import exceptions
|
import exceptions
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def downrange(start, stop=0):
|
def downrange(start, stop=0):
|
||||||
@ -71,5 +72,12 @@ class SuspendSimulation(exceptions.Exception):
|
|||||||
""" Basic exception to suspend a Simulation """
|
""" Basic exception to suspend a Simulation """
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def printExcInfo():
|
||||||
|
kind, value = sys.exc_info()[:2]
|
||||||
|
msg = str(kind)
|
||||||
|
msg = msg[msg.rindex('.')+1:]
|
||||||
|
if str(value):
|
||||||
|
msg += ": %s" % value
|
||||||
|
print msg
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user