################################################################################
# FICHE DE MODELE SABER : ED:1 REV:0
# AUTEUR:OCSIMIZE DATE:04/21/07
#
# FICHIER glitchsuppress_oc.sin : ind.a
# ETAT : valid
################################################################################
################################################################################
# Copyright 2007 and beyond, Ocsimize.
# This template may not be reproduced or modified
# without permission from Ocsimize. Ocsimize does not assume
# liability for the use of this template or the results
# obtained from using it as long as it is not validated.
################################################################################
################################################################################
# MODIFICATION
#
# 04/21/07: creation
#
################################################################################
#
# pins
#
################################################################################
# Name Type Signification
#
# in logic_4 signal input
# out logic_4 filtered signal output
#
################################################################################
#
# Parameters definition
#
################################################################################
# Name Default value Signification
#
# del 5u (s) time duration under which double signal change
# is ignored
# startdel 40u (s) from 0 to startdel filtering is down
#
################################################################################
#
# Postprocess information
#
################################################################################
# Name Unit Signification
#
# - - -
#
################################################################################
#
# usage
#
################################################################################
#
# This template remove quick change from digital signal (glitch)
#
#
# ---- ----- ---------
# | | | | | |
# | | | | | |
# ----- - - ---------- -- --
# (in) o--| |--o (out)
# ----------
#
################################################################################
# Notes :
################################################################################
#
# * the signal transitions are delayed of del seconds
# * this inhibition function works from "0" to "startDel" not from
# "retart time" to "restart time + startDel"
#
################################################################################
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
#==============================================================================#
template glitchsuppress_oc in out = del,startdel
#==============================================================================#
state logic_4 in, out
number del = 5u,startDel=40u
{
state logic_4 clock=l4_0
state nu change[2]
state time timetosee=startdel
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
when(dc_init ) {
# copy in --> out, watchdog set (clock = l4_0) nothing is accepted before
# del seconds
schedule_event(time,out,in)
clock = l4_0
change=schedule_event (time + del, clock, l4_1)
}
when(time_init ) {
schedule_event(time,out,in)
# be sure to have watchdog set
if(clock==l4_1) {
schedule_event(time,out,in)
clock = l4_0
}
}
when(event_on(clock) & time_domain) {
# del seconds after the latest change watchdog is down and
# we can accept copy in --> out and set watchdog (clock = l4_0)
if(clock==l4_1) {
schedule_event(time,out,in)
clock = l4_0
}
}
when(event_on(in) & time_domain) {
# there was a change but it is a transitory situation
# as the watchdog is still set and the watchdog time is over
if(clock==l4_0 & (time >= timetosee)) {
deschedule(change)
# schedule_event(time,out,in)
change=schedule_event(time + del,clock,l4_1)
timetosee=time+del
}
# there was a change and it is accepted as we
# still are in starting time
else if(time<startDel) {
schedule_event(time,out,in)
}
# there was a change and it is not accepted as we
# still are in watchdog time
else if(time>=startDel & time<timetosee) {
clock = l4_0
deschedule(change)
change=schedule_event(time + del,clock,l4_1)
timetosee= time+del
}
}
}
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8