26 Description = QObject::tr (
"jk flip flop with set and reset verilog device");
29 QObject::tr (
"cross coupled gate transfer function high scaling factor")));
31 QObject::tr (
"cross coupled gate transfer function low scaling factor")));
33 QObject::tr (
"cross coupled gate delay")
34 +
" ("+QObject::tr (
"s")+
")"));
46 p->
Props.getFirst()->Value =
Props.getFirst()->Value;
53 Name = QObject::tr(
"JK-FlipFlop w/ SR");
54 BitmapFile = (
char *)
"jkff_SR";
56 if(getNewOne)
return new jkff_SR();
63 Lines.append(
new Line(-30,-40, 30,-40,QPen(Qt::darkBlue,2)));
64 Lines.append(
new Line( 30,-40, 30, 40,QPen(Qt::darkBlue,2)));
65 Lines.append(
new Line( 30, 40,-30, 40,QPen(Qt::darkBlue,2)));
66 Lines.append(
new Line(-30, 40,-30,-40,QPen(Qt::darkBlue,2)));
68 Lines.append(
new Line(-50,-20,-30,-20,QPen(Qt::darkBlue,2)));
69 Lines.append(
new Line(-50, 20,-30, 20,QPen(Qt::darkBlue,2)));
70 Lines.append(
new Line( 30, 20, 50, 20,QPen(Qt::darkBlue,2)));
71 Lines.append(
new Line( 30,-20, 50,-20,QPen(Qt::darkBlue,2)));
73 Lines.append(
new Line(-50, 0,-30, 0,QPen(Qt::darkBlue,2)));
75 Lines.append(
new Line(-30,-10,-20, 0,QPen(Qt::darkBlue,2)));
76 Lines.append(
new Line(-30, 10,-20, 0,QPen(Qt::darkBlue,2)));
78 Lines.append(
new Line( 0,-50, 0,-60,QPen(Qt::darkBlue,2)));
79 Lines.append(
new Line( 0, 50, 0, 60,QPen(Qt::darkBlue,2)));
81 Arcs.append(
new Arc( -5, -50, 10, 10, 0, 16*360, QPen(Qt::darkBlue,2)));
82 Arcs.append(
new Arc( -5, 40, 10, 10, 0, 16*360, QPen(Qt::darkBlue,2)));
84 Texts.append(
new Text(-25,-32,
"J", Qt::darkBlue, 12.0));
85 Texts.append(
new Text(-25, 7,
"K", Qt::darkBlue, 12.0));
86 Texts.append(
new Text( 11,-32,
"Q", Qt::darkBlue, 12.0));
87 Texts.append(
new Text( -5,-39,
"S", Qt::darkBlue, 12.0));
88 Texts.append(
new Text( 11, 7,
"Q", Qt::darkBlue, 12.0));
89 Texts.current()->over=
true;
90 Texts.append(
new Text( -5, 17,
"R", Qt::darkBlue, 12.0));
108 QString td =
Props.at(2)->Value;
112 QString S =
Ports.at(0)->Connection->Name;
113 QString J =
Ports.at(1)->Connection->Name;
114 QString CLK =
Ports.at(2)->Connection->Name;
115 QString K =
Ports.at(3)->Connection->Name;
116 QString R =
Ports.at(4)->Connection->Name;
117 QString QB =
Ports.at(5)->Connection->Name;
118 QString Q =
Ports.at(6)->Connection->Name;
120 s =
"\n "+
Name+
":process ("+S+
", "+CLK+
", "+R+
") is\n"+
121 " variable state : std_logic;\n"+
123 " if ("+S+
" = '0') then state := '1';\n"+
124 " elsif ("+R+
" = '0') then state := '0';\n"+
125 " elsif ("+CLK+
" = '1' and "+CLK+
"'event) then\n"+
126 " if ("+J+
" = '1' and "+K+
" = '1') then state := not state;\n"+
127 " elsif ("+J+
" = '1' and "+K+
" = '0') then state := '1';\n"+
128 " elsif ("+J+
" = '0' and "+K+
" = '1') then state := '0';\n"+
131 " "+Q+
" <= state"+td+
132 " "+QB+
" <= not state"+td+
139 QString td =
Props.at(2)->Value;
144 QString S =
Ports.at(0)->Connection->Name;
145 QString J =
Ports.at(1)->Connection->Name;
146 QString CLK =
Ports.at(2)->Connection->Name;
147 QString K =
Ports.at(3)->Connection->Name;
148 QString R =
Ports.at(4)->Connection->Name;
149 QString QB =
Ports.at(5)->Connection->Name;
150 QString Q =
Ports.at(6)->Connection->Name;
152 QString QR =
"Q_reg" +
Name + Q;
153 QString QBR =
"QB_reg" +
Name + QB;
154 QString ST =
"Q_state" +
Name;
156 l =
"\n // "+
Name+
" jk flip-flop with set and reset\n"+
157 " assign "+Q+
" = "+QR+
";\n"+
158 " reg "+QR+
" = 0;\n"+
159 " assign "+QB+
" = "+QBR+
";\n"+
160 " reg "+QBR+
" = 1;\n"+
161 " reg "+ST+
" = 0;\n"+
162 " always @ (posedge "+CLK+
")\n"+
164 " if ("+R+
" == 1 && "+S+
" == 1)\n"+
166 " if ("+J+
" == 1 && "+K+
" == 1) "+ST+
" = ~"+ST+
";\n"+
167 " if ("+J+
" == 1 && "+K+
" == 0) "+ST+
" = 1;\n"+
168 " if ("+J+
" == 0 && "+K+
" == 1) "+ST+
" = 0;\n"+
169 " "+QR+
" <="+td+
" "+ST+
";\n"+
170 " "+QBR+
" <="+td+
" ~"+ST+
";\n"+
173 " always @ ("+R+
")\n"+
175 " if ("+R+
" == 0) "+ST+
" = 0;\n"+
176 " "+QR+
" <="+td+
" "+ST+
";\n"+
177 " "+QBR+
" <="+td+
" ~"+ST+
";\n"+
179 " always @ ("+S+
")\n"+
181 " if ("+S+
" == 0) "+ST+
" = 1;\n"+
182 " "+QR+
" <="+td+
" "+ST+
";\n"+
183 " "+QBR+
" <="+td+
" ~"+ST+
";\n"+
bool VHDL_Delay(QString &td, const QString &Name)
Q3PtrList< struct Arc > Arcs
static Element * info(QString &, char *&, bool getNewOne=false)
bool Verilog_Delay(QString &td, const QString &Name)
Definitions and declarations for the main application.
Q3PtrList< Property > Props
Superclass of all schematic drawing elements.
virtual void recreate(Schematic *)