26 Description = QObject::tr (
"2bit 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(
"2Bit Comparator");
52 BitmapFile = (
char *)
"comp_2bit";
60 Lines.append(
new Line(-40, -50, 40,-50,QPen(Qt::darkBlue,2)));
61 Lines.append(
new Line( 40, -50, 40, 60,QPen(Qt::darkBlue,2)));
62 Lines.append(
new Line( 40, 60,-40, 60,QPen(Qt::darkBlue,2)));
63 Lines.append(
new Line(-40, 60,-40, -50,QPen(Qt::darkBlue,2)));
65 Lines.append(
new Line(-60,-10,-40,-10,QPen(Qt::darkBlue,2)));
66 Lines.append(
new Line(-60, 10,-40, 10,QPen(Qt::darkBlue,2)));
67 Lines.append(
new Line(-60, 30,-40, 30,QPen(Qt::darkBlue,2)));
68 Lines.append(
new Line(-60, 50,-40, 50,QPen(Qt::darkBlue,2)));
69 Lines.append(
new Line( 40, 30, 60, 30,QPen(Qt::darkBlue,2)));
70 Lines.append(
new Line( 40, 10, 60, 10,QPen(Qt::darkBlue,2)));
71 Lines.append(
new Line( 40,-10, 60,-10,QPen(Qt::darkBlue,2)));
73 Texts.append(
new Text(-25,-45,
"COMP", Qt::darkBlue, 12.0));
75 Texts.append(
new Text(-25,-20,
"{", Qt::darkBlue, 16.0));
76 Texts.append(
new Text(-15,-15,
"X", Qt::darkBlue, 12.0));
77 Texts.append(
new Text(-35,-23,
"0", Qt::darkBlue, 12.0));
78 Texts.append(
new Text(-35, -3,
"1", Qt::darkBlue, 12.0));
79 Texts.append(
new Text(-25, 22,
"{", Qt::darkBlue, 16.0));
80 Texts.append(
new Text(-15, 27,
"Y", Qt::darkBlue, 12.0));
81 Texts.append(
new Text(-35, 17,
"0", Qt::darkBlue, 12.0));
82 Texts.append(
new Text(-35, 37,
"1", Qt::darkBlue, 12.0));
83 Texts.append(
new Text( 5, 17,
"X<Y", Qt::darkBlue, 12.0));
84 Texts.append(
new Text( 5, -3,
"X>Y", Qt::darkBlue, 12.0));
85 Texts.append(
new Text( 5,-23,
"X=Y", Qt::darkBlue, 12.0));
103 QString td =
Props.at(1)->Value;
107 QString X0 =
Ports.at(0)->Connection->Name;
108 QString X1 =
Ports.at(1)->Connection->Name;
109 QString Y0 =
Ports.at(2)->Connection->Name;
110 QString Y1 =
Ports.at(3)->Connection->Name;
111 QString L =
Ports.at(4)->Connection->Name;
112 QString G =
Ports.at(5)->Connection->Name;
113 QString E =
Ports.at(6)->Connection->Name;
115 s =
"\n "+
Name+
":process ("+X0+
", "+X1+
", "+Y0+
", "+Y1+
")\n"+
117 " "+L+
" <= ((not "+X1+
") and "+Y1+
") or (not ("+X1+
" xor "+Y1+
") and (not ("+X0+
") and "+Y0+
"))"+td+
118 " "+G+
" <= ("+X1+
" and (not "+Y1+
"))"+
" or (not ("+X1+
" xor "+Y1+
") and ("+X0+
" and (not "+Y0+
")))"+td+
119 " "+E+
" <= (not ("+X1+
" xor "+Y1+
")) and (not ("+X0+
" xor "+Y0+
"))"+td+
128 QString td =
Props.at(1)->Value;
131 QString X0 =
Ports.at(0)->Connection->Name;
132 QString X1 =
Ports.at(1)->Connection->Name;
133 QString Y0 =
Ports.at(2)->Connection->Name;
134 QString Y1 =
Ports.at(3)->Connection->Name;
135 QString L =
Ports.at(4)->Connection->Name;
136 QString G =
Ports.at(5)->Connection->Name;
137 QString E =
Ports.at(6)->Connection->Name;
139 QString LR =
"L_reg" +
Name + L;
140 QString GR =
"G_reg" +
Name + G;
141 QString ER =
"E_reg" +
Name + E;
143 l =
"\n // "+
Name+
" 2bit comparator\n"+
144 " assign "+L+
" = "+LR+
";\n"+
145 " reg "+LR+
" = 0;\n"+
146 " assign "+G+
" = "+GR+
";\n"+
147 " reg "+GR+
" = 0;\n"+
148 " assign "+E+
" = "+ER+
";\n"+
149 " reg "+ER+
" = 0;\n"+
150 " always @ ("+X0+
" or "+X1+
" or "+Y0+
" or "+Y1+
")\n"+
152 " "+LR+
" <="+td+
" ((~"+X1+
") && "+Y1+
") || (~("+X1+
" ^ "+Y1+
") && (~("+X0+
") && "+Y0+
"));\n"+
153 " "+GR+
" <="+td+
" ("+X1+
" && (~"+Y1+
"))"+
" || (~("+X1+
" ^ "+Y1+
") && ("+X0+
" && (~"+Y0+
")));\n"+
154 " "+ER+
" <="+td+
" (~("+X1+
" ^ "+Y1+
")) && (~("+X0+
" ^ "+Y0+
"));\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
static Element * info(QString &, char *&, bool getNewOne=false)
Superclass of all schematic drawing elements.
virtual void recreate(Schematic *)