digsim-engine 1.13.0__tar.gz

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 (94) hide show
  1. digsim_engine-1.13.0/LICENSE.md +32 -0
  2. digsim_engine-1.13.0/MANIFEST.in +2 -0
  3. digsim_engine-1.13.0/PKG-INFO +59 -0
  4. digsim_engine-1.13.0/README.md +30 -0
  5. digsim_engine-1.13.0/pyproject.toml +58 -0
  6. digsim_engine-1.13.0/setup.cfg +4 -0
  7. digsim_engine-1.13.0/src/digsim/circuit/__init__.py +7 -0
  8. digsim_engine-1.13.0/src/digsim/circuit/_circuit.py +764 -0
  9. digsim_engine-1.13.0/src/digsim/circuit/_native.py +1029 -0
  10. digsim_engine-1.13.0/src/digsim/circuit/_waves_writer.py +131 -0
  11. digsim_engine-1.13.0/src/digsim/circuit/components/__init__.py +52 -0
  12. digsim_engine-1.13.0/src/digsim/circuit/components/_arithmetic.py +266 -0
  13. digsim_engine-1.13.0/src/digsim/circuit/components/_bus_bits.py +103 -0
  14. digsim_engine-1.13.0/src/digsim/circuit/components/_button.py +61 -0
  15. digsim_engine-1.13.0/src/digsim/circuit/components/_buzzer.py +64 -0
  16. digsim_engine-1.13.0/src/digsim/circuit/components/_circuit_port.py +293 -0
  17. digsim_engine-1.13.0/src/digsim/circuit/components/_clock.py +105 -0
  18. digsim_engine-1.13.0/src/digsim/circuit/components/_counter.py +147 -0
  19. digsim_engine-1.13.0/src/digsim/circuit/components/_decoder.py +140 -0
  20. digsim_engine-1.13.0/src/digsim/circuit/components/_dip_switch.py +91 -0
  21. digsim_engine-1.13.0/src/digsim/circuit/components/_flip_flops.py +162 -0
  22. digsim_engine-1.13.0/src/digsim/circuit/components/_gates.py +408 -0
  23. digsim_engine-1.13.0/src/digsim/circuit/components/_hd44780.py +451 -0
  24. digsim_engine-1.13.0/src/digsim/circuit/components/_hd44780_rom.py +118 -0
  25. digsim_engine-1.13.0/src/digsim/circuit/components/_hexdigit.py +107 -0
  26. digsim_engine-1.13.0/src/digsim/circuit/components/_ic.py +96 -0
  27. digsim_engine-1.13.0/src/digsim/circuit/components/_label_wire.py +204 -0
  28. digsim_engine-1.13.0/src/digsim/circuit/components/_led.py +66 -0
  29. digsim_engine-1.13.0/src/digsim/circuit/components/_led_bar.py +67 -0
  30. digsim_engine-1.13.0/src/digsim/circuit/components/_logic_analyzer.py +111 -0
  31. digsim_engine-1.13.0/src/digsim/circuit/components/_memory.py +517 -0
  32. digsim_engine-1.13.0/src/digsim/circuit/components/_memstdout.py +60 -0
  33. digsim_engine-1.13.0/src/digsim/circuit/components/_note.py +40 -0
  34. digsim_engine-1.13.0/src/digsim/circuit/components/_on_off_switch.py +64 -0
  35. digsim_engine-1.13.0/src/digsim/circuit/components/_probe.py +90 -0
  36. digsim_engine-1.13.0/src/digsim/circuit/components/_seven_segment.py +47 -0
  37. digsim_engine-1.13.0/src/digsim/circuit/components/_splitter.py +214 -0
  38. digsim_engine-1.13.0/src/digsim/circuit/components/_static_level.py +54 -0
  39. digsim_engine-1.13.0/src/digsim/circuit/components/_static_value.py +97 -0
  40. digsim_engine-1.13.0/src/digsim/circuit/components/_subcircuit.py +439 -0
  41. digsim_engine-1.13.0/src/digsim/circuit/components/_tristate_buffer.py +81 -0
  42. digsim_engine-1.13.0/src/digsim/circuit/components/_verilog_component.py +26 -0
  43. digsim_engine-1.13.0/src/digsim/circuit/components/_yosys_atoms.py +1373 -0
  44. digsim_engine-1.13.0/src/digsim/circuit/components/_yosys_component.py +1126 -0
  45. digsim_engine-1.13.0/src/digsim/circuit/components/_yosys_functional.py +1714 -0
  46. digsim_engine-1.13.0/src/digsim/circuit/components/atoms/__init__.py +28 -0
  47. digsim_engine-1.13.0/src/digsim/circuit/components/atoms/_component.py +329 -0
  48. digsim_engine-1.13.0/src/digsim/circuit/components/atoms/_digsim_exception.py +8 -0
  49. digsim_engine-1.13.0/src/digsim/circuit/components/atoms/_port.py +708 -0
  50. digsim_engine-1.13.0/src/digsim/circuit/components/ic/4017.json +1062 -0
  51. digsim_engine-1.13.0/src/digsim/circuit/components/ic/4021.json +286 -0
  52. digsim_engine-1.13.0/src/digsim/circuit/components/ic/4029.json +1447 -0
  53. digsim_engine-1.13.0/src/digsim/circuit/components/ic/4094.json +584 -0
  54. digsim_engine-1.13.0/src/digsim/circuit/components/ic/4511.json +1071 -0
  55. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74138.json +763 -0
  56. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74139.json +610 -0
  57. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74148.json +1368 -0
  58. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74151.json +303 -0
  59. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74157.json +248 -0
  60. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74161.json +674 -0
  61. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74162.json +631 -0
  62. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74163.json +673 -0
  63. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74164.json +267 -0
  64. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74165.json +319 -0
  65. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74173.json +403 -0
  66. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74181.json +2002 -0
  67. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74182.json +893 -0
  68. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74193.json +1386 -0
  69. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74194.json +919 -0
  70. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74245.json +466 -0
  71. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74283.json +732 -0
  72. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74374.json +395 -0
  73. digsim_engine-1.13.0/src/digsim/circuit/components/ic/7448.json +834 -0
  74. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74574.json +395 -0
  75. digsim_engine-1.13.0/src/digsim/circuit/components/ic/74595.json +603 -0
  76. digsim_engine-1.13.0/src/digsim/circuit/components/ic/7485.json +1042 -0
  77. digsim_engine-1.13.0/src/digsim/storage_model/__init__.py +19 -0
  78. digsim_engine-1.13.0/src/digsim/storage_model/_app.py +159 -0
  79. digsim_engine-1.13.0/src/digsim/storage_model/_circuit.py +266 -0
  80. digsim_engine-1.13.0/src/digsim/synth/__init__.py +12 -0
  81. digsim_engine-1.13.0/src/digsim/synth/__main__.py +111 -0
  82. digsim_engine-1.13.0/src/digsim/synth/_synthesis.py +529 -0
  83. digsim_engine-1.13.0/src/digsim/utils/__init__.py +25 -0
  84. digsim_engine-1.13.0/src/digsim/utils/_netlist_graph.py +199 -0
  85. digsim_engine-1.13.0/src/digsim/utils/_yosys_netlist.py +251 -0
  86. digsim_engine-1.13.0/src/digsim/verilog/__init__.py +19 -0
  87. digsim_engine-1.13.0/src/digsim/verilog/__main__.py +78 -0
  88. digsim_engine-1.13.0/src/digsim/verilog/_formatter.py +225 -0
  89. digsim_engine-1.13.0/src/digsim/verilog/_lexer.py +218 -0
  90. digsim_engine-1.13.0/src/digsim_engine.egg-info/PKG-INFO +59 -0
  91. digsim_engine-1.13.0/src/digsim_engine.egg-info/SOURCES.txt +92 -0
  92. digsim_engine-1.13.0/src/digsim_engine.egg-info/dependency_links.txt +1 -0
  93. digsim_engine-1.13.0/src/digsim_engine.egg-info/requires.txt +9 -0
  94. digsim_engine-1.13.0/src/digsim_engine.egg-info/top_level.txt +1 -0
