What is ''_'' in Verilog?

2022-01-26 20:02:34 标签 verilogsystem-verilogiverilog

I was viewing this code snippet:

module FD2 (d, cp, cd, q, qn);
  input d, cp, cd;
  output q, qn;
  nand #1   nand_2 (n2, d_, cp_),
            nand_3 (n3, n1, n4),
            nand_7 (q, n5, qn);
// SJM  nand #0   nand_1 (n1, d, cp_, cd),
  nand   nand_1 (n1, d, cp_, cd),
            nand_4 (n4, n2, n3, cd),
            nand_5 (n5, n3, cp),
            nand_6 (n6, n4, cp),
            nand_8 (qn, n6, cd, q);
// SJM not  #0   inv_1 (cp_, cp),
  not   inv_1 (cp_, cp),
            inv_2 (d_, d);
endmodule

What does "cp_" signify?

No where I could find answers so I thought of posting here。

###A underscore " _ " is legal character of any identifier and has no special meaning。 But some people refer to the "_" character as "bar" meaning as if as you wrotecp_ as

as

__
cp

meaning the negation of cp

###In your codecp_ is the name of a sis the name of a signal just likecp is the name of another signal. This the name of another signal。 The underscore has no special meaning in the name。 This is an example of a simple identifier 。 Refer to IEEE Std 1800-2017 section 5。6 Identifiers keywords and system names :

An identifier is used to give an object a unique name so it can be

referenced。 An identifier is either a simple identifier or an escaped

identifier (see 5。6。1)。 A simple identifier shall be any sequence of

letters digits dollar signs ( $ ) and underscore characters ( _ )。

It is legal to not declare signals explicitly but it is a recommended good practice to do so。 It would be better to declare the signal using:

wire cp_;

The same is true for other signals which have not been declared such as d_ n1 etc。

See also section 6。10 Implicit declarations 。

阅读全文

▼ 版权说明

相关文章也很精彩
推荐内容
更多标签
相关热门
全站排行
随便看看

错说 cuoshuo.com —— 程序员的报错记录

部分内容根据CC版权协议转载;网站内容仅供参考,生产环境使用务必查阅官方文档

辽ICP备19011660号-5

×

扫码关注公众号:职场神器
发送: 1
获取永久解锁本站全部文章的验证码