PySHDL 0.3.1__tar.gz → 1.0.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 (536) hide show
  1. pyshdl-1.0.0/.github/workflows/ci.yml +64 -0
  2. pyshdl-1.0.0/.github/workflows/nightly.yml +86 -0
  3. {pyshdl-0.3.1 → pyshdl-1.0.0}/.github/workflows/publish.yml +14 -14
  4. pyshdl-1.0.0/.gitignore +31 -0
  5. pyshdl-1.0.0/PKG-INFO +140 -0
  6. pyshdl-1.0.0/README.md +127 -0
  7. pyshdl-1.0.0/SHDL/__init__.py +57 -0
  8. pyshdl-1.0.0/SHDL/circuit.py +567 -0
  9. pyshdl-1.0.0/SHDL/errors.py +105 -0
  10. pyshdl-1.0.0/SHDL/info.py +119 -0
  11. pyshdl-1.0.0/conformance/MANIFEST.json +181 -0
  12. pyshdl-1.0.0/conformance/__init__.py +14 -0
  13. pyshdl-1.0.0/conformance/cases/abi_lazy_peek/case.json +26 -0
  14. pyshdl-1.0.0/conformance/cases/abi_lazy_peek/circuit.shdl +15 -0
  15. pyshdl-1.0.0/conformance/cases/abi_lazy_peek/expected.base.shdl +385 -0
  16. pyshdl-1.0.0/conformance/cases/abi_lazy_peek/traces/hidden_tick_iff_dirty.json +76 -0
  17. pyshdl-1.0.0/conformance/cases/abi_peek_input/case.json +26 -0
  18. pyshdl-1.0.0/conformance/cases/abi_peek_input/circuit.shdl +15 -0
  19. pyshdl-1.0.0/conformance/cases/abi_peek_input/expected.base.shdl +385 -0
  20. pyshdl-1.0.0/conformance/cases/abi_peek_input/traces/input_peek_tickless.json +42 -0
  21. pyshdl-1.0.0/conformance/cases/abi_poke_masking/case.json +26 -0
  22. pyshdl-1.0.0/conformance/cases/abi_poke_masking/circuit.shdl +5 -0
  23. pyshdl-1.0.0/conformance/cases/abi_poke_masking/expected.base.shdl +62 -0
  24. pyshdl-1.0.0/conformance/cases/abi_poke_masking/traces/masking.json +69 -0
  25. pyshdl-1.0.0/conformance/cases/abi_reset_init/case.json +29 -0
  26. pyshdl-1.0.0/conformance/cases/abi_reset_init/circuit.shdl +29 -0
  27. pyshdl-1.0.0/conformance/cases/abi_reset_init/expected.base.shdl +164 -0
  28. pyshdl-1.0.0/conformance/cases/abi_reset_init/stdgates.shdl +31 -0
  29. pyshdl-1.0.0/conformance/cases/abi_reset_init/traces/reset_restores_seeds.json +84 -0
  30. pyshdl-1.0.0/conformance/cases/abi_step_zero/case.json +26 -0
  31. pyshdl-1.0.0/conformance/cases/abi_step_zero/circuit.shdl +15 -0
  32. pyshdl-1.0.0/conformance/cases/abi_step_zero/expected.base.shdl +385 -0
  33. pyshdl-1.0.0/conformance/cases/abi_step_zero/traces/step_zero_noop.json +54 -0
  34. pyshdl-1.0.0/conformance/cases/abi_vcc_cycle0/case.json +26 -0
  35. pyshdl-1.0.0/conformance/cases/abi_vcc_cycle0/circuit.shdl +16 -0
  36. pyshdl-1.0.0/conformance/cases/abi_vcc_cycle0/expected.base.shdl +96 -0
  37. pyshdl-1.0.0/conformance/cases/abi_vcc_cycle0/traces/vcc_wave.json +64 -0
  38. pyshdl-1.0.0/conformance/cases/add100/case.json +29 -0
  39. pyshdl-1.0.0/conformance/cases/add100/circuit.shdl +18 -0
  40. pyshdl-1.0.0/conformance/cases/add100/expected.base.shdl +934 -0
  41. pyshdl-1.0.0/conformance/cases/add100/fullAdder.shdl +16 -0
  42. pyshdl-1.0.0/conformance/cases/add100/traces/sums.json +88 -0
  43. pyshdl-1.0.0/conformance/cases/add2/case.json +29 -0
  44. pyshdl-1.0.0/conformance/cases/add2/circuit.shdl +16 -0
  45. pyshdl-1.0.0/conformance/cases/add2/expected.base.shdl +271 -0
  46. pyshdl-1.0.0/conformance/cases/add2/fullAdder.shdl +16 -0
  47. pyshdl-1.0.0/conformance/cases/add2/traces/sums.json +157 -0
  48. pyshdl-1.0.0/conformance/cases/adder8_ripple/case.json +31 -0
  49. pyshdl-1.0.0/conformance/cases/adder8_ripple/circuit.shdl +19 -0
  50. pyshdl-1.0.0/conformance/cases/adder8_ripple/expected.base.shdl +820 -0
  51. pyshdl-1.0.0/conformance/cases/adder8_ripple/fullAdder.shdl +16 -0
  52. pyshdl-1.0.0/conformance/cases/adder8_ripple/traces/carry_wave.json +326 -0
  53. pyshdl-1.0.0/conformance/cases/adder8_ripple/traces/sums.json +186 -0
  54. pyshdl-1.0.0/conformance/cases/adder_n_default/case.json +29 -0
  55. pyshdl-1.0.0/conformance/cases/adder_n_default/circuit.shdl +16 -0
  56. pyshdl-1.0.0/conformance/cases/adder_n_default/expected.base.shdl +452 -0
  57. pyshdl-1.0.0/conformance/cases/adder_n_default/fullAdder.shdl +16 -0
  58. pyshdl-1.0.0/conformance/cases/adder_n_default/traces/sums.json +128 -0
  59. pyshdl-1.0.0/conformance/cases/adder_n_mixed/adderN.shdl +16 -0
  60. pyshdl-1.0.0/conformance/cases/adder_n_mixed/case.json +31 -0
  61. pyshdl-1.0.0/conformance/cases/adder_n_mixed/circuit.shdl +22 -0
  62. pyshdl-1.0.0/conformance/cases/adder_n_mixed/expected.base.shdl +651 -0
  63. pyshdl-1.0.0/conformance/cases/adder_n_mixed/fullAdder.shdl +16 -0
  64. pyshdl-1.0.0/conformance/cases/adder_n_mixed/traces/both_widths.json +188 -0
  65. pyshdl-1.0.0/conformance/cases/alu/adderN.shdl +27 -0
  66. pyshdl-1.0.0/conformance/cases/alu/case.json +34 -0
  67. pyshdl-1.0.0/conformance/cases/alu/circuit.shdl +65 -0
  68. pyshdl-1.0.0/conformance/cases/alu/expected.base.shdl +2958 -0
  69. pyshdl-1.0.0/conformance/cases/alu/fullAdder.shdl +34 -0
  70. pyshdl-1.0.0/conformance/cases/alu/muxN.shdl +39 -0
  71. pyshdl-1.0.0/conformance/cases/alu/traces/all_ops.json +216 -0
  72. pyshdl-1.0.0/conformance/cases/bus_ops/case.json +29 -0
  73. pyshdl-1.0.0/conformance/cases/bus_ops/circuit.shdl +29 -0
  74. pyshdl-1.0.0/conformance/cases/bus_ops/expected.base.shdl +110 -0
  75. pyshdl-1.0.0/conformance/cases/bus_ops/traces/sign_extend.json +82 -0
  76. pyshdl-1.0.0/conformance/cases/comparator/case.json +28 -0
  77. pyshdl-1.0.0/conformance/cases/comparator/circuit.shdl +30 -0
  78. pyshdl-1.0.0/conformance/cases/comparator/expected.base.shdl +513 -0
  79. pyshdl-1.0.0/conformance/cases/comparator/stdgates.shdl +31 -0
  80. pyshdl-1.0.0/conformance/cases/comparator/traces/equality.json +107 -0
  81. pyshdl-1.0.0/conformance/cases/concat_demo/case.json +28 -0
  82. pyshdl-1.0.0/conformance/cases/concat_demo/circuit.shdl +12 -0
  83. pyshdl-1.0.0/conformance/cases/concat_demo/expected.base.shdl +137 -0
  84. pyshdl-1.0.0/conformance/cases/concat_demo/traces/wiring.json +168 -0
  85. pyshdl-1.0.0/conformance/cases/cond_matrix/case.json +30 -0
  86. pyshdl-1.0.0/conformance/cases/cond_matrix/circuit.shdl +38 -0
  87. pyshdl-1.0.0/conformance/cases/cond_matrix/expected.base.shdl +179 -0
  88. pyshdl-1.0.0/conformance/cases/cond_matrix/traces/operator_matrix.json +88 -0
  89. pyshdl-1.0.0/conformance/cases/const_demo/case.json +28 -0
  90. pyshdl-1.0.0/conformance/cases/const_demo/circuit.shdl +10 -0
  91. pyshdl-1.0.0/conformance/cases/const_demo/expected.base.shdl +164 -0
  92. pyshdl-1.0.0/conformance/cases/const_demo/traces/const_bits.json +64 -0
  93. pyshdl-1.0.0/conformance/cases/cpu_rege/case.json +32 -0
  94. pyshdl-1.0.0/conformance/cases/cpu_rege/circuit.shdl +38 -0
  95. pyshdl-1.0.0/conformance/cases/cpu_rege/dLatch.shdl +30 -0
  96. pyshdl-1.0.0/conformance/cases/cpu_rege/expected.base.shdl +5940 -0
  97. pyshdl-1.0.0/conformance/cases/cpu_rege/srLatch.shdl +29 -0
  98. pyshdl-1.0.0/conformance/cases/cpu_rege/stdgates.shdl +31 -0
  99. pyshdl-1.0.0/conformance/cases/cpu_rege/traces/two_phase_load.json +160 -0
  100. pyshdl-1.0.0/conformance/cases/d_latch/case.json +30 -0
  101. pyshdl-1.0.0/conformance/cases/d_latch/circuit.shdl +30 -0
  102. pyshdl-1.0.0/conformance/cases/d_latch/expected.base.shdl +231 -0
  103. pyshdl-1.0.0/conformance/cases/d_latch/srLatch.shdl +29 -0
  104. pyshdl-1.0.0/conformance/cases/d_latch/stdgates.shdl +31 -0
  105. pyshdl-1.0.0/conformance/cases/d_latch/traces/track_and_hold.json +83 -0
  106. pyshdl-1.0.0/conformance/cases/deep_hier/case.json +29 -0
  107. pyshdl-1.0.0/conformance/cases/deep_hier/circuit.shdl +34 -0
  108. pyshdl-1.0.0/conformance/cases/deep_hier/expected.base.shdl +141 -0
  109. pyshdl-1.0.0/conformance/cases/deep_hier/traces/invert.json +68 -0
  110. pyshdl-1.0.0/conformance/cases/degen_slice/case.json +28 -0
  111. pyshdl-1.0.0/conformance/cases/degen_slice/circuit.shdl +18 -0
  112. pyshdl-1.0.0/conformance/cases/degen_slice/expected.base.shdl +116 -0
  113. pyshdl-1.0.0/conformance/cases/degen_slice/traces/reorder.json +124 -0
  114. pyshdl-1.0.0/conformance/cases/derived_gates/case.json +30 -0
  115. pyshdl-1.0.0/conformance/cases/derived_gates/circuit.shdl +11 -0
  116. pyshdl-1.0.0/conformance/cases/derived_gates/expected.base.shdl +213 -0
  117. pyshdl-1.0.0/conformance/cases/derived_gates/stdgates.shdl +16 -0
  118. pyshdl-1.0.0/conformance/cases/derived_gates/traces/truth_tables.json +128 -0
  119. pyshdl-1.0.0/conformance/cases/diamond/case.json +33 -0
  120. pyshdl-1.0.0/conformance/cases/diamond/circuit.shdl +21 -0
  121. pyshdl-1.0.0/conformance/cases/diamond/expected.base.shdl +198 -0
  122. pyshdl-1.0.0/conformance/cases/diamond/leaf.shdl +6 -0
  123. pyshdl-1.0.0/conformance/cases/diamond/left.shdl +8 -0
  124. pyshdl-1.0.0/conformance/cases/diamond/right.shdl +8 -0
  125. pyshdl-1.0.0/conformance/cases/diamond/traces/nand_nor.json +108 -0
  126. pyshdl-1.0.0/conformance/cases/full_adder/case.json +29 -0
  127. pyshdl-1.0.0/conformance/cases/full_adder/circuit.shdl +16 -0
  128. pyshdl-1.0.0/conformance/cases/full_adder/expected.base.shdl +152 -0
  129. pyshdl-1.0.0/conformance/cases/full_adder/traces/truth_table.json +244 -0
  130. pyshdl-1.0.0/conformance/cases/init_comb/case.json +31 -0
  131. pyshdl-1.0.0/conformance/cases/init_comb/circuit.shdl +22 -0
  132. pyshdl-1.0.0/conformance/cases/init_comb/expected.base.shdl +84 -0
  133. pyshdl-1.0.0/conformance/cases/init_comb/traces/seed_then_recompute.json +67 -0
  134. pyshdl-1.0.0/conformance/cases/mux2/case.json +28 -0
  135. pyshdl-1.0.0/conformance/cases/mux2/circuit.shdl +26 -0
  136. pyshdl-1.0.0/conformance/cases/mux2/expected.base.shdl +136 -0
  137. pyshdl-1.0.0/conformance/cases/mux2/traces/select.json +156 -0
  138. pyshdl-1.0.0/conformance/cases/mux4n/case.json +27 -0
  139. pyshdl-1.0.0/conformance/cases/mux4n/circuit.shdl +39 -0
  140. pyshdl-1.0.0/conformance/cases/mux4n/expected.base.shdl +1324 -0
  141. pyshdl-1.0.0/conformance/cases/mux4n/traces/select_tree.json +88 -0
  142. pyshdl-1.0.0/conformance/cases/nested_repl/case.json +29 -0
  143. pyshdl-1.0.0/conformance/cases/nested_repl/circuit.shdl +14 -0
  144. pyshdl-1.0.0/conformance/cases/nested_repl/expected.base.shdl +83 -0
  145. pyshdl-1.0.0/conformance/cases/nested_repl/traces/word.json +88 -0
  146. pyshdl-1.0.0/conformance/cases/passthru_wire/case.json +28 -0
  147. pyshdl-1.0.0/conformance/cases/passthru_wire/circuit.shdl +20 -0
  148. pyshdl-1.0.0/conformance/cases/passthru_wire/expected.base.shdl +136 -0
  149. pyshdl-1.0.0/conformance/cases/passthru_wire/traces/exhaustive.json +98 -0
  150. pyshdl-1.0.0/conformance/cases/pipe/case.json +28 -0
  151. pyshdl-1.0.0/conformance/cases/pipe/circuit.shdl +20 -0
  152. pyshdl-1.0.0/conformance/cases/pipe/expected.base.shdl +226 -0
  153. pyshdl-1.0.0/conformance/cases/pipe/traces/latency.json +94 -0
  154. pyshdl-1.0.0/conformance/cases/primitives_all/case.json +32 -0
  155. pyshdl-1.0.0/conformance/cases/primitives_all/circuit.shdl +15 -0
  156. pyshdl-1.0.0/conformance/cases/primitives_all/expected.base.shdl +177 -0
  157. pyshdl-1.0.0/conformance/cases/primitives_all/traces/cycle0.json +41 -0
  158. pyshdl-1.0.0/conformance/cases/primitives_all/traces/truth_tables.json +192 -0
  159. pyshdl-1.0.0/conformance/cases/register_n/case.json +32 -0
  160. pyshdl-1.0.0/conformance/cases/register_n/circuit.shdl +23 -0
  161. pyshdl-1.0.0/conformance/cases/register_n/dLatch.shdl +30 -0
  162. pyshdl-1.0.0/conformance/cases/register_n/expected.base.shdl +1392 -0
  163. pyshdl-1.0.0/conformance/cases/register_n/srLatch.shdl +29 -0
  164. pyshdl-1.0.0/conformance/cases/register_n/stdgates.shdl +31 -0
  165. pyshdl-1.0.0/conformance/cases/register_n/traces/load_hold_load.json +68 -0
  166. pyshdl-1.0.0/conformance/cases/repeated_names/case.json +27 -0
  167. pyshdl-1.0.0/conformance/cases/repeated_names/circuit.shdl +21 -0
  168. pyshdl-1.0.0/conformance/cases/repeated_names/expected.base.shdl +135 -0
  169. pyshdl-1.0.0/conformance/cases/repeated_names/traces/propagation_wave.json +94 -0
  170. pyshdl-1.0.0/conformance/cases/repeater/case.json +27 -0
  171. pyshdl-1.0.0/conformance/cases/repeater/circuit.shdl +13 -0
  172. pyshdl-1.0.0/conformance/cases/repeater/expected.base.shdl +162 -0
  173. pyshdl-1.0.0/conformance/cases/repeater/traces/replication.json +68 -0
  174. pyshdl-1.0.0/conformance/cases/ring_clock/case.json +27 -0
  175. pyshdl-1.0.0/conformance/cases/ring_clock/circuit.shdl +25 -0
  176. pyshdl-1.0.0/conformance/cases/ring_clock/expected.base.shdl +194 -0
  177. pyshdl-1.0.0/conformance/cases/ring_clock/traces/oscillation.json +175 -0
  178. pyshdl-1.0.0/conformance/cases/single_gate/case.json +27 -0
  179. pyshdl-1.0.0/conformance/cases/single_gate/circuit.shdl +18 -0
  180. pyshdl-1.0.0/conformance/cases/single_gate/expected.base.shdl +81 -0
  181. pyshdl-1.0.0/conformance/cases/single_gate/traces/cycle_semantics.json +54 -0
  182. pyshdl-1.0.0/conformance/cases/split_byte/case.json +28 -0
  183. pyshdl-1.0.0/conformance/cases/split_byte/circuit.shdl +6 -0
  184. pyshdl-1.0.0/conformance/cases/split_byte/expected.base.shdl +87 -0
  185. pyshdl-1.0.0/conformance/cases/split_byte/traces/nibbles.json +107 -0
  186. pyshdl-1.0.0/conformance/cases/sr_latch/case.json +30 -0
  187. pyshdl-1.0.0/conformance/cases/sr_latch/circuit.shdl +29 -0
  188. pyshdl-1.0.0/conformance/cases/sr_latch/expected.base.shdl +164 -0
  189. pyshdl-1.0.0/conformance/cases/sr_latch/stdgates.shdl +31 -0
  190. pyshdl-1.0.0/conformance/cases/sr_latch/traces/set_hold_reset.json +98 -0
  191. pyshdl-1.0.0/conformance/conformance.md +424 -0
  192. pyshdl-1.0.0/conformance/runner/__init__.py +1 -0
  193. pyshdl-1.0.0/conformance/runner/cli.py +71 -0
  194. pyshdl-1.0.0/conformance/runner/executor.py +83 -0
  195. pyshdl-1.0.0/conformance/runner/gen.py +195 -0
  196. pyshdl-1.0.0/conformance/runner/oracle.py +71 -0
  197. pyshdl-1.0.0/conformance/runner/schema.py +493 -0
  198. pyshdl-1.0.0/conformance/runner/suite.py +266 -0
  199. pyshdl-1.0.0/docs/SHDL_Project.md +264 -0
  200. pyshdl-1.0.0/docs/base_shdl.md +541 -0
  201. pyshdl-1.0.0/docs/golden_tests.md +679 -0
  202. pyshdl-1.0.0/docs/pyshdl.md +611 -0
  203. pyshdl-1.0.0/docs/shdl.md +1043 -0
  204. pyshdl-1.0.0/docs/shdlc_goals.md +258 -0
  205. pyshdl-1.0.0/examples/CPU/ISA.md +229 -0
  206. pyshdl-1.0.0/examples/CPU/README.md +58 -0
  207. pyshdl-1.0.0/examples/CPU/adder16.shdl +24 -0
  208. pyshdl-1.0.0/examples/CPU/alu.shdl +98 -0
  209. pyshdl-1.0.0/examples/CPU/bench_adder16.py +133 -0
  210. pyshdl-1.0.0/examples/CPU/control.shdl +312 -0
  211. pyshdl-1.0.0/examples/CPU/parts.shdl +129 -0
  212. pyshdl-1.0.0/examples/CPU/profiling/exp0_baseline.py +68 -0
  213. pyshdl-1.0.0/examples/CPU/profiling/exp1_micro.py +80 -0
  214. pyshdl-1.0.0/examples/CPU/profiling/exp3_op_census.py +118 -0
  215. pyshdl-1.0.0/examples/CPU/profiling/exp4_settle.py +127 -0
  216. pyshdl-1.0.0/examples/CPU/profiling/exp5_hostcost.py +59 -0
  217. pyshdl-1.0.0/examples/CPU/profiling/exp5b_cflags.py +73 -0
  218. pyshdl-1.0.0/examples/CPU/profiling/exp6_mulshootout.py +216 -0
  219. pyshdl-1.0.0/examples/CPU/profiling/journal.md +311 -0
  220. pyshdl-1.0.0/examples/CPU/programs/maxarray.s +25 -0
  221. pyshdl-1.0.0/examples/CPU/programs/mul.s +10 -0
  222. pyshdl-1.0.0/examples/CPU/programs/popcount.s +14 -0
  223. pyshdl-1.0.0/examples/CPU/ram.shdl +76 -0
  224. pyshdl-1.0.0/examples/CPU/regfile.shdl +35 -0
  225. pyshdl-1.0.0/examples/CPU/seq.shdl +38 -0
  226. pyshdl-1.0.0/examples/CPU/sr16.shdl +146 -0
  227. pyshdl-1.0.0/examples/CPU/sr16tools/__init__.py +1 -0
  228. pyshdl-1.0.0/examples/CPU/sr16tools/alu_ref.py +58 -0
  229. pyshdl-1.0.0/examples/CPU/sr16tools/asm.py +318 -0
  230. pyshdl-1.0.0/examples/CPU/sr16tools/driver.py +197 -0
  231. pyshdl-1.0.0/examples/CPU/sr16tools/golden.py +198 -0
  232. pyshdl-1.0.0/examples/README.md +60 -0
  233. pyshdl-1.0.0/examples/add100.shdl +27 -0
  234. pyshdl-1.0.0/examples/adder8.shdl +31 -0
  235. pyshdl-1.0.0/examples/adderN.shdl +27 -0
  236. pyshdl-1.0.0/examples/alu.shdl +65 -0
  237. pyshdl-1.0.0/examples/busOps.shdl +29 -0
  238. pyshdl-1.0.0/examples/comparator.shdl +30 -0
  239. pyshdl-1.0.0/examples/dLatch.shdl +30 -0
  240. pyshdl-1.0.0/examples/fullAdder.shdl +34 -0
  241. pyshdl-1.0.0/examples/interacting.py +111 -0
  242. pyshdl-1.0.0/examples/inverter.shdl +18 -0
  243. pyshdl-1.0.0/examples/mux2.shdl +26 -0
  244. pyshdl-1.0.0/examples/muxN.shdl +39 -0
  245. pyshdl-1.0.0/examples/registerN.shdl +23 -0
  246. pyshdl-1.0.0/examples/ringClock.shdl +25 -0
  247. pyshdl-1.0.0/examples/srLatch.shdl +36 -0
  248. pyshdl-1.0.0/examples/stdgates.shdl +31 -0
  249. pyshdl-1.0.0/flattener/__init__.py +3 -0
  250. pyshdl-1.0.0/flattener/__main__.py +3 -0
  251. pyshdl-1.0.0/flattener/ast_nodes.py +285 -0
  252. pyshdl-1.0.0/flattener/cli.py +84 -0
  253. pyshdl-1.0.0/flattener/diagnostics.py +90 -0
  254. pyshdl-1.0.0/flattener/emit.py +32 -0
  255. pyshdl-1.0.0/flattener/expr.py +82 -0
  256. pyshdl-1.0.0/flattener/lexer.py +233 -0
  257. pyshdl-1.0.0/flattener/loader.py +210 -0
  258. pyshdl-1.0.0/flattener/metadata.py +172 -0
  259. pyshdl-1.0.0/flattener/parser.py +646 -0
  260. pyshdl-1.0.0/flattener/phases/__init__.py +5 -0
  261. pyshdl-1.0.0/flattener/phases/constants.py +82 -0
  262. pyshdl-1.0.0/flattener/phases/expand.py +625 -0
  263. pyshdl-1.0.0/flattener/phases/expander.py +299 -0
  264. pyshdl-1.0.0/flattener/phases/flatten.py +401 -0
  265. pyshdl-1.0.0/flattener/phases/monomorphize.py +481 -0
  266. pyshdl-1.0.0/flattener/pipeline.py +133 -0
  267. pyshdl-1.0.0/flattener/sim/high_eval.py +190 -0
  268. pyshdl-1.0.0/flattener/source.py +31 -0
  269. pyshdl-1.0.0/flattener/timing.py +171 -0
  270. pyshdl-1.0.0/flattener/validate.py +184 -0
  271. pyshdl-1.0.0/pyproject.toml +68 -0
  272. pyshdl-1.0.0/scripts/build_conformance_corpus.py +1388 -0
  273. pyshdl-1.0.0/shdlc/__init__.py +15 -0
  274. pyshdl-1.0.0/shdlc/__main__.py +5 -0
  275. pyshdl-1.0.0/shdlc/baseshdl.py +130 -0
  276. pyshdl-1.0.0/shdlc/cc.py +125 -0
  277. pyshdl-1.0.0/shdlc/cli.py +135 -0
  278. pyshdl-1.0.0/shdlc/codegen.py +493 -0
  279. pyshdl-1.0.0/shdlc/compile.py +51 -0
  280. pyshdl-1.0.0/shdlc/harness.py +145 -0
  281. pyshdl-1.0.0/shdlc/model.py +378 -0
  282. pyshdl-1.0.0/shdlc/sim/base_eval.py +115 -0
  283. pyshdl-1.0.0/tests/compiler/__init__.py +0 -0
  284. pyshdl-1.0.0/tests/compiler/conftest.py +94 -0
  285. pyshdl-1.0.0/tests/compiler/fuzz_gen.py +117 -0
  286. pyshdl-1.0.0/tests/compiler/harness.py +259 -0
  287. pyshdl-1.0.0/tests/compiler/test_abi_contracts.py +352 -0
  288. pyshdl-1.0.0/tests/compiler/test_base_reader.py +229 -0
  289. pyshdl-1.0.0/tests/compiler/test_batch_settle.py +153 -0
  290. pyshdl-1.0.0/tests/compiler/test_cc.py +239 -0
  291. pyshdl-1.0.0/tests/compiler/test_chunked.py +84 -0
  292. pyshdl-1.0.0/tests/compiler/test_cli.py +227 -0
  293. pyshdl-1.0.0/tests/compiler/test_codegen.py +663 -0
  294. pyshdl-1.0.0/tests/compiler/test_determinism.py +58 -0
  295. pyshdl-1.0.0/tests/compiler/test_differential.py +50 -0
  296. pyshdl-1.0.0/tests/compiler/test_edge_cases.py +84 -0
  297. pyshdl-1.0.0/tests/compiler/test_feedback.py +106 -0
  298. pyshdl-1.0.0/tests/compiler/test_frontend_errors.py +87 -0
  299. pyshdl-1.0.0/tests/compiler/test_fuzz.py +359 -0
  300. pyshdl-1.0.0/tests/compiler/test_independence.py +48 -0
  301. pyshdl-1.0.0/tests/compiler/test_lazy_peek.py +151 -0
  302. pyshdl-1.0.0/tests/compiler/test_model.py +644 -0
  303. pyshdl-1.0.0/tests/compiler/test_nocrash_shdlc.py +346 -0
  304. pyshdl-1.0.0/tests/compiler/test_optlevels.py +55 -0
  305. pyshdl-1.0.0/tests/compiler/test_oracle_robustness.py +126 -0
  306. pyshdl-1.0.0/tests/compiler/test_ports.py +95 -0
  307. pyshdl-1.0.0/tests/compiler/test_primitives.py +181 -0
  308. pyshdl-1.0.0/tests/compiler/test_propagation.py +119 -0
  309. pyshdl-1.0.0/tests/compiler/test_reset_init.py +109 -0
  310. pyshdl-1.0.0/tests/compiler/test_sanitizers.py +214 -0
  311. pyshdl-1.0.0/tests/compiler/test_sim_contracts.py +262 -0
  312. pyshdl-1.0.0/tests/compiler/test_symbols.py +40 -0
  313. pyshdl-1.0.0/tests/compiler/test_toolchain.py +188 -0
  314. pyshdl-1.0.0/tests/cpu/__init__.py +0 -0
  315. pyshdl-1.0.0/tests/cpu/conftest.py +177 -0
  316. pyshdl-1.0.0/tests/cpu/test_alu.py +43 -0
  317. pyshdl-1.0.0/tests/cpu/test_alu_reserved.py +83 -0
  318. pyshdl-1.0.0/tests/cpu/test_corners.py +128 -0
  319. pyshdl-1.0.0/tests/cpu/test_examples.py +48 -0
  320. pyshdl-1.0.0/tests/cpu/test_freeze.py +127 -0
  321. pyshdl-1.0.0/tests/cpu/test_instructions.py +474 -0
  322. pyshdl-1.0.0/tests/cpu/test_margin.py +57 -0
  323. pyshdl-1.0.0/tests/cpu/test_parts.py +53 -0
  324. pyshdl-1.0.0/tests/cpu/test_poweron.py +181 -0
  325. pyshdl-1.0.0/tests/cpu/test_programs.py +133 -0
  326. pyshdl-1.0.0/tests/cpu/test_ram.py +55 -0
  327. pyshdl-1.0.0/tests/cpu/test_regfile.py +53 -0
  328. pyshdl-1.0.0/tests/cpu/test_seq.py +70 -0
  329. pyshdl-1.0.0/tests/fixtures/add100.shdl +18 -0
  330. pyshdl-1.0.0/tests/fixtures/add2.shdl +16 -0
  331. pyshdl-1.0.0/tests/fixtures/adder8.shdl +19 -0
  332. pyshdl-1.0.0/tests/fixtures/adderN.shdl +16 -0
  333. pyshdl-1.0.0/tests/fixtures/alu.shdl +14 -0
  334. pyshdl-1.0.0/tests/fixtures/clock.shdl +15 -0
  335. pyshdl-1.0.0/tests/fixtures/concatDemo.shdl +12 -0
  336. pyshdl-1.0.0/tests/fixtures/constDemo.shdl +10 -0
  337. pyshdl-1.0.0/tests/fixtures/fullAdder.shdl +16 -0
  338. pyshdl-1.0.0/tests/fixtures/gatesDemo.shdl +11 -0
  339. pyshdl-1.0.0/tests/fixtures/passthru.shdl +20 -0
  340. pyshdl-1.0.0/tests/fixtures/pipe.shdl +20 -0
  341. pyshdl-1.0.0/tests/fixtures/repeater.shdl +13 -0
  342. pyshdl-1.0.0/tests/fixtures/splitByte.shdl +6 -0
  343. pyshdl-1.0.0/tests/fixtures/srlatch.shdl +15 -0
  344. pyshdl-1.0.0/tests/fixtures/stdgates.shdl +16 -0
  345. pyshdl-1.0.0/tests/flattener/fuzz_source_gen.py +585 -0
  346. pyshdl-1.0.0/tests/flattener/helpers.py +39 -0
  347. pyshdl-1.0.0/tests/flattener/test_cli.py +212 -0
  348. pyshdl-1.0.0/tests/flattener/test_conformance.py +608 -0
  349. pyshdl-1.0.0/tests/flattener/test_constants.py +163 -0
  350. pyshdl-1.0.0/tests/flattener/test_determinism.py +167 -0
  351. pyshdl-1.0.0/tests/flattener/test_diagnostic_sites.py +1130 -0
  352. pyshdl-1.0.0/tests/flattener/test_diagnostics_matrix.py +263 -0
  353. pyshdl-1.0.0/tests/flattener/test_emit.py +78 -0
  354. pyshdl-1.0.0/tests/flattener/test_equivalence.py +254 -0
  355. pyshdl-1.0.0/tests/flattener/test_expand.py +523 -0
  356. pyshdl-1.0.0/tests/flattener/test_expander.py +334 -0
  357. pyshdl-1.0.0/tests/flattener/test_expr.py +62 -0
  358. pyshdl-1.0.0/tests/flattener/test_flatten.py +276 -0
  359. pyshdl-1.0.0/tests/flattener/test_fuzz_source.py +360 -0
  360. pyshdl-1.0.0/tests/flattener/test_lexer.py +281 -0
  361. pyshdl-1.0.0/tests/flattener/test_loader.py +302 -0
  362. pyshdl-1.0.0/tests/flattener/test_metadata.py +369 -0
  363. pyshdl-1.0.0/tests/flattener/test_monomorphize.py +294 -0
  364. pyshdl-1.0.0/tests/flattener/test_nocrash.py +326 -0
  365. pyshdl-1.0.0/tests/flattener/test_parser.py +419 -0
  366. pyshdl-1.0.0/tests/flattener/test_robustness.py +124 -0
  367. pyshdl-1.0.0/tests/flattener/test_scale.py +406 -0
  368. pyshdl-1.0.0/tests/flattener/test_spec_examples.py +150 -0
  369. pyshdl-1.0.0/tests/flattener/test_timing.py +222 -0
  370. pyshdl-1.0.0/tests/flattener/test_validate.py +297 -0
  371. pyshdl-1.0.0/tests/pyshdl/conftest.py +58 -0
  372. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_batch.py +102 -0
  373. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_boundary.py +78 -0
  374. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_conformance.py +45 -0
  375. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_construct.py +273 -0
  376. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_cpu.py +84 -0
  377. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_errors.py +155 -0
  378. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_lockstep.py +42 -0
  379. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_ports.py +184 -0
  380. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_reset.py +56 -0
  381. pyshdl-1.0.0/tests/pyshdl/test_pyshdl_settle.py +76 -0
  382. pyshdl-1.0.0/uv.lock +108 -0
  383. pyshdl-0.3.1/.github/workflows/deploy-docs.yml +0 -62
  384. pyshdl-0.3.1/.github/workflows/test.yml +0 -129
  385. pyshdl-0.3.1/.gitignore +0 -67
  386. pyshdl-0.3.1/PKG-INFO +0 -172
  387. pyshdl-0.3.1/README.md +0 -155
  388. pyshdl-0.3.1/docs/README.md +0 -52
  389. pyshdl-0.3.1/docs/docs/architecture/_category_.json +0 -8
  390. pyshdl-0.3.1/docs/docs/architecture/base-shdl.md +0 -236
  391. pyshdl-0.3.1/docs/docs/architecture/compiler-internals.md +0 -350
  392. pyshdl-0.3.1/docs/docs/architecture/flattening-pipeline.md +0 -411
  393. pyshdl-0.3.1/docs/docs/architecture/overview.md +0 -172
  394. pyshdl-0.3.1/docs/docs/architecture/pyshdl-internals.md +0 -302
  395. pyshdl-0.3.1/docs/docs/debugger/_category_.json +0 -8
  396. pyshdl-0.3.1/docs/docs/debugger/breakpoints.md +0 -317
  397. pyshdl-0.3.1/docs/docs/debugger/commands.md +0 -508
  398. pyshdl-0.3.1/docs/docs/debugger/common-problems.md +0 -315
  399. pyshdl-0.3.1/docs/docs/debugger/debug-build.md +0 -408
  400. pyshdl-0.3.1/docs/docs/debugger/getting-started.md +0 -246
  401. pyshdl-0.3.1/docs/docs/debugger/hierarchy.md +0 -349
  402. pyshdl-0.3.1/docs/docs/debugger/inspection.md +0 -350
  403. pyshdl-0.3.1/docs/docs/debugger/overview.md +0 -116
  404. pyshdl-0.3.1/docs/docs/debugger/python-api.md +0 -516
  405. pyshdl-0.3.1/docs/docs/debugger/scripting.md +0 -394
  406. pyshdl-0.3.1/docs/docs/debugger/waveforms.md +0 -389
  407. pyshdl-0.3.1/docs/docs/examples/8-bit-adder.md +0 -111
  408. pyshdl-0.3.1/docs/docs/examples/_category_.json +0 -8
  409. pyshdl-0.3.1/docs/docs/examples/comparator.md +0 -136
  410. pyshdl-0.3.1/docs/docs/examples/decoder.md +0 -235
  411. pyshdl-0.3.1/docs/docs/examples/full-adder.md +0 -105
  412. pyshdl-0.3.1/docs/docs/examples/half-adder.md +0 -60
  413. pyshdl-0.3.1/docs/docs/examples/multiplexer.md +0 -139
  414. pyshdl-0.3.1/docs/docs/examples/register.md +0 -248
  415. pyshdl-0.3.1/docs/docs/getting-started/_category_.json +0 -8
  416. pyshdl-0.3.1/docs/docs/getting-started/first-circuit.md +0 -129
  417. pyshdl-0.3.1/docs/docs/getting-started/installation.md +0 -98
  418. pyshdl-0.3.1/docs/docs/getting-started/using-pyshdl.md +0 -239
  419. pyshdl-0.3.1/docs/docs/intro.md +0 -128
  420. pyshdl-0.3.1/docs/docs/language-reference/_category_.json +0 -8
  421. pyshdl-0.3.1/docs/docs/language-reference/components.md +0 -170
  422. pyshdl-0.3.1/docs/docs/language-reference/connections.md +0 -143
  423. pyshdl-0.3.1/docs/docs/language-reference/constants.md +0 -138
  424. pyshdl-0.3.1/docs/docs/language-reference/errors.md +0 -785
  425. pyshdl-0.3.1/docs/docs/language-reference/generators.md +0 -209
  426. pyshdl-0.3.1/docs/docs/language-reference/imports.md +0 -110
  427. pyshdl-0.3.1/docs/docs/language-reference/lexical-elements.md +0 -119
  428. pyshdl-0.3.1/docs/docs/language-reference/overview.md +0 -76
  429. pyshdl-0.3.1/docs/docs/language-reference/signals.md +0 -114
  430. pyshdl-0.3.1/docs/docs/language-reference/standard-gates.md +0 -280
  431. pyshdl-0.3.1/docs/docusaurus.config.ts +0 -139
  432. pyshdl-0.3.1/docs/package.json +0 -47
  433. pyshdl-0.3.1/docs/sidebars.ts +0 -33
  434. pyshdl-0.3.1/docs/src/components/HomepageFeatures/index.tsx +0 -71
  435. pyshdl-0.3.1/docs/src/components/HomepageFeatures/styles.module.css +0 -11
  436. pyshdl-0.3.1/docs/src/css/custom.css +0 -30
  437. pyshdl-0.3.1/docs/src/pages/index.module.css +0 -23
  438. pyshdl-0.3.1/docs/src/pages/index.tsx +0 -44
  439. pyshdl-0.3.1/docs/src/pages/markdown-page.md +0 -7
  440. pyshdl-0.3.1/docs/static/img/docusaurus-social-card.jpg +0 -0
  441. pyshdl-0.3.1/docs/static/img/docusaurus.png +0 -0
  442. pyshdl-0.3.1/docs/static/img/favicon.ico +0 -0
  443. pyshdl-0.3.1/docs/static/img/halfAdder.png +0 -0
  444. pyshdl-0.3.1/docs/static/img/logo.svg +0 -1
  445. pyshdl-0.3.1/docs/static/img/undraw_docusaurus_mountain.svg +0 -171
  446. pyshdl-0.3.1/docs/static/img/undraw_docusaurus_react.svg +0 -170
  447. pyshdl-0.3.1/docs/static/img/undraw_docusaurus_tree.svg +0 -40
  448. pyshdl-0.3.1/docs/tsconfig.json +0 -8
  449. pyshdl-0.3.1/examples/SHDL_components/add100.shdl +0 -181
  450. pyshdl-0.3.1/examples/SHDL_components/addSub16.shdl +0 -19
  451. pyshdl-0.3.1/examples/SHDL_components/adder16.shdl +0 -17
  452. pyshdl-0.3.1/examples/SHDL_components/alu.shdl +0 -130
  453. pyshdl-0.3.1/examples/SHDL_components/and16inputs.shdl +0 -41
  454. pyshdl-0.3.1/examples/SHDL_components/bitwise_and16.shdl +0 -4
  455. pyshdl-0.3.1/examples/SHDL_components/bitwise_not16.shdl +0 -5
  456. pyshdl-0.3.1/examples/SHDL_components/bitwise_or16.shdl +0 -5
  457. pyshdl-0.3.1/examples/SHDL_components/bitwise_xor16.shdl +0 -5
  458. pyshdl-0.3.1/examples/SHDL_components/clock.shdl +0 -21
  459. pyshdl-0.3.1/examples/SHDL_components/demux.shdl +0 -19
  460. pyshdl-0.3.1/examples/SHDL_components/flagsZN.shdl +0 -19
  461. pyshdl-0.3.1/examples/SHDL_components/fullAdder.shdl +0 -19
  462. pyshdl-0.3.1/examples/SHDL_components/mux2.shdl +0 -19
  463. pyshdl-0.3.1/examples/SHDL_components/mux2_16.shdl +0 -10
  464. pyshdl-0.3.1/examples/SHDL_components/mux8.shdl +0 -20
  465. pyshdl-0.3.1/examples/SHDL_components/mux8_16.shdl +0 -14
  466. pyshdl-0.3.1/examples/SHDL_components/negate16.shdl +0 -19
  467. pyshdl-0.3.1/examples/SHDL_components/or16inputs.shdl +0 -26
  468. pyshdl-0.3.1/examples/SHDL_components/reg16.shdl +0 -33
  469. pyshdl-0.3.1/examples/SHDL_components/shift1.shdl +0 -47
  470. pyshdl-0.3.1/examples/interacting.py +0 -47
  471. pyshdl-0.3.1/pyproject.toml +0 -86
  472. pyshdl-0.3.1/src/SHDB/__init__.py +0 -87
  473. pyshdl-0.3.1/src/SHDL/__init__.py +0 -182
  474. pyshdl-0.3.1/src/SHDL/bus_compiler/__init__.py +0 -10
  475. pyshdl-0.3.1/src/SHDL/bus_compiler/analyzer.py +0 -401
  476. pyshdl-0.3.1/src/SHDL/bus_compiler/codegen.py +0 -576
  477. pyshdl-0.3.1/src/SHDL/bus_compiler/compiler.py +0 -137
  478. pyshdl-0.3.1/src/SHDL/bus_compiler/debug_codegen.py +0 -313
  479. pyshdl-0.3.1/src/SHDL/bus_compiler/debug_info_gen.py +0 -96
  480. pyshdl-0.3.1/src/SHDL/bus_compiler/graph.py +0 -143
  481. pyshdl-0.3.1/src/SHDL/compiler/__init__.py +0 -51
  482. pyshdl-0.3.1/src/SHDL/compiler/analyzer.py +0 -445
  483. pyshdl-0.3.1/src/SHDL/compiler/ast.py +0 -233
  484. pyshdl-0.3.1/src/SHDL/compiler/cli.py +0 -280
  485. pyshdl-0.3.1/src/SHDL/compiler/codegen.py +0 -542
  486. pyshdl-0.3.1/src/SHDL/compiler/compiler.py +0 -446
  487. pyshdl-0.3.1/src/SHDL/compiler/debug_codegen.py +0 -391
  488. pyshdl-0.3.1/src/SHDL/compiler/debug_info_gen.py +0 -205
  489. pyshdl-0.3.1/src/SHDL/compiler/lexer.py +0 -272
  490. pyshdl-0.3.1/src/SHDL/compiler/parser.py +0 -327
  491. pyshdl-0.3.1/src/SHDL/debugger/__init__.py +0 -91
  492. pyshdl-0.3.1/src/SHDL/debugger/circuit.py +0 -840
  493. pyshdl-0.3.1/src/SHDL/debugger/cli.py +0 -656
  494. pyshdl-0.3.1/src/SHDL/debugger/controller.py +0 -631
  495. pyshdl-0.3.1/src/SHDL/debugger/debuginfo.py +0 -435
  496. pyshdl-0.3.1/src/SHDL/debugger/sourcemap.py +0 -235
  497. pyshdl-0.3.1/src/SHDL/debugger/symbols.py +0 -438
  498. pyshdl-0.3.1/src/SHDL/driver/__init__.py +0 -40
  499. pyshdl-0.3.1/src/SHDL/driver/circuit.py +0 -458
  500. pyshdl-0.3.1/src/SHDL/driver/exceptions.py +0 -31
  501. pyshdl-0.3.1/src/SHDL/errors.py +0 -804
  502. pyshdl-0.3.1/src/SHDL/flattener/__init__.py +0 -58
  503. pyshdl-0.3.1/src/SHDL/flattener/ast.py +0 -334
  504. pyshdl-0.3.1/src/SHDL/flattener/flattener.py +0 -1000
  505. pyshdl-0.3.1/src/SHDL/flattener/lexer.py +0 -300
  506. pyshdl-0.3.1/src/SHDL/flattener/parser.py +0 -571
  507. pyshdl-0.3.1/src/SHDL/flattener/tokens.py +0 -112
  508. pyshdl-0.3.1/src/SHDL/semantic/__init__.py +0 -28
  509. pyshdl-0.3.1/src/SHDL/semantic/analyzer.py +0 -247
  510. pyshdl-0.3.1/src/SHDL/semantic/connection.py +0 -292
  511. pyshdl-0.3.1/src/SHDL/semantic/resolver.py +0 -589
  512. pyshdl-0.3.1/src/SHDL/semantic/type_check.py +0 -315
  513. pyshdl-0.3.1/src/SHDL/semantic/warnings.py +0 -162
  514. pyshdl-0.3.1/src/SHDL/source_map.py +0 -307
  515. pyshdl-0.3.1/tests/README.md +0 -74
  516. pyshdl-0.3.1/tests/TEST_REPORT.md +0 -318
  517. pyshdl-0.3.1/tests/circuits/test_adder4.shdl +0 -28
  518. pyshdl-0.3.1/tests/circuits/test_adder8.shdl +0 -28
  519. pyshdl-0.3.1/tests/circuits/test_bitwise.shdl +0 -60
  520. pyshdl-0.3.1/tests/circuits/test_comparator.shdl +0 -130
  521. pyshdl-0.3.1/tests/circuits/test_constants.shdl +0 -157
  522. pyshdl-0.3.1/tests/circuits/test_decoder.shdl +0 -112
  523. pyshdl-0.3.1/tests/circuits/test_gates.shdl +0 -113
  524. pyshdl-0.3.1/tests/circuits/test_generators.shdl +0 -88
  525. pyshdl-0.3.1/tests/circuits/test_half_full_adder.shdl +0 -42
  526. pyshdl-0.3.1/tests/circuits/test_mux.shdl +0 -76
  527. pyshdl-0.3.1/tests/conftest.py +0 -18
  528. pyshdl-0.3.1/tests/test_bus_compiler.py +0 -683
  529. pyshdl-0.3.1/tests/test_debugger.py +0 -965
  530. pyshdl-0.3.1/tests/test_errors.py +0 -679
  531. pyshdl-0.3.1/tests/test_shdl.py +0 -372
  532. pyshdl-0.3.1/tests/test_shdl_comprehensive.py +0 -2092
  533. pyshdl-0.3.1/uv.lock +0 -439
  534. {pyshdl-0.3.1 → pyshdl-1.0.0}/LICENSE +0 -0
  535. /pyshdl-0.3.1/docs/static/.nojekyll → /pyshdl-1.0.0/flattener/sim/__init__.py +0 -0
  536. /pyshdl-0.3.1/src/SHDL/py.typed → /pyshdl-1.0.0/shdlc/sim/__init__.py +0 -0
