|
楼主 |
发表于 2015-4-28 10:24:20
|
显示全部楼层
另外附上.m文件。即输入的激励
这是我给的m文件,即输入的激励:
function [iport,tnext] = test(oport, tnow, portinfo)
tnext=[];
iport=struct();
persistent inc;
persistent rst;
CLK_PERIOD = 1e-8;
RST_MUL_TIME = 5;
RST_TIME = RST_MUL_TIME * CLK_PERIOD;
if isempty(inc)
inc=0;
iport.addin=dec2bin(0,12);
iport.en=dec2bin(0,1);
end
inc =inc+1;
if tnow <= RST_TIME
rst = dec2bin(0, 1);
inc=[];
else
rst = dec2bin(1, 1);
end
if inc>=10
iport.addin=dec2bin(inc,12);
iport.en=dec2bin(1,1);
end
if 30==mvl2dec(oport.addout)
iport.en=dec2bin(0,1);
end
iport.rst_n=rst;
end |
|