0

i am new to vhdl. i have a code with me as follows (the sub prog compiles very fine). i can't fix the following error

** Error: C:/Users/acer/Desktop/alu new/ALU_VHDL.vhd(110): Illegal sequential statement. ** Error: C:/Users/acer/Desktop/alu new/ALU_VHDL.vhd(115): Illegal sequential statement. ** Error: C:/Users/acer/Desktop/alu new/ALU_VHDL.vhd(120): Illegal sequential statement. ** Error: C:/Users/acer/Desktop/alu new/ALU_VHDL.vhd(128): Illegal sequential statement. ** Warning: [14] C:/Users/acer/Desktop/alu new/ALU_VHDL.vhd(128): (vcom-1272) Length of formal "Remainder" is 4; length of actual is 8.

** Error: C:/Users/acer/Desktop/alu new/ALU_VHDL.vhd(138): VHDL Compiler exiting

the line nos are bold ones in the code here.they are the portmap ones Can anyone please help me out with this. it would be very kind of you.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

entity ALU_VHDL is
   port
   (
      OperandA : in std_logic_vector(3 downto 0);
      OperandB : in std_logic_vector(3 downto 0);
      Operation: in std_logic_vector(2 downto 0);
        Startt    : in std_logic;
      Ready : out std_logic;
        Result_High : out std_logic_vector(3 downto 0);
        Result_Low : out  std_logic_vector(7 downto 0);
        Errorsig : out std_logic;
        Reset_n : in std_logic;
        Clkk : in std_logic);
end entity ALU_VHDL;

architecture Behavioral of ALU_VHDL is
-- And gate
 component AND_gate
  port( 
    x,y  : IN std_logic_vector(3 downto 0);
    z    : OUT std_logic_vector(3 downto 0));
end component;

-- OR Gate
component OR_gate
  port( 
    x,y  : IN std_logic_vector(3 downto 0);
    z    : OUT std_logic_vector(3 downto 0));
end component;
-- XOR gate

component XOR_gate
  port( 
    x,y  : IN std_logic_vector(3 downto 0);
    z    : OUT std_logic_vector(3 downto 0));
end component;
-- Adder

COMPONENT adder4 
PORT
    (
    C : IN std_logic;
    x,y : IN std_logic_vector(3 DOWNTO 0);
    R   : OUT std_logic_vector(3 DOWNTO 0);
    C_out   : OUT std_logic);
END COMPONENT;

-- Subtractor
COMPONENT Substractor4 
PORT
       (
        br_in : IN std_logic;
        x,y : IN std_logic_vector(3 DOWNTO 0);

        R   : OUT std_logic_vector(3 DOWNTO 0);
        E   : out std_logic);
END COMPONENT;

-- Multiplier
COMPONENT mult4by4 
    port(operA, operB: in std_logic_vector(3 downto 0);
     sumOut: out std_logic_vector(7 downto 0));
END COMPONENT;

-- Division
COMPONENT Division 
Port ( Dividend : in std_logic_vector(3 downto 0);
           Divisor : in std_logic_vector(3 downto 0);
           Start :   in std_logic;
           Clk :     in std_logic;
           Quotient :  out std_logic_vector(3 downto 0);
           Remainder :    out std_logic_vector(3 downto 0);
           Finish : out std_logic);
END COMPONENT;  

 begin

   process(OperandA, OperandB, Startt, Operation) is
   begin


      case Operation is

             when "000" => 
                 Result_High <= "XXXX";


             when "001" =>
                 Result_High <= OperandA and OperandB;


                 when "010" =>
           Result_High <= OperandA or OperandB;


           when "011" =>
           Result_High <= OperandA xor OperandB;



           when "100" => 
           -- Adder
                 **U05 : adder4 PORT MAP (C=>Startt,x=>OperandA,y=>OperandB,R=>Result_High,C_out=>Ready);**


           when "101" =>
           -- Substractor & Error signal
                 **U06 : Substractor4 PORT MAP (br_in=>Startt,x=>OperandA,y=>OperandB,R=>Result_High,E=>Errorsig);**


             when "110" =>
                 -- multiplication
           **U07 : mult4by4 PORT MAP (operA=>OperandA,operB=>OperandB,sumOut=>Result_Low);**


           when "111" =>
                 -- Division
                 if (OperandB ="0000") then
                   Errorsig <= '1';
                 else
             **U08 : Division PORT MAP (Dividend=>OperandA,Divisor=>OperandB,Start=>Startt,Clk=>Clkk,Quotient=>Result_High,Remainder=>Result_Low,Finish=>Ready);**
                 end if;

                 when others =>
                 Errorsig <= '1';

      end case;

   end process;

end architecture Behavioral;
1
  • What is the purpose of portmap? Commented Dec 18, 2013 at 1:04

3 Answers 3

2

You cannot instantiate entities within a process.

Move all entity instantiations out of the process (into the architecture body) and work from there.

Sign up to request clarification or add additional context in comments.

Comments

0

If you want to in instantiate component depending on the value of 'Operation', like the zennehoy wrote, you should instantiate components out of the process and in this case statement only use signal connected to this components in instantiations and link it to port you want.

Comments

0

For the length issue change the "Remainder : out std_logic_vector(3 downto 0);" to "Remainder : out std_logic_vector(7 downto 0);"

1 Comment

You're debugging 5 years old code...I doubt this is still relevant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.