>From: Nasim Hussain <Nasim.Hussain@sun.com> > always_comb begin > a = x || y; > b = x && y; > end > > >will simulator's parser issue a warning or an error as i am doing a >logical (and not bit-wise) OR / AND operation on 2 vectors ? No, applying the logical operators to vectors is perfectly legal and well-defined. > always_comb begin > a = !(x == 2'b00) || !(y == 2'b00); > b = !(x == 2'b00) && !(y == 2'b00); > end Essentially yes, though it can be expressed more concisely with a reduction-OR operator: always_comb begin a = (|x) || (|y); b = (|x) && (|y); Like C, the truth value of a multi-bit vector is based on whether it is zero. That truth value is used when a vector is used with a logical AND or OR, or as a condition in an if-statement or conditional operator. Steven Sharp sharp@cadence.comReceived on Wed Jan 25 11:15:53 2006
This archive was generated by hypermail 2.1.8 : Wed Jan 25 2006 - 11:16:12 PST