@@ -0,0 +1,64 @@
1
+ # CI — T0..T4 on every push / PR (golden_tests.md §1.2, CCT-6, FUZ-6 gate).
2
+ #
3
+ # Runs the commit-time tiers (unit, property, differential small-N, conformance,
4
+ # CPU acceptance) across the Linux + macOS platform matrix with both the system
5
+ # compiler and, on Linux, clang — the CCT-6 platform-matrix obligation (today the
6
+ # suite is proven on macOS/clang only). uv provides Python 3.14 and the single
7
+ # dev dependency (pytest). The heavy stress tier (SHDLC_SCALE) and the soak
8
+ # campaign run nightly, not here, so commit-time stays fast.
9
+ name: CI
10
+
11
+ on:
12
+ push:
13
+ branches: [main, master]
14
+ pull_request:
15
+ workflow_dispatch:
16
+
17
+ # A newer push to the same ref cancels the in-flight run.
18
+ concurrency:
19
+ group: ci-${{ github.workflow }}-${{ github.ref }}
20
+ cancel-in-progress: true
21
+
22
+ jobs:
23
+ test:
24
+ name: T0-T4 (${{ matrix.os }}, cc=${{ matrix.cc }})
25
+ runs-on: ${{ matrix.os }}
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ include:
30
+ # Linux: exercise both gcc (system cc) and clang — the two backends
31
+ # CCT-6 calls out as missing today.
32
+ - os: ubuntu-latest
33
+ cc: gcc
34
+ - os: ubuntu-latest
35
+ cc: clang
36
+ # macOS: the platform the suite was originally proven on (clang).
37
+ - os: macos-latest
38
+ cc: clang
39
+ env:
40
+ # shdlc.cc honours $CC for compiler discovery; pin it per matrix leg so the
41
+ # generated-C builds (differential, chunked, CPU) use the intended toolchain.
42
+ CC: ${{ matrix.cc }}
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+
46
+ - name: Install uv
47
+ uses: astral-sh/setup-uv@v5
48
+ with:
49
+ enable-cache: true
50
+
51
+ - name: Pin Python 3.14
52
+ run: uv python install 3.14
53
+
54
+ - name: Sync the environment (pytest only; no extra deps)
55
+ run: uv sync --frozen
56
+
57
+ - name: Show the compiler under test
58
+ run: ${{ matrix.cc }} --version
59
+
60
+ # T0 unit + T1 property + T2 differential (small N) + T3 conformance + T4
61
+ # CPU acceptance. The whole tree under tests/ is the commit-time suite; the
62
+ # minutes-scale stress tests self-skip unless SHDLC_SCALE is set (nightly).
63
+ - name: Run T0-T4 (uv run pytest -q)
64
+ run: uv run pytest -q
@@ -0,0 +1,86 @@
1
+ # Nightly soak + coverage (golden_tests.md T5, FUZ-6, the P2 coverage gate).
2
+ #
3
+ # The commit-time CI (ci.yml) runs the suite at its fast defaults. This scheduled
4
+ # job re-runs it with the soak knobs cranked to campaign scale — the large-N
5
+ # differential / fuzz tiers and the SHDLC_SCALE stress builds (SCL-3/4) — and
6
+ # emits a report-only coverage summary for flattener/ and shdlc/. A nightly
7
+ # failure freezes a permanent regression artifact (suite policy §4).
8
+ name: Nightly
9
+
10
+ on:
11
+ schedule:
12
+ # 07:00 UTC daily (off-peak; after most pushes have settled).
13
+ - cron: "0 7 * * *"
14
+ workflow_dispatch:
15
+
16
+ concurrency:
17
+ group: nightly-${{ github.workflow }}
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ soak:
22
+ name: Soak campaign (${{ matrix.os }})
23
+ runs-on: ${{ matrix.os }}
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ os: [ubuntu-latest, macos-latest]
28
+ env:
29
+ # Differential / netlist-fuzz tiers at campaign scale.
30
+ SHDLC_FUZZ: "500"
31
+ SHDLC_DIFF_CYCLES: "5000"
32
+ # FUZ-3 SHDL-source fuzzer at campaign scale, with the compiled-C lockstep
33
+ # leg enabled (opt-in / ~100x slower, so it only runs here).
34
+ SHDLC_SOURCE_FUZZ: "500"
35
+ SHDLC_SOURCE_FUZZ_CYCLES: "100"
36
+ SHDLC_SOURCE_FUZZ_CC: "1"
37
+ # FUZ-4 frontend no-crash campaign.
38
+ SHDLC_NOCRASH: "2000"
39
+ # SCL-3/SCL-4 minutes-scale stress builds (10^5-gate compile + 100-cycle
40
+ # differential, 10^4-instance generator).
41
+ SHDLC_SCALE: "1"
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+
45
+ - name: Install uv
46
+ uses: astral-sh/setup-uv@v5
47
+ with:
48
+ enable-cache: true
49
+
50
+ - name: Pin Python 3.14
51
+ run: uv python install 3.14
52
+
53
+ - name: Sync the environment
54
+ run: uv sync --frozen
55
+
56
+ # -p no:randomly / no special flags: the suite is seed-stable by name, so a
57
+ # campaign-scale run is a deterministic, larger replay of the same tests.
58
+ - name: Run the soak campaign (T0-T5)
59
+ run: uv run pytest -q
60
+
61
+ coverage:
62
+ name: Coverage (report-only)
63
+ runs-on: ubuntu-latest
64
+ steps:
65
+ - uses: actions/checkout@v4
66
+
67
+ - name: Install uv
68
+ uses: astral-sh/setup-uv@v5
69
+ with:
70
+ enable-cache: true
71
+
72
+ - name: Pin Python 3.14
73
+ run: uv python install 3.14
74
+
75
+ - name: Sync the environment
76
+ run: uv sync --frozen
77
+
78
+ # Report-only line+branch coverage for the two packages the P2 gate names.
79
+ # pytest-cov is pulled in ad-hoc via --with so it never enters the locked
80
+ # runtime/dev dependency set. No fail-under here: this is a ratchet target
81
+ # (≥95% on flattener phases), reported, not yet enforced.
82
+ - name: Coverage report for flattener/ and shdlc/
83
+ run: >-
84
+ uv run --with pytest-cov pytest -q
85
+ --cov=flattener --cov=shdlc --cov-branch
86
+ --cov-report=term-missing
@@ -14,23 +14,23 @@ jobs:
14
14
  build:
