blob: a69c1cc9973d471b6552b1c6377ce84a09a14c3b (
plain)
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
|
library ieee ;
use ieee.std_logic_1164.all;
use ieee.numeric_std_unsigned.all;
entity Adder is
generic(
N : positive := 4
);
port(
A : in std_logic_vector(N-1 downto 0);
B : in std_logic_vector(N-1 downto 0);
Cin : in std_logic;
Sum : out std_logic_vector(N-1 downto 0);
Cout : out std_logic
);
end Adder;
architecture RTL of Adder is
signal cout_sum: std_logic_vector(Sum'length downto 0);
begin
-- This works fine:
-- cout_sum <= ("0" & A) + B + Cin;
-- Cout <= cout_sum(Sum'length);
-- Sum <= cout_sum(Sum'length-1 downto 0);
-- This crashes GHDL:
(Cout, Sum) <= ("0" & A) + B + Cin;
end RTL;
|