Problem with using components in vhdl

Status
Not open for further replies.

mhmmdrz92

Newbie level 2
Joined
Jan 25, 2018
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
38
I want to use carry look ahead and ripple carry adder components to write a vhdl code of a combinational adder. the inputs are 16 bits an the components are 4 bits, so i would use four of them. this is the code:


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
library ieee;
use ieee.std_logic_1164.all;
 
entity ETAII is
  port (
    A  : in std_logic_vector(15 downto 0);
    B  : in std_logic_vector(15 downto 0);
     --cin : in std_logic;
    --
     c_out : out std_logic;
    result : out std_logic_vector(15 downto 0)
    );
end ETAII;
 
architecture rtl of ETAII is
 
    component carry_lookahead_adder is
        generic (g_WIDTH : natural := 4);
       port (
         i_add1_cla  : in std_logic_vector(g_WIDTH-1 downto 0);
         i_add2_cla  : in std_logic_vector(g_WIDTH-1 downto 0);
         c_in_cla : in std_logic;
         --
         c_result_cla : out std_logic
         
         );
    end component carry_lookahead_adder;
 
    component ripple_carry_adder is
      generic (g_WIDTH : natural := 4);
      port (
         i_add1_rca  : in std_logic_vector(g_WIDTH-1 downto 0);
         i_add2_rca  : in std_logic_vector(g_WIDTH-1 downto 0);
         c_in_rca : in std_logic:='-';
         --
         o_result   : out std_logic_vector(g_WIDTH-1 downto 0)
         );
    end component ripple_carry_adder;
 
    signal c1,c2,c3,c4 : std_logic;
    signal result1 : std_logic_vector(15 downto 0);
 
begin
 
    cla1: carry_lookahead_adder generic map (g_WIDTH => 4) port map(
        i_add1_cla => A(3 downto 0),
        i_add2_cla => B(3 downto 0),
        c_in_cla => '0',
        c_result_cla => c1);
 
 
    rca1: ripple_carry_adder generic map (g_WIDTH => 4) port map(
        i_add1_rca => A(3 downto 0),
        i_add2_rca => B(3 downto 0),
        c_in_rca => '0',
        o_result => result1(3 downto 0));
 
        
    cla2: carry_lookahead_adder generic map (g_WIDTH => 4) port map(
        i_add1_cla => A(7 downto 4),
        i_add2_cla => B(7 downto 4),
        c_in_cla => '0',
        c_result_cla => c2); 
 
 
    rca2: ripple_carry_adder generic map (g_WIDTH => 4) port map(
        i_add1_cla => A(7 downto 4),
        i_add2_cla => B(7 downto 4),
        c_in_rca => c1,
        o_result => result1 (7 downto 4));
        
    cla3: carry_lookahead_adder generic map (g_WIDTH => 4) port map(
        i_add1_rca => A(11 downto 8),
        i_add2_rca => B(11 downto 8),
        c_in_cla => '0',
        c_result_cla => c3);
 
 
    rca3: ripple_carry_adder generic map (g_WIDTH => 4) port map(
        i_add1_rca => A(11 downto 8),
        i_add2_rca => B(11 downto 8),
        c_in_rca => c2,
        o_result => result1 (11 downto 8));
        
    cla4: carry_lookahead_adder generic map (g_WIDTH => 4) port map(
        i_add1_cla => A(15 downto 12),
        i_add2_cla => B(15 downto 12),
        c_in_cla => '0',
        c_result_cla => c4);
 
 
    rca4: ripple_carry_adder generic map (g_WIDTH => 4) port map(
        i_add1_rca => A(15 downto 12),
        i_add2_rca => B(15 downto 12),
        c_in_rca => c3,
        o_result => result1 (15 downto 12));
    
result <= result1;
c_out <= c4;
 
end rtl;



I recieve these similar errors from altera quartus:

What should I do to solve this error?
 

is this a copy past error?
the ripple_carry_adder port is called i_add1_rca
You have tried to connect to i_add_cla (which doesnt exist on the component).
 

yes, the errors are pasted from the software.
I didn't get your hint about the question and i don,t know how to solve the problem
 

change this:


Code VHDL - [expand]
1
2
3
4
5
cla3: carry_lookahead_adder generic map (g_WIDTH => 4) port map(
        i_add1_rca => A(11 downto 8),
        i_add2_rca => B(11 downto 8),
        c_in_cla => '0',
        c_result_cla => c3);



to this:


Code VHDL - [expand]
1
2
3
4
5
cla3: carry_lookahead_adder generic map (g_WIDTH => 4) port map(
        i_add1_cla => A(11 downto 8),
        i_add2_cla => B(11 downto 8),
        c_in_cla => '0',
        c_result_cla => c3);

 

That is not the only set of copy paste errors. You should have used a generate.
 

I can see some more errors in the lines 66-70.
Code:
        rca2: ripple_carry_adder generic map (g_WIDTH => 4) port map(
        i_add1_cla => A(7 downto 4),
        i_add2_cla => B(7 downto 4),
        c_in_rca => c1,
        o_result => result1 (7 downto 4));

should be replaced by
Code:
    rca2: ripple_carry_adder generic map (g_WIDTH => 4) port map(
        i_add1_rca => A(7 downto 4),
        i_add2_rca => B(7 downto 4),
        c_in_rca => c1,
        o_result => result1 (7 downto 4));
 

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