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.

Solution to interview question about coding

Status
Not open for further replies.

bharat_in

Member level 4
Joined
Oct 5, 2006
Messages
78
Helped
9
Reputation
18
Reaction score
7
Trophy points
1,288
Activity points
1,716
Re: interview question

assign c= foo ? a:b;

For above statement, what will be the value of c, when all foo, a and b are "z"?
 

armardu

Member level 1
Joined
Oct 6, 2007
Messages
36
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,477
interview question

with the synthesis perspective, the first statement synthesizes to "MUX" and the second one synthesizes to a "PRIORITY ENCODER"
 

krishna_1980

Junior Member level 3
Joined
Jan 4, 2006
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,457
interview question

In simulation it will have problem only when selection line is "X". Otherwise there is no difference after synthesis, whether you implement with ternary or if/else?
 

pramodm

Member level 2
Joined
May 29, 2007
Messages
48
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,288
Activity points
1,529
interview question

I think, the differece is

the statemenyt c = foo ? a : b; is a concurent statement that any signal changes in LHS, a new value is assigned to RHS

but for statement if (foo) c = a; else c = b; is procedural statement that must written in always
if we are not include all the signals on LHS in sensitivity list the result will different from first one, otherwise it must same
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top