例如有一个模块

  1. module x(a,b,c);
  2.   input a,b;
  3.    output c;
  4.  
  5.   parameter t='d0, h=9'd3;
  6.  
  7.   ......
  8.  
  9. endmodule

两种解决方法:

  • 1、使用带有参数值的模块实例语句
  1. module x_top(d,e,f,g);
  2.   input d,e,f;
  3.   output g;
  4.  
  5.   x #(,) xx(
  6.       .a(a),
  7.       .b(b),
  8.       .c(c)
  9.       );
  10. endmodule
  • 2、使用参数重定义语句deparam
  1. module x_top(d,e,f,g);
  2.   input d,e,f;
  3.   output g;
  4.  
  5.   deparam xx.t = 'd1, xx.h = 9'd4;
  6.  
  7.   x  xx(
  8.       .a(a),
  9.       .b(b),
  10.       .c(c)
  11.       );
  12.  
  13. endmodule

注意:对于下面这个模块

  1. module exam_prj
  2. #(parameter WIDTH=)     //parameter 1
  3. //端口内的参数只能在这使用
  4. (
  5. input [WIDTH-:] dataa,//[WIDTH-1:0]
  6. input [WIDTH-:] datab,
  7.  
  8. output reg [WIDTH:] result
  9. );
  10. parameter Conuter_Top = 'd9;//用于代码部分的参数 parameter 2
  11. //代码部分省略
  12. endmodule

这里出现的两个参数 parameter,第一个表示只在端口设置时使用,第二个是对于模块内部的使用。

2018-04-18  17:26:34

Verilog如何从外部更改模块内参数的更多相关文章

  1. linux驱动: 如何向模块传递参数, module_param和module_param_array

    如何向模块传递参数,Linux kernel 提供了一个简单的框架.    1.  module_param(name, type, perm); name 既是用户看到的参数名,又是模块内接受参数的 ...

  2. http_proxy_module模块常用参数

    Nginx的upstream模块相当于是建立一个函数库一样,把后端的服务器地址放在了一个池子里,而proxy模块则是从这个池子里调用了这些服务器. http_proxy_module模块常用参数: p ...

  3. Python-组织结构-目录结构、包导入、__init__文件、模块内置变量、* 导入限制

    __pycache__ .pyc文件,中间代码,提升python运行效率 目录 分档和归类 Python项目组织结构 包 模块 类 函数.变量 # 层级依次往下都是一对多关系 Python项目目录结构 ...

  4. ObsoleteAttribute 可适用于除程序集、模块、参数或返回值以外的所有程序元素。 将元素标记为过时可以通知用户:该元素在产品的未来版本中将被移除。

    官方文档:https://msdn.microsoft.com/zh-cn/library/system.obsoleteattribute(v=vs.110).aspx 备注 ObsoleteAtt ...

  5. SLAM入门之视觉里程计(2):相机模型(内参数,外参数)

    相机成像的过程实际是将真实的三维空间中的三维点映射到成像平面(二维空间)过程,可以简单的使用小孔成像模型来描述该过程,以了解成像过程中三维空间到二位图像空间的变换过程. 本文包含两部分内容,首先介绍小 ...

  6. 嵌入Python | 调用Python模块中有参数的函数

    开发环境Python版本:3.6.4 (32-bit)编辑器:Visual Studio CodeC++环境:Visual Studio 2013 需求说明前一篇<在C++中嵌入Python|调 ...

  7. 2 python全局变量如何指定(是在模块内,还是函数内)

    示例代码1 xx=1 def __recurrence(): # #前面的0到sentence_length-1的下标,存储的就是最原始的词向量,但是我们也要将其转变为Tensor global xx ...

  8. OpenCV在未知相机内参数情况下的立体图像矫正方法及注意事项

    http://blog.sina.com.cn/s/blog_4298002e01013yb8.html 很多时候我们不知道摄像机的内参数矩阵,并且我们也不太关注内参数到底是多少,因为我们仅仅关心如何 ...

  9. ansible api常用模块与参数

    ###ansibleAPI 常用模块 用于读取yaml,json格式的文件 from ansible.parsing.dataloader import DataLoader #用于管理变量的类,包括 ...

随机推荐

  1. 第三百九十二节,Django+Xadmin打造上线标准的在线教育平台—sql注入攻击,xss攻击,csrf攻击

    第三百九十二节,Django+Xadmin打造上线标准的在线教育平台—sql注入攻击,xss攻击,csrf攻击 sql注入攻击 也就是黑客通过表单提交的地方,在表单里输入了sql语句,就是通过SQL语 ...

  2. Git 修改远端仓库地址

    方法有三种:1.修改命令git remote set-url origin [url] 例如:git remote set-url origin gitlab@gitlab.chumob.com:ph ...

  3. [DL] *Deep Learning for Industry - Wang Yi

    Link: 分布式机器学习系列讲座 - 04 Deep Learning WANG Yi. https://cxwangyi.wordpress.com/ https://www.zhihu.com/ ...

  4. 【zheng阅读系列】shiro权限管理

    一.配置文件 upms-server/springMVC-servlet.xml <?xml version="1.0" encoding="UTF-8" ...

  5. Zabbix监控MySQL免密码设置

    zabbix自带MySQL监控模板,配置文件在/etc/zabbix/zabbix_agentd.d userparameter_mysql.conf 如果MySQL不使用密码可以直接使用这个监控模板 ...

  6. [No0000177]详解/etc/profile、/etc/bash.bahsrc、~/.profile、~/.bashrc的用途

    之前安装Linux的一些软件时,总要修改Linux的配置文件.当时也是一知半解.而且,网上有些安装教程,会说,修改配置文件后要重启Linux.但事实上是不需要重启的. Linux安装时可能要修改的配置 ...

  7. 如何写好.babelrc?Babel的presets和plugins配置解析

    什么是Babel The compiler for writing next generation JavaScript. 官网是这么说的,翻译一下就是下一代JavaScript 语法的编译器. 作为 ...

  8. LU decomposition can be viewed as the matrix form of Gaussian elimination.

    https://en.wikipedia.org/wiki/LU_decomposition One way to find the LU decomposition of this simple m ...

  9. 结构体指针 Pointers to Structures struct Books Book1; struct Books *struct_pointer;

    小结: 1.To access the members of a structure using a pointer to that structure, you must use the → ope ...

  10. go,gcvis,golang, privoxy,and git proxy

    /etc/init.d/privoxy restartexport http_proxy=http://127.0.0.1:8118export https_proxy=http://127.0.0. ...