50 const sc_signal<bool>&
reset;
51 const sc_signal<bool>& in_ok;
52 const sc_signal<bool>& out_ok;
53 sc_signal<bool>& instrb;
54 sc_signal<bool>& outstrb;
58 BUBBLE( sc_module_name NAME,
60 const sc_signal<bool>& RESET,
61 const sc_signal<bool>& IN_OK,
62 const sc_signal<bool>& OUT_OK,
63 sc_signal<bool>& INSTRB,
64 sc_signal<bool>& OUTSTRB,
88 a1 (A1), a2(A2), a3(A3), a4(A4),
89 a5 (A5), a6(A6), a7(A7), a8(A8),
90 d1 (D1), d2(D2), d3(D3), d4(D4),
91 d5 (D5), d6(D6), d7(D7), d8(D8)
95 reset_signal_is(
reset,
true);
122 outstrb.write(
false);
133 for (
i = 1;
i <= 8;
i++) {
136 for (
i = 1;
i <= 8;
i++) {
149 do {
wait(); }
while (!in_ok);
154 B[1] =
a1.read(); B[2] = a2.read(); B[3] = a3.read(); B[4] = a4.read();
155 B[5] = a5.read(); B[6] = a6.read(); B[7] = a7.read(); B[8] = a8.read();
158 lout <<
"STARTING BUBBLE SORT" << endl;
162 for (
i = 1;
i <= 7;
i++) {
164 if (B[
i].to_int() > B[
i+1].to_int()) {
165 for (
j = 1;
j <= 8;
j++) {
171 minel = C[
i].to_int();
173 for (
j = 1;
j <= 8;
j++) {
180 if (B[
x].to_int() > B[
x-1].to_int()) {
184 for (
j = 1;
j <= 8;
j++) {
191 for (
j = 1;
j <= 8;
j++) {
204 d1.write(C[1]); d2.write(C[2]); d3.write(C[3]); d4.write(C[4]);
205 d5.write(C[5]); d6.write(C[6]); d7.write(C[7]); d8.write(C[8]);
209 do {
wait(); }
while (!out_ok);
211 outstrb.write(
false);