Frm: IEEE Std 1364™-2001, IEEE Standard Verilog® Hardware Description Language

The continuous assignment statement shall place a continuous assignment on a net data type. The net may be explicitly declared, or may inherit an implicit declaration in accordance with the implicit declarations rules defined in 3.5.

Assignments on nets shall be continuous and automatic. This means that whenever an operand in the righthand side expression changes value, the whole right-hand side shall be evaluated and if the new value is different from the previous value, then the new value shall be assigned to the left-hand side.

Example:

Example 1—The following is an example of a continuous assignment to a net that has been previously declared:

wire mynet ;
assign (strong1, pull0) mynet = enable ;

Example 2—The following is an example of the use of a continuous assignment to model a 4-bit adder with carry. The assignment could not be specified directly in the declaration of the nets because it requires a concatenation on the left-hand side.

module adder (sum_out, carry_out, carry_in, ina, inb);
output [:] sum_out;
output carry_out;
input [:] ina, inb;
input carry_in;
wire carry_out, carry_in;
wire [:] sum_out, ina, inb;
assign {carry_out, sum_out} = ina + inb + carry_in;
endmodule

Example 3—The following example describes a module with one 16-bit output bus. It selects between one of four input busses and connects the selected bus to the output bus.

module select_bus(busout, bus0, bus1, bus2, bus3, enable, s);
parameter n = ;
parameter Zee = ’bz;
output [:n] busout;
input [:n] bus0, bus1, bus2, bus3;
input enable;
input [:] s;
tri [:n] data; // net declaration
// net declaration with continuous assignment
tri [:n] busout = enable ? data : Zee;
// assignment statement with four continuous assignments
assign
data = (s == ) ? bus0 : Zee,
data = (s == ) ? bus1 : Zee,
data = (s == ) ? bus2 : Zee,
data = (s == ) ? bus3 : Zee;
endmodule

The following sequence of events is experienced during simulation of this example:

a) The value of s, a bus selector input variable, is checked in the assign statement. Based on the value of s, the net data receives the data from one of the four input buses.

b) The setting of data net triggers the continuous assignment in the net declaration for busout. If enable is set, the contents of data are assigned to busout; if enable is 0, the contents of Zee are assigned to busout.

最新文章

  1. Axel替代wget
  2. grunt配置太复杂?使用Qbuild进行文件合并、压缩、格式化等处理
  3. mysql group_concat 使用 (按分组组合字段)
  4. The 2015 China Collegiate Programming Contest K Game Rooms hdu 5550
  5. Count Primes ----质数判断
  6. OneNote 2013 快捷键
  7. java图形化编程
  8. Replace Pioneer 续用2
  9. Retention、Documented、Inherited三种注解
  10. [LeetCode] Consecutive Numbers 连续的数字 --数据库知识(mysql)
  11. 第25章 项目6:使用CGI进行远程编辑
  12. 直接拿来用 九个超实用的PHP代码片段(二)
  13. java 数据设置和显示
  14. Vue项目中GraphQL入门学习与应用
  15. php的trie_filter扩展安装敏感词查找
  16. mybatis多数据源报错
  17. 【Flask-RESTPlus系列】Flask-RESTPlus系列译文开篇
  18. SVN 安装vs插件
  19. JDBC Connection Configuration
  20. Android中使用隐藏API(大量图解)

热门文章

  1. PHP 工程师技能图谱
  2. HTML5: HTML5 测验
  3. MySQL-8.0填坑
  4. 跨站请求伪造(CSRF)与跨域问题
  5. js预编译的四部曲
  6. 接口自动化测试框架-AIM3.0-开源+OOP
  7. js系列教程11-json、ajax(XMLHttpRequest)、comet、SSE、WebSocket全解
  8. Spring Boot国际化支持
  9. 在python中创建列表的最佳和/或最快方法
  10. 四、hibernate的缓存