(*-- LES DEFAUTS SONT DANS LES BITS DU MOT WDEF_N ---*)
(*Bit horloge 5s*)
TON_0(IN:=NOT H5s, PT:=t#5s, Q=>H5s);
(* Bits qui ont changés d'état dans WDEF_N *)
WXOR:=WDEF_N XOR WDEF_M;
(* Bits en apparitions*)
WAPP:=WXOR AND WDEF_N;
(* Mémoire Etat N->N-1 *)
WDEF_M:=WDEF_N;
(*Raz FIFO *)
FIFO_0 (R:=%S0 or %S1 or %S13, SET:=false,GET:=false, X:=XX,N_MAX:=128, FULL=>FIFO_PLEIN,EMPTY=>FIFO_VIDE,Y=> OUT_DEF) ;
(*Entrée des défauts en apparition dans registre FIFO *)
for XX:=1 to 16 do
if WAPP.0 then
FIFO_0 (SET:=true,GET:=false, X:=XX, N_MAX:=128, Y=>OUT_DEF) ;
end_if;
WAPP:=SHR(WAPP,1);
END_FOR;
(*Extraction des n°de défauts du FIFO pour affichage toutes les 5s *)
if H5s then
FIFO_0(SET:=false,GET:=true, X:=XX,N_MAX:=128, Y=>OUT_DEF) ;
if OUT_DEF>0 then
(*n°défaut*)
BYTE0:=INT_TO_BYTE(OUT_DEF);
(*faire l'affichage ici*)
OUT_DEF:=0;
end_if;
end_if;