Re: Shift limits

From: Marq Kole <marq.kole_at_.....>
Date: Fri Aug 31 2007 - 01:15:42 PDT
Paul,

The Verilog 1364-1995 LRM states that the vacated bit positions shall be
filled with zeroes. So the effect of a shift larger than the size of the
left operand is zero, independent of the shift direction.

Cheers,
Marq




                                                                       
                                                                       
                                                                       
                                                                        To
                                       verilog-ams                     
                                       <verilog-ams@server.eda-stds.org>
     Paul Floyd                                                         cc
     <Paul_Floyd@mentor.c                                              
     om>                                                           Subject
                                       Shift limits                    
     Sent by:                                               Classification
     owner-verilog-ams@se                                              
     rver.eda.org                                                      
                                                                       
     29-08-2007 17:38                                                  
                                                                       
                                                                       
                                                                       




Hi

In the 2.2 LRM, section 4.1.10, no comment is made on the effect of a
shift when the right operand is greater than the width of the left
operand. In the ISO C standard, 1999, this is undefined (section 6.5.7,
para 3; C is also undefined for a negative right operand whereas the
Verilog-AMS LRM specifies that the right operand is treated as unsigned).

Just a couple of examples:

integer i, j;

i = 1;
j = i << 32;

Is j undefined (like C) or 0? Same question for 'j = i >> 32;'.

Regards
Paul Floyd
--
Dr. Paul Floyd
Mentor Graphics Corporation


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





graycol.gif pic11721.gif ecblank.gif
Received on Fri Aug 31 01:44:28 2007

This archive was generated by hypermail 2.1.8 : Fri Aug 31 2007 - 01:45:18 PDT