- 把所有的图像文件名称放到一个文件里, 一行一个
- 把图像文件名读到一个tcl的列表里
注意tcNames需要是全局变量
set FSIZE_B 100
set gcnt 0
array set tcNames { }
# read out the testcase name fromt he file
proc getTCNames {path} {
global tcNames
set fileHandle [open $path {RDONLY}]
set tcNames [split [read $fileHandle nonewline] "\n"]
close $fileHandle
}
- 定义load 文件函数
proc loadNewFile {{mempath "dut.m1.sram.mem"}} {
global gcnt
global tcNames
set filename [lindex $tcNames $gcnt]
puts $filename
#if the file size is less than FSIZE_B, then wait
while { [file size $filename] < $FSIZE_B } {
sleep 1s
}
memory -load $mempath -file $filename
incr gcnt;
}
- 定义sdl
# if the current image id processed, load the new image
INSTANCE loadNext;
state s0 {
if (dut.BFM.nextImg == 'bP)
{
DISPLAY("the current image is done at %t");
exec "loadNewFile";
}
}
# if the all testcase is done
INSTANCE monDone;
state s0 {
if ( dut.BFM.done == 1 ) {
trigger;
DISPLAY("the emulation is done at %t");
}
}
- run script
emu_init
getTCNames ../tc_list
loadNewFile
sdl -load ld.tdf
sdl -enable
emu_run