Forum Discussion
Altera_Forum
Honored Contributor
15 years agohelp to correct error in program
sir/mam, part of my program is :##
m_out1 : std_logic_vector(15 downto 0);qsin_out1 :std_logic_vector(14 downto 0); x_in1,f1 : integer,# ## error : Operator <DIVIDE> must have constant operands or first operand must be power of 2 --> x_in1 <= 2*f1* conv_integer(signed(qsin_out1))/ conv_integer (signed (m_out1)); plz help me how i rectify this error. thanks in advance.2 Replies
- Altera_Forum
Honored Contributor
Since it says something related to power of 2 error, try changing the "14 downto 0" to "15 downto 0" that might fix the problem
- Altera_Forum
Honored Contributor
Guess you get the error when compiling with quartus?
I think you code is a bit too fancy to be impelemented in HW directly by the Quartus software. Dividing is logic consuming in FPGA's. To infer a divider you best use a standard component of altera. Eg:ALTFP_DIV, it is a standard megafunction.