Hallo ihr Lieben,
ich habe eine kurze Frage.
Wie geht man mit Bits von zum Beispiel einem std_logic_vector um, die
man nicht benötigt, oder nur indirekt? Klingt komisch, ich weiß, ist
aber bei mir der Fall. Ich gabe euch mal ein Beispiel.
Es wird eine Multiplikation durchgeführt. Beide Faktoren sind vom Typ
std_logic_vector(22 downto 0) und werden als signed mit einander
multipliziert. Damit muss das Ergebnis die doppelte Bitbreite der
Faktoren besitzen und ist std_logic_vector (45 downto 0). Für meine
Anwendung ist es nötig, das ich nur bestimmte Bits des Ergebnisses nutze
und weiter verarbeite. Die Restlichen beachte ich nicht weiter und
bekomme dadurch bei der Synthese immer Warnungen, dass diese Signale im
Block unconnected sind. Das ist nicht schön. Also meine Frage, was mache
ich am Besten mit den Bits die ich nur indirekt benötige, damit diese
Meldungen nicht erscheinen.
Hier nochmal das Beispiel:
1 | library ieee;
|
2 | use ieee.std_logic_1164.all;
|
3 | use ieee.std_logic_arith.all;
|
4 |
|
5 | entity Scale is
|
6 | port ( clk : in std_logic;
|
7 | SUM_Adder_Matrix : in std_logic_vector (16 downto 0);
|
8 | Normierung : in std_logic_vector(7 downto 0);
|
9 | Pixel_out : out std_logic_vector (7 downto 0)
|
10 | );
|
11 | end Scale;
|
12 |
|
13 | architecture Behavioral of Scale is
|
14 |
|
15 | Signal Scale : std_logic_vector (7 downto 0) := "00000001";
|
16 | Signal Prod : std_logic_vector (45 downto 0);
|
17 | Signal sig_SUM_Adder_Matrix : std_logic_vector (22 downto 0);
|
18 | Signal sig_Scale : std_logic_vector (22 downto 0);
|
19 |
|
20 |
|
21 | begin
|
22 | Scale <= Normierung;
|
23 | process(clk)
|
24 | begin
|
25 |
|
26 | if (clk'event and clk = '1') then
|
27 |
|
28 | if Scale(7) = '1' then
|
29 | sig_Scale(22 downto 8) <= (others => '1');
|
30 | sig_Scale(7 downto 0) <= Scale (7 downto 0);
|
31 | else
|
32 | sig_Scale(22 downto 8) <= (others => '0');
|
33 | sig_Scale(7 downto 0) <= Scale (7 downto 0);
|
34 | end if;
|
35 |
|
36 | sig_SUM_Adder_Matrix(22 downto 6) <= SUM_Adder_Matrix(16 downto 0);
|
37 | sig_SUM_Adder_Matrix(5 downto 0) <= (others => '0');
|
38 |
|
39 |
|
40 | end if;
|
41 |
|
42 | end process;
|
43 |
|
44 |
|
45 | process(clk)
|
46 |
|
47 | constant Max_255 : std_logic_vector (33 downto 0) := "0000000000000000000000000011111111";
|
48 | constant Min_0 : std_logic_vector (33 downto 0) := (others => '0');
|
49 | constant Add_1 : std_logic_vector(7 downto 0) := "00000001";
|
50 |
|
51 | begin
|
52 | if (clk'event and clk = '1') then
|
53 | Prod <= signed(sig_SUM_Adder_Matrix) * signed(sig_Scale);
|
54 | if (signed(Prod(45 downto 12)) >= signed(Max_255)) then
|
55 | Pixel_out <= (others => '1');
|
56 | elsif (signed(Prod(45 downto 12)) <= signed(Min_0)) then
|
57 | Pixel_out <= (others => '0');
|
58 | else
|
59 | if Prod(11)= '1' then
|
60 | Pixel_out <= unsigned(Prod(19 downto 12)) + unsigned(Add_1);
|
61 | else
|
62 | Pixel_out <= Prod (19 downto 12);
|
63 | end if;
|
64 | end if;
|
65 | end if;
|
66 |
|
67 |
|
68 | end process;
|
69 | end Behavioral;
|