Re: Shift limits

From: Paul Floyd <Paul_Floyd_at_.....>
Date: Mon Sep 03 2007 - 05:10:36 PDT
Bresticker, Shalom wrote:

>In Verilog, it is well defined. You should keep shifting in zeroes as
>many times as specified. So the result would be zero. This is often
>useful.
>  
>
Hi

Thanks Shalom and Marq. This is what I expected. I had doubts when I 
tried to implement Verilog << directly in C/C++, for example, with the 
wonderful C++ overloaded left shift operator:

int i = 1;
cout << hex << (i << 33) << endl;

Which compiles with a warning and prints "2" - seemingly the shift is 
done modulo the word size in bits.

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.
Received on Mon Sep 3 05:11:17 2007

This archive was generated by hypermail 2.1.8 : Mon Sep 03 2007 - 05:11:34 PDT