@@ -0,0 +1,32 @@
1
+ The Clear BSD License
2
+
3
+ Copyright (c) 2023-2024, Fredrik Andersson
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
21
+ LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ -------------------------------------------------------------------------------
@@ -0,0 +1,2 @@
1
+ graft src/digsim/circuit/components/ic
2
+ global-exclude *.py[co]
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: digsim-engine
3
+ Version: 1.13.0
4
+ Summary: The simulator of DigSim: digital logic circuits in Python, and Verilog with Yosys
5
+ Author-email: Fredrik Andersson <freand@gmail.com>
6
+ Maintainer-email: Fredrik Andersson <freand@gmail.com>
7
+ Project-URL: homepage, https://github.com/freand76/digsim
8
+ Project-URL: documentation, https://freand76.github.io/digsim/
9
+ Keywords: educational,simulation,digital,verilog
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE.md
21
+ Requires-Dist: pyvcd==0.5.0
22
+ Requires-Dist: platformdirs==4.9.4
23
+ Requires-Dist: pydantic==2.14.1
24
+ Requires-Dist: yowasp-yosys==0.70.0.0.post1259
25
+ Requires-Dist: yowasp-runtime==1.96
26
+ Requires-Dist: wasmtime==47.0.1
27
+ Requires-Dist: digsim-native==0.5.0; (sys_platform == "linux" and platform_machine in "x86_64 aarch64") or (sys_platform == "win32" and platform_machine in "AMD64 ARM64") or sys_platform == "darwin"
28
+ Dynamic: license-file
29
+
30
+ # digsim-engine
31
+
32
+ The simulator of [DigSim](https://github.com/freand76/digsim), without its GUI: digital
33
+ logic circuits in Python, Verilog synthesized by Yosys (which runs in-process, nothing
34
+ else to install), VCD files for GTKWave, and the circuit files of the GUI.
35
+
36
+ ```sh
37
+ pip install digsim-engine
38
+ ```
39
+
40
+ ```python
41
+ from digsim.circuit import Circuit
42
+ from digsim.circuit.components import AND, PushButton
43
+
44
+ circuit = Circuit(vcd="and.vcd")
45
+ a = PushButton(circuit, "a")
46
+ b = PushButton(circuit, "b")
47
+ gate = AND(circuit, "gate")
48
+ a.O.wire = gate.A
49
+ b.O.wire = gate.B
50
+ circuit.init()
51
+ a.push()
52
+ b.push()
53
+ circuit.run(ns=10)
54
+ print(gate.Y.value) # 1
55
+ ```
56
+
57
+ The GUI application, `pip install digsim-logic-simulator`, uses this package. See the
58
+ [documentation](https://freand76.github.io/digsim/) for the Python API, Verilog components
59
+ and testbenches with pytest.
@@ -0,0 +1,30 @@
1
+ # digsim-engine
2
+
3
+ The simulator of [DigSim](https://github.com/freand76/digsim), without its GUI: digital
4
+ logic circuits in Python, Verilog synthesized by Yosys (which runs in-process, nothing
5
+ else to install), VCD files for GTKWave, and the circuit files of the GUI.
6
+
7
+ ```sh
8
+ pip install digsim-engine
9
+ ```
10
+
11
+ ```python
12
+ from digsim.circuit import Circuit
13
+ from digsim.circuit.components import AND, PushButton
14
+
15
+ circuit = Circuit(vcd="and.vcd")
16
+ a = PushButton(circuit, "a")
17
+ b = PushButton(circuit, "b")
18
+ gate = AND(circuit, "gate")
19
+ a.O.wire = gate.A
20
+ b.O.wire = gate.B
21
+ circuit.init()
22
+ a.push()
23
+ b.push()
24
+ circuit.run(ns=10)
25
+ print(gate.Y.value) # 1
26
+ ```
27
+
28
+ The GUI application, `pip install digsim-logic-simulator`, uses this package. See the
29
+ [documentation](https://freand76.github.io/digsim/) for the Python API, Verilog components
30
+ and testbenches with pytest.
@@ -0,0 +1,58 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "digsim-engine"
7
+ description = "The simulator of DigSim: digital logic circuits in Python, and Verilog with Yosys"
8
+ # The same version as digsim-logic-simulator (../pyproject.toml), which pins it
9
+ version = "1.13.0"
10
+ authors = [{name = "Fredrik Andersson", email = "freand@gmail.com"}]
11
+ maintainers = [{name = "Fredrik Andersson", email = "freand@gmail.com"}]
12
+ readme = "README.md"
13
+ license-files = ["LICENSE.md"]
14
+ urls = { homepage = "https://github.com/freand76/digsim", documentation = "https://freand76.github.io/digsim/" }
15
+
16
+ classifiers = [
17
+ "Development Status :: 5 - Production/Stable",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Programming Language :: Python :: 3.15",
24
+ "Programming Language :: Python :: 3 :: Only",
25
+ ]
26
+
27
+ requires-python = ">=3.11"
28
+ dependencies = [
29
+ "pyvcd==0.5.0",
30
+ "platformdirs==4.9.4",
31
+ "pydantic==2.14.1",
32
+ "yowasp-yosys==0.70.0.0.post1259",
33
+ # Runs Yosys in-process: yowasp-yosys accepts any 1.x, and it decides the wasmtime versions
34
+ "yowasp-runtime==1.96",
35
+ "wasmtime==47.0.1",
36
+ # The native engine (https://github.com/freand76/digsim-native), on the platforms it has
37
+ # wheels for. Without it DigSim simulates in Python
38
+ "digsim-native==0.5.0; (sys_platform == 'linux' and platform_machine in 'x86_64 aarch64') or (sys_platform == 'win32' and platform_machine in 'AMD64 ARM64') or sys_platform == 'darwin'",
39
+ ]
40
+
41
+ keywords = ["educational", "simulation", "digital", "verilog"]
42
+
43
+ [tool.setuptools.packages.find]
44
+ where = ["src"]
45
+ namespaces = true
46
+
47
+ [tool.setuptools.package-data]
48
+ # The netlists of the ICs (IntegratedCircuit)
49
+ "digsim.circuit.components.ic" = ["*.json"]
50
+
51
+ [tool.uv]
52
+ # Rebuild the cached package when the sources change, not only pyproject.toml
53
+ cache-keys = [
54
+ { file = "pyproject.toml" },
55
+ { file = "MANIFEST.in" },
56
+ { file = "src/**/*.py" },
57
+ { file = "src/**/*.json" },
58
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ # Copyright (c) Fredrik Andersson, 2023-2026
2
+ # All rights reserved
3
+
4
+ """All classes within digsim.circuit namespace"""
5
+
6
+ from ._circuit import Circuit, RunResult
7
+ from .components import PortConnectionError