veriforge 0.0.1__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 (438) hide show
  1. veriforge-0.0.1/LICENSE +21 -0
  2. veriforge-0.0.1/PKG-INFO +271 -0
  3. veriforge-0.0.1/README.md +224 -0
  4. veriforge-0.0.1/benchmarks/benchmark.py +1020 -0
  5. veriforge-0.0.1/examples/axi/axi_crossbar_4x4/bench/axi_crossbar_4x4_bench.py +153 -0
  6. veriforge-0.0.1/examples/axi/axi_crossbar_4x4/debug/debug_axi.py +113 -0
  7. veriforge-0.0.1/examples/axi/axi_crossbar_4x4/debug/debug_width.py +108 -0
  8. veriforge-0.0.1/examples/axi/axi_lite_example.py +90 -0
  9. veriforge-0.0.1/examples/axi/axi_stream_example.py +74 -0
  10. veriforge-0.0.1/examples/basics/alu.py +102 -0
  11. veriforge-0.0.1/examples/basics/counter.py +54 -0
  12. veriforge-0.0.1/examples/basics/fsm.py +103 -0
  13. veriforge-0.0.1/examples/basics/shift_register.py +71 -0
  14. veriforge-0.0.1/examples/basics/testbench.py +94 -0
  15. veriforge-0.0.1/examples/composability/design_explorer.py +122 -0
  16. veriforge-0.0.1/examples/composability/pipeline_generator.py +152 -0
  17. veriforge-0.0.1/examples/composability/register_bank.py +191 -0
  18. veriforge-0.0.1/examples/darkriscv/diag_compare.py +55 -0
  19. veriforge-0.0.1/examples/darkriscv/profile_compiled.py +52 -0
  20. veriforge-0.0.1/examples/darkriscv/run_fast.py +122 -0
  21. veriforge-0.0.1/examples/darkriscv/run_sim.py +146 -0
  22. veriforge-0.0.1/examples/debug/gen_partselect/test_gen_partselect.py +103 -0
  23. veriforge-0.0.1/examples/debug/gen_port_partsel/test_gen_port_partsel.py +40 -0
  24. veriforge-0.0.1/examples/debug/gen_unpacked_arr/test_gen_unpacked_arr.py +69 -0
  25. veriforge-0.0.1/examples/femtorv/cosim_validate.py +57 -0
  26. veriforge-0.0.1/examples/femtorv/gen_firmware.py +693 -0
  27. veriforge-0.0.1/examples/femtorv/run_fast.py +137 -0
  28. veriforge-0.0.1/examples/femtorv/run_sim.py +144 -0
  29. veriforge-0.0.1/examples/ibex/gen_firmware.py +491 -0
  30. veriforge-0.0.1/examples/ibex/model_test.py +51 -0
  31. veriforge-0.0.1/examples/ibex/parse_test.py +47 -0
  32. veriforge-0.0.1/examples/ibex/run_sim.py +174 -0
  33. veriforge-0.0.1/examples/ibex/run_vcd.py +193 -0
  34. veriforge-0.0.1/examples/ibex/vcd_compare_verilator.py +539 -0
  35. veriforge-0.0.1/examples/library/cdc_example.py +31 -0
  36. veriforge-0.0.1/examples/library/codec_example.py +25 -0
  37. veriforge-0.0.1/examples/library/dsp_example.py +33 -0
  38. veriforge-0.0.1/examples/library/fifo_example.py +28 -0
  39. veriforge-0.0.1/examples/library/xilinx_example.py +34 -0
  40. veriforge-0.0.1/examples/multi_iface_project/tb/multi_iface_tb.py +449 -0
  41. veriforge-0.0.1/examples/pause_demo/pause_demo.py +856 -0
  42. veriforge-0.0.1/examples/picorv32/cosim_validate.py +56 -0
  43. veriforge-0.0.1/examples/picorv32/gen_firmware.py +735 -0
  44. veriforge-0.0.1/examples/picorv32/run_fast.py +137 -0
  45. veriforge-0.0.1/examples/picorv32/run_sim.py +133 -0
  46. veriforge-0.0.1/examples/pulp/axi/axi_cdc/bench/axi_cdc_bench.py +295 -0
  47. veriforge-0.0.1/examples/pulp/axi/axi_cdc/run_sim.py +313 -0
  48. veriforge-0.0.1/examples/pulp/axi/axi_fifo/bench/axi_fifo_bench.py +300 -0
  49. veriforge-0.0.1/examples/pulp/axi/axi_fifo/run_sim.py +342 -0
  50. veriforge-0.0.1/examples/pulp/axi/axi_lite_dw_converter/bench/axi_lite_dw_bench.py +432 -0
  51. veriforge-0.0.1/examples/pulp/axi/axi_lite_dw_converter/run_sim.py +480 -0
  52. veriforge-0.0.1/examples/pulp/axi/axi_lite_mailbox/bench/axi_lite_mailbox_bench.py +143 -0
  53. veriforge-0.0.1/examples/pulp/axi/axi_lite_mailbox/run_sim.py +160 -0
  54. veriforge-0.0.1/examples/pulp/axi/axi_lite_regs/bench/axi_lite_regs_bench.py +93 -0
  55. veriforge-0.0.1/examples/pulp/axi/axi_lite_regs/run_sim.py +310 -0
  56. veriforge-0.0.1/examples/pulp/axi/axi_lite_to_axi/bench/axi_lite_to_axi_bench.py +118 -0
  57. veriforge-0.0.1/examples/pulp/axi/axi_lite_to_axi/run_sim.py +230 -0
  58. veriforge-0.0.1/examples/pulp/axi/axi_lite_xbar/bench/axi_lite_xbar_bench.py +116 -0
  59. veriforge-0.0.1/examples/pulp/axi/axi_lite_xbar/run_sim.py +226 -0
  60. veriforge-0.0.1/examples/pulp/axi/axi_mem_flat/bench/axi_mem_flat_bench.py +102 -0
  61. veriforge-0.0.1/examples/pulp/axi/axi_to_axi_lite/bench/axi_to_axi_lite_bench.py +160 -0
  62. veriforge-0.0.1/examples/pulp/axi/axi_to_axi_lite/run_sim.py +244 -0
  63. veriforge-0.0.1/examples/pulp/axi/axi_xbar/bench/axi_xbar_bench.py +358 -0
  64. veriforge-0.0.1/examples/pulp/axi/axi_xbar/run_sim.py +408 -0
  65. veriforge-0.0.1/examples/pulp/common_cells/binary_to_gray/run_sim.py +91 -0
  66. veriforge-0.0.1/examples/pulp/common_cells/cc_onehot/run_sim.py +91 -0
  67. veriforge-0.0.1/examples/pulp/common_cells/cdc_2phase/run_sim.py +219 -0
  68. veriforge-0.0.1/examples/pulp/common_cells/cdc_2phase_clearable/run_sim.py +475 -0
  69. veriforge-0.0.1/examples/pulp/common_cells/cdc_4phase/run_sim.py +273 -0
  70. veriforge-0.0.1/examples/pulp/common_cells/cdc_fifo/run_sim.py +237 -0
  71. veriforge-0.0.1/examples/pulp/common_cells/cdc_fifo_gray/run_sim.py +211 -0
  72. veriforge-0.0.1/examples/pulp/common_cells/cdc_reset_ctrlr/run_sim.py +339 -0
  73. veriforge-0.0.1/examples/pulp/common_cells/counter/run_sim.py +94 -0
  74. veriforge-0.0.1/examples/pulp/common_cells/credit_counter/run_sim.py +93 -0
  75. veriforge-0.0.1/examples/pulp/common_cells/delta_counter/run_sim.py +91 -0
  76. veriforge-0.0.1/examples/pulp/common_cells/edge_detect/run_sim.py +95 -0
  77. veriforge-0.0.1/examples/pulp/common_cells/edge_propagator_ack/run_sim.py +98 -0
  78. veriforge-0.0.1/examples/pulp/common_cells/edge_propagator_rx/run_sim.py +94 -0
  79. veriforge-0.0.1/examples/pulp/common_cells/edge_propagator_tx/run_sim.py +92 -0
  80. veriforge-0.0.1/examples/pulp/common_cells/exp_backoff/run_sim.py +92 -0
  81. veriforge-0.0.1/examples/pulp/common_cells/fall_through_register/run_sim.py +217 -0
  82. veriforge-0.0.1/examples/pulp/common_cells/fifo_v3/run_sim.py +276 -0
  83. veriforge-0.0.1/examples/pulp/common_cells/gray_to_binary/run_sim.py +91 -0
  84. veriforge-0.0.1/examples/pulp/common_cells/heaviside/run_sim.py +91 -0
  85. veriforge-0.0.1/examples/pulp/common_cells/isochronous_4phase_handshake/run_sim.py +199 -0
  86. veriforge-0.0.1/examples/pulp/common_cells/isochronous_spill_register/run_sim.py +258 -0
  87. veriforge-0.0.1/examples/pulp/common_cells/lfsr_8bit/run_sim.py +92 -0
  88. veriforge-0.0.1/examples/pulp/common_cells/lossy_valid_to_stream/run_sim.py +206 -0
  89. veriforge-0.0.1/examples/pulp/common_cells/lzc/run_sim.py +91 -0
  90. veriforge-0.0.1/examples/pulp/common_cells/max_counter/run_sim.py +94 -0
  91. veriforge-0.0.1/examples/pulp/common_cells/onehot_to_bin/run_sim.py +91 -0
  92. veriforge-0.0.1/examples/pulp/common_cells/passthrough_stream_fifo/run_sim.py +253 -0
  93. veriforge-0.0.1/examples/pulp/common_cells/plru_tree/run_sim.py +92 -0
  94. veriforge-0.0.1/examples/pulp/common_cells/popcount/run_sim.py +109 -0
  95. veriforge-0.0.1/examples/pulp/common_cells/read/run_sim.py +91 -0
  96. veriforge-0.0.1/examples/pulp/common_cells/ring_buffer/run_sim.py +92 -0
  97. veriforge-0.0.1/examples/pulp/common_cells/rr_arb_tree/run_sim.py +192 -0
  98. veriforge-0.0.1/examples/pulp/common_cells/rstgen/run_sim.py +182 -0
  99. veriforge-0.0.1/examples/pulp/common_cells/rstgen_bypass/run_sim.py +182 -0
  100. veriforge-0.0.1/examples/pulp/common_cells/serial_deglitch/run_sim.py +92 -0
  101. veriforge-0.0.1/examples/pulp/common_cells/shift_reg/run_sim.py +93 -0
  102. veriforge-0.0.1/examples/pulp/common_cells/spill_register/bench/spill_register_bench.py +94 -0
  103. veriforge-0.0.1/examples/pulp/common_cells/spill_register/run_sim.py +231 -0
  104. veriforge-0.0.1/examples/pulp/common_cells/spill_register_flushable/run_sim.py +212 -0
  105. veriforge-0.0.1/examples/pulp/common_cells/stream_arbiter/run_sim.py +211 -0
  106. veriforge-0.0.1/examples/pulp/common_cells/stream_arbiter_flushable/run_sim.py +228 -0
  107. veriforge-0.0.1/examples/pulp/common_cells/stream_delay/run_sim.py +193 -0
  108. veriforge-0.0.1/examples/pulp/common_cells/stream_demux/run_sim.py +147 -0
  109. veriforge-0.0.1/examples/pulp/common_cells/stream_fifo/bench/stream_fifo_bench.py +98 -0
  110. veriforge-0.0.1/examples/pulp/common_cells/stream_fifo/run_sim.py +240 -0
  111. veriforge-0.0.1/examples/pulp/common_cells/stream_fifo_optimal_wrap/run_sim.py +245 -0
  112. veriforge-0.0.1/examples/pulp/common_cells/stream_filter/run_sim.py +146 -0
  113. veriforge-0.0.1/examples/pulp/common_cells/stream_fork/run_sim.py +197 -0
  114. veriforge-0.0.1/examples/pulp/common_cells/stream_fork_dynamic/run_sim.py +205 -0
  115. veriforge-0.0.1/examples/pulp/common_cells/stream_join/run_sim.py +144 -0
  116. veriforge-0.0.1/examples/pulp/common_cells/stream_mux/run_sim.py +156 -0
  117. veriforge-0.0.1/examples/pulp/common_cells/stream_omega_net/run_sim.py +289 -0
  118. veriforge-0.0.1/examples/pulp/common_cells/stream_register/bench/stream_register_bench.py +91 -0
  119. veriforge-0.0.1/examples/pulp/common_cells/stream_register/run_sim.py +213 -0
  120. veriforge-0.0.1/examples/pulp/common_cells/stream_throttle/run_sim.py +235 -0
  121. veriforge-0.0.1/examples/pulp/common_cells/stream_to_mem/run_sim.py +277 -0
  122. veriforge-0.0.1/examples/pulp/common_cells/stream_xbar/run_sim.py +220 -0
  123. veriforge-0.0.1/examples/pulp/common_cells/stream_xbar_typed/run_sim.py +190 -0
  124. veriforge-0.0.1/examples/pulp/common_cells/sub_per_hash/oracle_vectors.py +168 -0
  125. veriforge-0.0.1/examples/pulp/common_cells/sub_per_hash/run_sim.py +92 -0
  126. veriforge-0.0.1/examples/pulp/common_cells/sync/run_sim.py +208 -0
  127. veriforge-0.0.1/examples/pulp/common_cells/sync_wedge/run_sim.py +210 -0
  128. veriforge-0.0.1/examples/pulp/common_cells/trip_counter/run_sim.py +93 -0
  129. veriforge-0.0.1/examples/pulp/common_cells/unread/run_sim.py +91 -0
  130. veriforge-0.0.1/examples/python_testbench/axi_stream_loopback.py +152 -0
  131. veriforge-0.0.1/examples/python_testbench/multi_domain_axis.py +171 -0
  132. veriforge-0.0.1/examples/serv/cosim_validate.py +76 -0
  133. veriforge-0.0.1/examples/serv/gen_firmware.py +693 -0
  134. veriforge-0.0.1/examples/serv/run_fast.py +174 -0
  135. veriforge-0.0.1/examples/serv/run_sim.py +165 -0
  136. veriforge-0.0.1/examples/taxi/tb/test_axil_ram.py +170 -0
  137. veriforge-0.0.1/examples/taxi/tb/test_axis_adapter.py +233 -0
  138. veriforge-0.0.1/examples/taxi/tb/test_axis_arb_mux.py +183 -0
  139. veriforge-0.0.1/examples/taxi/tb/test_axis_async_fifo.py +210 -0
  140. veriforge-0.0.1/examples/taxi/tb/test_axis_broadcast.py +157 -0
  141. veriforge-0.0.1/examples/taxi/tb/test_axis_register.py +211 -0
  142. veriforge-0.0.1/pyproject.toml +187 -0
  143. veriforge-0.0.1/setup.cfg +4 -0
  144. veriforge-0.0.1/setup.py +45 -0
  145. veriforge-0.0.1/src/veriforge/__init__.py +39 -0
  146. veriforge-0.0.1/src/veriforge/__main__.py +1427 -0
  147. veriforge-0.0.1/src/veriforge/_version.py +1 -0
  148. veriforge-0.0.1/src/veriforge/analysis/__init__.py +64 -0
  149. veriforge-0.0.1/src/veriforge/analysis/clock_reset.py +438 -0
  150. veriforge-0.0.1/src/veriforge/analysis/const_fold.py +351 -0
  151. veriforge-0.0.1/src/veriforge/analysis/lint.py +502 -0
  152. veriforge-0.0.1/src/veriforge/analysis/resolver.py +494 -0
  153. veriforge-0.0.1/src/veriforge/analysis/width_inference.py +341 -0
  154. veriforge-0.0.1/src/veriforge/codegen/__init__.py +17 -0
  155. veriforge-0.0.1/src/veriforge/codegen/format_style.py +63 -0
  156. veriforge-0.0.1/src/veriforge/codegen/verilog_emitter.py +1354 -0
  157. veriforge-0.0.1/src/veriforge/codegen/verilog_formatter.py +1014 -0
  158. veriforge-0.0.1/src/veriforge/convert/__init__.py +5 -0
  159. veriforge-0.0.1/src/veriforge/convert/to_dsl.py +1078 -0
  160. veriforge-0.0.1/src/veriforge/dsl/__init__.py +81 -0
  161. veriforge-0.0.1/src/veriforge/dsl/builder.py +1960 -0
  162. veriforge-0.0.1/src/veriforge/dsl/interface.py +293 -0
  163. veriforge-0.0.1/src/veriforge/dsl/lib/__init__.py +55 -0
  164. veriforge-0.0.1/src/veriforge/dsl/lib/axi.py +76 -0
  165. veriforge-0.0.1/src/veriforge/dsl/lib/axi_stream.py +119 -0
  166. veriforge-0.0.1/src/veriforge/dsl/lib/cdc.py +114 -0
  167. veriforge-0.0.1/src/veriforge/dsl/lib/codec.py +113 -0
  168. veriforge-0.0.1/src/veriforge/dsl/lib/dsp.py +291 -0
  169. veriforge-0.0.1/src/veriforge/dsl/lib/fifo.py +96 -0
  170. veriforge-0.0.1/src/veriforge/dsl/lib/xilinx.py +152 -0
  171. veriforge-0.0.1/src/veriforge/dsl/ram.py +265 -0
  172. veriforge-0.0.1/src/veriforge/dsl/testbench.py +1732 -0
  173. veriforge-0.0.1/src/veriforge/dsl/testbench_deps.py +147 -0
  174. veriforge-0.0.1/src/veriforge/lark_file/__init__.py +0 -0
  175. veriforge-0.0.1/src/veriforge/lark_file/gen_tree.py +256 -0
  176. veriforge-0.0.1/src/veriforge/lark_file/parse_metadata.py +656 -0
  177. veriforge-0.0.1/src/veriforge/model/__init__.py +189 -0
  178. veriforge-0.0.1/src/veriforge/model/assignments.py +40 -0
  179. veriforge-0.0.1/src/veriforge/model/base.py +185 -0
  180. veriforge-0.0.1/src/veriforge/model/behavioral.py +79 -0
  181. veriforge-0.0.1/src/veriforge/model/design.py +282 -0
  182. veriforge-0.0.1/src/veriforge/model/expressions.py +427 -0
  183. veriforge-0.0.1/src/veriforge/model/functions.py +146 -0
  184. veriforge-0.0.1/src/veriforge/model/generate.py +270 -0
  185. veriforge-0.0.1/src/veriforge/model/instances.py +168 -0
  186. veriforge-0.0.1/src/veriforge/model/interface.py +175 -0
  187. veriforge-0.0.1/src/veriforge/model/nets.py +88 -0
  188. veriforge-0.0.1/src/veriforge/model/package.py +128 -0
  189. veriforge-0.0.1/src/veriforge/model/parameters.py +59 -0
  190. veriforge-0.0.1/src/veriforge/model/ports.py +100 -0
  191. veriforge-0.0.1/src/veriforge/model/specify.py +63 -0
  192. veriforge-0.0.1/src/veriforge/model/statements.py +658 -0
  193. veriforge-0.0.1/src/veriforge/model/sv_types.py +330 -0
  194. veriforge-0.0.1/src/veriforge/model/variables.py +89 -0
  195. veriforge-0.0.1/src/veriforge/preprocessor.py +719 -0
  196. veriforge-0.0.1/src/veriforge/project.py +360 -0
  197. veriforge-0.0.1/src/veriforge/refactor/__init__.py +79 -0
  198. veriforge-0.0.1/src/veriforge/refactor/_boundary_models.py +189 -0
  199. veriforge-0.0.1/src/veriforge/refactor/_boundary_pull_push.py +81 -0
  200. veriforge-0.0.1/src/veriforge/refactor/_boundary_selection.py +472 -0
  201. veriforge-0.0.1/src/veriforge/refactor/_boundary_validation.py +161 -0
  202. veriforge-0.0.1/src/veriforge/refactor/_extract_classify.py +641 -0
  203. veriforge-0.0.1/src/veriforge/refactor/_extract_models.py +230 -0
  204. veriforge-0.0.1/src/veriforge/refactor/_pull_up_engine.py +3323 -0
  205. veriforge-0.0.1/src/veriforge/refactor/_push_down_engine.py +267 -0
  206. veriforge-0.0.1/src/veriforge/refactor/_refactor_utils.py +244 -0
  207. veriforge-0.0.1/src/veriforge/refactor/diagnostics.py +21 -0
  208. veriforge-0.0.1/src/veriforge/refactor/hierarchy_boundary.py +320 -0
  209. veriforge-0.0.1/src/veriforge/refactor/hierarchy_collapse.py +295 -0
  210. veriforge-0.0.1/src/veriforge/refactor/hierarchy_extract.py +2689 -0
  211. veriforge-0.0.1/src/veriforge/refactor/hierarchy_graph.py +390 -0
  212. veriforge-0.0.1/src/veriforge/refactor/visualization.py +118 -0
  213. veriforge-0.0.1/src/veriforge/scaffold.py +361 -0
  214. veriforge-0.0.1/src/veriforge/sim/__init__.py +38 -0
  215. veriforge-0.0.1/src/veriforge/sim/bench/__init__.py +119 -0
  216. veriforge-0.0.1/src/veriforge/sim/bench/interfaces.py +798 -0
  217. veriforge-0.0.1/src/veriforge/sim/bench/lowering.py +2339 -0
  218. veriforge-0.0.1/src/veriforge/sim/bench/plan.py +381 -0
  219. veriforge-0.0.1/src/veriforge/sim/bench/planner.py +596 -0
  220. veriforge-0.0.1/src/veriforge/sim/bench/runtime.py +471 -0
  221. veriforge-0.0.1/src/veriforge/sim/compiled/__init__.py +19 -0
  222. veriforge-0.0.1/src/veriforge/sim/compiled/_codegen_utils.py +118 -0
  223. veriforge-0.0.1/src/veriforge/sim/compiled/_expr_emitter.py +1986 -0
  224. veriforge-0.0.1/src/veriforge/sim/compiled/_gen_narrow_accessors.py +12 -0
  225. veriforge-0.0.1/src/veriforge/sim/compiled/_gen_narrow_assign.py +12 -0
  226. veriforge-0.0.1/src/veriforge/sim/compiled/_gen_narrow_stage.py +12 -0
  227. veriforge-0.0.1/src/veriforge/sim/compiled/_gen_narrow_tail.py +12 -0
  228. veriforge-0.0.1/src/veriforge/sim/compiled/_gen_sections.py +1168 -0
  229. veriforge-0.0.1/src/veriforge/sim/compiled/_gen_wide_section.py +1092 -0
  230. veriforge-0.0.1/src/veriforge/sim/compiled/_process_compiler.py +1439 -0
  231. veriforge-0.0.1/src/veriforge/sim/compiled/_stmt_emitters.py +2366 -0
  232. veriforge-0.0.1/src/veriforge/sim/compiled/_wide_emitter.py +4008 -0
  233. veriforge-0.0.1/src/veriforge/sim/compiled/codegen.py +1718 -0
  234. veriforge-0.0.1/src/veriforge/sim/compiled/compiled_scheduler.py +1172 -0
  235. veriforge-0.0.1/src/veriforge/sim/compiled/compiler.py +406 -0
  236. veriforge-0.0.1/src/veriforge/sim/compiled/templates/narrow_accessors.pxi +81 -0
  237. veriforge-0.0.1/src/veriforge/sim/compiled/templates/narrow_assign.pxi +6379 -0
  238. veriforge-0.0.1/src/veriforge/sim/compiled/templates/narrow_stage.pxi +5165 -0
  239. veriforge-0.0.1/src/veriforge/sim/compiled/templates/narrow_tail.pxi +144 -0
  240. veriforge-0.0.1/src/veriforge/sim/cosim.py +802 -0
  241. veriforge-0.0.1/src/veriforge/sim/elaborate.py +2460 -0
  242. veriforge-0.0.1/src/veriforge/sim/endpoints/__init__.py +73 -0
  243. veriforge-0.0.1/src/veriforge/sim/endpoints/_generator.py +96 -0
  244. veriforge-0.0.1/src/veriforge/sim/endpoints/axi4_master.py +348 -0
  245. veriforge-0.0.1/src/veriforge/sim/endpoints/axi4_responder.py +365 -0
  246. veriforge-0.0.1/src/veriforge/sim/endpoints/axi_lite_common.py +65 -0
  247. veriforge-0.0.1/src/veriforge/sim/endpoints/axi_lite_master.py +169 -0
  248. veriforge-0.0.1/src/veriforge/sim/endpoints/axi_lite_request_driver.py +69 -0
  249. veriforge-0.0.1/src/veriforge/sim/endpoints/axi_lite_responder.py +323 -0
  250. veriforge-0.0.1/src/veriforge/sim/endpoints/axi_lite_response_driver.py +58 -0
  251. veriforge-0.0.1/src/veriforge/sim/endpoints/axis_sink.py +203 -0
  252. veriforge-0.0.1/src/veriforge/sim/endpoints/axis_source.py +145 -0
  253. veriforge-0.0.1/src/veriforge/sim/endpoints/detect.py +737 -0
  254. veriforge-0.0.1/src/veriforge/sim/endpoints/frame.py +353 -0
  255. veriforge-0.0.1/src/veriforge/sim/endpoints/helpers.py +388 -0
  256. veriforge-0.0.1/src/veriforge/sim/endpoints/membus_master.py +122 -0
  257. veriforge-0.0.1/src/veriforge/sim/endpoints/membus_responder.py +151 -0
  258. veriforge-0.0.1/src/veriforge/sim/endpoints/pause.py +114 -0
  259. veriforge-0.0.1/src/veriforge/sim/endpoints/stream_sink.py +86 -0
  260. veriforge-0.0.1/src/veriforge/sim/endpoints/stream_source.py +105 -0
  261. veriforge-0.0.1/src/veriforge/sim/evaluator.py +888 -0
  262. veriforge-0.0.1/src/veriforge/sim/event_queue.py +266 -0
  263. veriforge-0.0.1/src/veriforge/sim/example_runner.py +30 -0
  264. veriforge-0.0.1/src/veriforge/sim/executor.py +1342 -0
  265. veriforge-0.0.1/src/veriforge/sim/scheduler.py +1483 -0
  266. veriforge-0.0.1/src/veriforge/sim/step_harness.py +33 -0
  267. veriforge-0.0.1/src/veriforge/sim/testbench.py +489 -0
  268. veriforge-0.0.1/src/veriforge/sim/trace.py +140 -0
  269. veriforge-0.0.1/src/veriforge/sim/value.py +605 -0
  270. veriforge-0.0.1/src/veriforge/sim/vcd.py +266 -0
  271. veriforge-0.0.1/src/veriforge/sim/vcd_compare.py +342 -0
  272. veriforge-0.0.1/src/veriforge/sim/vm/__init__.py +22 -0
  273. veriforge-0.0.1/src/veriforge/sim/vm/compiler.py +2601 -0
  274. veriforge-0.0.1/src/veriforge/sim/vm/interpreter.py +1022 -0
  275. veriforge-0.0.1/src/veriforge/sim/vm/opcodes.py +151 -0
  276. veriforge-0.0.1/src/veriforge/sim/vm/vm_scheduler.py +1569 -0
  277. veriforge-0.0.1/src/veriforge/transforms/__init__.py +6 -0
  278. veriforge-0.0.1/src/veriforge/transforms/_assignments.py +176 -0
  279. veriforge-0.0.1/src/veriforge/transforms/_declarations.py +943 -0
  280. veriforge-0.0.1/src/veriforge/transforms/_design_builder.py +700 -0
  281. veriforge-0.0.1/src/veriforge/transforms/_expressions.py +1348 -0
  282. veriforge-0.0.1/src/veriforge/transforms/_functions_tasks.py +474 -0
  283. veriforge-0.0.1/src/veriforge/transforms/_generate.py +362 -0
  284. veriforge-0.0.1/src/veriforge/transforms/_instances.py +401 -0
  285. veriforge-0.0.1/src/veriforge/transforms/_statements.py +1089 -0
  286. veriforge-0.0.1/src/veriforge/transforms/_tree_utils.py +48 -0
  287. veriforge-0.0.1/src/veriforge/transforms/comment_extractor.py +164 -0
  288. veriforge-0.0.1/src/veriforge/transforms/tree_to_model.py +1278 -0
  289. veriforge-0.0.1/src/veriforge/verilog_parser.py +63 -0
  290. veriforge-0.0.1/tests/__init__.py +0 -0
  291. veriforge-0.0.1/tests/conftest.py +340 -0
  292. veriforge-0.0.1/tests/test_analysis/test_block_locals.py +58 -0
  293. veriforge-0.0.1/tests/test_analysis/test_clock_reset.py +403 -0
  294. veriforge-0.0.1/tests/test_analysis/test_clock_reset_hier.py +99 -0
  295. veriforge-0.0.1/tests/test_analysis/test_const_fold.py +628 -0
  296. veriforge-0.0.1/tests/test_analysis/test_generate_improvements.py +546 -0
  297. veriforge-0.0.1/tests/test_analysis/test_interface.py +389 -0
  298. veriforge-0.0.1/tests/test_analysis/test_lint.py +504 -0
  299. veriforge-0.0.1/tests/test_analysis/test_package.py +570 -0
  300. veriforge-0.0.1/tests/test_analysis/test_struct_union.py +755 -0
  301. veriforge-0.0.1/tests/test_analysis/test_typedef_enum.py +366 -0
  302. veriforge-0.0.1/tests/test_analysis/test_width_inference.py +522 -0
  303. veriforge-0.0.1/tests/test_dsl/__init__.py +0 -0
  304. veriforge-0.0.1/tests/test_dsl/test_axi4_mem_example.py +92 -0
  305. veriforge-0.0.1/tests/test_dsl/test_axi_cdc_pulp_example.py +53 -0
  306. veriforge-0.0.1/tests/test_dsl/test_axi_fifo_pulp_example.py +51 -0
  307. veriforge-0.0.1/tests/test_dsl/test_axi_lite_dw_pulp_example.py +57 -0
  308. veriforge-0.0.1/tests/test_dsl/test_axi_lite_mailbox_pulp_example.py +88 -0
  309. veriforge-0.0.1/tests/test_dsl/test_axi_lite_regs_example.py +92 -0
  310. veriforge-0.0.1/tests/test_dsl/test_axi_lite_to_axi_pulp_example.py +50 -0
  311. veriforge-0.0.1/tests/test_dsl/test_axi_lite_xbar_pulp_example.py +53 -0
  312. veriforge-0.0.1/tests/test_dsl/test_axi_to_axi_lite_pulp_example.py +53 -0
  313. veriforge-0.0.1/tests/test_dsl/test_axi_xbar_pulp_example.py +53 -0
  314. veriforge-0.0.1/tests/test_dsl/test_builder.py +2919 -0
  315. veriforge-0.0.1/tests/test_dsl/test_builder_errors_m24.py +478 -0
  316. veriforge-0.0.1/tests/test_dsl/test_builder_errors_m9.py +314 -0
  317. veriforge-0.0.1/tests/test_dsl/test_convert_to_dsl.py +1289 -0
  318. veriforge-0.0.1/tests/test_dsl/test_dsl_boundary.py +210 -0
  319. veriforge-0.0.1/tests/test_dsl/test_examples.py +351 -0
  320. veriforge-0.0.1/tests/test_dsl/test_lib_axi.py +324 -0
  321. veriforge-0.0.1/tests/test_dsl/test_lib_cdc.py +191 -0
  322. veriforge-0.0.1/tests/test_dsl/test_lib_codec.py +186 -0
  323. veriforge-0.0.1/tests/test_dsl/test_lib_dsp.py +251 -0
  324. veriforge-0.0.1/tests/test_dsl/test_lib_fifo.py +156 -0
  325. veriforge-0.0.1/tests/test_dsl/test_lib_xilinx.py +171 -0
  326. veriforge-0.0.1/tests/test_dsl/test_ram.py +276 -0
  327. veriforge-0.0.1/tests/test_dsl/test_roundtrip_dsl.py +1174 -0
  328. veriforge-0.0.1/tests/test_dsl/test_sv_dsl.py +645 -0
  329. veriforge-0.0.1/tests/test_dsl/test_sv_interface_emit.py +233 -0
  330. veriforge-0.0.1/tests/test_dsl/test_taxi_axil_ram.py +98 -0
  331. veriforge-0.0.1/tests/test_dsl/test_taxi_axis_adapter.py +208 -0
  332. veriforge-0.0.1/tests/test_dsl/test_taxi_axis_arb_mux.py +116 -0
  333. veriforge-0.0.1/tests/test_dsl/test_taxi_axis_async_fifo.py +136 -0
  334. veriforge-0.0.1/tests/test_dsl/test_taxi_axis_async_fifo_dualclk.py +221 -0
  335. veriforge-0.0.1/tests/test_dsl/test_taxi_axis_broadcast.py +97 -0
  336. veriforge-0.0.1/tests/test_dsl/test_taxi_axis_register.py +116 -0
  337. veriforge-0.0.1/tests/test_dsl/test_testbench.py +484 -0
  338. veriforge-0.0.1/tests/test_dsl/test_testbench_bench_style.py +350 -0
  339. veriforge-0.0.1/tests/test_dsl/test_testbench_deps.py +96 -0
  340. veriforge-0.0.1/tests/test_dsl/test_testbench_enhanced.py +182 -0
  341. veriforge-0.0.1/tests/test_formatter/__init__.py +0 -0
  342. veriforge-0.0.1/tests/test_formatter/test_formatter.py +716 -0
  343. veriforge-0.0.1/tests/test_lsp/__init__.py +0 -0
  344. veriforge-0.0.1/tests/test_lsp/test_lark_fallback.py +137 -0
  345. veriforge-0.0.1/tests/test_lsp/test_navigation.py +120 -0
  346. veriforge-0.0.1/tests/test_lsp/test_symbols.py +85 -0
  347. veriforge-0.0.1/tests/test_lsp/test_trace.py +2641 -0
  348. veriforge-0.0.1/tests/test_model/__init__.py +0 -0
  349. veriforge-0.0.1/tests/test_model/conftest.py +17 -0
  350. veriforge-0.0.1/tests/test_model/test_analysis.py +930 -0
  351. veriforge-0.0.1/tests/test_model/test_behavioral.py +780 -0
  352. veriforge-0.0.1/tests/test_model/test_comment_roundtrip.py +172 -0
  353. veriforge-0.0.1/tests/test_model/test_comments.py +257 -0
  354. veriforge-0.0.1/tests/test_model/test_corpus.py +495 -0
  355. veriforge-0.0.1/tests/test_model/test_functions_generate.py +911 -0
  356. veriforge-0.0.1/tests/test_model/test_instances.py +461 -0
  357. veriforge-0.0.1/tests/test_model/test_module.py +475 -0
  358. veriforge-0.0.1/tests/test_model/test_roundtrip.py +140 -0
  359. veriforge-0.0.1/tests/test_model/test_specify.py +360 -0
  360. veriforge-0.0.1/tests/test_model/test_tree_to_model_characterization.py +129 -0
  361. veriforge-0.0.1/tests/test_model/test_typed_sv_regressions.py +156 -0
  362. veriforge-0.0.1/tests/test_partial_assign.py +170 -0
  363. veriforge-0.0.1/tests/test_preprocessor/__init__.py +0 -0
  364. veriforge-0.0.1/tests/test_preprocessor/test_preprocessor.py +774 -0
  365. veriforge-0.0.1/tests/test_project/__init__.py +0 -0
  366. veriforge-0.0.1/tests/test_project/test_darkriscv.py +216 -0
  367. veriforge-0.0.1/tests/test_project/test_project.py +1271 -0
  368. veriforge-0.0.1/tests/test_refactor/test_hierarchy_graph.py +5926 -0
  369. veriforge-0.0.1/tests/test_sim/__init__.py +590 -0
  370. veriforge-0.0.1/tests/test_sim/test_axi_lite_master.py +438 -0
  371. veriforge-0.0.1/tests/test_sim/test_axis_endpoints.py +258 -0
  372. veriforge-0.0.1/tests/test_sim/test_axis_frame.py +119 -0
  373. veriforge-0.0.1/tests/test_sim/test_bench_native.py +1695 -0
  374. veriforge-0.0.1/tests/test_sim/test_bench_plan.py +372 -0
  375. veriforge-0.0.1/tests/test_sim/test_bench_planner.py +367 -0
  376. veriforge-0.0.1/tests/test_sim/test_bench_runtime.py +266 -0
  377. veriforge-0.0.1/tests/test_sim/test_combinational_coordinator.py +193 -0
  378. veriforge-0.0.1/tests/test_sim/test_compiled.py +60771 -0
  379. veriforge-0.0.1/tests/test_sim/test_compiled_batch_run_propagation.py +142 -0
  380. veriforge-0.0.1/tests/test_sim/test_compiled_latent_risks.py +174 -0
  381. veriforge-0.0.1/tests/test_sim/test_coordinator_strict.py +349 -0
  382. veriforge-0.0.1/tests/test_sim/test_darkriscv_constructs.py +2339 -0
  383. veriforge-0.0.1/tests/test_sim/test_evaluator.py +492 -0
  384. veriforge-0.0.1/tests/test_sim/test_executor.py +699 -0
  385. veriforge-0.0.1/tests/test_sim/test_function_task.py +499 -0
  386. veriforge-0.0.1/tests/test_sim/test_generate.py +1014 -0
  387. veriforge-0.0.1/tests/test_sim/test_generator_endpoint.py +147 -0
  388. veriforge-0.0.1/tests/test_sim/test_hierarchy.py +1140 -0
  389. veriforge-0.0.1/tests/test_sim/test_ibex_examples.py +7763 -0
  390. veriforge-0.0.1/tests/test_sim/test_interface_detection.py +433 -0
  391. veriforge-0.0.1/tests/test_sim/test_membus_endpoints.py +599 -0
  392. veriforge-0.0.1/tests/test_sim/test_memory.py +1937 -0
  393. veriforge-0.0.1/tests/test_sim/test_multi_domain_runner.py +213 -0
  394. veriforge-0.0.1/tests/test_sim/test_param_width.py +576 -0
  395. veriforge-0.0.1/tests/test_sim/test_planner_naming_fallback.py +198 -0
  396. veriforge-0.0.1/tests/test_sim/test_precedence_and_fixes.py +1063 -0
  397. veriforge-0.0.1/tests/test_sim/test_pulp_axi_examples.py +3261 -0
  398. veriforge-0.0.1/tests/test_sim/test_pulp_common_cells_examples.py +1216 -0
  399. veriforge-0.0.1/tests/test_sim/test_pulp_ready_valid_examples.py +3716 -0
  400. veriforge-0.0.1/tests/test_sim/test_scheduler.py +470 -0
  401. veriforge-0.0.1/tests/test_sim/test_sim_sv.py +1030 -0
  402. veriforge-0.0.1/tests/test_sim/test_stream_protocol.py +146 -0
  403. veriforge-0.0.1/tests/test_sim/test_structural_patterns.py +1722 -0
  404. veriforge-0.0.1/tests/test_sim/test_testbench.py +714 -0
  405. veriforge-0.0.1/tests/test_sim/test_value.py +475 -0
  406. veriforge-0.0.1/tests/test_sim/test_value_widths.py +545 -0
  407. veriforge-0.0.1/tests/test_sim/test_vcd.py +269 -0
  408. veriforge-0.0.1/tests/test_sim/test_vm.py +3591 -0
  409. veriforge-0.0.1/tests/test_sim/test_wide_signal_catchall.py +271 -0
  410. veriforge-0.0.1/tests/test_validation/__init__.py +0 -0
  411. veriforge-0.0.1/tests/test_validation/test_iverilog_validation.py +2226 -0
  412. veriforge-0.0.1/tests/test_validation/test_vm_vs_reference.py +1279 -0
  413. veriforge-0.0.1/tests/test_verilog_parser/test_all.py +106 -0
  414. veriforge-0.0.1/tests/test_verilog_parser/test_rule_examples.py +118 -0
  415. veriforge-0.0.1/tests/test_verilog_parser/test_section_a1.py +143 -0
  416. veriforge-0.0.1/tests/test_verilog_parser/test_section_a2.py +247 -0
  417. veriforge-0.0.1/tests/test_verilog_parser/test_section_a6.py +245 -0
  418. veriforge-0.0.1/tests/test_verilog_parser/test_section_a8.py +299 -0
  419. veriforge-0.0.1/tests/test_verilog_parser/test_sv_features.py +590 -0
  420. veriforge-0.0.1/tools/check_overview.py +214 -0
  421. veriforge-0.0.1/tools/validate_compiled_pytest.py +245 -0
  422. veriforge-0.0.1/veriforge.egg-info/PKG-INFO +271 -0
  423. veriforge-0.0.1/veriforge.egg-info/SOURCES.txt +436 -0
  424. veriforge-0.0.1/veriforge.egg-info/dependency_links.txt +1 -0
  425. veriforge-0.0.1/veriforge.egg-info/entry_points.txt +3 -0
  426. veriforge-0.0.1/veriforge.egg-info/requires.txt +23 -0
  427. veriforge-0.0.1/veriforge.egg-info/top_level.txt +10 -0
  428. veriforge-0.0.1/veriforge_lsp/__init__.py +0 -0
  429. veriforge-0.0.1/veriforge_lsp/__main__.py +6 -0
  430. veriforge-0.0.1/veriforge_lsp/handlers/__init__.py +0 -0
  431. veriforge-0.0.1/veriforge_lsp/handlers/extended.py +1807 -0
  432. veriforge-0.0.1/veriforge_lsp/handlers/navigation.py +172 -0
  433. veriforge-0.0.1/veriforge_lsp/handlers/symbols.py +210 -0
  434. veriforge-0.0.1/veriforge_lsp/handlers/text_sync.py +58 -0
  435. veriforge-0.0.1/veriforge_lsp/index.py +111 -0
  436. veriforge-0.0.1/veriforge_lsp/protocol.py +64 -0
  437. veriforge-0.0.1/veriforge_lsp/server.py +184 -0
  438. veriforge-0.0.1/veriforge_lsp/workspace.py +664 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Chip Lukes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: veriforge
