Dear All:
用Saber有段時(shí)間了,發(fā)現(xiàn)其模型中少了一個(gè)數(shù)字信號(hào)的delay模型;此功能在仿真時(shí),仿真時(shí)還是會(huì)用到的;雖然saber有buffer模型可以進(jìn)行delay,但其是同時(shí)對(duì)上升沿和下降沿進(jìn)行delay的;對(duì)于一些只對(duì)單邊延時(shí)的需要,此模型就愛(ài)莫能助了。因此我利用MAST語(yǔ)言寫(xiě)了一個(gè)delay模型,此模型可對(duì)上升沿、下降沿、雙沿delay進(jìn)行單獨(dú)配置,方便實(shí)際應(yīng)用。有需要的朋友,可以試一下,以下為MAST代碼。
// ..................................//
template delay_mast in out=Td,type
state logic_4 in,out
enum {Rising,Falling,Dual} type=Dual
number Td=0 #Define delay time
{
number del_ID=0 # Identifier of delay type: 1--Rising;-1--Falling;0--Dual
parameters {
if(Td<0) {
error("%:Td should be not less than 0:Td=%",instance(),Td) # error information for Td<0
}
if(type==Rising) {
del_ID=1
}
else if(type==Falling) {
del_ID=-1
}
else {
del_ID=0
}
}
when(dc_init){
schedule_event(time,out,in) #Setting out=in at DC analysis
}
when(event_on(in)){
if(del_ID==0) {
schedule_event(time+Td,out,in)
}
else if(del_ID==1){
if(in==l4_1) {
schedule_event(time+Td,out,in)
}
else {
schedule_event(time,out,in)
}
}
else {
if(in==l4_0){
schedule_event(time+Td,out,in)
}
else {
schedule_event(time,out,in)
}
}
}
}