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