02-11-2011 01:22 AM
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:
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.
02-15-2011 03:48 AM
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
02-24-2011 12:27 AM
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);
02-24-2011 01:31 AM
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!