nortl 1.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. nortl/__init__.py +85 -0
  2. nortl/components/__init__.py +8 -0
  3. nortl/components/channel.py +132 -0
  4. nortl/components/timer.py +73 -0
  5. nortl/core/__init__.py +40 -0
  6. nortl/core/checker.py +135 -0
  7. nortl/core/common/__init__.py +4 -0
  8. nortl/core/common/access.py +25 -0
  9. nortl/core/common/debug.py +6 -0
  10. nortl/core/common/naming_helper.py +33 -0
  11. nortl/core/constructs/__init__.py +13 -0
  12. nortl/core/constructs/condition.py +143 -0
  13. nortl/core/constructs/fork_join.py +84 -0
  14. nortl/core/constructs/loop.py +138 -0
  15. nortl/core/engine.py +575 -0
  16. nortl/core/exceptions.py +139 -0
  17. nortl/core/manager/__init__.py +6 -0
  18. nortl/core/manager/scratch_manager.py +128 -0
  19. nortl/core/manager/signal_manager.py +71 -0
  20. nortl/core/modifiers.py +136 -0
  21. nortl/core/module.py +181 -0
  22. nortl/core/operations.py +834 -0
  23. nortl/core/parameter.py +88 -0
  24. nortl/core/process.py +451 -0
  25. nortl/core/protocols.py +628 -0
  26. nortl/core/renderers/__init__.py +0 -0
  27. nortl/core/renderers/operations/__init__.py +34 -0
  28. nortl/core/renderers/operations/arithmetics.py +38 -0
  29. nortl/core/renderers/operations/base.py +111 -0
  30. nortl/core/renderers/operations/comparison.py +44 -0
  31. nortl/core/renderers/operations/logic.py +38 -0
  32. nortl/core/renderers/operations/misc.py +26 -0
  33. nortl/core/renderers/operations/slice.py +30 -0
  34. nortl/core/signal.py +878 -0
  35. nortl/core/state.py +201 -0
  36. nortl/py.typed +0 -0
  37. nortl/renderer/__init__.py +5 -0
  38. nortl/renderer/mermaid_renderer.py +38 -0
  39. nortl/renderer/networkx_renderer.py +29 -0
  40. nortl/renderer/verilog_renderer.py +325 -0
  41. nortl/renderer/verilog_utils/__init__.py +6 -0
  42. nortl/renderer/verilog_utils/formatter.py +29 -0
  43. nortl/renderer/verilog_utils/process.py +226 -0
  44. nortl/renderer/verilog_utils/structural.py +146 -0
  45. nortl/renderer/verilog_utils/utils.py +23 -0
  46. nortl/utils/__init__.py +0 -0
  47. nortl/utils/parse_utils.py +37 -0
  48. nortl/utils/templates/testbench.sv +41 -0
  49. nortl/utils/test_wrapper.py +218 -0
  50. nortl/utils/type_aliases.py +15 -0
  51. nortl/verilog_library/__init__.py +74 -0
  52. nortl/verilog_library/nortl_clock_gate.sv +20 -0
  53. nortl/verilog_library/nortl_count_down_timer.sv +50 -0
  54. nortl/verilog_library/nortl_delay.sv +66 -0
  55. nortl/verilog_library/nortl_edge_detector.sv +34 -0
  56. nortl/verilog_library/nortl_sync.sv +28 -0
  57. nortl-1.4.0.dist-info/METADATA +105 -0
  58. nortl-1.4.0.dist-info/RECORD +60 -0
  59. nortl-1.4.0.dist-info/WHEEL +4 -0
  60. nortl-1.4.0.dist-info/licenses/LICENSE +11 -0
