更新时间:2022-05-08 03:29:38
这是三元运算符.这是if语句的简写
That's a ternary operator. It's shorthand for an if statement
格式:
condition ? if true : if false
示例:
tone[23] ? clkdivider-1 : clkdivider/2-1
翻译成类似的东西(语法不正确,但我想您会理解的):
Translates to something like (not correct syntax but I think you'll get it):
if tone[23] is 1, counter = clkdivider-1
else counter = clkdivider/2-1
以下是使用if语句和三进制的 2比1 MUX的两个示例运算符.
Here are two examples of a 2 to 1 MUX using if statement and ternary operator.
在asic-world网站上,有条件的运营商
On the asic-world website, it is covered under Conditional Operators