| | 网站首页 | 新闻 | SOPC | FPGA | DSP | ARM | 嵌入式操作系统 | 下载 | 网上商城 | 芯片价格参考 | 留言 | 论坛 | 网络协议 | 驱动设计 | 购买指南-HowtoBuy | | |
![]() |
![]() |
| 您现在的位置: FPGA开发板&SOPC开发板-嵌入式控制研究室 >> FPGA >> FPGA应用 >> 文章正文 |
|
|||||
| Verilog HDL常见问题 | |||||
| 作者:周俊峰 陈… 文章来源:互联网 点击数: 更新时间:2006-9-26 | |||||
|
问题:在使用case语句建模组合逻辑的时候,综合工具提示会出现latch 引申:实际上这个问题还经常出现在使用if...else建模组合逻辑当中。 问题:如何使用Verilog语言描述一个双向口。 对双向口,我们可以将其理解为2个分量:一个输入分量,一个输出分量。另外还需要一个控制信号控制输出分量何时输出。此时,我们就可以很容易地对双向端口建模。 例子:
inout inout_pin; wire inout_pin; wire input_of_inout; assign input_of_inout = inout_pin; assign inout_pin = out_en ? output_of_inout : z; endmodule 在仿真的时候,需要注意双向口的处理。如果是直接与另外一个模块的双向口连接,那么只要保证一个模块在输出的时候,另外一个模块没有输出(处于高阻态)就可以了。
答案:
1 (defined as true), 0 (defined as false),
引申:
4.1.9 Logical operators The operators logical and (&&) and logical or (||) are logical connectives. The result of the evaluation of a logical comparison shall be 1 (defined as true), 0 (defined as false), or, if the result is ambiguous, the unknown value (x). The precedence of && is greater than that of ||, and both are lower than relational and equality operators. A third logical operator is the unary logical negation operator (!). The negation operator converts a nonzero or true operand into 0 and a zero or false operand into 1. An ambiguous truth value remains as x. Examples: Example 1—If reg alpha holds the integer value 237 and beta holds the value zero, then the following examples perform as described: regA = alpha && beta; // regA is set to 0 Example 2—The following expression performs a logical and of three subexpressions without needing any parentheses: a < size-1 && b != c && index != lastone However, it is recommended for readability purposes that parentheses be used to show very clearly the precedence intended, as in the following rewrite of this example: (a < size-1) && (b != c) && (index != lastone) Example 3—A common use of ! is in constructions like the following: if (!inword) In some cases, the preceding construct makes more sense to someone reading the code than this equivalent construct: if (inword == 0) |
|||||
| 文章录入:fengfeiyi 责任编辑:fengfeiyi | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 用FPGA实现DSP远程在线编程 FPGA验证技术 用CPU配置FPGA(一)概 述 用CPU配置FPGA(二)硬件设计 用CPU配置FPGA(三)软件操作 用CPU配置FPGA (四) 应用实例 在Modelsim se中创建altera仿… N奇数分频方法总结 Altera FPGA、CPLD 学习笔记 在PLD开发中提高VHDL的综合质… |
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 管理登录 | | |
![]() |
Copyright © 2005www.21control.com 嵌入式控制技术研究室 版权所有 站长:康草科技 |