15
15
  name: Build distribution
16
16
  runs-on: ubuntu-latest
17
-
17
+
18
18
  steps:
19
19
  - name: Checkout code
20
20
  uses: actions/checkout@v4
21
-
21
+
22
22
  - name: Install uv
23
23
  uses: astral-sh/setup-uv@v4
24
-
24
+
25
25
  - name: Set up Python
26
- run: uv python install 3.12
27
-
26
+ run: uv python install 3.14
27
+
28
28
  - name: Set up env
29
29
  run: uv venv
30
30
 
31
31
  - name: Build package
32
32
  run: uv build
33
-
33
+
34
34
  - name: Store the distribution packages
35
35
  uses: actions/upload-artifact@v4
36
36
  with:
@@ -41,21 +41,21 @@ jobs:
41
41
  name: Publish to PyPI
42
42
  needs: [build]
43
43
  runs-on: ubuntu-latest
44
-
44
+
45
45
  environment:
46
46
  name: pypi
47
47
  url: https://pypi.org/p/PySHDL
48
-
48
+
49
49
  permissions:
50
50
  id-token: write # IMPORTANT: mandatory for trusted publishing
51
-
51
+
52
52
  steps:
53
53
  - name: Download all the dists
54
54
  uses: actions/download-artifact@v4
