%% gh
%% Les portes logiques
%% échelle et étendue de l'image
60 setxunit
-.5 10.5 setxrange
0 5 setyrange
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% définitions des couleurs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/coul0 {0 0 0 0.5 setcmykcolor} def %gris
/coul1 {noir} def
/coul2 {orange} def
/coul3 {rouge} def
/coul4 {bleu} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Bibliothèque logic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
uselogic
/loadnodedict true def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Les portes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 setlinewidth
setPalatino
/abs1 { 2 } def
/abs2 { 8 } def
% Relais BUF
coul2
(buf) node
abs1 4 [.4 dup] (BUF) ccpict
$A$
bufin [1.5 dup] cltexlabel
$S=A$
bufout [1.5 dup] crtexlabel
(RELAIS (buf)) abs1 2.5 sub 4 [1.5 dup] crtext
% Et AND
coul1
(and) node
abs1 3 [.4 dup] (AND) ccpict
$A$
andin1 [1.5 dup] cltexlabel
$B$
andin0 [1.5 dup] cltexlabel
$S=AB$
andout [1.5 dup] crtexlabel
(ET (and)) abs1 2.5 sub 3 [1.5 dup] crtext
% Ou OR
(or) node
abs1 2 [.4 dup] (OR) ccpict
$A$
orin1 [1.5 dup] cltexlabel
$B$
orin0 [1.5 dup] cltexlabel
$S=A+B$
orout [1.5 dup] crtexlabel
(OU (or)) abs1 2.5 sub 2 [1.5 dup] crtext
% Oux XOR
(xor) node
abs1 1 [.4 dup] (XOR) ccpict
$A$
xorin1 [1.5 dup] cltexlabel
$B$
xorin0 [1.5 dup] cltexlabel
$S=A \oplus B$
xorout [1.5 dup] crtexlabel
(OUX (xor)) abs1 2.5 sub 1 [1.5 dup] crtext
% Non INV
(inv) node
abs2 4 [.4 dup] (INV) ccpict
$A$
invin [1.5 dup] cltexlabel
$S=\overline{A}$
invout [1.5 dup] crtexlabel
(NON (inv)) abs2 3.5 sub 4 [1.5 dup] crtext
% Non Et NAND
(nand) node
abs2 3 [.4 dup] (NAND) ccpict
$A$
nandin1 [1.5 dup] cltexlabel
$B$
nandin0 [1.5 dup] cltexlabel
$S=\overline{A B}$
nandout [1.5 dup] crtexlabel
(NON ET (nand)) abs2 3.5 sub 3 [1.5 dup] crtext
% Non Ou NOR
(nor) node
abs2 2 [.4 dup] (NOR) ccpict
$A$
norin1 [1.5 dup] cltexlabel
$B$
norin0 [1.5 dup] cltexlabel
$S=\overlin{A + B}$
norout [1.5 dup] crtexlabel
(NON OU (nor)) abs2 3.5 sub 2 [1.5 dup] crtext
% Non Oux NXOR
coul2
(nxor) node
abs2 1 [.4 dup] (NXOR) ccpict
$A$
nxorin1 [1.5 dup] cltexlabel
$B$
nxorin0 [1.5 dup] cltexlabel
$S=\overline{A \oplus B}$
nxorout [1.5 dup] crtexlabel
(NON OUX (nxor)) abs2 3.5 sub 1 [1.5 dup] crtext