Christoph Z. schrieb:
> Im Fall von lokalen packages versuche es mit (work ist die
> Projekt-lokale Library):use work.fixed_pkg_c.ALL
Dankeschön! :)
Ich habe mal den MinimalCode von Andreas Schwarz ausprobiert und wollte
diesen auf meinem BASYS2 testen...
1 | library ieee;
|
2 | use ieee.std_logic_1164.all;
|
3 | use ieee.numeric_std.all;
|
4 | use work.math_utility_pkg.all;
|
5 | use work.fixed_pkg.all;
|
6 | entity top is
|
7 |
|
8 | port (
|
9 | in1 : in STD_LOGIC_VECTOR (7 downto 0); -- inputs
|
10 | out1 : out STD_LOGIC_VECTOR (7 downto 0) -- output
|
11 | );
|
12 |
|
13 |
|
14 | end entity top;
|
15 |
|
16 | architecture rtl of top is
|
17 |
|
18 | signal x, y : sfixed (3 downto -3);
|
19 |
|
20 | begin
|
21 | x <= to_sfixed(in1, 3, -3);
|
22 | y <= x * 2;
|
23 | out1 <= to_slv(y);
|
24 | end rtl;
|
Jedoch bekomme ich andauernd die Warnung:
WARNING:Par:288 - The signal in1<0>_IBUF has no load. PAR will not
attempt to route this signal.
WARNING:Par:288 - The signal in1<1>_IBUF has no load. PAR will not
attempt to route this signal.
WARNING:Par:288 - The signal in1<2>_IBUF has no load. PAR will not
attempt to route this signal.
WARNING:Par:288 - The signal in1<3>_IBUF has no load. PAR will not
attempt to route this signal.
WARNING:Par:288 - The signal in1<4>_IBUF has no load. PAR will not
attempt to route this signal.
WARNING:Par:288 - The signal in1<5>_IBUF has no load. PAR will not
attempt to route this signal.
WARNING:Par:288 - The signal in1<6>_IBUF has no load. PAR will not
attempt to route this signal.
WARNING:Par:288 - The signal in1<7>_IBUF has no load. PAR will not
attempt to route this signal.
und deswegen funktioniert natuerlich auch gar nichts auf dem board...
mein UCF-File:
1 | NET "out1<0>" LOC = "G1";
|
2 | NET "out1<1>" LOC = "P4";
|
3 | NET "out1<2>" LOC = "N4";
|
4 | NET "out1<3>" LOC = "N5";
|
5 | NET "out1<4>" LOC = "P6";
|
6 | NET "out1<5>" LOC = "P7";
|
7 | NET "out1<6>" LOC = "M11";
|
8 | NET "out1<7>" LOC = "M5";
|
9 | NET "in1<0>" LOC = "N3";
|
10 | NET "in1<1>" LOC = "E2";
|
11 | NET "in1<2>" LOC = "F3";
|
12 | NET "in1<3>" LOC = "G3";
|
13 | NET "in1<4>" LOC = "B4";
|
14 | NET "in1<5>" LOC = "K3";
|
15 | NET "in1<6>" LOC = "L3";
|
16 | NET "in1<7>" LOC = "P11";
|
Wisst ihr vll wieso?
und was ich noch nicht ganz verstehe... was macht "to_slv(y)"?
Wenn ich nun wie oben zwei signale von einander subtrahieren moechte und
anschliesend mit einer dritten, wie oben beschrieben, multiplizieren
moechte...
wie wuerde dann der Code ungefaehr aussehen? (angenommen a und b hat nur
max. 3 nachkommastellen)
dann waere doch ca. so oder?
1 | architecture rtl of top is
|
2 |
|
3 | signal c : integer := 5;
|
4 | signal a, b, z : sfixed (3 downto -3); --a = 0.010; b =0.002;
|
5 |
|
6 | begin
|
7 | a <= to_sfixed(in1, 3, -3);
|
8 | b <= to_sfixed(in2, 3, -3); --wuerde auch (in1, 3, 0) mit (in2, 3, -3) funktionieren?
|
9 |
|
10 | z <= (a-b)*c; --funktioniert das mit c oder muss ich das dann noch irgendwie casten?
|
11 | out1 <= to_slv(z); --wozu dient to_slv(z)?
|
12 | end rtl;
|