论坛» DIY与开源设计» 电子DIY

modelsim 软件仿真

菜鸟
2013-06-28 22:29 1楼

没有参加DIY,因为没有时间工具自己焊接,买了一块CPLD的板子,但我想以后用软件仿真还是比较多,所以需要学习使用软件仿真。,

在网上搜索很长时间,发现没有一个比较好的说明i主,要测试代码处没有说明。最后,根据mod就elsim中的帮助文件,tutorial终于初步成功,

quartus II 12

Modelsim使用verilog软件仿真:参考资料help-pdf documentation-tutorial,我使用vhdl的没有成功。

1,建立目录,copy D:\altera\13.0\modelsim_ase\examples\tutorials\verilog\basicSimulation目录下的counter.v ,tcounter.v文件到新建目录下。tcounter.v为测试文件。

2,new -project ,选择增加文件,

3,compile-compile all,会编译并把文件增加到work 中,

4,在libary - work 中双击test_counter,进入仿真

5,instance中,右键add to -wave -all items in region.波形图

6,运行,有波形出现。

7,断点:files中, 双击sim下的文件,进入文件,可以加断点



quartusII 中仿真


1,新建目录,copy 文件

2,新建工程,project wizard,工程名为counter,如名称不为这,需要更改代码,tools setting 中simulation,选择modelsim altera ,verilog

3,编译,

4,tools-rtl simulation,进入modelsim,中间已经有一个couter文件

5,加入tcouter,使用compile-compile选择tcouter.v

6,转入modelsim仿真中的步骤4



quartusII中更改名称


1,project 名称为test

2, 更改counter.v

module counter 中改为test,save as test.v

3.编译

4,更改tcouter.v

counter dut 中改为test dut

5,project ,add file 增加tcouter.v,编译

6,选择test.v仿真

7,转到quartusII 中仿真步骤5



quartusII生产测试程序


1.processing-start -start test bench,在.\simulation\modelsim中有test.vt文件

2,test.vt 中增加测试代码,参考tcouter,加入时钟与reset赋值等

3.转入quartusII步骤5,加入test.vt


测试程序分析

1.测试程序主要为主程序提供输入信号,如例程中clk,reset 为,input,测试程序中使用reg,count 为output,测试程序中为wire

2.使用test il进行口线关联,.clk(clk);

3.对测试输出信号进行编程,begin end即主程序得到输入信号。


菜鸟
2013-06-28 22:56 2楼

VHDL软件仿真

1。modelsim中的vhdl例程使用quartus II编译不通过,

if reset'event then,此处因为表示边沿,有些编译器不识别

2,其余仿真与verilog一样,注意时间,时间必须右pS变为nS,并使用zoom full可以看到全部波形

3,直接使用modelsim编译正常,仿真正常,


例程分析

1,使用component 申明counter

2, 输出使用signal定义

3,使用dut进行关联

4,编程输入信号。

菜鸟
2013-06-28 22:56 3楼
ISE 软件仿真
菜鸟
2013-06-28 22:57 4楼
3
菜鸟
2013-06-28 22:57 5楼
4
高工
2013-06-28 23:13 6楼
楼主占贴是不是要出教程啊,期待
院士
2013-06-30 17:33 7楼
这也不错,自娱自乐的
菜鸟
2013-06-30 21:41 8楼
找个地方保存调试记录,否则以后找不到,
共8条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册]