-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdco.vhd
executable file
·130 lines (102 loc) · 2.65 KB
/
dco.vhd
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
-- ****************************************************
-- Program: dco.vhd
-- Description: Digital Controlled Oscillator
-- Paper reference used: P. E. Allen. Lecture 080 - All Digital Phase Lock Loops (ADPLL). Material da disciplina Frequency Sythesizers, The School of Electrical and Computer Engineering of Georgia Institute of Technology,2003. Acessado em: 02/07/2021.
-- Input:carry,dec,idclock
-- Output: idout.
-- Author: Wellington W. F. Sarmento, Paulo de T. C. Pequeno e Rodrigo Ciarlini
-- Date: 28/06/2021
-- State: NOT VALIDATED!!!!
-- ****************************************************
library ieee;
use ieee.std_logic_1164.all;
entity dco is
port (
carry, borrow, clock : in std_logic;
dco_out : out std_logic
);
end dco;
architecture dco_arch of dco is
constant n: natural:=8;
signal soutincr,soutdecr,sidoutincr, sidoutdecr,sidout: std_logic:='0';
signal ot: std_logic:='0';
signal sborrow,scarry: std_logic:='0';
signal countincr,countfc : natural:=0;
signal countdecr : natural:=8;
begin
sborrow<=borrow;
scarry<=carry;
dco_out<=ot OR sidout;
sidout<=sidoutincr XOR sidoutdecr;
incr: process(clock,sborrow)
begin
if (clock'event AND clock='1') then
if (sborrow='1') then
sidoutincr<= '1';
else
sidoutincr<='0';
end if;
end if;
end process incr;
decr: process(clock,scarry)
begin
if (clock'event AND clock='1') then
if (scarry='1') then
sidoutdecr<= '0';
else
sidoutdecr<='1';
end if;
end if;
-- if (clock'event AND clock='1') then
-- if (scarry='1') then
-- sidout<='0';
-- end if;
-- end if;
end process decr;
freqcenter: process(clock)
begin
if (clock'event AND clock='1') then
countfc<=countfc+1;
if (countfc=7) then
countfc<=0;
ot<=not ot;
end if;
end if;
end process freqcenter;
--counterincr: process(clock)
--
--begin
-- if (clock'event AND clock='1') then
--
-- if (soutincr='1') then
-- countincr<=countincr+1;
-- if (countincr>(n-1)) then
-- countincr<=0;
-- sidoutincr<='0';
-- else
-- sidoutincr<=not sidoutincr;
-- end if;
-- end if;
--
-- end if;
--end process counterincr;
--
--
--counterdecr: process(clock)
--
--begin
-- if (clock'event AND clock='1') then
-- if (soutdecr='1') then
-- countdecr<=countdecr-1;
-- if (countdecr=0) then
-- countdecr<=8;
-- sidoutdecr<='0';
-- else
-- sidoutdecr<=not sidoutdecr;
-- end if;
-- end if;
--
--
-- end if;
--end process counterdecr;
end dco_arch;