1 /****************************************************************************
2 Copyright (C) 1987-2015 by Jeffery P. Hansen
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 Last edit by hansen on Mon Jan 19 18:17:11 2009
19 ****************************************************************************/
20 #include "tkgate.h"
21
22 #define PMOS_IN 0
23 #define PMOS_OUT 1
24
25 void Mos_WriteCellDef(FILE *f,GCellSpec *gcs);
26
27 static iconDimensions pmos_iconDims[] = {
28 {0, 0, 14, 18, 7, 9},
29 {0, 19, 18, 14, 9, 7},
30 {19, 15, 14, 18, 7, 7},
31 {15, 0, 18, 14, 7, 7},
32 };
33 static int pmos_iconBoldOffset = 34;
34
35 GPadLoc pmos_data_loc[] ={ /* Tr. data */
36 {6,-8,6,-8,D_UP},
37 {-7,-8,-7,-8,D_LEFT},
38 {-8,8,-8,8,D_DOWN},
39 {8,7,8,7,D_RIGHT}};
40
41 GPadLoc pmos_out_loc[] = { /* Tr. out */
42 {6,9,6,9,D_DOWN},
43 {8,-8,8,-8,D_RIGHT},
44 {-8,-7,-8,-7,D_UP},
45 {-7,7,-7,7,D_LEFT}};
46
47 GPadLoc pmos_gate_loc[] = { /* Tr. gate */
48 {-8,0,-8,0,D_LEFT},
49 {0,7,0,7,D_DOWN},
50 {7,0,7,0,D_RIGHT},
51 {0,-8,0,-8,D_UP}};
52
53 static char *psPmos[] = {
54 "%",
55 "% An PMOS gate",
56 "%",
57 "/pspmos {",
58 " [[0 1][1 -1][-1 0][1 1]] adjstartgate",
59 " -8 9 moveto",
60 " -8 -8 lineto stroke",
61 " 6.5 8.5 moveto",
62 " -4 8.5 lineto",
63 " -4 -7.5 lineto",
64 " 6.5 -7.5 lineto stroke",
65 " closepath fill",
66 " -3.5 8.5 moveto",
67 " -0.5 11 lineto",
68 " -0.5 6 lineto",
69 " closepath fill",
70 " grestore",
71 "} bind def",
72 0
73 };
74
75 GGateInfo gate_pmos_info = {
76 0,
77 "PMOS",
78 "pmos",0x0,
79 "pspmos",psPmos,
80 -1,0,
81
82 {{"Ctl-t p", {"gm.gate",0}, {"gm.gate.pmos",0,"tr"}, "gat_make PMOS"},
83 {0}
84 },
85 pmos_iconDims,
86
87 3,{
88 {"Z",OUT,1,1,pmos_out_loc,0},
89 {"S",IN,1,1,pmos_data_loc,0},
90 {"G",IN,1,1,pmos_gate_loc,0}},
91 {{10,4,LJ},{0,-12,CT},{-10,4,RJ},{0,18,CT}},
92 {1},
93
94 {"Diz","Dgz",0},
95
96 Generic_Make,
97 Mos_WriteCellDef,
98 Generic_Init,
99 Generic_Delete,
100 Generic_GetExtents,
101 Generic_HitDistance,
102 Generic_Draw,
103 Generic_Move,
104 Generic_Copy,
105 Err_AddInput,
106 Err_AddOutput,
107 Err_AddInOut,
108 Generic_Rotate,
109 Err_RemovePort,
110 Err_ChangePin,
111 Nop_SimInitFunc,
112 Nop_SimHitFunc,
113 Generic_PSWrite,
114 Generic_EditProps,
115 Generic_VerSave,
116 };
117
init_pmos()118 void init_pmos()
119 {
120 Pixmap P;
121
122 P = Pixmap_registerFromFile("pmos","pmos.b");
123 gateinfo_iconInit(&gate_pmos_info,P,pmos_iconDims,pmos_iconBoldOffset);
124 RegisterGate(&gate_pmos_info);
125 }
126