Apr 9, 2012 #1 S shaiko Advanced Member level 5 Joined Aug 20, 2011 Messages 2,644 Helped 303 Reputation 608 Reaction score 297 Trophy points 1,363 Activity points 18,302 In VHDL you can do the following assignment : Code: x <= ( others => '1' ) ; However, You cannot compare this way : Code: if x = ( others => '1' ) then Is there a way to do it compactly without writing the whole long vector? Code: if x = "1111111111111111111111111111111111111111" then
In VHDL you can do the following assignment : Code: x <= ( others => '1' ) ; However, You cannot compare this way : Code: if x = ( others => '1' ) then Is there a way to do it compactly without writing the whole long vector? Code: if x = "1111111111111111111111111111111111111111" then
Apr 9, 2012 #2 TuAtAu Advanced Member level 4 Joined May 22, 2011 Messages 119 Helped 9 Reputation 18 Reaction score 9 Trophy points 1,298 Location Jupiital Activity points 2,149 Good question, I will like to know that too! But for me, since "1111111111111111111..." is a constant, will consider to declare CONSTANT in generic or library package named CONSTANT32bit1 then Code: if x = CONSTANT32bit1 then .. .. end if; if y = CONSTANT32bit1 then .. .. end if; ---etc
Good question, I will like to know that too! But for me, since "1111111111111111111..." is a constant, will consider to declare CONSTANT in generic or library package named CONSTANT32bit1 then Code: if x = CONSTANT32bit1 then .. .. end if; if y = CONSTANT32bit1 then .. .. end if; ---etc
Apr 9, 2012 #3 T TrickyDicky Advanced Member level 7 Joined Jun 7, 2010 Messages 7,110 Helped 2,081 Reputation 4,181 Reaction score 2,048 Trophy points 1,393 Activity points 39,769 either declare a handy constant: constant ONES : std_logic_vector(x'range) := (others => '1'); if x = ONES then or create the vector properly: if x = (x'range => (others => '1') ) then I think the first one is better.
either declare a handy constant: constant ONES : std_logic_vector(x'range) := (others => '1'); if x = ONES then or create the vector properly: if x = (x'range => (others => '1') ) then I think the first one is better.
Apr 10, 2012 #4 P permute Advanced Member level 3 Joined Jul 16, 2010 Messages 918 Helped 295 Reputation 590 Reaction score 266 Trophy points 1,343 Activity points 8,543 IIRC, you can do "x = (x'range => '1')" or "signed(x) = -1"