Forum Discussion
Altera_Forum
Honored Contributor
16 years agonot compiling
hello all i wrote down this simple divider code and for some reson it wont compile- it gives me the No feasible entries for infix operator "/" thats the code: library ieee; use ieee.st...
Altera_Forum
Honored Contributor
16 years agoThere are three issues involved with this short code snippet.
- a trivial one: the VHDL divide operator is slash '/' rather than backslash '\' - an arithmetic one: the quotient must have the same length as a - a VHDL library related one: std_logic_arith doesn't infer divider for signed type, you need to use numeric_std instead P.S.: This code compiles correctlylibrary ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity div is
generic (N : positive := 8 );
port ( a : in signed(N-1 downto 0);
b : in signed (N-1 downto 0);
div_res : out signed(N-1 downto 0)
);
end entity;
architecture behave_div of div is
begin
div_res<=a / b;
end behave_div;