May 28, 2019 #1 S stanford Full Member level 2 Joined Feb 16, 2014 Messages 132 Helped 4 Reputation 8 Reaction score 6 Trophy points 1,298 Activity points 2,223 1. Are these two code functionally equivalent? 2. Will they synthesize into the same hardware? Code: always_comb out = 0; out = (sel[0]) ? in[0] : out; out = (sel[1]) ? in[1] : out; Code: assign out = sel[1] ? in[1] : sel[0] ? in[0] : 0;
1. Are these two code functionally equivalent? 2. Will they synthesize into the same hardware? Code: always_comb out = 0; out = (sel[0]) ? in[0] : out; out = (sel[1]) ? in[1] : out; Code: assign out = sel[1] ? in[1] : sel[0] ? in[0] : 0;
May 28, 2019 #2 FvM Super Moderator Staff member Joined Jan 22, 2008 Messages 52,423 Helped 14,752 Reputation 29,786 Reaction score 14,101 Trophy points 1,393 Location Bochum, Germany Activity points 298,112 1. Are these two code functionally equivalent? Click to expand... What do you expect? 2. Will they synthesize into the same hardware? Click to expand... Most likely, if 1 is true. Code 1 involves a syntax error.
1. Are these two code functionally equivalent? Click to expand... What do you expect? 2. Will they synthesize into the same hardware? Click to expand... Most likely, if 1 is true. Code 1 involves a syntax error.
May 28, 2019 #3 S stanford Full Member level 2 Joined Feb 16, 2014 Messages 132 Helped 4 Reputation 8 Reaction score 6 Trophy points 1,298 Activity points 2,223 FvM said: What do you expect? Most likely, if 1 is true. Code 1 involves a syntax error. Click to expand... Are you referring to missing begin/end? I was wondering if they are actually functionally equivalent. I wasn't sure.
FvM said: What do you expect? Most likely, if 1 is true. Code 1 involves a syntax error. Click to expand... Are you referring to missing begin/end? I was wondering if they are actually functionally equivalent. I wasn't sure.
May 28, 2019 #4 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,369 Assuming the missing begin/end was a typo, they are functionally equivalent and should synthesize to the same hardware. The only difference is in simulation debugging, you'll be able to see the intermediate assignments if you step through the code.
Assuming the missing begin/end was a typo, they are functionally equivalent and should synthesize to the same hardware. The only difference is in simulation debugging, you'll be able to see the intermediate assignments if you step through the code.