3
+ Version: 0.0.1
4
+ Summary: Parse, analyze, simulate, and generate Verilog/SystemVerilog from Python.
5
+ Author-email: Chip Lukes <34627158+chiplukes@users.noreply.github.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/chiplukes/veriforge
8
+ Project-URL: Changelog, https://github.com/chiplukes/veriforge/releases
9
+ Project-URL: Issues, https://github.com/chiplukes/veriforge/issues
10
+ Project-URL: CI, https://github.com/chiplukes/veriforge/actions
11
+ Keywords: Verilog,Lark,Parse
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: Implementation :: CPython
21
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
22
+ Classifier: License :: OSI Approved :: MIT License
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: lark
28
+ Requires-Dist: rich
29
+ Requires-Dist: treelib
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest; extra == "test"
32
+ Requires-Dist: pytest-cov; extra == "test"
33
+ Requires-Dist: pytest-xdist; extra == "test"
34
+ Requires-Dist: filelock; extra == "test"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pre-commit; extra == "dev"
37
+ Requires-Dist: vulture; extra == "dev"
38
+ Provides-Extra: bench
39
+ Requires-Dist: cython; extra == "bench"
40
+ Requires-Dist: setuptools; extra == "bench"
41
+ Requires-Dist: myhdl; extra == "bench"
42
+ Requires-Dist: filelock; extra == "bench"
43
+ Provides-Extra: lsp
44
+ Requires-Dist: pygls>=1.3; extra == "lsp"
45
+ Requires-Dist: intervaltree>=3.1; extra == "lsp"
46
+ Dynamic: license-file
47
+
48
+ # veriforge
49
+ [![CI](https://github.com/chiplukes/veriforge/actions/workflows/ci.yml/badge.svg)](https://github.com/chiplukes/veriforge/actions/workflows/ci.yml)
50
+ [![Changelog](https://img.shields.io/github/v/release/chiplukes/veriforge?include_prereleases&label=changelog)](https://github.com/chiplukes/veriforge/releases)
51
+ [![License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/chiplukes/veriforge/blob/main/LICENSE)
52
+
53
+ A Python library for parsing, analyzing, generating, and simulating Verilog/SystemVerilog designs, built on the [Lark](https://github.com/lark-parser/lark) parser.
54
+
55
+ ## Features
56
+
57
+ - **Parse** Verilog 2005 (with SystemVerilog extensions) into a semantic model
58
+ - **Preprocess** source files (`` `define ``, `` `ifdef ``, `` `include ``, `` `timescale ``, etc.)
59
+ - **Multi-file project** support — parse directories, link cross-module instances
60
+ - **Analyze** designs — width inference, constant folding, clock/reset extraction, lint checks
61
+ - **Emit** formatted Verilog from the model (round-trip, configurable style)
62
+ - **Python DSL** — build hardware with operator-overloaded Python, emit to Verilog or simulate directly
63
+ - **Component library** — FIFO, CDC, codec, AXI-Stream, AXI4-Lite, DSP, RAM, Xilinx inference
64
+ - **Auto-generate testbenches** from any module
65
+ - **Convert** parsed Verilog to DSL code (Verilog → Python translation)
66
+ - **Simulate** — event-driven 4-state simulator with three engines (reference, bytecode VM, compiled Cython)
67
+ - **VCD output** — IEEE 1364-2001 waveform dumps, cross-simulator validation
68
+ - **Inspect** semantic models through lookup helpers and JSON serialization
69
+ - **Language Server** — `veriforge-lsp` provides editor diagnostics, symbols, navigation, hover, and custom hierarchy/trace commands (install [Verible](https://github.com/chipsalliance/verible) for fast between-save diagnostics; the server falls back to the built-in Lark parser when Verible is absent)
70
+
71
+ ## Documentation
72
+
73
+ - [Getting Started](notes/getting_started.md) — installation and quick workflows
74
+ - [User Guide](notes/user_guide.md) — detailed guide with API examples
75
+ - [Architecture](notes/architecture.md) — layer overview and links to sub-topics
76
+ - [Developer Guide](notes/developer_guide.md) — setup, testing, contributing
77
+ - [Public API Guide](notes/public_api.md) — recommended imports for user code
78
+ - [DSL Reference](notes/dsl/dsl_guide.md) — Python DSL syntax reference
79
+ - [Support Matrix](notes/support_matrix.md) — practical support status across project surfaces
80
+ - [LSP Server](notes/veriforge_lsp.md) — Verilog/SystemVerilog Language Server Protocol support
81
+ - [Roadmap](notes/roadmap.md) — known future work items
82
+ - [Grammar Support Status](docs/grammar_support.md) — parser-rule metadata table
83
+ - [Grammar Dependencies (JSON)](docs/grammar_deps.json) — machine-readable rule dependency map
84
+
85
+ ## Quick Start
86
+
87
+ ### Parse a Verilog file
88
+
89
+ ```python
90
+ from veriforge.project import parse_file
91
+ from veriforge.codegen import emit_module
92
+
93
+ design = parse_file("rtl/counter.v", preprocess=True)
94
+ for mod in design.modules:
95
+ print(emit_module(mod))
96
+ ```
97
+
98
+ ### Build hardware with the Python DSL
99
+
100
+ ```python
101
+ from veriforge.dsl import Module, posedge
102
+ from veriforge.codegen import emit_module
103
+
104
+ with Module("counter") as m:
105
+ clk = m.input("clk")
106
+ rst = m.input("rst")
107
+ count = m.output_reg("count", width=8)
108
+
109
+ with m.always(posedge(clk)):
110
+ with m.if_(rst):
111
+ count <<= 0
112
+ with m.else_():
113
+ count <<= count + 1
114
+
115
+ print(emit_module(m.build()))
116
+ ```
117
+
118
+ ### Simulate directly from Python
119
+
120
+ ```python
121
+ from veriforge.sim import Simulator, Clock
122
+
123
+ sim = Simulator(m.build())
124
+ sim.fork(Clock(sim.signal("clk"), period=10))
125
+
126
+ def test(s):
127
+ s.drive("rst", 1)
128
+
129
+ sim.run(test, max_time=200)
130
+ print(sim.read("count"))
131
+ ```
132
+
133
+ ### Analyze a project
134
+
135
+ ```python
136
+ from veriforge.project import parse_directory
137
+ from veriforge.analysis import analyze_design, lint_design
138
+
139
+ design = parse_directory("rtl/", preprocess=True)
140
+ analyze_design(design)
141
+ for w in lint_design(design):
142
+ print(f"[{w.code.name}] {w.message}")
143
+ ```
144
+
145
+ ## Installation
146
+
147
+ ### Prerequisites
148
+ - Python (CPython 3.10+ or PyPy 3.10+)
149
+ - See [python.org](https://www.python.org) for standalone install
150
+ - For uv-based install see [docs.astral.sh/uv](https://docs.astral.sh/uv/getting-started/installation/)
151
+
152
+ ### Dependencies
153
+ - Lark
154
+ - Rich
155
+ - treelib
156
+
157
+ ### PyPy Support (Optional — ~4x Simulation Speedup)
158
+
159
+ The full test suite passes under PyPy. Running the simulator under PyPy gives
160
+ approximately **4x faster simulation** compared to CPython thanks to JIT
161
+ compilation, with zero code changes required.
162
+
163
+ 1. Install PyPy 3.10+ from https://www.pypy.org/download.html
164
+ 2. Install dependencies: `pypy3 -m pip install lark rich treelib`
165
+ 3. Run: `pypy3 -m veriforge ...`
166
+
167
+ ### Install with uv (recommended)
168
+
169
+ ```bash
170
+ git clone https://github.com/chiplukes/veriforge
171
+ cd veriforge
172
+ uv sync --extra test
173
+ ```
174
+
175
+ ### Install with pip
176
+
177
+ ```bash
178
+ git clone https://github.com/chiplukes/veriforge
179
+ cd veriforge
180
+ python -m venv .venv
181
+ # Activate:
182
+ # Linux/macOS: source .venv/bin/activate
183
+ # Windows PowerShell: .venv\Scripts\activate
184
+ pip install -e .[test]
185
+ ```
186
+
187
+ ## CLI Usage
188
+
189
+ The CLI is subcommand-based (legacy `-f/-t/-r` flags remain supported):
190
+
191
+ ```bash
192
+ # Parse a file and print the syntax tree
193
+ uv run veriforge tree -f path/to/file.v
194
+
195
+ # Reconstruct Verilog text from the parsed tree
196
+ uv run veriforge reconstruct -f path/to/file.v
197
+
198
+ # Parse summaries (support --json for automation)
199
+ uv run veriforge parse-file -f rtl/top.v
200
+ uv run veriforge parse-directory rtl/
201
+
202
+ # Generate a Python testbench skeleton
203
+ uv run veriforge generate-python-testbench --file rtl/top.v
204
+
205
+ # Export a parsed project to Python DSL files
206
+ uv run veriforge export-dsl rtl/ out_dsl/
207
+
208
+ # Inspect hierarchy / wrapper candidates (--format text|dot|mermaid)
209
+ uv run veriforge hierarchy graph rtl/
210
+
211
+ # Grammar tree visualization
212
+ uv run python -m veriforge.lark_file.gen_tree --all --depth 5
213
+ ```
214
+
215
+ See `veriforge <command> --help` for full flag listings and
216
+ [notes/cli_json_schema.md](notes/cli_json_schema.md) for the `--json` output contract.
217
+
218
+ ## Running Tests
219
+
220
+ ```bash
221
+ # Same representative fast slice used by push/PR CI
222
+ uv run --extra test pytest tests/test_verilog_parser/test_all.py tests/test_model/test_module.py tests/test_model/test_instances.py tests/test_model/test_roundtrip.py tests/test_model/test_tree_to_model_characterization.py tests/test_analysis/test_width_inference.py tests/test_analysis/test_const_fold.py tests/test_preprocessor/test_preprocessor.py tests/test_formatter/test_formatter.py --tb=no -q
223
+
224
+ # Full local suite
225
+ uv run --extra test pytest tests/ --tb=no -q
226
+ ```
227
+
228
+ ## Examples
229
+
230
+ Runnable examples are in the `examples/` directory. See
231
+ [`examples/README.md`](examples/README.md) for prerequisites and category
232
+ guidance.
233
+
234
+ - `examples/basics/` — counter, shift register, FSM, ALU, testbench
235
+ - `examples/library/` — FIFO, CDC, codec, DSP, Xilinx components
236
+ - `examples/axi/` — AXI-Stream and AXI4-Lite usage
237
+ - `examples/composability/` — pipeline generators, design exploration, register banks
238
+ - `examples/darkriscv/` — real-world RISC-V SoC integration target
239
+ - `examples/femtorv/` — compact RISC-V processor integration target
240
+ - `examples/picorv32/` — PicoRV32 processor integration target
241
+ - `examples/serv/` — SERV bit-serial RISC-V processor integration target
242
+ - `examples/ibex/` — Ibex-related validation assets
243
+ - `examples/pulp/` — imported validation targets based on `pulp-platform` designs
244
+
245
+ ## Current Limitations
246
+
247
+ veriforge targets RTL-level behavioral simulation and analysis. Before using it, it is worth knowing where the current boundaries are:
248
+
249
+ **Simulation scope**
250
+ - This is a behavioral RTL simulator, not a replacement for Icarus Verilog, Verilator, or commercial tools for full-chip verification. It is well-suited for unit-level testbenches, design exploration, and cross-validating specific behaviors.
251
+ - X/Z propagation is modeled but corner cases in complex expressions may not match the IEEE spec in all situations. For designs where X-propagation correctness is critical, cross-validate with `IcarusCosim`.
252
+ - Specify blocks (timing annotations) and gate-level / UDP primitives are parsed and emitted but not executed.
253
+ - The compiled Cython engine falls back to reference coroutines for `#delay` / `@(posedge)` inside `initial`/`always` blocks; a `warnings.warn` is emitted when this happens. The workaround is to move timing control into the Python testbench layer.
254
+
255
+ **SystemVerilog subset**
256
+ - The SystemVerilog verification layer is out of scope: classes, SVA assertions, covergroups, `randomize`/constraints, dynamic arrays, queues, `bind`, and `program` blocks are not simulated.
257
+ - Packed structs, interfaces, and parameterized interfaces work for common RTL patterns but may require flat wrapper modules for complex cases. The [support matrix](notes/support_matrix.md) has the per-construct breakdown.
258
+ - Functions and tasks cover the common RTL patterns used by the validation examples; unusual calling conventions or recursive functions may fail.
259
+
260
+ **Verilog-to-DSL conversion**
261
+ - The converter (`export-dsl`) is intentionally conservative. Control-flow-heavy constructs, complex always blocks, and module-level generate blocks often require manual rewriting. See [notes/dsl/dsl_conversion_coverage.md](notes/dsl/dsl_conversion_coverage.md) for the detailed gap list.
262
+
263
+ **Hierarchy refactor tooling**
264
+ - Structural, behavioral, parameterized, and generate-containing wrappers are detected and classified but collapse is intentionally blocked pending safer transforms. Extract and boundary-move operations cover common direct-wiring cases; complex connectivity patterns fail closed with a diagnostic. See [notes/roadmap.md](notes/roadmap.md) for the backlog.
265
+
266
+ **Performance**
267
+ - Even with the compiled Cython engine, throughput is lower than C-based simulators. For simple sequential testbenches on medium-sized designs, performance is practical. For very large designs or workloads requiring millions of cycles, prefer a dedicated simulator and use veriforge for the analysis and testbench-generation layers.
268
+
269
+ ## License
270
+
271
+ [MIT](https://choosealicense.com/licenses/mit/)
@@ -0,0 +1,224 @@
1
+ # veriforge
2
+ [![CI](https://github.com/chiplukes/veriforge/actions/workflows/ci.yml/badge.svg)](https://github.com/chiplukes/veriforge/actions/workflows/ci.yml)
3
+ [![Changelog](https://img.shields.io/github/v/release/chiplukes/veriforge?include_prereleases&label=changelog)](https://github.com/chiplukes/veriforge/releases)
4
+ [![License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/chiplukes/veriforge/blob/main/LICENSE)
5
+
6
+ A Python library for parsing, analyzing, generating, and simulating Verilog/SystemVerilog designs, built on the [Lark](https://github.com/lark-parser/lark) parser.
7
+
8
+ ## Features
9
+
10
+ - **Parse** Verilog 2005 (with SystemVerilog extensions) into a semantic model
11
+ - **Preprocess** source files (`` `define ``, `` `ifdef ``, `` `include ``, `` `timescale ``, etc.)
12
+ - **Multi-file project** support — parse directories, link cross-module instances
13
+ - **Analyze** designs — width inference, constant folding, clock/reset extraction, lint checks
14
+ - **Emit** formatted Verilog from the model (round-trip, configurable style)
15
+ - **Python DSL** — build hardware with operator-overloaded Python, emit to Verilog or simulate directly
16
+ - **Component library** — FIFO, CDC, codec, AXI-Stream, AXI4-Lite, DSP, RAM, Xilinx inference
17
+ - **Auto-generate testbenches** from any module
18
+ - **Convert** parsed Verilog to DSL code (Verilog → Python translation)
19
+ - **Simulate** — event-driven 4-state simulator with three engines (reference, bytecode VM, compiled Cython)
20
+ - **VCD output** — IEEE 1364-2001 waveform dumps, cross-simulator validation
21
+ - **Inspect** semantic models through lookup helpers and JSON serialization
22
+ - **Language Server** — `veriforge-lsp` provides editor diagnostics, symbols, navigation, hover, and custom hierarchy/trace commands (install [Verible](https://github.com/chipsalliance/verible) for fast between-save diagnostics; the server falls back to the built-in Lark parser when Verible is absent)
23
+
24
+ ## Documentation
25
+
26
+ - [Getting Started](notes/getting_started.md) — installation and quick workflows
27
+ - [User Guide](notes/user_guide.md) — detailed guide with API examples
28
+ - [Architecture](notes/architecture.md) — layer overview and links to sub-topics
29
+ - [Developer Guide](notes/developer_guide.md) — setup, testing, contributing
30
+ - [Public API Guide](notes/public_api.md) — recommended imports for user code
31
+ - [DSL Reference](notes/dsl/dsl_guide.md) — Python DSL syntax reference
32
+ - [Support Matrix](notes/support_matrix.md) — practical support status across project surfaces
33
+ - [LSP Server](notes/veriforge_lsp.md) — Verilog/SystemVerilog Language Server Protocol support
34
+ - [Roadmap](notes/roadmap.md) — known future work items
35
+ - [Grammar Support Status](docs/grammar_support.md) — parser-rule metadata table
36
+ - [Grammar Dependencies (JSON)](docs/grammar_deps.json) — machine-readable rule dependency map
37
+
38
+ ## Quick Start
39
+
40
+ ### Parse a Verilog file
41
+
42
+ ```python
43
+ from veriforge.project import parse_file
44
+ from veriforge.codegen import emit_module
45
+
46
+ design = parse_file("rtl/counter.v", preprocess=True)
47
+ for mod in design.modules:
48
+ print(emit_module(mod))
49
+ ```
50
+
51
+ ### Build hardware with the Python DSL
52
+
53
+ ```python
54
+ from veriforge.dsl import Module, posedge
55
+ from veriforge.codegen import emit_module
56
+
57
+ with Module("counter") as m:
58
+ clk = m.input("clk")
59
+ rst = m.input("rst")
60
+ count = m.output_reg("count", width=8)
61
+
62
+ with m.always(posedge(clk)):
63
+ with m.if_(rst):
64
+ count <<= 0
65
+ with m.else_():
66
+ count <<= count + 1
67
+
68
+ print(emit_module(m.build()))
69
+ ```
70
+
71
+ ### Simulate directly from Python
72
+
73
+ ```python
74
+ from veriforge.sim import Simulator, Clock
75
+
76
+ sim = Simulator(m.build())
77
+ sim.fork(Clock(sim.signal("clk"), period=10))
78
+
79
+ def test(s):
80
+ s.drive("rst", 1)
81
+
82
+ sim.run(test, max_time=200)
83
+ print(sim.read("count"))
84
+ ```
85
+
86
+ ### Analyze a project
87
+
88
+ ```python
89
+ from veriforge.project import parse_directory
90
+ from veriforge.analysis import analyze_design, lint_design
91
+
92
+ design = parse_directory("rtl/", preprocess=True)
93
+ analyze_design(design)
94
+ for w in lint_design(design):
95
+ print(f"[{w.code.name}] {w.message}")
96
+ ```
97
+
98
+ ## Installation
99
+
100
+ ### Prerequisites
101
+ - Python (CPython 3.10+ or PyPy 3.10+)
102
+ - See [python.org](https://www.python.org) for standalone install
103
+ - For uv-based install see [docs.astral.sh/uv](https://docs.astral.sh/uv/getting-started/installation/)
104
+
105
+ ### Dependencies
106
+ - Lark
107
+ - Rich
108
+ - treelib
109
+
110
+ ### PyPy Support (Optional — ~4x Simulation Speedup)
111
+
112
+ The full test suite passes under PyPy. Running the simulator under PyPy gives
113
+ approximately **4x faster simulation** compared to CPython thanks to JIT
114
+ compilation, with zero code changes required.
115
+
116
+ 1. Install PyPy 3.10+ from https://www.pypy.org/download.html
117
+ 2. Install dependencies: `pypy3 -m pip install lark rich treelib`
118
+ 3. Run: `pypy3 -m veriforge ...`
119
+
120
+ ### Install with uv (recommended)
121
+
122
+ ```bash
123
+ git clone https://github.com/chiplukes/veriforge
124
+ cd veriforge
125
+ uv sync --extra test
126
+ ```
127
+
128
+ ### Install with pip
129
+
130
+ ```bash
131
+ git clone https://github.com/chiplukes/veriforge
132
+ cd veriforge
133
+ python -m venv .venv
134
+ # Activate:
135
+ # Linux/macOS: source .venv/bin/activate
136
+ # Windows PowerShell: .venv\Scripts\activate
137
+ pip install -e .[test]
138
+ ```
139
+
140
+ ## CLI Usage
141
+
142
+ The CLI is subcommand-based (legacy `-f/-t/-r` flags remain supported):
143
+
144
+ ```bash
145
+ # Parse a file and print the syntax tree
146
+ uv run veriforge tree -f path/to/file.v
147
+
148
+ # Reconstruct Verilog text from the parsed tree
149
+ uv run veriforge reconstruct -f path/to/file.v
150
+
151
+ # Parse summaries (support --json for automation)
152
+ uv run veriforge parse-file -f rtl/top.v
153
+ uv run veriforge parse-directory rtl/
154
+
155
+ # Generate a Python testbench skeleton
156
+ uv run veriforge generate-python-testbench --file rtl/top.v
157
+
158
+ # Export a parsed project to Python DSL files
159
+ uv run veriforge export-dsl rtl/ out_dsl/
160
+
161
+ # Inspect hierarchy / wrapper candidates (--format text|dot|mermaid)
162
+ uv run veriforge hierarchy graph rtl/
163
+
164
+ # Grammar tree visualization
165
+ uv run python -m veriforge.lark_file.gen_tree --all --depth 5
166
+ ```
167
+
168
+ See `veriforge <command> --help` for full flag listings and
169
+ [notes/cli_json_schema.md](notes/cli_json_schema.md) for the `--json` output contract.
170
+
171
+ ## Running Tests
172
+
173
+ ```bash
174
+ # Same representative fast slice used by push/PR CI
175
+ uv run --extra test pytest tests/test_verilog_parser/test_all.py tests/test_model/test_module.py tests/test_model/test_instances.py tests/test_model/test_roundtrip.py tests/test_model/test_tree_to_model_characterization.py tests/test_analysis/test_width_inference.py tests/test_analysis/test_const_fold.py tests/test_preprocessor/test_preprocessor.py tests/test_formatter/test_formatter.py --tb=no -q
176
+
177
+ # Full local suite
178
+ uv run --extra test pytest tests/ --tb=no -q
179
+ ```
180
+
181
+ ## Examples
182
+
183
+ Runnable examples are in the `examples/` directory. See
184
+ [`examples/README.md`](examples/README.md) for prerequisites and category
185
+ guidance.
186
+
187
+ - `examples/basics/` — counter, shift register, FSM, ALU, testbench
188
+ - `examples/library/` — FIFO, CDC, codec, DSP, Xilinx components
189
+ - `examples/axi/` — AXI-Stream and AXI4-Lite usage
190
+ - `examples/composability/` — pipeline generators, design exploration, register banks
191
+ - `examples/darkriscv/` — real-world RISC-V SoC integration target
192
+ - `examples/femtorv/` — compact RISC-V processor integration target
193
+ - `examples/picorv32/` — PicoRV32 processor integration target
194
+ - `examples/serv/` — SERV bit-serial RISC-V processor integration target
195
+ - `examples/ibex/` — Ibex-related validation assets
196
+ - `examples/pulp/` — imported validation targets based on `pulp-platform` designs
197
+
198
+ ## Current Limitations
199
+
200
+ veriforge targets RTL-level behavioral simulation and analysis. Before using it, it is worth knowing where the current boundaries are:
201
+
202
+ **Simulation scope**
203
+ - This is a behavioral RTL simulator, not a replacement for Icarus Verilog, Verilator, or commercial tools for full-chip verification. It is well-suited for unit-level testbenches, design exploration, and cross-validating specific behaviors.
204
+ - X/Z propagation is modeled but corner cases in complex expressions may not match the IEEE spec in all situations. For designs where X-propagation correctness is critical, cross-validate with `IcarusCosim`.
205
+ - Specify blocks (timing annotations) and gate-level / UDP primitives are parsed and emitted but not executed.
206
+ - The compiled Cython engine falls back to reference coroutines for `#delay` / `@(posedge)` inside `initial`/`always` blocks; a `warnings.warn` is emitted when this happens. The workaround is to move timing control into the Python testbench layer.
207
+
208
+ **SystemVerilog subset**
209
+ - The SystemVerilog verification layer is out of scope: classes, SVA assertions, covergroups, `randomize`/constraints, dynamic arrays, queues, `bind`, and `program` blocks are not simulated.
210
+ - Packed structs, interfaces, and parameterized interfaces work for common RTL patterns but may require flat wrapper modules for complex cases. The [support matrix](notes/support_matrix.md) has the per-construct breakdown.
211
+ - Functions and tasks cover the common RTL patterns used by the validation examples; unusual calling conventions or recursive functions may fail.
212
+
213
+ **Verilog-to-DSL conversion**
214
+ - The converter (`export-dsl`) is intentionally conservative. Control-flow-heavy constructs, complex always blocks, and module-level generate blocks often require manual rewriting. See [notes/dsl/dsl_conversion_coverage.md](notes/dsl/dsl_conversion_coverage.md) for the detailed gap list.
215
+
216
+ **Hierarchy refactor tooling**
217
+ - Structural, behavioral, parameterized, and generate-containing wrappers are detected and classified but collapse is intentionally blocked pending safer transforms. Extract and boundary-move operations cover common direct-wiring cases; complex connectivity patterns fail closed with a diagnostic. See [notes/roadmap.md](notes/roadmap.md) for the backlog.
218
+
219
+ **Performance**
220
+ - Even with the compiled Cython engine, throughput is lower than C-based simulators. For simple sequential testbenches on medium-sized designs, performance is practical. For very large designs or workloads requiring millions of cycles, prefer a dedicated simulator and use veriforge for the analysis and testbench-generation layers.
221
+
222
+ ## License
223
+
224
+ [MIT](https://choosealicense.com/licenses/mit/)