UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser: Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Reply

ROL logic operator library

Accepted Solution Solved
Visitor
Posts: 24
Registered: ‎11-22-2010
Accepted Solution

ROL logic operator library

Hi,
please I have a question, maybe it's very simple but I couldn't find the answer.

I need to use ROL logic operator, but I'm still getting the same error:
ROL can not have such operands in this context.

 

I have tried to use these libraries:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.std_logic_arith.all;
use IEEE.numeric_std.all;


And I have tried to use operands of type STD_LOGIC_VECTOR and STD_ULOGIC_VECTOR (as I read in the designer's guide to VHDL book), but I'm still getting that error.

y <= x ROL 3;
Also I have tried integers other than 3, but nothing.

Please can anyone help me with this.

Thanks.

Dina

Voyager
Posts: 381
Registered: ‎08-14-2007

Re: ROL logic operator library

 

I think this kind of instruction works only for bit_vector type, try to use bit_vector instead STD_LOGIC_VECTOR

 

regards

View solution in original post


All Replies
Voyager
Posts: 381
Registered: ‎08-14-2007

Re: ROL logic operator library

 

I think this kind of instruction works only for bit_vector type, try to use bit_vector instead STD_LOGIC_VECTOR

 

regards

Visitor
Posts: 24
Registered: ‎11-22-2010

Re: ROL logic operator library

It works... great  :-)

Thank you very much.

 

Scholar
Posts: 2,533
Registered: ‎08-14-2007

Re: ROL logic operator library

Hi

If you want to avoid type conversions you can do it also this way:

 

mysig <= mysig (mysig'length-1-rolwidth downto 0) & mysig(mysig'lenght-1 downto mysig'length-rolwidth );

 

Of course if you like to have the operator in your code, for better readability, you can put this line in a function.

 

Have a nice synthesis

  Eilert

Moderator
Posts: 57
Registered: ‎11-04-2010

Re: ROL logic operator library

If you want to keep the IO of module being STD_LOGIC_VECTOR, you can use To_StdLogicVector to change the internal signal type to STD_LOGIC_VECTOR.

Ex: data_out <= To_StdLogicVector(temp);

Teacher
Posts: 2,113
Registered: ‎09-09-2010

Re: ROL logic operator library

The equivalent/replacement function for the ieee.numeric_std package is 'rotate_left', which is defined for both signed and unsigned types (but not std_logic_vector). You could the operation do with casts all in one line, though:


data_out  <= std_logic_vector(rotate_left(unsigned(data_in), 3));


The second parameter need not be a constant, but if it is a signal then it will infer a barrel shifter, which is a lot of logic!

 


------------------------------------------
"If it don't work in simulation, it won't work on the board."
Visitor
Posts: 24
Registered: ‎11-22-2010

Re: ROL logic operator library

Thank you very much for your replys :)