@@ -0,0 +1,628 @@
1
+ from types import TracebackType
2
+ from typing import Any, ClassVar, Deque, Dict, Generic, List, Literal, Mapping, Optional, Protocol, Sequence, Set, Tuple, Type, TypeVar, Union
3
+
4
+ from typing_extensions import Self
5
+
6
+ from nortl.utils.type_aliases import IntSlice
7
+
8
+ __all__ = [
9
+ 'AnySignal',
10
+ 'Operand',
11
+ 'PermanentSignal',
12
+ ]
13
+
14
+ Operand = Union['Renderable', int, bool]
15
+ PermanentSignal = Union['SignalProto', 'SignalSliceProto']
16
+ AnySignal = Union['SignalProto', 'SignalSliceProto', 'ScratchSignalProto']
17
+
18
+ SIGNAL_TYPES = Literal['input', 'output', 'interface', 'internal', 'local']
19
+ EVENT_TYPES = Literal['edge', 'delay', 'sync']
20
+ BIT_ORDER = Literal['H:L', 'L:H']
21
+
22
+ # Access Check Definitions
23
+ SIGNAL_ACCESS_CHECKS = Literal['exclusive_read', 'exclusive_write', 'identical_rw']
24
+ ACCESS_CHECKS = SIGNAL_ACCESS_CHECKS
25
+
26
+ T_Signal = TypeVar('T_Signal', 'SignalProto', 'SignalSliceProto', covariant=True)
27
+
28
+
29
+ class NamedEntityProto(Protocol):
30
+ @property
31
+ def name(self) -> str: ...
32
+
33
+ def get_metadata(self, key: str, default: Any = None) -> Any: ...
34
+
35
+ def set_metadata(self, key: str, value: Any) -> None: ...
36
+
37
+ def has_metadata(self, key: str) -> bool: ...
38
+
39
+
40
+ class OperationTraitProto(Protocol):
41
+ """Trait for signals, constants or statements that allow construction of arithmetic and logic operations."""
42
+
43
+ @property
44
+ def is_primitive(self) -> bool: ...
45
+
46
+ @property
47
+ def operand_width(self) -> Optional[int]: ...
48
+
49
+ def read_access(self, ignore: Set[ACCESS_CHECKS] = ...) -> None: ...
50
+
51
+ def render(self, target: Optional[str] = None) -> str: ...
52
+
53
+ # Arithemtic Operations
54
+ def __add__(self, value: Operand, /) -> 'OperationProto': ...
55
+
56
+ def __sub__(self, value: Operand, /) -> 'OperationProto': ...
57
+
58
+ def __mul__(self, value: Operand, /) -> 'OperationProto': ...
59
+
60
+ def __truediv__(self, value: Operand, /) -> 'OperationProto': ...
61
+
62
+ def __mod__(self, value: Operand, /) -> 'OperationProto': ...
63
+
64
+ # Arithmetic Operations (Right-Side)
65
+ def __radd__(self, value: Operand, /) -> 'OperationProto': ...
66
+
67
+ def __rsub__(self, value: Operand, /) -> 'OperationProto': ...
68
+
69
+ def __rmul__(self, value: Operand, /) -> 'OperationProto': ...
70
+
71
+ def __rtruediv__(self, value: Operand, /) -> 'OperationProto': ...
72
+
73
+ def __rmod__(self, value: Operand, /) -> 'OperationProto': ...
74
+
75
+ # Logic Operations
76
+ def __and__(self, value: Operand, /) -> 'OperationProto': ...
77
+
78
+ def __or__(self, value: Operand, /) -> 'OperationProto': ...
79
+
80
+ def __xor__(self, value: Operand, /) -> 'OperationProto': ...
81
+
82
+ def __lshift__(self, value: Operand, /) -> 'OperationProto': ...
83
+
84
+ def __rshift__(self, value: Operand, /) -> 'OperationProto': ...
85
+
86
+ # Logic Operations (Right Side)
87
+ def __rand__(self, value: Operand, /) -> 'OperationProto': ...
88
+
89
+ def __ror__(self, value: Operand, /) -> 'OperationProto': ...
90
+
91
+ def __rxor__(self, value: Operand, /) -> 'OperationProto': ...
92
+
93
+ def __rlshift__(self, value: Operand, /) -> 'OperationProto': ...
94
+
95
+ def __rrshift__(self, value: Operand, /) -> 'OperationProto': ...
96
+
97
+ # Misc.
98
+ def __neg__(self) -> 'OperationProto': ...
99
+
100
+ def __pos__(self) -> 'OperationProto': ...
101
+
102
+ # Inversion
103
+ def __invert__(self) -> 'OperationProto': ...
104
+
105
+ # Comparison
106
+ def __eq__(self, value: Operand, /) -> 'OperationProto': ... # type: ignore[override]
107
+
108
+ def __ne__(self, value: Operand, /) -> 'OperationProto': ... # type: ignore[override]
109
+
110
+ def __lt__(self, value: Operand, /) -> 'OperationProto': ...
111
+
112
+ def __le__(self, value: Operand, /) -> 'OperationProto': ...
113
+
114
+ def __gt__(self, value: Operand, /) -> 'OperationProto': ...
115
+
116
+ def __ge__(self, value: Operand, /) -> 'OperationProto': ...
117
+
118
+ # Bit Slicing
119
+ def __getitem__(self, index: Union[int, slice]) -> 'OperationTraitProto': ...
120
+
121
+
122
+ class OperationProto(OperationTraitProto, Protocol):
123
+ """Wrapper object that represents an operation."""
124
+
125
+ @property
126
+ def operands(self) -> Sequence['Renderable']: ...
127
+
128
+
129
+ class Renderable(OperationTraitProto, Protocol):
130
+ """Renderable signal or operation that can be used as an condition."""
131
+
132
+
133
+ class AssignmentTarget(OperationTraitProto, Protocol):
134
+ """Object that can be used as assignment target."""
135
+
136
+ @property
137
+ def name(self) -> str: ...
138
+
139
+ @property
140
+ def engine(self) -> 'EngineProto': ...
141
+
142
+ def write_access(self, ignore: Set[ACCESS_CHECKS] = ...) -> None: ...
143
+
144
+ def overlaps_with(self, other: 'AssignmentTarget') -> Union[bool, Literal['partial']]: ...
145
+
146
+
147
+ class ConstProto(Renderable, Protocol):
148
+ pass
149
+
150
+
151
+ class VarProto(ConstProto, Protocol):
152
+ def update(self, value: Union[int, bool, str]) -> None: ...
153
+
154
+
155
+ class ModuleInstanceProto(Protocol):
156
+ _clock_gating: bool
157
+
158
+ @property
159
+ def module(self) -> 'ModuleProto': ...
160
+
161
+ @property
162
+ def name(self) -> str: ...
163
+
164
+ @property
165
+ def port_connections(self) -> Dict[str, 'PermanentSignal']: ...
166
+
167
+ @property
168
+ def parameter_overrides(self) -> Dict[str, Union[ConstProto, 'ParameterProto', Renderable]]: ...
169
+
170
+ def connect_port(self, port_name: str, signal: 'PermanentSignal') -> None: ...
171
+
172
+ def get_connected_signal(self, port_name: str) -> 'PermanentSignal': ...
173
+
174
+ def override_parameter(self, name: str, value: Union[int, 'ParameterProto', Renderable]) -> None: ...
175
+
176
+
177
+ class StateProto(NamedEntityProto, Protocol):
178
+ _prints: List[Tuple[str, Tuple[Renderable, ...]]]
179
+ _printfs: Dict[str, List[Tuple[str, Tuple[Renderable, ...]]]]
180
+
181
+ @property
182
+ def engine(self) -> 'EngineProto': ...
183
+
184
+ @property
185
+ def worker(self) -> 'WorkerProto': ...
186
+
187
+ # Assignment Management
188
+ @property
189
+ def allow_assignments(self) -> bool: ...
190
+
191
+ @property
192
+ def assignments(self) -> Sequence[Tuple[AssignmentTarget, Renderable]]: ...
193
+
194
+ def add_assignment(self, signal: AssignmentTarget, value: Renderable) -> None: ...
195
+
196
+ def get_assignment(self, signal: AssignmentTarget) -> Optional[Tuple[AssignmentTarget, Renderable]]: ...
197
+
198
+ # Transition Management
199
+ @property
200
+ def transitions(self) -> Sequence[Tuple[Renderable, Self]]: ...
201
+
202
+ def _add_transition(self, condition: Renderable, state: Self) -> None: ...
203
+
204
+ def _restrict_transition(self, state: Self) -> None: ...
205
+
206
+ def _lock_transitions(self) -> None: ...
207
+
208
+ # Misc.
209
+ def render(self, target: Optional[str] = None) -> str: ...
210
+
211
+ def print(self, line: str, *args: Renderable) -> None: ...
212
+
213
+ def printf(self, fname: str, line: str, *args: Renderable) -> None: ...
214
+
215
+
216
+ class ScratchManagerProto(Protocol):
217
+ engine: 'EngineProto'
218
+ scratch_signals: Deque['ScratchSignalProto']
219
+
220
+ @property
221
+ def scratchpad(self) -> 'SignalProto': ...
222
+
223
+ def create(self, width: int) -> 'ScratchSignalProto': ...
224
+
225
+ @property
226
+ def scratch_map(self) -> List[bool]: ...
227
+
228
+ def alloc(self, width: int) -> Optional[int]: ...
229
+
230
+ def enter_context(self) -> None: ...
231
+
232
+ def exit_context(self) -> None: ...
233
+
234
+ def force_release_signals_by_thread(self, thread: 'ThreadProto') -> None: ...
235
+
236
+ def free_accesses_from_thread(self, thread: 'ThreadProto') -> None: ...
237
+
238
+
239
+ class SignalManagerProto(Protocol):
240
+ @property
241
+ def signals(self) -> Mapping[str, 'SignalProto']: ...
242
+
243
+ @property
244
+ def combinationals(self) -> Sequence[Tuple['SignalProto', Renderable]]: ...
245
+
246
+ def get_signal(self, name: str) -> 'SignalProto': ...
247
+
248
+ def create_signal(
249
+ self,
250
+ type: SIGNAL_TYPES,
251
+ name: str,
252
+ width: Union[int, 'ParameterProto', Renderable] = 1,
253
+ data_type: str = 'logic',
254
+ is_synchronized: bool = False,
255
+ pulsing: bool = False,
256
+ ) -> 'SignalProto': ...
257
+
258
+ def free_accesses_from_thread(self, thread: 'ThreadProto') -> None: ...
259
+
260
+
261
+ # Protocol mixin, used by Engine and Worker
262
+ class _StateManager(Protocol):
263
+ @property
264
+ def state_names(self) -> Set[str]: ...
265
+
266
+ def create_state(self, name: Optional[str] = None, allow_assignments: bool = True) -> 'StateProto': ...
267
+
268
+ @property
269
+ def current_state(self) -> 'StateProto': ...
270
+
271
+ @current_state.setter
272
+ def current_state(self, state: 'StateProto') -> None: ...
273
+
274
+ @property
275
+ def next_state(self) -> 'StateProto': ...
276
+
277
+ @property
278
+ def reset_state(self) -> 'StateProto': ...
279
+
280
+
281
+ class EngineProto(_StateManager, Protocol):
282
+ MAIN_WORKER_NAME: ClassVar[str]
283
+ MAIN_THREAD_NAME: ClassVar[str]
284
+
285
+ module_name: str
286
+
287
+ # State manegement (+_StateManager)
288
+ @property
289
+ def states(self) -> Mapping[str, Sequence[StateProto]]: ...
290
+
291
+ # Worker Managment
292
+ @property
293
+ def workers(self) -> Mapping[str, 'WorkerProto']: ...
294
+
295
+ def create_worker(self, name: Optional[str] = None) -> 'WorkerProto': ...
296
+
297
+ @property
298
+ def current_worker(self) -> 'WorkerProto': ...
299
+
300
+ @current_worker.setter
301
+ def current_worker(self, worker: 'WorkerProto') -> None: ...
302
+
303
+ @property
304
+ def main_worker(self) -> 'WorkerProto': ...
305
+
306
+ # Thread Managment
307
+ @property
308
+ def current_thread(self) -> 'ThreadProto': ...
309
+
310
+ @property
311
+ def main_thread(self) -> 'ThreadProto': ...
312
+
313
+ # Signal Managment
314
+ @property
315
+ def signal_manager(self) -> SignalManagerProto: ...
316
+
317
+ @property
318
+ def scratch_manager(self) -> ScratchManagerProto: ...
319
+
320
+ @property
321
+ def signals(self) -> Mapping[str, 'SignalProto']: ...
322
+
323
+ @property
324
+ def combinationals(self) -> Sequence[Tuple['SignalProto', Renderable]]: ...
325
+
326
+ def define_input(
327
+ self, name: str, width: Union[int, 'ParameterProto', Renderable] = 1, data_type: str = 'logic', is_synchronized: bool = False
328
+ ) -> 'SignalProto': ...
329
+
330
+ def define_output(
331
+ self,
332
+ name: str,
333
+ width: Union[int, 'ParameterProto', Renderable] = 1,
334
+ reset_value: int = 0,
335
+ data_type: str = 'logic',
336
+ value: Union[Renderable, None] = None,
337
+ ) -> 'SignalProto': ...
338
+
339
+ def define_local(
340
+ self,
341
+ name: str,
342
+ width: Union[int, 'ParameterProto', Renderable] = 1,
343
+ reset_value: int | None = None,
344
+ data_type: str = 'logic',
345
+ pulsing: bool = False,
346
+ value: Union[Renderable, None] = None,
347
+ ) -> 'SignalProto': ...
348
+
349
+ def define_scratch(self, width: int) -> 'ScratchSignalProto': ...
350
+
351
+ # Parameter Managment
352
+ @property
353
+ def parameters(self) -> Mapping[str, 'ParameterProto']: ...
354
+
355
+ def define_parameter(self, name: str, default_value: int = 0, width: Optional[int] = None) -> 'ParameterProto': ...
356
+
357
+ # Setting outputs
358
+ def set(self, signal: AssignmentTarget, level: Union[Renderable, int, bool]) -> None: ...
359
+
360
+ def set_once(self, signal: AssignmentTarget, level: Union[Renderable, int, bool], reset_level: Union[Renderable, int, bool] = False) -> None: ...
361
+
362
+ def sync(self) -> None: ...
363
+
364
+ def wait_for(self, condition: Renderable) -> None: ...
365
+
366
+ def jump_if(self, condition: Renderable, true_state: StateProto, false_state: Optional[StateProto] = None) -> None: ...
367
+
368
+ # Debugging Prints
369
+
370
+ def print(self, line: str, *args: Renderable) -> None: ...
371
+
372
+ def printf(self, fname: str, line: str, *args: Renderable) -> None: ...
373
+
374
+ # Module Managment
375
+ @property
376
+ def modules(self) -> Mapping[str, 'ModuleProto']: ...
377
+
378
+ @property
379
+ def module_instances(self) -> Mapping[str, ModuleInstanceProto]: ...
380
+
381
+ def define_module(self, name: str) -> 'ModuleProto': ...
382
+
383
+ def add_module(self, module: 'ModuleProto') -> None: ...
384
+
385
+ def create_module_instance(self, module_name: str, instance_name: str, clock_gating: bool = False) -> 'ModuleInstanceProto': ...
386
+
387
+ def connect_module_port(self, instance_name: str, port_name: str, signal: 'PermanentSignal') -> None: ...
388
+
389
+ def override_module_parameter(self, instance_name: str, parameter_name: str, value: Union[int, 'ParameterProto', Renderable]) -> None: ...
390
+
391
+
392
+ class ModuleProto(Protocol):
393
+ _ignore_clk_rst_connection: bool
394
+
395
+ @property
396
+ def name(self) -> str: ...
397
+
398
+ @property
399
+ def ports(self) -> List[str]: ...
400
+ @property
401
+ def parameters(self) -> Dict[str, int]: ...
402
+
403
+ @property
404
+ def hdl_code(self) -> str: ...
405
+
406
+ def add_port(self, port_name: str) -> None: ...
407
+
408
+ def has_port(self, port_name: str) -> bool: ...
409
+
410
+ def add_parameter(self, name: str, value: int) -> None: ...
411
+
412
+ def set_clk_request(self, port_name: str) -> None: ...
413
+
414
+ @property
415
+ def clk_request_port(self) -> Optional[str]: ...
416
+
417
+
418
+ # Access checks
419
+ class StaticAccessProto(Protocol):
420
+ thread: 'ThreadProto'
421
+ active: bool
422
+
423
+ def disable(self) -> None: ...
424
+
425
+
426
+ class StaticAccessCheckerProto(Protocol):
427
+ @property
428
+ def reading_thread_names(self) -> Set[str]: ...
429
+
430
+ @property
431
+ def writing_thread_names(self) -> Set[str]: ...
432
+
433
+ def disable_check(self, check: SIGNAL_ACCESS_CHECKS) -> None: ...
434
+
435
+ def check(self, ignore: Set[ACCESS_CHECKS] = set()) -> None: ...
436
+
437
+
438
+ # Signals
439
+ class _BaseSignalProto(AssignmentTarget, Protocol):
440
+ @property
441
+ def _is_synchronized(self) -> bool: ...
442
+
443
+ @property
444
+ def type(self) -> SIGNAL_TYPES: ...
445
+
446
+ @property
447
+ def pulsing(self) -> bool: ...
448
+
449
+ @property
450
+ def escaped_name(self) -> str: ...
451
+
452
+ @property
453
+ def width(self) -> Union[int, 'ParameterProto', Renderable]: ...
454
+
455
+ @property
456
+ def data_type(self) -> str: ...
457
+
458
+ # Access Control
459
+ @property
460
+ def read_accesses(self) -> Set[StaticAccessProto]: ...
461
+
462
+ @property
463
+ def write_accesses(self) -> Set[StaticAccessProto]: ...
464
+
465
+ @property
466
+ def last_read_access_thread(self) -> Optional['ThreadProto']: ...
467
+
468
+ @last_read_access_thread.setter
469
+ def last_read_access_thread(self, value: 'ThreadProto') -> None: ...
470
+
471
+ @property
472
+ def last_write_access_thread(self) -> Optional['ThreadProto']: ...
473
+
474
+ @last_write_access_thread.setter
475
+ def last_write_access_thread(self, value: 'ThreadProto') -> None: ...
476
+
477
+ @property
478
+ def access_checker(self) -> StaticAccessCheckerProto: ...
479
+
480
+ def free_access_from_thread(self, thread: 'ThreadProto') -> None: ...
481
+
482
+
483
+ class _EventSourceSignalProto(Generic[T_Signal], Protocol):
484
+ def rising(self) -> T_Signal: ...
485
+
486
+ def falling(self) -> T_Signal: ...
487
+
488
+ def delayed(self, cycles: Union[int, 'ParameterProto'] = 1) -> T_Signal: ...
489
+
490
+ def synchronized(self) -> T_Signal: ...
491
+
492
+
493
+ class _BaseSliceProto(_BaseSignalProto, Protocol):
494
+ @property
495
+ def base_signal(self) -> 'SignalProto': ...
496
+
497
+ @property
498
+ def index(self) -> Union[int, IntSlice]: ...
499
+
500
+ def __getitem__(self, index: Union[int, IntSlice]) -> Self: ...
501
+
502
+
503
+ class SignalProto(_EventSourceSignalProto['SignalProto'], _BaseSignalProto, Protocol):
504
+ def __getitem__(self, index: Union[int, IntSlice]) -> 'SignalSliceProto': ...
505
+
506
+
507
+ class SignalSliceProto(_BaseSliceProto, _EventSourceSignalProto['SignalSliceProto'], Protocol):
508
+ def as_scratch_signal(self) -> 'ScratchSignalProto': ...
509
+
510
+
511
+ class ScratchSignalProto(_BaseSliceProto, Protocol):
512
+ @property
513
+ def owner(self) -> 'ThreadProto': ...
514
+
515
+ def __enter__(self) -> Self: ...
516
+
517
+ def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
518
+
519
+ def enter_context(self) -> None: ...
520
+
521
+ def exit_context(self) -> None: ...
522
+
523
+ @property
524
+ def released(self) -> bool: ...
525
+
526
+ def release(self, force: bool = False) -> None: ...
527
+
528
+
529
+ # Parameters
530
+ class ParameterProto(Renderable, Protocol):
531
+ @property
532
+ def engine(self) -> EngineProto: ...
533
+
534
+ @property
535
+ def name(self) -> str: ...
536
+
537
+ @property
538
+ def default_value(self) -> int: ...
539
+
540
+ @property
541
+ def width(self) -> Optional[int]: ...
542
+
543
+
544
+ # Parallel processing
545
+ class WorkerProto(_StateManager, NamedEntityProto, Protocol):
546
+ @property
547
+ def engine(self) -> EngineProto: ...
548
+
549
+ @property
550
+ def is_main_worker(self) -> bool: ...
551
+
552
+ def create_scoped_name(self, name: str) -> str: ...
553
+
554
+ @property
555
+ def sync_reset(self) -> Renderable: ...
556
+
557
+ @sync_reset.setter
558
+ def sync_reset(self, value: Renderable) -> None: ...
559
+
560
+ # Control Signals for Threads
561
+ @property
562
+ def reset(self) -> SignalProto: ...
563
+
564
+ @property
565
+ def start(self) -> SignalProto: ...
566
+
567
+ @property
568
+ def select(self) -> SignalProto: ...
569
+
570
+ @property
571
+ def idle(self) -> SignalProto: ...
572
+
573
+ # State Management
574
+ @property
575
+ def states(self) -> Sequence[StateProto]: ...
576
+
577
+ def leave_foreground(self) -> None: ...
578
+
579
+ # Thread Management
580
+ @property
581
+ def threads(self) -> Sequence['ThreadProto']: ...
582
+
583
+ def create_thread(self, name: Optional[str] = None) -> 'ThreadProto': ...
584
+
585
+ @property
586
+ def working(self) -> bool: ...
587
+
588
+ @property
589
+ def current_thread(self) -> 'ThreadProto': ...
590
+
591
+ # Misc.
592
+ def raise_reset(self) -> None: ...
593
+
594
+ def clear_reset(self) -> None: ...
595
+
596
+
597
+ class ThreadProto(NamedEntityProto, Protocol):
598
+ @property
599
+ def engine(self) -> EngineProto: ...
600
+
601
+ @property
602
+ def worker(self) -> WorkerProto: ...
603
+
604
+ @property
605
+ def is_main_thread(self) -> bool: ...
606
+
607
+ @property
608
+ def active(self) -> bool: ...
609
+ @active.setter
610
+ def active(self, value: bool) -> None: ...
611
+
612
+ _spawned_threads: List[Self]
613
+ parent_thread: Optional[Self]
614
+
615
+ def join(self) -> None: ...
616
+
617
+ @property
618
+ def finished(self) -> Renderable: ...
619
+
620
+ @property
621
+ def running(self) -> bool: ...
622
+
623
+ def cancel(self) -> None: ...
624
+
625
+ def finish(self) -> None: ...
626
+
627
+ @property
628
+ def call_stack(self) -> List[Self]: ...
File without changes
@@ -0,0 +1,34 @@
1
+ """Renderers.
2
+
3
+ This package contains the rendering implementation for all supported operations.
4
+ """
5
+
6
+ from .arithmetics import Addition, Division, Modulo, Multiplication, Substraction
7
+ from .comparison import Equality, Greater, GreaterOrEqual, Less, LessOrEqual, Unequality
8
+ from .logic import And, ExclusiveOr, LeftShift, Or, RightShift
9
+ from .misc import Inversion, Negative, Positive
10
+ from .slice import Slice
11
+
12
+ __all__ = [
13
+ 'Addition',
14
+ 'And',
15
+ 'Const',
16
+ 'Division',
17
+ 'Equality',
18
+ 'ExclusiveOr',
19
+ 'Greater',
20
+ 'GreaterOrEqual',
21
+ 'Inversion',
22
+ 'LeftShift',
23
+ 'Less',
24
+ 'LessOrEqual',
25
+ 'Modulo',
26
+ 'Multiplication',
27
+ 'Negative',
28
+ 'Or',
29
+ 'Positive',
30
+ 'RightShift',
31
+ 'Slice',
32
+ 'Substraction',
33
+ 'Unequality',
34
+ ]
@@ -0,0 +1,38 @@
1
+ """Arithmetic operations."""
2
+
3
+ from typing import Optional
4
+
5
+ from nortl.core.renderers.operations.base import TwoSideRenderer
6
+
7
+ __all__ = [
8
+ 'Addition',
9
+ 'Division',
10
+ 'Modulo',
11
+ 'Multiplication',
12
+ 'Substraction',
13
+ ]
14
+
15
+
16
+ class Addition(TwoSideRenderer):
17
+ def __call__(self, target: Optional[str] = None) -> str:
18
+ return f'({self.left} + {self.right})'
19
+
20
+
21
+ class Substraction(TwoSideRenderer):
22
+ def __call__(self, target: Optional[str] = None) -> str:
23
+ return f'({self.left} - {self.right})'
24
+
25
+
26
+ class Multiplication(TwoSideRenderer):
27
+ def __call__(self, target: Optional[str] = None) -> str:
28
+ return f'({self.left} * {self.right})'
29
+
30
+
31
+ class Division(TwoSideRenderer):
32
+ def __call__(self, target: Optional[str] = None) -> str:
33
+ return f'({self.left} / {self.right})'
34
+
35
+
36
+ class Modulo(TwoSideRenderer):
37
+ def __call__(self, target: Optional[str] = None) -> str:
38
+ return f'({self.left} % {self.right})'