Mar 22, 2015 #1 T tokwatbaboy Newbie level 6 Joined Sep 5, 2011 Messages 12 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Location Singapore Activity points 1,353 Not a RTL coder but I need to understand this piece of code: finalGater = scanEn ? testModeEn: ~scanEn ? funcMode : 1'hx; what does it means? any sample code/syntax I can use as reference? thanks!
Not a RTL coder but I need to understand this piece of code: finalGater = scanEn ? testModeEn: ~scanEn ? funcMode : 1'hx; what does it means? any sample code/syntax I can use as reference? thanks!
Mar 22, 2015 #2 D dave_59 Advanced Member level 3 Joined Dec 15, 2011 Messages 838 Helped 365 Reputation 734 Reaction score 360 Trophy points 1,353 Location Fremont, CA, USA Activity points 7,366 See section 11.4.11 Conditional operator of the IEEE 1800-2012 LRM.
Mar 22, 2015 #3 T tokwatbaboy Newbie level 6 Joined Sep 5, 2011 Messages 12 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Location Singapore Activity points 1,353 Thank you! Appreciate for pointing me the document.
Mar 22, 2015 #4 mrflibble Advanced Member level 5 Joined Apr 19, 2010 Messages 2,720 Helped 679 Reputation 1,360 Reaction score 652 Trophy points 1,393 Activity points 19,551 tokwatbaboy said: finalGater = scanEn ? testModeEn: ~scanEn ? funcMode : 1'hx; Click to expand... And regarding code readability, personally I'd write that like so: Code SystemVerilog - [expand]1 finalGater = scanEn ? testModeEn : (~scanEn ? funcMode : 1'hx); That way it's easier to see how the ~scanEn ? funcMode : 1'hx part of the expression is evaluated. Not just for yourself, but also for future victims. Even if that future victim is future you.
tokwatbaboy said: finalGater = scanEn ? testModeEn: ~scanEn ? funcMode : 1'hx; Click to expand... And regarding code readability, personally I'd write that like so: Code SystemVerilog - [expand]1 finalGater = scanEn ? testModeEn : (~scanEn ? funcMode : 1'hx); That way it's easier to see how the ~scanEn ? funcMode : 1'hx part of the expression is evaluated. Not just for yourself, but also for future victims. Even if that future victim is future you.