第1个回答 2011-11-25
FPGA是不能实现DA转换的,它内部处理的都是数字信号,不能输出模拟信号。一般是用FPGA控制系统工作流程,产生控制信号,DSP输出数字信号处理后得到的数字信号,经专门的DA芯片,如PCM1798、1794、AD1955、CS4398、AK4396、AK4399等等,FPGA只能实现特定类型的脉冲,如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity dac_ds is
port(reset :in std_logic;
clk :in std_logic;
din :in std_logic_vector(7 downto 0);--Signed integer
dout :out std_logic);
end dac_ds;
architecture arch_dac_ds of dac_ds is
signal error :std_logic_vector(9 downto 0);--Error accumulator is 2 bits larger
constant zeros:std_logic_vector(7 downto 0):=(others=>'0');
begin
process(reset,clk,din)
variable val :std_logic_vector(9 downto 0);
begin
if reset='1'then
error<=(others=>'0');
dout<='0';
elsif clk'event and clk='1' then
--val:=din+error;din is sign extended to nbits+2
val:=(din(din'high)&din(din'high)&din)+error;
if val(val'high)='0'then
dout<='1';
error<=val+("11"& zeros);
else
dout<='0';
error<=val+("01"&zeros);
end if;
end if;
end process;
end arch_dac_ds