使用 VHDL 代码生成纯正弦波作为 FPGA 的输出

发布于 2024-09-08 03:34:43 字数 63 浏览 8 评论 0原文

我们知道 FPGA 的输出是数字的,但我们可以使用 vhdl 代码生成纯模拟正弦波吗?我还可以指定正弦波的频率。

We know that the output of an FPGA is digital but can we genrate a pure analog sine wave using a vhdl code. also can I specify the frequency of the sine wav.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

萧瑟寒风 2024-09-15 03:34:43

定义“纯粹”——您可以接受多少“位”量化……以及什么频率?

对于低位的低频率,您可以在 FPGA 中构建一个简单的 PWM 或 delta-sigma DAC,并在“外部”放置一个低通滤波器(抱歉,这必须是真正的模拟硬件:)。 此示例可能提供信息

如果没有一些外部资源,就无法实现这一 目标虽然是组件。

Define "pure" - how many "bits" of quantisation can you live with... and what frequency?

For lowish frequencies at lowish bits you could build a simple PWM or delta-sigma DAC in the FPGA and put a low-pass filter on the "outside" (sorry, that'll have to be real analogue hardware :) . This example may be informative

Not going to get there without some external componentry though.

静若繁花 2024-09-15 03:34:43

您可以查看直接数字合成。它基本上使用 ROM 来存储正弦样本,并使用相位累加器索引到 ROM 以生成具有所需频率的输出信号。分辨率和最大频率受 fpga 时钟和 ROM 大小的限制。

不过,您仍然需要一个模拟重建滤波器。

You can look into Direct Digital Synthesis. It basically uses a ROM to store the sine samples and uses a phase accumulator to index into the ROM to generate the output signal with the desired frequency. Resolution and maximum frequency is bound by the fpga clock and the ROM size.

You still need an anlog reconstruction filter, though.

他不在意 2024-09-15 03:34:43

从存储器中先前存储的样本生成纯正弦波的方法以不同的速率/存储位置读取存储器以改变正弦波的频率和/或频谱纯度称为直接数字合成。

这使您能够生成具有所需频谱纯度的各种正弦频率。适用于手机和平板电脑软件定义无线电的&任何其他类似的应用程序。 DDS ASIC 也可用,但通常价格昂贵。

FPGA 是更便宜的替代方案。 FPGA只能产生所需的数字输出,但如果没有滤波器或DAC和DAC,就无法产生模拟信号。一些基本的过滤。

大多数 FPGA 供应商都在其 IDE(集成开发环境)中提供免费的 DDS IP 核。查看 Actel/Xilinx/Altera IP。他们是免费的。如果你无法获得IP,你可以在Matlab和DDS中拉一个DDS功能块。利用第 3 方工具(上述所有三个供应商均提供)通过 Matlab 接口合成 DDS。 DDS 有时也称为 DDFS:直接数字频率合成。

The Method of generating Pure Sine waves from a previously stored samples in memory & reading the memory at varying rate / memory locations to change the frequency and or the spectral purity of the sine wave is called Direct Digital Synthesis.

This allows you to generate wide range of sine freq's with the required spectral purity. Useful in Mobiles & Software Defined Radio's & any other similar application. DDS ASIC's are also available but are usually expensive.

FPGA's are cheaper alternative. FPGA can only generate the required Digital output , but the analog singal cant be generated without a filter or a DAC & some basic filtering.

Most FPGA vendors have a free DDS IP Core with their IDE (Integrated Dev Environment). Checkout Actel/ Xilinx / Altera IP's. They're free. If you cannot manage to get an IP, you can pull a DDS function block in Matlab & utilize a 3rd party tool .. (available with all three above vendors) to synthesize a DDS via Matlab Interface . DDS is sometimes also known as DDFS : Direct Digital Frequency Synthesis.

浅忆流年 2024-09-15 03:34:43

除了极少数混合信号模型(例如一些 Actel 产品)外,FPGA 不具备所需模拟重构滤波器的组件。它们必须添加到外部。

Except for a very few mixed-signal models (e.g. some Actel products), FPGAs do not have the components for the required analog reconstruction filter. They would have to be added on the outside.

懵少女 2024-09-15 03:34:43
library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.NUMERIC_STD.ALL;  
-- use this library as much as possible.

entity sinewave is

port (clk :in  std_logic;

      dataout : out real range -1.0 to 1.0);

end sinewave;

architecture Behavioral of sinewave is

signal i : integer range 0 to 77:=0;

type memory_type is array (0 to 71) of real range  -1.0000 to 1.0000 ;

--ROM for storing the sine values generated.

signal temp : memory_type :=(0.0,0.0872, 0.1736, 0.2588, 0.3420, 0.4226, 0.5000, 0.5736, 0.6428, 0.7071, 0.7660, 
                             0.8191, 0.8660, 0.9063, 0.9397, 0.9659, 0.9848, 0.9962, 1.0000,0.9962,0.9848,0.9659,
                             0.9397, 0.9063, 0.8660, 0.8191, 0.7660, 0.7071, 0.6428, 0.5000, 0.4226, 0.3420, 0.2588, 
                             0.1736, 0.0872,0.0, 0.0,-0.0872,-0.1736, -0.2588, -0.3420,-0.4226, -0.5000, -0.5736, 
                            -0.6428, -0.7071, -0.7660, -0.8191, -0.8660, -0.9063, -0.9397, -0.9659, -0.9848, -0.9962, 
                            -1.0000,-0.9962,-0.9848,-0.9659,-0.9397, -0.9063, -0.8660, -0.8191, 
                            -0.766, -0.7071, -0.6428, -0.5000, -0.4226, -0.3420, -0.2588, -0.1736, -0.0872,0.0);


begin

process(clk)

begin

  --to check the rising edge of the clock signal

if(rising_edge(clk)) then    

dataout <= temp(i);

i <= i+ 1;

if(i = 71) then

i <= 0;

end if;

end if;

end process;

end Behavioral;

解决这个实现
它显示的误差大于表达式 1.000 预期的常数值

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.NUMERIC_STD.ALL;  
-- use this library as much as possible.

entity sinewave is

port (clk :in  std_logic;

      dataout : out real range -1.0 to 1.0);

end sinewave;

architecture Behavioral of sinewave is

signal i : integer range 0 to 77:=0;

type memory_type is array (0 to 71) of real range  -1.0000 to 1.0000 ;

--ROM for storing the sine values generated.

signal temp : memory_type :=(0.0,0.0872, 0.1736, 0.2588, 0.3420, 0.4226, 0.5000, 0.5736, 0.6428, 0.7071, 0.7660, 
                             0.8191, 0.8660, 0.9063, 0.9397, 0.9659, 0.9848, 0.9962, 1.0000,0.9962,0.9848,0.9659,
                             0.9397, 0.9063, 0.8660, 0.8191, 0.7660, 0.7071, 0.6428, 0.5000, 0.4226, 0.3420, 0.2588, 
                             0.1736, 0.0872,0.0, 0.0,-0.0872,-0.1736, -0.2588, -0.3420,-0.4226, -0.5000, -0.5736, 
                            -0.6428, -0.7071, -0.7660, -0.8191, -0.8660, -0.9063, -0.9397, -0.9659, -0.9848, -0.9962, 
                            -1.0000,-0.9962,-0.9848,-0.9659,-0.9397, -0.9063, -0.8660, -0.8191, 
                            -0.766, -0.7071, -0.6428, -0.5000, -0.4226, -0.3420, -0.2588, -0.1736, -0.0872,0.0);


begin

process(clk)

begin

  --to check the rising edge of the clock signal

if(rising_edge(clk)) then    

dataout <= temp(i);

i <= i+ 1;

if(i = 71) then

i <= 0;

end if;

end if;

end process;

end Behavioral;

Solve this implementation
It shows error than constant value expected for expression 1.000

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文