使用 Dsp Builder 设计正弦信号发生器
在 simulink 中使用 Altera Dsp Builder Blockset(安装好 dsp builder 后)下的模块按上图
所示连接号各个模块。
Simulink 下的仿真如图所示:
PS:怎样 copy 示波器显示图形
在 Matlab 的 Command Window 中输入
>> set(0,'ShowHiddenHandles','on');set(gcf,'menubar','figure');
SignalCompiler 使用方法
对于手动设计流程,适配步骤已没必要,通常只需完成前两个步骤即可。
使用 ModelSim 进行 RTL 级仿真(RTL--register transfer level)
To perform RTL simulation with the ModelSim software, you must add a TestBench
block.
Perform the following steps:
1. Select the AltLab library from the Altera DSP Builder BlockSet folder in the
Simulink Library Browser.
2. Drag and drop a TestBench block into your model.
3. Double-click on the new TestBench block.
4. Ensure that Enable Test Bench generation is on.
5. Click the Advanced tab (下图).
6. Turn on the Launch GUI option. This option causes the ModelSim GUI to be
launched when ModelSim simulation is invoked.
7.
Click Generate HDL to generate a VDHL-based testbench from your model.
8. Click Run Simulink to generate Simulink simulation results for the testbench.
9. Click Run ModelSim to load your design into ModelSim.
Your design is simulated with the output displayed in the ModelSim Wave
window. The testbench initializes all your design registers with a pulse on the
aclr input signal.
10. All waveforms are initially shown using digital format in the ModelSim Wave
window. Change the format of the sinin, sindelay and streammod signals to
analog.
按如下操作:
把光标放到sinout那一项,在wave窗口菜单中选择properties,打开Wave Properties对
话框,在Format选项卡中,更改为下图所示:
RTL级仿真:
使用 Quartu2 实现时序仿真
1.创建一个 quartus2 的工程
点击 New Project Wizard ,按提示创建工程,需注意的地方是在 Family & Device Settings
页器件类型要和 dsp builder 的 SignalCompiler 那选择的一样。
2.将 dsp builder 的设计添加到工程
1. On the View menu in the Quartus II software, point to Utility Windows and click
Tcl Console to display the Tcl Console.
2. Run the singen_add.tcl script that can be found in the
DesignExamples\Tutorials\GettingStartedSinMdl directory by typing the following
command
in the Tcl Console window:
#source <>/DesignExamples/Tutorials/GettingStartedSinMdl/singen_add.tcl
(用 D:、E:……代替)
PS:You must use / separators instead of \ separators in the command path name used
in
the Tcl console window. You can use a relative path if you organize your design data
with the DSP Builder and Quartus II designs in subdirectories of the same design
hierarchy.An example instantiation is added to your Quartus II project.
3. Click the Files tab in the Quartus II software.
4. Right-click singen.mdl and click Select Set as Top-Level Entity.
5. Compile the Quartus II design by clicking Start Compilation on the Processing
Menu.
3.接着编译工程,新建一个.vwf 文件,加到工程中。
Quartus 中仿真时如果出现 no simulation input file assignment specify
按下面方法解决(转载):
翻译成中文就是仿真文件没有被指定,要仿真的话先要建一个仿真文件:
file -> new -> 选择 Other file 选项卡 -> Vector Waveform File
然后把输入输出端口加进去,再设置输入的信号,保存,就可以仿真了。
如果你之前已经建立过了,就打开 assignments->settings->simulator settings
看里面的有个文本框 simulation input 里面是否为空,为空的话就要找到你所建立的
Vector Waveform File 文件,是以*.VMF 结尾的,如果没找到,你又以为你建立了
Vector Waveform File ,很可能粗心的你还没保存 Vector Waveform File ,保存了才会
在 project 里面找到。
创建一个.bdf 文件,并将其设置成顶层文件。
在 file 目录下,右键"sinwave_example.Vhd",点击"creat symbol files for current
file"再在.Bdf 文件中插入建立的这个叫做"sinwave_example"的 symbol,再给它加上 input、
output 的脚什么的,就可以了(如果要下载到硬件上跑,再配置一下引脚 O(∩_∩)O~)。