[sv-bc] logical operation on vectors

From: Nasim Hussain <Nasim.Hussain_at_.....>
Date: Wed Jan 25 2006 - 10:30:05 PST
hello-

i had a small question. it also applies to verilog 1995 (and 2001), but
i am not sure i fully understand how it works.


let us assume i have something like the following.
(note: instead of | and &, i "mistakenly" used || and &&)


	logic [1:0] x,y;
	logic a,b;

	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 ?


if the compiler issues a warning and continues, then what would the
simulator output be at runtime when x=2'b10 and y=2'b10 ?

i see it says a=1 and b=1. how does it work ? does it get treated like:


	always_comb begin
	   a = !(x == 2'b00) || !(y == 2'b00);
	   b = !(x == 2'b00) && !(y == 2'b00);
	end


i always used to think maybe it would do a bit-wise OR / AND but for the
LSBs only... and so, i was expecting a=0 and b=0 for the above stimulus.

but it appears i am wrong.

thanks,
Received on Wed Jan 25 10:30:08 2006

This archive was generated by hypermail 2.1.8 : Wed Jan 25 2006 - 10:32:05 PST