Hallo,
im wesentlichen habe ich den Code:
1 | library ieee;
|
2 | use ieee.STD_LOGIC_1164.all;
|
3 | library ieee;
|
4 | use ieee.NUMERIC_STD.all;
|
5 | library AppPackages;
|
6 | use AppPackages.AppPackage.all;
|
7 |
|
8 | entity Testdetimm is
|
9 | port (TimeReq : in std_logic_vector (17 downto 0);
|
10 | TimeVal : in std_logic_vector (17 downto 0);
|
11 | clk : in std_logic ;
|
12 | clrn : in std_logic ;
|
13 | CompTimeNow : out std_logic ;
|
14 | TimeTooShort : out std_logic ;
|
15 | NewPat : in std_logic
|
16 | );
|
17 | end Testdetimm;
|
18 |
|
19 | architecture a of Testdetimm is
|
20 | signal TimeReqM : unsigned(17 downto 0 );
|
21 | signal TimeValM : unsigned(17 downto 0 );
|
22 | signal detimm : unsigned(17 downto 0 );
|
23 | signal detimm2 : unsigned(17 downto 0 );
|
24 | signal SubTime : unsigned(17 downto 0 );
|
25 | signal TimeReqMS : unsigned(17 downto 0 );
|
26 | signal SubReq : unsigned(17 downto 0 );
|
27 | signal NewPatS : std_logic;
|
28 |
|
29 | begin
|
30 | process (clk, clrn)
|
31 | begin
|
32 | if clrn = '0' then
|
33 | TimeReqM <= (others =>'0');
|
34 | TimeValM <= (others =>'0');
|
35 | detimm <= (others =>'0');
|
36 | detimm2 <= (others =>'0');
|
37 | SubTime <= (others =>'0');
|
38 | CompTimeNow <= '0';
|
39 | NewPatS <='0';
|
40 | TimeTooShort <= '0';
|
41 |
|
42 | elsif clk'event and clk = '1' then
|
43 | detimm <= to_unsigned(ct20us,18);
|
44 | detimm2 <= detimm (16 downto 0) & '0';
|
45 | TimeReqM <= unsigned(TimeReq);
|
46 | TimeValM <= unsigned(TimeVal);
|
47 | SubTime <= TimeReqM - TimeValM;
|
48 | SubReq <= TimeReqM - TimeReqMS;
|
49 | if ( (NewPatS ='0') AND (NewPat ='1')) then
|
50 | if (SubReq < (detimm2 + "111")) then
|
51 | TimeTooShort <= '1';
|
52 | else
|
53 | TimeTooShort <= '0';
|
54 | end if;
|
55 | end if;
|
56 | if (detimm2 < SubTime) AND (detimm > SubTime ) then
|
57 | CompTimeNow <= '1';
|
58 | else
|
59 | CompTimeNow <= '0';
|
60 | end if;
|
61 | NewPatS <= NewPat;
|
62 | TimeReqMS <= TimeReqM;
|
63 | end if;
|
64 | end process;
|
65 | end;
|
cT20us ist eine Konstante aus AppPackage mit folgender Definition:
1 | constant cT1us : integer range 0 to 2047 := 30;
|
2 | constant cT20us : integer range 0 to 2047 := 20 * cT1us;
|
Mein Problem ist nun wie folgt:
Wenn ich alles generiere (mit Visual Elite)
"detimm[2]" "detimm[1]" "detimm[0]" "detimm2[3]" "detimm2[2]"
"detimm2[1]" "detimm2[0]" einfach weg synthetisiert.
Simuliere ich dann mit Quartus 6.1 kommt folgendes (siehe Bild)
Warum? Ist an den Casts was falsch? Kann ich eine if-Abfrage mit
unsigned überhaupt machen?
Bin ratlos...
Vielleicht ist der Fehler sehr einfach und ich sehe ihn nicht... Wo sind
meine Bits hin?
Wer kann mir helfen? Falsche Lib? Besser Unsigned?
Vlg