1
0
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:
jand 2003-05-29 13:54:45 +00:00
parent 1bdfe5ab97
commit 13ede7255e
5 changed files with 18 additions and 3 deletions

View File

@ -38,6 +38,7 @@ from join import join
from _Waiter import _Waiter
from util import StopSimulation, SuspendSimulation
import simrun
import simrunc
schedule = _futureEvents.append
@ -86,7 +87,10 @@ class Simulation(object):
os.close(cosim._wf)
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():

View File

@ -27,6 +27,8 @@ from __future__ import generators
from join import join
from _simulator import _siglist, _futureEvents;
class _Waiter(object):

View File

@ -36,6 +36,7 @@ from types import GeneratorType
from join import join
from _Waiter import _Waiter
from util import StopSimulation, SuspendSimulation
from util import printExcInfo
schedule = _futureEvents.append

View File

@ -1,6 +1,7 @@
#include "Python.h"
#include <assert.h>
#include <stdio.h>
static PyObject *_simulator;
static PyObject *_siglist;
@ -42,10 +43,8 @@ run(PyObject *self, PyObject *args, PyObject *kwargs)
t = PyLong_AsLongLong(tO);
Py_DECREF(tO);
for (;;) {
len = PyList_Size(_siglist);
for (i = 0; i < len; i++) {
s = PyList_GetItem(_siglist, i);
@ -108,6 +107,7 @@ run(PyObject *self, PyObject *args, PyObject *kwargs)
ev = PyTuple_New(2);
newtO = PyLong_FromLongLong(t + ct);
PyTuple_SetItem(ev, 0, newtO);
Py_INCREF(clone);
PyTuple_SetItem(ev, 1, clone);
PyList_Append(_futureEvents, ev);
Py_DECREF(ev);

View File

@ -33,6 +33,7 @@ __version__ = "$Revision$"
__date__ = "$Date$"
import exceptions
import sys
def downrange(start, stop=0):
@ -71,5 +72,12 @@ class SuspendSimulation(exceptions.Exception):
""" Basic exception to suspend a Simulation """
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