-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDac_controller.vhd.bak
95 lines (75 loc) · 1.95 KB
/
Dac_controller.vhd.bak
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
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity FibonachiDacTest is
Generic (dataBusRes: natural := 47; dacRes: natural := 11; addrRes: natural := 1);
port
(
data : in STD_LOGIC_VECTOR (dataBusRes DOWNTO 0);
clk : in std_logic;
nreset : out std_logic;
nldac : out std_logic;
db : out STD_LOGIC_VECTOR (dacRes DOWNTO 0);
randw : out std_logic;
a : out STD_LOGIC_VECTOR (addrRes DOWNTO 0);
ncs : out std_logic;
test : out std_logic
);
end entity;
architecture rtl of FibonachiDacTest is
begin
process (clk)
variable temp: integer := 0;
type dacAdressesType is array(3 downto 0) of STD_LOGIC_VECTOR (addrRes DOWNTO 0);
type dacValuesType is array(3 downto 0) of STD_LOGIC_VECTOR (dacRes DOWNTO 0);
variable dacAdresses: dacAdressesType :=("11","10","01","00");
variable dacValues: dacValuesType;
begin
dacValues(0):=data(dacRes downto 0);
dacValues(1):=data(dacRes*2+1 downto dacRes+1);
dacValues(2):=data(dacRes*3+2 downto dacRes*2+2);
dacValues(3):=data(dataBusRes downto dacRes*3+3);
nreset<='1';
if ( rising_edge( clk ) ) then
temp := temp + 1;
if ( temp = 1 ) then
db<= dacValues(0);
elsif ( temp = 2) then
a<= dacAdresses(0);
randw<='0';
ncs<= '0';
-- first dac
elsif ( temp = 10) then
db<= dacValues(1);
ncs<= '1';
elsif ( temp = 12) then
a<= dacAdresses(1);
ncs<= '0';
-- second dac
elsif ( temp = 20) then
db<= dacValues(2);
ncs<= '1';
elsif ( temp = 22) then
a<= dacAdresses(2);
ncs<= '0';
-- third dac
elsif ( temp = 30) then
db<= dacValues(3);
ncs<= '1';
elsif ( temp = 32) then
a<= dacAdresses(3);
ncs<= '0';
-- fourth dac
elsif ( temp = 33) then
nldac<='0';
elsif (temp = 40) then
randw<='1';
ncs<= '1';
elsif (temp = 43) then
nldac<='1';
temp:=0;
end if;
end if;
test<=clk;
end process;
end rtl;