55
55
  with:
56
56
  name: python-package-distributions
57
57
  path: dist/
58
-
58
+
59
59
  - name: Publish distribution to PyPI
60
60
  uses: pypa/gh-action-pypi-publish@release/v1
61
61
 
@@ -64,21 +64,21 @@ jobs:
64
64
  if: github.event_name == 'workflow_dispatch'
65
65
  needs: [build]
66
66
  runs-on: ubuntu-latest
67
-
67
+
68
68
  environment:
69
69
  name: testpypi
70
70
  url: https://test.pypi.org/p/PySHDL
71
-
71
+
72
72
  permissions:
73
73
  id-token: write
74
-
74
+
75
75
  steps:
76
76
  - name: Download all the dists
77
77
  uses: actions/download-artifact@v4
78
78
  with:
79
79
  name: python-package-distributions
80
80
  path: dist/
81
-
81
+
82
82
  - name: Publish distribution to TestPyPI
83
83
  uses: pypa/gh-action-pypi-publish@release/v1
84
84
  with:
@@ -0,0 +1,31 @@
1
+ # Python bytecode / packaging
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+
8
+ # Virtual environments
9
+ .venv/
10
+
11
+ # Tool caches
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ .mypy_cache/
15
+
16
+ # Coverage
17
+ .coverage
18
+ .coverage.*
19
+ htmlcov/
20
+
21
+ # Compiled simulator artifacts emitted by shdlc (shared libraries)
22
+ *.so
23
+ *.dylib
24
+ *.dll
25
+
26
+ # macOS
27
+ .DS_Store
28
+
29
+ # Claude Code: keep shareable workflows under version control; ignore local state
30
+ .claude/*
31
+ !.claude/workflows/
pyshdl-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: PySHDL
3
+ Version: 1.0.0
4
+ Summary: SHDL hardware-description toolchain: the PySHDL user-facing driver, the SHDL→Base SHDL flattener, the Base SHDL→C compiler (shdlc), and the conformance suite.
5
+ Project-URL: Homepage, https://github.com/rafa-rrayes/SHDL
6
+ Project-URL: Repository, https://github.com/rafa-rrayes/SHDL
7
+ Project-URL: Documentation, https://rafa-rrayes.github.io/SHDL/
8
+ Author-email: rafa-rrayes <rafa@rayes.com.br>
9
+ License-Expression: GPL-3.0-or-later
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.14
12
+ Description-Content-Type: text/markdown
13
+
14
+ # SHDL
15
+
16
+ SHDL (Simple Hardware Description Language) is an educational, gate-level
17
+ hardware description language and simulation toolchain. Its founding principle
18
+ is **fidelity**: circuits simulate gate by gate, one propagation level per
19
+ cycle (the unit-delay model), and no tool in the chain is allowed to collapse
20
+ or shortcut that structure. You describe hardware out of AND/OR/NOT/XOR; you
21
+ watch signals ripple through it.
22
+
23
+ ## The two languages
24
+
25
+ **SHDL** is the authoring language: reusable hierarchical components,
26
+ multi-bit ports, compile-time parameters, generators and conditionals for
27
+ repetitive structure, bit slices and concatenation, named constants, optional
28
+ initial state, and imports. Specified in [docs/shdl.md](docs/shdl.md).
29
+
30
+ **Base SHDL** is the intermediate representation every tool consumes: a flat
31
+ netlist of single-bit wires over exactly six primitives — `AND`, `OR`, `NOT`,
32
+ `XOR`, `__VCC__`, `__GND__` — plus a JSON metadata section (multi-bit port
33
+ groups, hierarchy, source maps, timing, constants, init seeds). Specified in
34
+ [docs/base_shdl.md](docs/base_shdl.md).
35
+
36
+ ## Pipeline
37
+
38
+ ```
39
+ .shdl source
40
+
41
+
42
+ Flattener six phases: strip, monomorphize, expand generators,
43
+ │ expand slices, materialize constants, flatten hierarchy
44
+
45
+ Base SHDL single-bit primitive netlist + JSON metadata
46
+
47
+
48
+ SHDLC generates C (two-buffer compute/commit cycle),
49
+ │ builds a shared library with a stable ABI
50
+
51
+ libcircuit reset() / poke() / peek() / step()
52
+ (+ step_settle() / run_batch() throughput paths)
53
+ ```
54
+
55
+ ## Quickstart
56
+
57
+ Requires Python ≥ 3.14 and a C compiler (clang or gcc).
58
+
59
+ Install the released package from PyPI to get the `SHDL` Python package and the
60
+ `shdlc` / `shdl-flatten` / `shdl-conformance` CLIs:
61
+
62
+ ```sh
63
+ pip install PySHDL # or: uv add PySHDL
64
+ ```
65
+
66
+ Or work from a clone with [uv](https://docs.astral.sh/uv/):
67
+
68
+ ```sh
69
+ uv sync
70
+
71
+ # Flatten SHDL to Base SHDL (inspect the IR)
72
+ uv run shdl-flatten examples/fullAdder.shdl
73
+
74
+ # Compile straight from SHDL source to a shared library
75
+ uv run shdlc examples/fullAdder.shdl -o fullAdder.dylib
76
+ ```
77
+
78
+ Drive a circuit from Python with **PySHDL** — one class, `Circuit`, runs the
79
+ whole pipeline (flatten → compile → build → load) in-process and exposes
80
+ poke/peek/step plus dict access and a context manager:
81
+
82
+ ```python
83
+ from SHDL import Circuit
84
+
85
+ with Circuit("examples/adder8.shdl") as c:
86
+ c["A"] = 100 # dict-style poke; bit 0 is the LSB
87
+ c["B"] = 55
88
+ c.settle() # advance every gate level (combinational depth)
89
+ print(c["Sum"]) # 155
90
+ ```
91
+
92
+ See [docs/pyshdl.md](docs/pyshdl.md) for the full guide, and
93
+ [examples/interacting.py](examples/interacting.py) for a runnable walkthrough
94
+ (`uv run python examples/interacting.py`). The underlying ABI is callable from
95
+ any language; see [docs/shdlc_goals.md](docs/shdlc_goals.md) §3 for the full
96
+ contract (masking, lazy evaluation, init-seeded power-on state).
97
+
98
+ ## Repository layout
99
+
100
+ | Path | What it is |
101
+ |---|---|
102
+ | `flattener/` | SHDL → Base SHDL (lexer, parser, six lowering phases, metadata, `HighEval` reference interpreter) |
103
+ | `shdlc/` | Base SHDL → C → shared library (model, codegen, cc driver, `BaseEval` reference interpreter, ctypes harness) |
104
+ | `SHDL/` | The user-facing Python driver: `Circuit` runs the pipeline in-process and exposes poke/peek/step (`from SHDL import Circuit`) |
105
+ | `conformance/` | Frozen corpus of cases with golden Base SHDL + cycle-by-cycle traces, and its runner |
106
+ | `tests/` | `flattener/`, `compiler/`, and `cpu/` suites (~1640 tests) |
107
+ | `examples/` | Small circuits (adders, latches, mux, ALU) and a complete, verified 16-bit CPU (`examples/CPU/`) |
108
+ | `docs/` | The normative specs and the verification map |
109
+ | `scripts/` | Maintenance tooling (conformance corpus builder) |
110
+
111
+ The flattener and shdlc are deliberately decoupled: Base SHDL text is the
112
+ *only* contract between them, and each side carries its own independent
113
+ reference interpreter so the two can cross-check each other.
114
+
115
+ ## Testing
116
+
117
+ ```sh
118
+ uv run pytest # full suite
119
+ uv run shdl-conformance run # golden corpus: flatten + compile + trace lockstep
120
+ ```
121
+
122
+ The suite covers per-phase units, per-raise-site diagnostics (every error's
123
+ exact position is pinned), differential fuzzing against two independent
124
+ oracles, byte-determinism, ABI contracts under ASAN/UBSAN, and instruction-
125
+ level lockstep of the example CPU against a golden model.
126
+
127
+ ## Documentation
128
+
129
+ - [docs/SHDL_Project.md](docs/SHDL_Project.md) — project charter: architecture, ecosystem, build sequence.
130
+ - [docs/shdl.md](docs/shdl.md) — the SHDL language specification.
131
+ - [docs/base_shdl.md](docs/base_shdl.md) — the Base SHDL IR specification.
132
+ - [docs/shdlc_goals.md](docs/shdlc_goals.md) — the compiler's obligations and ABI contract.
133
+ - [docs/golden_tests.md](docs/golden_tests.md) — the verification map tying every spec obligation to tests.
134
+
135
+ ## Status
136
+
137
+ The flattener, the SHDLC compiler (release ABI), the conformance suite, and
138
+ **PySHDL** — the user-facing Python driver (`from SHDL import Circuit`) — are
139
+ complete and green. Next up are the debug build and the SHDB debugger — see the
140
+ build sequence in the charter.
pyshdl-1.0.0/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # SHDL
2
+
3
+ SHDL (Simple Hardware Description Language) is an educational, gate-level
4
+ hardware description language and simulation toolchain. Its founding principle
5
+ is **fidelity**: circuits simulate gate by gate, one propagation level per
6
+ cycle (the unit-delay model), and no tool in the chain is allowed to collapse
7
+ or shortcut that structure. You describe hardware out of AND/OR/NOT/XOR; you
8
+ watch signals ripple through it.
9
+
10
+ ## The two languages
11
+
12
+ **SHDL** is the authoring language: reusable hierarchical components,
13
+ multi-bit ports, compile-time parameters, generators and conditionals for
14
+ repetitive structure, bit slices and concatenation, named constants, optional
15
+ initial state, and imports. Specified in [docs/shdl.md](docs/shdl.md).
16
+
17
+ **Base SHDL** is the intermediate representation every tool consumes: a flat
18
+ netlist of single-bit wires over exactly six primitives — `AND`, `OR`, `NOT`,
19
+ `XOR`, `__VCC__`, `__GND__` — plus a JSON metadata section (multi-bit port
20
+ groups, hierarchy, source maps, timing, constants, init seeds). Specified in
21
+ [docs/base_shdl.md](docs/base_shdl.md).
22
+
23
+ ## Pipeline
24
+
25
+ ```
26
+ .shdl source
27
+
28
+
29
+ Flattener six phases: strip, monomorphize, expand generators,
30
+ │ expand slices, materialize constants, flatten hierarchy
31
+
32
+ Base SHDL single-bit primitive netlist + JSON metadata
33
+
34
+
35
+ SHDLC generates C (two-buffer compute/commit cycle),
36
+ │ builds a shared library with a stable ABI
37
+
38
+ libcircuit reset() / poke() / peek() / step()
39
+ (+ step_settle() / run_batch() throughput paths)
40
+ ```
41
+
42
+ ## Quickstart
43
+
44
+ Requires Python ≥ 3.14 and a C compiler (clang or gcc).
45
+
46
+ Install the released package from PyPI to get the `SHDL` Python package and the
47
+ `shdlc` / `shdl-flatten` / `shdl-conformance` CLIs:
48
+
49
+ ```sh
50
+ pip install PySHDL # or: uv add PySHDL
51
+ ```
52
+
53
+ Or work from a clone with [uv](https://docs.astral.sh/uv/):
54
+
55
+ ```sh
56
+ uv sync
57
+
58
+ # Flatten SHDL to Base SHDL (inspect the IR)
59
+ uv run shdl-flatten examples/fullAdder.shdl
60
+
61
+ # Compile straight from SHDL source to a shared library
62
+ uv run shdlc examples/fullAdder.shdl -o fullAdder.dylib
63
+ ```
64
+
65
+ Drive a circuit from Python with **PySHDL** — one class, `Circuit`, runs the
66
+ whole pipeline (flatten → compile → build → load) in-process and exposes
67
+ poke/peek/step plus dict access and a context manager:
68
+
69
+ ```python
70
+ from SHDL import Circuit
71
+
72
+ with Circuit("examples/adder8.shdl") as c:
73
+ c["A"] = 100 # dict-style poke; bit 0 is the LSB
74
+ c["B"] = 55
75
+ c.settle() # advance every gate level (combinational depth)
76
+ print(c["Sum"]) # 155
77
+ ```
78
+
79
+ See [docs/pyshdl.md](docs/pyshdl.md) for the full guide, and
80
+ [examples/interacting.py](examples/interacting.py) for a runnable walkthrough
81
+ (`uv run python examples/interacting.py`). The underlying ABI is callable from
82
+ any language; see [docs/shdlc_goals.md](docs/shdlc_goals.md) §3 for the full
83
+ contract (masking, lazy evaluation, init-seeded power-on state).
84
+
85
+ ## Repository layout
86
+
87
+ | Path | What it is |
88
+ |---|---|
89
+ | `flattener/` | SHDL → Base SHDL (lexer, parser, six lowering phases, metadata, `HighEval` reference interpreter) |
90
+ | `shdlc/` | Base SHDL → C → shared library (model, codegen, cc driver, `BaseEval` reference interpreter, ctypes harness) |
91
+ | `SHDL/` | The user-facing Python driver: `Circuit` runs the pipeline in-process and exposes poke/peek/step (`from SHDL import Circuit`) |
92
+ | `conformance/` | Frozen corpus of cases with golden Base SHDL + cycle-by-cycle traces, and its runner |
93
+ | `tests/` | `flattener/`, `compiler/`, and `cpu/` suites (~1640 tests) |
94
+ | `examples/` | Small circuits (adders, latches, mux, ALU) and a complete, verified 16-bit CPU (`examples/CPU/`) |
95
+ | `docs/` | The normative specs and the verification map |
96
+ | `scripts/` | Maintenance tooling (conformance corpus builder) |
97
+
98
+ The flattener and shdlc are deliberately decoupled: Base SHDL text is the
99
+ *only* contract between them, and each side carries its own independent
100
+ reference interpreter so the two can cross-check each other.
101
+
102
+ ## Testing
103
+
104
+ ```sh
105
+ uv run pytest # full suite
106
+ uv run shdl-conformance run # golden corpus: flatten + compile + trace lockstep
107
+ ```
108
+
109
+ The suite covers per-phase units, per-raise-site diagnostics (every error's
110
+ exact position is pinned), differential fuzzing against two independent
111
+ oracles, byte-determinism, ABI contracts under ASAN/UBSAN, and instruction-
112
+ level lockstep of the example CPU against a golden model.
113
+
114
+ ## Documentation
115
+
116
+ - [docs/SHDL_Project.md](docs/SHDL_Project.md) — project charter: architecture, ecosystem, build sequence.
117
+ - [docs/shdl.md](docs/shdl.md) — the SHDL language specification.
118
+ - [docs/base_shdl.md](docs/base_shdl.md) — the Base SHDL IR specification.
119
+ - [docs/shdlc_goals.md](docs/shdlc_goals.md) — the compiler's obligations and ABI contract.
120
+ - [docs/golden_tests.md](docs/golden_tests.md) — the verification map tying every spec obligation to tests.
121
+
122
+ ## Status
123
+
124
+ The flattener, the SHDLC compiler (release ABI), the conformance suite, and
125
+ **PySHDL** — the user-facing Python driver (`from SHDL import Circuit`) — are
126
+ complete and green. Next up are the debug build and the SHDB debugger — see the
127
+ build sequence in the charter.
@@ -0,0 +1,57 @@
1
+ """SHDL — the Python driver for SHDL circuits.
2
+
3
+ The user-facing layer of the SHDL toolchain: compile a circuit (from a
4
+ ``.shdl`` file, SHDL source text, a Base SHDL artifact, or a prebuilt
5
+ shared library) and drive the simulation through an ergonomic interface::
6
+
7
+ from SHDL import Circuit
8
+
9
+ with Circuit("examples/adder8.shdl") as c:
10
+ c["A"] = 100
11
+ c["B"] = 55
12
+ c.settle()
13
+ print(c["Sum"]) # 155
14
+
15
+ Everything runs in-process: the flattener lowers SHDL to Base SHDL, shdlc
16
+ generates C, the host C compiler builds a shared library, and ctypes loads
17
+ a private copy of it. See ``docs/pyshdl.md`` for the user guide.
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ __version__ = "1.0.0"
23
+
24
+ from .circuit import Circuit
25
+ from .errors import (
26
+ BuildError,
27
+ ClosedCircuitError,
28
+ CompilationError,
29
+ CompileError,
30
+ FlattenError,
31
+ MetadataUnavailableError,
32
+ PortValueError,
33
+ PySHDLError,
34
+ SettleRefusedError,
35
+ SignalNotFoundError,
36
+ SimulationError,
37
+ )
38
+ from .info import CircuitInfo, PortInfo, TimingInfo
39
+
40
+ __all__ = [
41
+ "BuildError",
42
+ "Circuit",
43
+ "CircuitInfo",
44
+ "ClosedCircuitError",
45
+ "CompilationError",
46
+ "CompileError",
47
+ "FlattenError",
48
+ "MetadataUnavailableError",
49
+ "PortInfo",
50
+ "PortValueError",
51
+ "PySHDLError",
52
+ "SettleRefusedError",
53
+ "SignalNotFoundError",
54
+ "SimulationError",
55
+ "TimingInfo",
56
+ "__version__",
57
+ ]