没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![vpi](https://img-home.csdnimg.cn/images/20250102104920.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![vpi](https://img-home.csdnimg.cn/images/20250102104920.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![application/x-zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/release/download_crawler_static/12482436/bg1.jpg)
MyHDL manual
Release 0.11
Jan Decaluwe
April 10, 2020
![](https://csdnimg.cn/release/download_crawler_static/12482436/bg2.jpg)
![](https://csdnimg.cn/release/download_crawler_static/12482436/bg3.jpg)
Contents
1 Overview 1
2 Background information 3
2.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 A small tutorial on generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 About decorators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Introduction to MyHDL 7
3.1 A basic MyHDL simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Signals and concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3 Parameters, ports and hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4 Terminology review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.5 Some remarks on MyHDL and Python . . . . . . . . . . . . . . . . . . . . . . . . 12
3.6 Summary and perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Hardware-oriented types 13
4.1 The intbv class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2 Bit indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3 Bit slicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4 The modbv class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.5 Unsigned and signed representation . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5 Structural modeling 19
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2 Conditional instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.3 Converting between lists of signals and bit vectors . . . . . . . . . . . . . . . . . 21
5.4 Inferring the list of instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6 RTL modeling 23
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.2 Combinatorial logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3 Sequential logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.4 Finite State Machine modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7 High level modeling 33
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7.2 Modeling with bus-functional procedures . . . . . . . . . . . . . . . . . . . . . . 33
i
![](https://csdnimg.cn/release/download_crawler_static/12482436/bg4.jpg)
7.3 Modeling memories with built-in types . . . . . . . . . . . . . . . . . . . . . . . . 38
7.4 Modeling errors using exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7.5 Object oriented modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8 Unit testing 45
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.2 The importance of unit tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.3 Unit test development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
9 Co-simulation with Verilog 53
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
9.2 The HDL side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
9.3 The MyHDL side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.4 Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
9.5 Implementation notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
10 Conversion to Verilog and VHDL 61
10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.2 Solution description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
10.4 The convertible subset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
10.5 Conversion of lists of signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
10.6 Conversion of Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
10.7 Assignment issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
10.8 Excluding code from conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
10.9 User-defined code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
10.10 Template transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
10.11 Conversion output verification by co-simulation . . . . . . . . . . . . . . . . . . . 70
10.12 Conversion of test benches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
10.13 Methodology notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
10.14 Known issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
11 Conversion examples 73
11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
11.2 A small sequential design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
11.3 A small combinatorial design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
11.4 A hierarchical design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
11.5 Optimizations for finite state machines . . . . . . . . . . . . . . . . . . . . . . . . 81
11.6 RAM inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.7 ROM inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
11.8 User-defined code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
12 Reference 91
12.1 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.2 Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.3 Co-simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
12.4 Conversion to Verilog and VHDL . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
12.5 Conversion output verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Python Module Index 105
Index 107
ii
![](https://csdnimg.cn/release/download_crawler_static/12482436/bg5.jpg)
CHAPTER 1
Overview
The goal of the MyHDL project is to empower hardware designers with the elegance and
simplicity of the Python language.
MyHDL is a free, open-source package for using Python as a hardware description and ver-
ification language. Python is a very high level language, and hardware designers can use its
full power to model and simulate their designs. Moreover, MyHDL can convert a design to
Verilog or VHDL. This provides a path into a traditional design flow.
Modeling
Python’s power and clarity make MyHDL an ideal solution for high level modeling. Python
is famous for enabling elegant solutions to complex modeling problems. Moreover, Python is
outstanding for rapid application development and experimentation.
The key idea behind MyHDL is the use of Python generators to model hardware concurrency.
Generators are best described as resumable functions. MyHDL generators are similar to al-
ways blocks in Verilog and processes in VHDL.
A hardware module (called a block in MyHDL terminology) is modeled as a function that re-
turns generators. This approach makes it straightforward to support features such as arbitrary
hierarchy, named port association, arrays of instances, and conditional instantiation. Further-
more, MyHDL provides classes that implement traditional hardware description concepts. It
provides a signal class to support communication between generators, a class to support bit
oriented operations, and a class for enumeration types.
Simulation and Verification
The built-in simulator runs on top of the Python interpreter. It supports waveform viewing by
tracing signal changes in a VCD file.
With MyHDL, the Python unit test framework can be used on hardware designs. Although
unit testing is a popular modern software verification technique, it is still uncommon in the
hardware design world.
MyHDL can also be used as hardware verification language for Verilog designs, by co-
simulation with traditional HDL simulators.
1
剩余111页未读,继续阅读
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/0a112fe5a1bd4c3e89617579380ce6fe_weixin_43492754.jpg!1)
weixin_43492754
- 粉丝: 2
- 资源: 3
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- YOLOv11在物流分拣中的多目标跟踪与包裹姿态估计实践.pdf
- YOLOv11在智慧工地中的应用-安全帽佩戴检测与危险区域预警.pdf
- YOLOv11在智慧交通中的车辆实时速度估计与轨迹跟踪实战教程.pdf
- YOLOv11在智慧交通中的车辆速度实时监控-毫米级精度与低延迟实战.pdf
- YOLOv11在智慧农业中的应用-实时病虫害检测与精准施药系统搭建.pdf
- YOLOv11在智能交通-实时车辆速度估计与轨迹追踪实战教程(附代码).pdf
- YOLOv11在智能交通管理中的实战-车辆速度估计与轨迹跟踪全解析.pdf
- YOLOv11在智能交通系统中的实时车辆检测与流量优化方案.pdf
- YOLOv11在智能交通中的车辆轨迹跟踪与违章识别实战教程.pdf
- YOLOv11在智能交通中的车辆轨迹跟踪与拥堵预测实战指南.pdf
- YOLOv11在智能交通中的车辆速度实时监控与轨迹预测实战.pdf
- YOLOv11在智能交通中的车辆实时追踪与跨摄像头轨迹融合实战(交通管理).pdf
- YOLOv11在智能交通中的车牌识别与超速车辆自动抓拍设计.pdf
- YOLOv11在智能交通中的实时车辆速度估计与轨迹跟踪实战(1).pdf
- YOLOv11在智能交通中的实时车辆速度估计与轨迹跟踪实战.pdf
- YOLOv11在智能交通中的实时车辆速度估计与轨迹跟踪实战指南.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)