Skip to content

Commit 15755a6

Browse files
author
Hiroaki Kataoka
authored
Merge pull request #7 from ktok07b6/devel
version 0.3.3
2 parents 3f7a907 + 8d98cb9 commit 15755a6

188 files changed

Lines changed: 11149 additions & 3815 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ __pycache__
33
debug*
44
tmp/
55
out/
6+
.suite_ignores

error.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def error_test(casefile_path, output=True):
3131
options.verbose_level = 0
3232
options.quiet_level = 3
3333
options.debug_mode = output
34+
options.verilog_dump = False
35+
options.verilog_monitor = False
3436
try:
3537
compile_main(casefile_path, options)
3638
except AssertionError:

polyphony.pyproj

Lines changed: 0 additions & 110 deletions
This file was deleted.

polyphony.sln

Lines changed: 0 additions & 20 deletions
This file was deleted.

polyphony/__init__.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ def _module_start(self, reentrance=False):
127127
_is_worker_running = True
128128
io._enable()
129129
for w in self._workers:
130-
w.start()
130+
th = _WorkerThread(w)
131+
self._worker_threads.append(th)
132+
th.start()
131133
for sub in self._submodules:
132134
sub._start(True)
133135
time.sleep(0.001)
@@ -139,18 +141,19 @@ def _module_stop(self, reentrance=False):
139141
if not _is_worker_running:
140142
return
141143
_is_worker_running = False
142-
for w in self._workers:
143-
w.prejoin()
144+
for th in self._worker_threads:
145+
th.prejoin()
144146
for sub in self._submodules:
145147
sub._stop()
146148
if not reentrance:
147149
io._disable()
148-
for w in self._workers:
149-
w.join()
150+
for th in self._worker_threads:
151+
th.join()
152+
self._worker_threads.clear()
150153

151154

152155
def _module_append_worker(self, fn, *args):
153-
self._workers.append(_Worker(fn, *args))
156+
self._workers.append(_Worker(fn, args))
154157

155158

156159
def _module_deepcopy(self, memo):
@@ -176,6 +179,7 @@ def _module_decorator(*args, **kwargs):
176179
instance._module_decorator = self
177180
io._enable()
178181
setattr(instance, '_workers', [])
182+
setattr(instance, '_worker_threads', [])
179183
setattr(instance, '_submodules', [])
180184
instance.__init__(*args, **kwargs)
181185
io._disable()
@@ -248,19 +252,25 @@ def __init__(self, param0, param1):
248252
'''
249253

250254

251-
class _Worker(threading.Thread):
252-
def __init__(self, func, *args):
255+
class _Worker(object):
256+
def __init__(self, func, args):
253257
super().__init__()
254258
self.func = func
255259
self.args = args
260+
261+
262+
class _WorkerThread(threading.Thread):
263+
def __init__(self, w):
264+
super().__init__()
265+
self.worker = w
256266
self.daemon = True
257267

258268
def run(self):
259269
try:
260-
if self.args:
261-
self.func(*self.args)
270+
if self.worker.args:
271+
self.worker.func(*self.worker.args)
262272
else:
263-
self.func()
273+
self.worker.func()
264274
except io.PolyphonyIOException as e:
265275
module.abort()
266276
except Exception as e:
@@ -277,20 +287,26 @@ def __init__(self, **kwargs):
277287
self.rules = kwargs
278288

279289
def __enter__(self):
280-
print('with rules=', self.rules)
281290
return self
282291

283292
def __exit__(self, exc_type, exc_value, traceback):
284293
return False
285294

286295
def __call__(self, func):
287296
def wrapper(*args, **kwargs):
288-
func(*args, **kwargs)
289-
print('decorator rules=', self.rules)
297+
return func(*args, **kwargs)
290298
return wrapper
291299

292300
def __call__(self, **kwargs):
293301
return _Rule._Stub(**kwargs)
294302

295303

296304
rule = _Rule()
305+
306+
307+
def pipelined(seq):
308+
return seq
309+
310+
311+
def unroll(seq, factor='full'):
312+
return seq

polyphony/_internal/_io.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __call__(self, v=None) -> generic:
2020

2121

2222
class Queue:
23-
def __init__(self, dtype:generic, direction:str='', maxsize:int=1) -> object:
23+
def __init__(self, dtype:generic, direction:str, maxsize:int=1) -> object:
2424
pass
2525

2626
def rd(self) -> generic:
@@ -32,8 +32,10 @@ def wr(self, v:generic) -> None:
3232
def __call__(self, v=None) -> generic:
3333
pass
3434

35+
@predicate
3536
def empty(self) -> bool:
3637
pass
3738

39+
@predicate
3840
def full(self) -> bool:
3941
pass

polyphony/_internal/_polyphony.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '0.3.2' # type: str
1+
__version__ = '0.3.3' # type: str
22
__all__ = [
33
'testbench',
44
'pure',
@@ -29,3 +29,13 @@ def module() -> None:
2929
@decorator
3030
def rule(kwargs) -> None:
3131
pass
32+
33+
34+
@builtin
35+
def unroll(seq, factor='full') -> list:
36+
pass
37+
38+
39+
@builtin
40+
def pipelined(seq) -> list:
41+
pass

0 commit comments

Comments
 (0)