Altera_Forum
Honored Contributor
18 years agomultiplying and dividing
I'm trying to use a divider since I don't have the division operator but I'm having some problems. It doesn't seem to like my stage, statements. It says, expression has 4 elements but must have 8 elements.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
USE ieee.std_logic_unsigned.all;
ENTITY ADC IS
PORT (N : IN STD_LOGIC_VECTOR(7 DOWNTO 0); --8 bit signal
D : IN STD_LOGIC_VECTOR(5 DOWNTO 0); --6 bit number needed to represent 51
ONES : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); --4 bit number needed to represent ones digit
TENS : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)); --4 bit number needed to represent tens digit
END ADC;
ARCHITECTURE Structure OF ADC IS
SIGNAL R: STD_LOGIC_VECTOR(5 DOWNTO 0); --6 bit number to represent remainder
COMPONENT lpm_divide1
PORT
(
denom : IN STD_LOGIC_VECTOR (5 DOWNTO 0);
numer : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
quotient : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
remain : OUT STD_LOGIC_VECTOR (5 DOWNTO 0)
);
END COMPONENT;
BEGIN
stage0: lpm_divide1 PORT MAP(D,N,ONES,R);
stage1: lpm_divide1 PORT MAP(D,R*"1010",TENS,R);
END Structure;