26 Description = QObject::tr (
"4bit comparator verilog device");
29 QObject::tr (
"transfer function high scaling factor")));
31 QObject::tr (
"output delay")
32 +
" ("+QObject::tr (
"s")+
")"));
44 p->
Props.getFirst()->Value =
Props.getFirst()->Value;
51 Name = QObject::tr(
"4Bit Comparator");
52 BitmapFile = (
char *)
"comp_4bit";
60 Lines.append(
new Line(-40, -90, 40,-90,QPen(Qt::darkBlue,2)));
61 Lines.append(
new Line( 40, -90, 40,100,QPen(Qt::darkBlue,2)));
62 Lines.append(
new Line( 40, 100,-40,100,QPen(Qt::darkBlue,2)));
63 Lines.append(
new Line(-40, 100,-40,-90,QPen(Qt::darkBlue,2)));
65 Lines.append(
new Line(-60,-50,-40,-50,QPen(Qt::darkBlue,2)));
66 Lines.append(
new Line(-60,-30,-40,-30,QPen(Qt::darkBlue,2)));
67 Lines.append(
new Line(-60,-10,-40,-10,QPen(Qt::darkBlue,2)));
68 Lines.append(
new Line(-60, 10,-40, 10,QPen(Qt::darkBlue,2)));
69 Lines.append(
new Line(-60, 30,-40, 30,QPen(Qt::darkBlue,2)));
70 Lines.append(
new Line(-60, 50,-40, 50,QPen(Qt::darkBlue,2)));
71 Lines.append(
new Line(-60, 70,-40, 70,QPen(Qt::darkBlue,2)));
72 Lines.append(
new Line(-60, 90,-40, 90,QPen(Qt::darkBlue,2)));
73 Lines.append(
new Line( 40, 30, 60, 30,QPen(Qt::darkBlue,2)));
74 Lines.append(
new Line( 40, 10, 60, 10,QPen(Qt::darkBlue,2)));
75 Lines.append(
new Line( 40,-10, 60,-10,QPen(Qt::darkBlue,2)));
77 Texts.append(
new Text(-25,-85,
"COMP", Qt::darkBlue, 12.0));
79 Texts.append(
new Text(-25,-40,
"{", Qt::darkBlue, 16.0));
80 Texts.append(
new Text(-15,-35,
"X", Qt::darkBlue, 12.0));
81 Texts.append(
new Text(-35,-63,
"0", Qt::darkBlue, 12.0));
82 Texts.append(
new Text(-35,-43,
"1", Qt::darkBlue, 12.0));
83 Texts.append(
new Text(-35,-23,
"2", Qt::darkBlue, 12.0));
84 Texts.append(
new Text(-35, -3,
"3", Qt::darkBlue, 12.0));
85 Texts.append(
new Text(-25, 42,
"{", Qt::darkBlue, 16.0));
86 Texts.append(
new Text(-15, 47,
"Y", Qt::darkBlue, 12.0));
87 Texts.append(
new Text(-35, 17,
"0", Qt::darkBlue, 12.0));
88 Texts.append(
new Text(-35, 37,
"1", Qt::darkBlue, 12.0));
89 Texts.append(
new Text(-35, 57,
"2", Qt::darkBlue, 12.0));
90 Texts.append(
new Text(-35, 77,
"3", Qt::darkBlue, 12.0));
91 Texts.append(
new Text( 5, 17,
"X<Y", Qt::darkBlue, 12.0));
92 Texts.append(
new Text( 5, -3,
"X>Y", Qt::darkBlue, 12.0));
93 Texts.append(
new Text( 5,-23,
"X=Y", Qt::darkBlue, 12.0));
115 QString td =
Props.at(1)->Value;
119 QString X0 =
Ports.at(0)->Connection->Name;
120 QString X1 =
Ports.at(1)->Connection->Name;
121 QString X2 =
Ports.at(2)->Connection->Name;
122 QString X3 =
Ports.at(3)->Connection->Name;
123 QString Y0 =
Ports.at(4)->Connection->Name;
124 QString Y1 =
Ports.at(5)->Connection->Name;
125 QString Y2 =
Ports.at(6)->Connection->Name;
126 QString Y3 =
Ports.at(7)->Connection->Name;
127 QString L =
Ports.at(8)->Connection->Name;
128 QString G =
Ports.at(9)->Connection->Name;
129 QString E =
Ports.at(10)->Connection->Name;
131 s =
"\n "+
Name+
":process ("+X0+
", "+X1+
", "+X2+
", "+X3+
", "+Y0+
", "+Y1+
", "+Y2+
", "+Y3+
")\n"+
132 " variable P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11 : std_logic;\n"+
134 " P0 := not ("+X0+
" xor "+Y0+
");\n"+
135 " P1 := not ("+X1+
" xor "+Y1+
");\n"+
136 " P2 := not ("+X2+
" xor "+Y2+
");\n"+
137 " P3 := not ("+X3+
" xor "+Y3+
");\n"+
138 " P4 := (not "+X0+
") and "+Y0+
";\n"+
139 " P5 := (not "+X1+
") and "+Y1+
";\n"+
140 " P6 := (not "+X2+
") and "+Y2+
";\n"+
141 " P7 := (not "+X3+
") and "+Y3+
";\n"+
142 " P8 := "+X0+
" and (not "+Y0+
");\n"+
143 " P9 := "+X1+
" and (not "+Y1+
");\n"+
144 " P10 := "+X2+
" and (not "+Y2+
");\n"+
145 " P11 := "+X3+
" and (not "+Y3+
");\n"+
146 " "+L+
" <= P7 or (P3 and P6) or (P3 and P2 and P5) or (P3 and P2 and P1 and P4)"+td+
147 " "+G+
" <= P11 or (P3 and P10) or (P3 and P2 and P9) or (P3 and P2 and P1 and P8)"+td+
148 " "+E+
" <= P3 and P2 and P1 and P0"+td+
157 QString td =
Props.at(1)->Value;
160 QString X0 =
Ports.at(0)->Connection->Name;
161 QString X1 =
Ports.at(1)->Connection->Name;
162 QString X2 =
Ports.at(2)->Connection->Name;
163 QString X3 =
Ports.at(3)->Connection->Name;
164 QString Y0 =
Ports.at(4)->Connection->Name;
165 QString Y1 =
Ports.at(5)->Connection->Name;
166 QString Y2 =
Ports.at(6)->Connection->Name;
167 QString Y3 =
Ports.at(7)->Connection->Name;
168 QString L =
Ports.at(8)->Connection->Name;
169 QString G =
Ports.at(9)->Connection->Name;
170 QString E =
Ports.at(10)->Connection->Name;
172 QString LR =
"L_reg" +
Name + L;
173 QString GR =
"G_reg" +
Name + G;
174 QString ER =
"E_reg" +
Name + E;
176 l =
"\n // "+
Name+
" 4bit comparator\n"+
177 " assign "+L+
" = "+LR+
";\n"+
178 " reg "+LR+
" = 0;\n"+
179 " assign "+G+
" = "+GR+
";\n"+
180 " reg "+GR+
" = 0;\n"+
181 " assign "+E+
" = "+ER+
";\n"+
182 " reg "+ER+
" = 0;\n"+
183 " reg P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11;\n"+
184 " always @ ("+X0+
" or "+X1+
" or "+X2+
" or "+X3+
" or "+Y0+
" or "+Y1+
" or "+Y2+
" or "+Y3+
")\n"+
186 " P0 = ~("+X0+
" ^ "+Y0+
");\n"+
187 " P1 = ~("+X1+
" ^ "+Y1+
");\n"+
188 " P2 = ~("+X2+
" ^ "+Y2+
");\n"+
189 " P3 = ~("+X3+
" ^ "+Y3+
");\n"+
190 " P4 = (~"+X0+
") && "+Y0+
";\n"+
191 " P5 = (~"+X1+
") && "+Y1+
";\n"+
192 " P6 = (~"+X2+
") && "+Y2+
";\n"+
193 " P7 = (~"+X3+
") && "+Y3+
";\n"+
194 " P8 = "+X0+
" && (~"+Y0+
");\n"+
195 " P9 = "+X1+
" && (~"+Y1+
");\n"+
196 " P10 = "+X2+
" && (~"+Y2+
");\n"+
197 " P11 = "+X3+
" && (~"+Y3+
");\n"+
198 " "+LR+
" <="+td+
" P7 || (P3 && P6) || (P3 && P2 && P5) || (P3 && P2 && P1 && P4)"+
";\n"+
199 " "+GR+
" <="+td+
" P11 || (P3 && P10) || (P3 && P2 && P9) || (P3 && P2 && P1 && P8)"+
";\n"+
200 " "+ER+
" <="+td+
" P3 && P2 && P1 && P0"+
";\n"+
bool VHDL_Delay(QString &td, const QString &Name)
bool Verilog_Delay(QString &td, const QString &Name)
Definitions and declarations for the main application.
Q3PtrList< Property > Props
Superclass of all schematic drawing elements.
static Element * info(QString &, char *&, bool getNewOne=false)
virtual void recreate(Schematic *)