The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 3:12pm
Pages: 1
Send Topic Print
rotate in Verilog-AMS (Read 6193 times)
ywguo
Community Fellow
*****
Offline



Posts: 943
Shanghai, PRC
rotate in Verilog-AMS
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
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: rotate in Verilog-AMS
Reply #1 - 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
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: rotate in Verilog-AMS
Reply #2 - 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
Back to top
 
 
View Profile WWW   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: rotate in Verilog-AMS
Reply #3 - 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.
Back to top
 
« Last Edit: Oct 20th, 2011, 5:01am by boe »  
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.