How to solve the infeasible operator error?

Status
Not open for further replies.

info_req

Member level 5
Joined
Jun 20, 2007
Messages
81
Helped
6
Reputation
12
Reaction score
4
Trophy points
1,288
Location
Pakistan
Activity points
1,764
helo dear,
I am using (i) (std_logic_vector)*(integer) to shift std_logic_vector right
ii) sll, shl, etc for shift left / right but it is not working. I am also adding appropriate libraries

ERROR is like: infeasible operator.

what may be the problem???


thanks in advance
 

Re: infeasible opearotr

You can do it manually to avoid this problem:
For example, a 5 bit number to be shifted left by 3:
num(4 downto 2)<=num(2 downto 0);
num(2 downto 0)<="00";

If you want to use multiplication, then you should use a binary number instead of integer:
e.g:
num2<=num1*"100";--shift by 2, num2's size should be larger than num1 by 2.
num1<=num2(4 downto 0);--if inside process, will hold value of the previous clock, be careful.

and you must include ieee.std_logic_unsigned.*;

Note that the multiplication method consumes more hardware if you want to synthesize your code.
 

Re: infeasible opearotr

VHDL wont allow you to use operators like * on different data types. That is your problem.
But if you HAVE to do it, then you will have to define your own operator, which would like writing a function, which would take an std_logic_vector type, and integer type, multiply it and return the result in the data type of your choice, this is also called oprator overloading.
Kr,
Avi
http://www.vlsiip.com
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…