微宝网 微宝网
首页
  • 专题

    • ZYNQ
    • 树莓派
    • 信号处理
    • 硬件
    • 大杂烩
  • 笔记

    • 《Git》
    • 《Qt》
    • 《Python》
转载
产品
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档

bitQ

饮马江湖,仗剑走天涯
首页
  • 专题

    • ZYNQ
    • 树莓派
    • 信号处理
    • 硬件
    • 大杂烩
  • 笔记

    • 《Git》
    • 《Qt》
    • 《Python》
转载
产品
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
  • Petalinux下触摸屏驱动
  • migen安装与使用
    • 安装
      • 安装python环境
      • 安装migen包
    • 安装 Icarus Verilog 和GTKwave
    • 环境测试
    • 编译文档
  • vivado工程Git版本控制
  • vivado工程异常
  • ZYNQ
bitQ
2024-02-16
目录

migen安装与使用

# migen安装与使用

尝试用Migen编写FPGA的逻辑,文章记录下来migen的安装与使用

# Migen is a Python-based tool that automates further the VLSI design process.

# 安装

# 安装python环境

python3.6.8

# 安装migen包

pip install migen

# 安装 Icarus Verilog 和GTKwave

Iverilog下载地址:

Icarus Verilog for Windows (bleyer.org) (opens new window)

image-20240216215611920

image-20240216215705538

image-20240216215835385

# 环境测试

官网上的例程更新太慢(不好使了),参考库里的例程

from migen import *


# Our simple counter, which increments at every cycle.
class Counter(Module):
    def __init__(self):
        self.count = Signal(4)

        # At each cycle, increase the value of the count signal.
        # We do it with convertible/synthesizable FHDL code.
        self.sync += self.count.eq(self.count + 1)


# Simply read the count signal and print it.
# The output is:
# Count: 0
# Count: 1
# Count: 2
# ...
def counter_test(dut):
    for i in range(20):
        print((yield dut.count))  # read and print
        yield  # next clock cycle
    # simulation ends with this generator


if __name__ == "__main__":
    dut = Counter()
    run_simulation(dut, counter_test(dut), vcd_name="basic1.vcd")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

运行成功后会在目录下生成 basic1.vcd,

用gtkwave可以查看波形了

image-20240217202342574

# 编译文档

1、clone代码

https://github.com/m-labs/migen.git

2、python 安装库

pip install -U sphinx

pip install sphinx_rtd_theme

3、打开命令终端,到代码的 migen\doc 目录下,执行编译命令

sphinx-build -b html . build

则会在build中生成migen文档

#FPGA#migen
上次更新: 2024/05/11, 12:28:27
Petalinux下触摸屏驱动
vivado工程Git版本控制

← Petalinux下触摸屏驱动 vivado工程Git版本控制→

最近更新
01
vivado工程异常
02-20
02
制作微信卡片
02-14
03
vivado工程Git版本控制
12-16
更多文章>
Theme by Vdoing | Copyright © 2023-2025 微宝 | MIT License
鲁ICP备14006596号-1
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式