Hallo zusammen,
ich bastle gerade an einem kleine Projekt und habe mir dazu ein CPLD der
Firma Xilinx besorgt. Und zwar den XC2C64A-7VQG44C.
1 | library IEEE;
|
2 | use IEEE.STD_LOGIC_1164.ALL;
|
3 | use IEEE.std_logic_unsigned."+";
|
4 |
|
5 |
|
6 | entity Schaltung is
|
7 | Port ( oa_out : in STD_LOGIC;
|
8 | clock : in STD_LOGIC;
|
9 | enable : in STD_LOGIC;
|
10 | reset : in STD_LOGIC;
|
11 |
|
12 | ready : out STD_LOGIC;
|
13 | n_ds_out: out STD_LOGIC;
|
14 | counter : out STD_LOGIC_VECTOR (13 downto 0));
|
15 | end Schaltung;
|
16 |
|
17 | architecture rtl_schaltung of Schaltung is
|
18 | signal e1 : STD_LOGIC;
|
19 | signal e0 : STD_LOGIC;
|
20 | signal ck0 : STD_LOGIC;
|
21 | signal ck1 : STD_LOGIC;
|
22 | signal count0_int : STD_LOGIC_VECTOR(13 downto 0);
|
23 | signal count1_int : STD_LOGIC_VECTOR(13 downto 0);
|
24 | signal ds_out_int : STD_LOGIC;
|
25 | begin
|
26 | e0 <= enable AND NOT count0_int(13);
|
27 |
|
28 | e1 <= ds_out_int AND e0;
|
29 |
|
30 | counter <= count1_int;
|
31 |
|
32 | ready <= '1' WHEN count0_int(13)='1' ELSE '0';
|
33 |
|
34 | n_ds_out <= NOT ds_out_int;
|
35 |
|
36 | dff0: process(clock, reset)
|
37 | begin
|
38 | if reset='0' then
|
39 | ds_out_int <= '0';
|
40 | elsif(clock'event AND clock='0') then
|
41 | ds_out_int <= oa_out;
|
42 | end if;
|
43 | end process dff0;
|
44 |
|
45 |
|
46 | etff0: process(clock, reset)
|
47 | begin
|
48 | if reset='0' then
|
49 | ck0 <= '0';
|
50 | elsif(clock'event AND clock='1') then
|
51 | if(e0='1') then
|
52 | ck0 <= NOT ck0;
|
53 | else
|
54 | ck0 <= ck0;
|
55 | end if;
|
56 | end if;
|
57 | end process etff0;
|
58 |
|
59 |
|
60 | etff1: process(clock, reset)
|
61 | begin
|
62 | if reset='0' then
|
63 | ck1 <= '0';
|
64 | elsif(clock'event AND clock ='1') then
|
65 | if(e1='1') then
|
66 | ck1 <= NOT ck1;
|
67 | else
|
68 | ck1 <= ck1;
|
69 | end if;
|
70 | end if;
|
71 | end process etff1;
|
72 |
|
73 |
|
74 | counter0: process(ck0, reset)
|
75 | begin
|
76 | if reset='0' then
|
77 | count0_int <= "00000000000000";
|
78 | elsif(ck0'event AND ck0='1') then
|
79 | count0_int <= count0_int +1;
|
80 | else
|
81 | count0_int <= count0_int;
|
82 |
|
83 | end if;
|
84 | end process counter0;
|
85 |
|
86 |
|
87 | counter1: process(ck1, reset)
|
88 | begin
|
89 | if reset='0' then
|
90 | count1_int <= "00000000000000";
|
91 | elsif(ck1'event AND ck1 ='1') then
|
92 | count1_int <= count1_int +1;
|
93 | else
|
94 | count1_int <= count1_int;
|
95 | end if;
|
96 | end process counter1;
|
97 |
|
98 |
|
99 |
|
100 | end rtl_schaltung;
|
Das ganze läuft auch schon relativ gut. Also die Funktion ist erkennbar.
Jedoch funktioniert der counter1 nicht richtig. Bzw er zählt zwar,
jedoch werden die Ausgänge auf die der Zähler gelegt wird nicht richtig
HGH.
Die höherwertigen Bits des Zählwerts werden statt 3,3V lediglich 1,3V.
Also z.B. bei einem Zählwert von 00000001010111 sieht die Spannung an
den Ausgängen so aus: 0V 0V 0V 0V 0V 0V 0V 1,3V 0V 1,3V 0V 3,3V 3,3V
3,3V.
Woran kann das liegen?
Mit freundlichen Grüßen
Stefan