https://mp.weixin.qq.com/s/qTgeBF9N0mx5UK3xWDb3jg

 
jchdl对Verilog做了增强,增加了用户自定义结构体类型。使用自定义结构体,可以对输入和输出接口进行分类,并简化模块输入输出接口的定义。
 
参考链接
 
1.创建And2.java, 并生成构造方法和logic()方法
 
2. 根据逻辑原理,添加输入输出接口
输入输出线作为类成员存在。使用注解标明是input port还是output port。
 
可以看到这里有一个类型为Abs的输入接口s。类型Abc实现自Structure接口,内部定义了一组成员:
注意点:
  1. 实现Structure接口;
  1. 成员声明为public,以便直接访问;
  1. Structure内部成员不声明input/output属性,在Module中使用的时候声明,如此结构体所有成员具有同样的输入和输出属性。
 
3. 在构造方法中搜集输入输出线并调用construct()方法
首先调用父类即Module类的构造方法,以构建模块hierarchy。
然后逐个把输入输出参数与input/output port对应上。
然后调用construct()方法构造模块(调用一次logic()方法,搜集模块的assign/always代码块、子模块)。
 
4. 在logic()方法中创建assign/always代码块,以及子模块
包含两个And子模块。可以看到这里直接使用s.a, s.b, s.c。
 
 
5. 创建inst静态方法方便后续使用
 
6. 创建main方法执行验证
运行结果为:
 
7. 生成Verilog
生成定制化模块名:
 
调用toVerilog()方法生成Verilog实现。
 
执行结果如下:
可以看到这里生成的输入输出接口名称进行了转换,使用结构体变量名为前缀。

jchdl - RTL实例 - And2(结构体的使用)的更多相关文章

  1. C 语言实例 - 使用结构体(struct)

    C 语言实例 - 使用结构体(struct) C 语言实例 C 语言实例 使用结构体(struct)存储学生信息. 实例 #include <stdio.h> struct student ...

  2. jchdl - RTL实例 - And2And(结构体嵌套的使用)

    https://mp.weixin.qq.com/s/PQIPkDymvcGc_re8ux50vA   结构体可以嵌套使用.   参考链接 https://github.com/wjcdx/jchdl ...

  3. C语言实例:结构体

    结构体: #include <stdio.h> #include <stdlib.h> //#pragma pack(1) typedef struct{ short i; / ...

  4. jchdl - RTL实例 - MOS6502 ALU

    https://mp.weixin.qq.com/s/nMxYVC2djk7DdAforerZPA   使用jchdl RTL实现MOS6502 CPU的ALU.   参考链接 https://git ...

  5. jchdl - RTL实例 - Counter4

    https://mp.weixin.qq.com/s/xtvMj5f-Uvx3vesVnH0P_A   计数器.   参考链接 https://github.com/wjcdx/jchdl/blob/ ...

  6. jchdl - RTL实例 - Adder

    https://mp.weixin.qq.com/s/9S29BCTcJfbpR62ALjSidA   加法器.   参考链接 https://github.com/wjcdx/jchdl/blob/ ...

  7. jchdl - RTL实例 - Mux

    https://mp.weixin.qq.com/s/OmQRQU2mU2I5d-qtV4PAwg   二选一输出.   参考链接 https://github.com/wjcdx/jchdl/blo ...

  8. jchdl - RTL实例 - AndReg

    https://mp.weixin.qq.com/s/p4-379tBRYKCYBk8AZoT8A   输入两组线相与,结果输出到寄存器.   参考链接 https://github.com/wjcd ...

  9. jchdl - RTL实例 - AndAnd

    https://mp.weixin.qq.com/s/JhUB3M1WhjAyUrN1HPIPTA   AndAnd是三输入与门模块,输出为相与的结果.   参考链接 https://github.c ...

随机推荐

  1. 树形dp compare E - Cell Phone Network POJ - 3659 B - Strategic game POJ - 1463

    B - Strategic game POJ - 1463   题目大意:给你一棵树,让你放最少的东西来覆盖所有的边   这个题目之前写过,就是一个简单的树形dp的板题,因为这个每一个节点都需要挺好处 ...

  2. Spring官网阅读(十)Spring中Bean的生命周期(下)

    文章目录 生命周期概念补充 实例化 createBean流程分析 doCreateBean流程分析 第一步:factoryBeanInstanceCache什么时候不为空? 第二步:创建对象(crea ...

  3. GroupJoin()各参数的意义及用法

    EF Core中GroupJoin的注释比较复杂: public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey ...

  4. Coursera课程笔记----P4E.Capstone----Week 4&5

    Spidering and Modeling Email Data(week4&5) Mailing List - Gmane Crawl the archive of a mailing l ...

  5. Java UDP小结

    UDP: * 发送端                                                                                           ...

  6. SpringData:关联查询

    一.查询方式 1.导航式查询 使用“对象.属性”   进行查询:对于多的查询, 默认就是延迟加载,添加注解@Transactional 在OneToMany 注解中需要添加属性   fetch:值:F ...

  7. centos6 升级gcc 无法识别的命令行选项“-std=gnu++1y”的解决办法

    npm install 提示: 1.下载源文件,并安装: wget http://people.centos.org/tru/devtools-2/devtools-2.repo mv devtool ...

  8. ruoyi-plus-server(一):引入Mybatis-Plus

    背景:著名开源管理系统ruoyi-vue是基于SpringBoot,Spring Security,JWT,Vue & Element 的前后端分离权限管理系统(https://gitee.c ...

  9. [tgpl]go匿名函数

    [tgpl]go匿名函数 0. 定义 匿名函数顾名思义是没有名字的函数, Named functions can be declared only at the package level, but ...

  10. Appium自动化(9) - appium元素定位的快速入门

    如果你还想从头学起Appium,可以看看这个系列的文章哦! https://www.cnblogs.com/poloyy/category/1693896.html 快速入门栗子:boss直聘 app ...