码迷,mamicode.com
首页 > 其他好文 > 详细

Modelsim仿真.do脚本示例

时间:2018-05-10 18:13:51      阅读:660      评论:0      收藏:0      [点我收藏+]

标签:col   bsp   定义   stat   virtual   状态机   工程   UNC   add   

#“#”为注释

#删除原有工程,需重启Modelsim

#vdel -all -lib work

#退出当前仿真

quit -sim

#清空命令行显示

.main clear

#创建库,是实际存在的物理库

vlib ./lib
vlib ./lib/design_work
vlib ./lib/sim_work
vlib ./lib/altera_work

 

#映射逻辑库到指定的物理库

vmap d_work ./lib/design_work
vmap s_work ./lib/sim_work
vmap a_work ./lib/altera_work

#编译代码文件到逻辑库

vlog -work s_work ./tb_serial_detec.v
vlog -work d_work ./../design/*.vo
vlog -work a_work ./altera_lib/*.v

#连接逻辑库,并启动仿真

vsim -t ns -sdfmax tb_serial_detec/serial_detec_inst=serial_detec_v.sdo -voptargs=+acc -L s_work -L d_work -L a_work s_work.tb_serial_detec

#状态机中状态的定义,用于显示

virtual type {
{0x001 s0}
{0x002 s1}
{0x004 s2}
{0x008 s3}
{0x010 s4}
{0x020 s5}
{0x040 s6}
{0x080 s7}
{0x100 s8}
} new_state

virtual function {(new_state)/tb_serial_detec/serial_detec_inst/c_state} state

#添加波形

add wave -divider {tb_serial_detec}
add wave -color yellow tb_serial_detec/*
add wave -divider {serial_detec}
add wave -color blue tb_serial_detec/serial_detec_inst/sclk
add wave -color blue tb_serial_detec/serial_detec_inst/rst_n
add wave -color blue tb_serial_detec/serial_detec_inst/i_bit
add wave -color blue tb_serial_detec/serial_detec_inst/detec_success

#状态机状态显示

add wave -color red tb_serial_detec/serial_detec_inst/state

#设定仿真运行时间

run  50us

 

Modelsim仿真.do脚本示例

标签:col   bsp   定义   stat   virtual   状态机   工程   UNC   add   

原文地址:https://www.cnblogs.com/MAQI/p/9020888.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!