Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What does the "?" symbol mean in Verilog?

Status
Not open for further replies.

rohankewl

Newbie level 5
Joined
Feb 27, 2007
Messages
10
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,283
Activity points
1,328
I have a simple doubt in verilog,
what does this statement mean
assign Full=(wrptr > 4'b1111)?1'b1:1'b0;
I don't get the'?' mark part.
 

hpinmax

Newbie level 6
Joined
Mar 20, 2007
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,361
? in Verilog

if wrptr is larger than 1111, output is 1. Otherwise, 0
 

kaustubh

Junior Member level 3
Joined
Apr 7, 2007
Messages
27
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,281
Activity points
1,499
Re: ? in Verilog

I have a simple doubt in verilog,
what does this statement mean
assign Full=(wrptr > 4'b1111)?1'b1:1'b0;
I don't get the'?' mark part.


"?" is called a ternary operator because it works on not two but THREE operands( wrptr > 4'b1111 actually evaluates to True or False which is in turn taken as the third operand).If the expression before the "?" evaluates to true then the value immediately following the "?" is assigned to the variable(here, Full) otherwise if its false the value after the ":" is assigned.
This ternary operator is the most simple way of implementing a MUX ..
By nesting the ternary operators, we can actually implement n:1 MUX ..

Regards
Kaustubh
 

    rohankewl

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top