Verilog 按位或 ("|") monadic [英] Verilog bitwise or ("|") monadic

查看:97
本文介绍了Verilog 按位或 ("|") monadic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过使用按位或运算符(|")的 Verilog 代码.目的是什么?

I've seen Verilog code where the bitwise or operator ("|") is used monadic. What's the purpose?

例如

| address[15:14]==0

|address[15:14]? io_din : ramrd

我们不能省略|"吗在这些情况下?

Cann't we omit the "|" in these cases?

推荐答案

在这种情况下,它充当了一个归约运算符,例如:

In this case it acts as a reduction operator, for example:

|4'b1000 => 1'b1 (OR)
&4'b1000 => 1'b0 (AND)
^4'b1000 => 1'b1 (XOR)

|4'b0000 => 1'b0
&4'b1111 => 1'b1
^4'b1111 => 1'b0

将整个总线逻辑或运算为 1 位值,或对整个总线应用 AND/XOR.

ORing the entire bus to a 1 bit value, or applying an AND/XOR to the entire bus.

这被称为一元"运算符,因为它只接受右手参数.它们在 SystemVerilog IEEE1800-2012 的第 11.4.9 节中有介绍.

This is referred to as a 'unary' operator as it only take a right hand argument. They are covered in Section 11.4.9 of SystemVerilog IEEE1800-2012.

这篇关于Verilog 按位或 ("|") monadic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