The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> rotate in Verilog-AMS
https://designers-guide.org/forum/YaBB.pl?num=1318926328

Message started by ywguo on Oct 18th, 2011, 1:25am

Title: rotate in Verilog-AMS
Post by ywguo on Oct 18th, 2011, 1:25am

Hi Guys,

I am curious that there is not any rotate operator in Verilog-AMS language. It is a simple operator in C language. I thought Verilog-AMS shares many features of C language.

Now I have to rotate registers as below.


Code:
reg [15:0] Areg;

Areg = {(Areg << 9) | (Areg >>  7)};  // rotate left 9 bit.


Best Regards,
Yawei

Title: Re: rotate in Verilog-AMS
Post by boe on Oct 18th, 2011, 8:36am

Hi Yawei,

ywguo wrote on Oct 18th, 2011, 1:25am:
I am curious that there is not any rotate operator in Verilog-AMS language.
I see no need for an operator in Verilog(-AMS). I would use
Code:
Areg = {Areg[6:0], Areg[15:7]};


Quote:
... It is a simple operator in C language. ...
It is?

- B O E

Title: Re: rotate in Verilog-AMS
Post by Ken Kundert on Oct 19th, 2011, 10:11pm

There are shift operators in Verilog and Verilog-AMS, but probably not in Verilog-A. They are both the normal shift operators (<< and >>) and the arithmetic shift operators (<<< and >>>).

Though I thought Boe's suggestion was just as good.

-Ken

Title: Re: rotate in Verilog-AMS
Post by boe on Oct 20th, 2011, 2:30am

Yawei,
if you want rotate_left/_right "operator" functions, feel free to define them yourself.

- B O E
PS: I think Verilog-A has shift operators for integers.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.