26 Description = QObject::tr (
"4bit grey to binary converter verilog device");
29 QObject::tr (
"transfer function scaling factor")));
31 QObject::tr (
"output delay")
32 +
" ("+QObject::tr (
"s")+
")"));
37 Model =
"greytobinary4bit";
44 p->
Props.getFirst()->Value =
Props.getFirst()->Value;
51 Name = QObject::tr(
"4Bit Grey2Bin");
52 BitmapFile = (
char *)
"greytobinary4bit";
60 Lines.append(
new Line(-30, -60, 30,-60,QPen(QPen::darkBlue,2)));
61 Lines.append(
new Line( 30, -60, 30, 40,QPen(QPen::darkBlue,2)));
62 Lines.append(
new Line( 30, 40,-30, 40,QPen(QPen::darkBlue,2)));
63 Lines.append(
new Line(-30, 40,-30, -60,QPen(QPen::darkBlue,2)));
65 Lines.append(
new Line(-50,-30,-30,-30,QPen(QPen::darkBlue,2)));
66 Lines.append(
new Line(-50,-10,-30,-10,QPen(QPen::darkBlue,2)));
67 Lines.append(
new Line(-50, 10,-30, 10,QPen(QPen::darkBlue,2)));
68 Lines.append(
new Line(-50, 30,-30, 30,QPen(QPen::darkBlue,2)));
70 Lines.append(
new Line( 30, 30, 50, 30,QPen(QPen::darkBlue,2)));
71 Lines.append(
new Line( 30, 10, 50, 10,QPen(QPen::darkBlue,2)));
72 Lines.append(
new Line( 30,-10, 50,-10,QPen(QPen::darkBlue,2)));
73 Lines.append(
new Line( 30,-30, 50,-30,QPen(QPen::darkBlue,2)));
75 Texts.append(
new Text(-16,-59,
"G", QPen::darkBlue, 12.0));
76 Texts.append(
new Text( -2,-59,
"/", QPen::darkBlue, 12.0));
77 Texts.append(
new Text( 5,-59,
"B", QPen::darkBlue, 12.0));
79 Texts.append(
new Text(-25,-43,
"0", QPen::darkBlue, 12.0));
80 Texts.append(
new Text(-25,-23,
"1", QPen::darkBlue, 12.0));
81 Texts.append(
new Text(-25, -3,
"2", QPen::darkBlue, 12.0));
82 Texts.append(
new Text(-25, 17,
"3", QPen::darkBlue, 12.0));
84 Texts.append(
new Text( 15,-43,
"0", QPen::darkBlue, 12.0));
85 Texts.append(
new Text( 15,-23,
"1", QPen::darkBlue, 12.0));
86 Texts.append(
new Text( 15, -3,
"2", QPen::darkBlue, 12.0));
87 Texts.append(
new Text( 15, 17,
"3", QPen::darkBlue, 12.0));
107 QString td =
Props.at(1)->Value;
111 QString
G0 =
Ports.at(0)->Connection->Name;
112 QString
G1 =
Ports.at(1)->Connection->Name;
113 QString
G2 =
Ports.at(2)->Connection->Name;
114 QString
G3 =
Ports.at(3)->Connection->Name;
115 QString
B3 =
Ports.at(4)->Connection->Name;
116 QString
B2 =
Ports.at(5)->Connection->Name;
117 QString
B1 =
Ports.at(6)->Connection->Name;
118 QString
B0 =
Ports.at(7)->Connection->Name;
120 s =
"\n " +
Name +
":process ("+G0+
", "+G1+
", "+G2+
", "+G3+
")\n"+
123 " "+B2+
" <= "+G3+
" xor "+G2+td+
124 " "+B1+
" <= "+G3+
" xor "+G2+
" xor "+G1+td+
125 " "+B0+
" <= "+G3+
" xor "+G2+
" xor "+G1+
" xor "+G0+td+
132 QString td =
Props.at(1)->Value;
135 QString
G0 =
Ports.at(0)->Connection->Name;
136 QString
G1 =
Ports.at(1)->Connection->Name;
137 QString
G2 =
Ports.at(2)->Connection->Name;
138 QString
G3 =
Ports.at(3)->Connection->Name;
139 QString
B3 =
Ports.at(4)->Connection->Name;
140 QString
B2 =
Ports.at(5)->Connection->Name;
141 QString
B1 =
Ports.at(6)->Connection->Name;
142 QString
B0 =
Ports.at(7)->Connection->Name;
146 QString B0R =
"net_reg" +
Name +
B0;
147 QString B1R =
"net_reg" +
Name +
B1;
148 QString B2R =
"net_reg" +
Name +
B2;
149 QString B3R =
"net_reg" +
Name +
B3;
151 l =
"\n // " +
Name +
" 4bit grey to binary\n" +
152 " assign " + B0 +
" = " + B0R +
";\n" +
153 " reg " + B0R +
" = 0;\n" +
154 " assign " + B1 +
" = " + B1R +
";\n" +
155 " reg " + B1R +
" = 0;\n" +
156 " assign " + B2 +
" = " + B2R +
";\n" +
157 " reg " + B2R +
" = 0;\n" +
158 " assign " + B3 +
" = " + B3R +
";\n" +
159 " reg " + B3R +
" = 0;\n" +
160 " always @ ("+G0+
" or "+G1+
" or "+G2+
" or "+G3+
")\n" +
162 " "+B3R+
" <="+td+
" "+G3+
";\n"+
163 " "+B2R+
" <="+td+
" "+G3+
" ^ "+G2+
";\n"+
164 " "+B1R+
" <="+td+
" "+G3+
" ^ "+G2+
" ^ "+G1+
";\n"+
165 " "+B0R+
" <="+td+
" "+G3+
" ^ "+G2+
" ^ "+G1+
" ^ "+G0+
";\n"+