Skip to main content

一个用于生成 Verilog 代码的 Python 工具

Project description

Pyrilog

一个用于生成 Verilog 代码的 Python 工具。使用 Python 的上下文管理器特性,以简洁的方式生成 Verilog 代码。

安装

使用 uv 安装:

uv pip install pyrilog

使用示例

from pyrilog import ModuleBlock, IfBlock, ElseBlock, add_parameter, add_assign

with ModuleBlock("Test"):
    add_parameter("PARAM_A", "32")
    with IfBlock("rstn"):
        add_assign("out_data", [], "in_data", [])
    with ElseBlock():
        add_assign("out_data", [], "0", [])

生成的 Verilog 代码:

module Test #(
    parameter PARAM_A = 32
) (
);
if (rstn) begin
    assign out_data = in_data;
end
else begin
    assign out_data = 0;
end
endmodule

特性

  • 支持模块定义
  • 支持 always 块
  • 支持条件语句(if-else)
  • 支持循环语句(for)
  • 支持生成块(generate)
  • 支持变量声明(wire、reg、genvar、integer)
  • 支持端口定义(input、output、inout)
  • 支持参数定义
  • 支持模块实例化

许可证

本项目采用 GNU 通用公共许可证第3版(GPLv3)。这意味着你可以自由地:

  • 使用
  • 修改
  • 分发

本软件,但任何修改后的版本都必须以相同的许可证发布。完整的许可证文本请参见 GNU GPLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrilog-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyrilog-0.1.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

pyrilog-0.1.0-py2.py3-none-any.whl (5.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyrilog-0.1.0.tar.gz.

File metadata

  • Download URL: pyrilog-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyrilog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f230ea6250d189dea26728e1090d0f764f08978fee23a75f480fc8983665db1
MD5 8ae4dc3f58c7ad0df87e7d6eafbdb15a
BLAKE2b-256 35a6e7a6e01888afad8cf557e131de51967aa2a4128dd63ac9251449046e6d09

See more details on using hashes here.

File details

Details for the file pyrilog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyrilog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyrilog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2d11ca7a4f7ad91ce79ab1a0217389fc48bcc213d4565fa6139f54a2c5bc65f
MD5 745a0395c486ddb8f8e15f3bf63cdd97
BLAKE2b-256 e493b00c17ccd23cd64fd62040bf3f0b9247f1e97cff7f91628ca1c1ad4cc812

See more details on using hashes here.

File details

Details for the file pyrilog-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pyrilog-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyrilog-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eb155835053615ecb7e9880931b0c1c8f7f9098373de047e4676e6d91c2aa497
MD5 de6b5f3563241e811ca88b17274288ed
BLAKE2b-256 575f019ac808f1731346e8895183d5f9ad525a7603a500e67c69d73255b4d175

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page