Continue to Site

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.

Verilog conditional operator

Status
Not open for further replies.

Muthuraja.M

Advanced Member level 4
Joined
Jul 20, 2013
Messages
101
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
634
Hi friends,

I need to know about the conditional operator clearly. Even though i do some of the examples as mux using conditional operators. But i didn't understand wat actually doing in the below code..


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module rumania(gate, D, Q);             
 
parameter Bi = 16;
parameter prop_delay = 0;
 
input gate;
input [Bi-1:0] D;
output [Bi-1:0] Q;
 
assign   Q = gate ? ((D[Bi-1] & !(|D[Bi-2:0])) ? 
    {1'b0, {(Bi-1){1'b1}}} :
      (- D)) : D;                                
 
endmodule




Actually this code has the inverting of input as its output when the gate is logic'1' and give the input as it the output when the gate is logic'0'.

But i need the operation used in this code.


Please clarify this..

Thanks in advance...
 
Last edited by a moderator:

1.First check the value of gate.
2.If gate=1, it then checks for D[Bi-1] & !(|D[Bi-2:0]).
3.If gate=0, then it assigns D to Q.(last D in statement).
4.If D[Bi-1] & !(|D[Bi-2:0] is true, then it assigns {1'b0, {(Bi-1){1'b1}}} to Q.
5.If D[Bi-1] & !(|D[Bi-2:0] is false then it assigns -D to Q.

I don't know what is -D..Or was it ~D?
 
Sharath666

Thank u very much..

I got it..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top