|
17 | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
18 | 18 | */
|
19 | 19 | #ifdef HAVE_CVS_IDENT
|
20 |
| -#ident "$Id: expr_synth.cc,v 1.56 2004/06/01 01:04:57 steve Exp $" |
| 20 | +#ident "$Id: expr_synth.cc,v 1.57 2004/06/12 15:00:02 steve Exp $" |
21 | 21 | #endif
|
22 | 22 |
|
23 | 23 | # include "config.h"
|
@@ -363,10 +363,61 @@ NetNet* NetEBMult::synthesize(Design*des)
|
363 | 363 |
|
364 | 364 | NetNet* NetEBDiv::synthesize(Design*des)
|
365 | 365 | {
|
366 |
| - cerr << get_line() << ": internal error: cannot synthesize division: " |
367 |
| - << *this << endl; |
368 |
| - des->errors += 1; |
369 |
| - return 0; |
| 366 | + NetNet*lsig = left_->synthesize(des); |
| 367 | + NetNet*rsig = right_->synthesize(des); |
| 368 | + |
| 369 | + NetScope*scope = lsig->scope(); |
| 370 | + |
| 371 | + NetNet*osig = new NetNet(scope, scope->local_symbol(), |
| 372 | + NetNet::IMPLICIT, expr_width()); |
| 373 | + osig->local_flag(true); |
| 374 | + |
| 375 | + switch (op()) { |
| 376 | + |
| 377 | + case '/': { |
| 378 | + NetDivide*div = new NetDivide(scope, scope->local_symbol(), |
| 379 | + expr_width(), |
| 380 | + lsig->pin_count(), |
| 381 | + rsig->pin_count()); |
| 382 | + des->add_node(div); |
| 383 | + |
| 384 | + for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1) |
| 385 | + connect(div->pin_DataA(idx), lsig->pin(idx)); |
| 386 | + for (unsigned idx = 0 ; idx < rsig->pin_count() ; idx += 1) |
| 387 | + connect(div->pin_DataB(idx), rsig->pin(idx)); |
| 388 | + for (unsigned idx = 0 ; idx < osig->pin_count() ; idx += 1) |
| 389 | + connect(div->pin_Result(idx), osig->pin(idx)); |
| 390 | + break; |
| 391 | + } |
| 392 | + |
| 393 | + case '%': { |
| 394 | + NetModulo*div = new NetModulo(scope, scope->local_symbol(), |
| 395 | + expr_width(), |
| 396 | + lsig->pin_count(), |
| 397 | + rsig->pin_count()); |
| 398 | + des->add_node(div); |
| 399 | + |
| 400 | + for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1) |
| 401 | + connect(div->pin_DataA(idx), lsig->pin(idx)); |
| 402 | + for (unsigned idx = 0 ; idx < rsig->pin_count() ; idx += 1) |
| 403 | + connect(div->pin_DataB(idx), rsig->pin(idx)); |
| 404 | + for (unsigned idx = 0 ; idx < osig->pin_count() ; idx += 1) |
| 405 | + connect(div->pin_Result(idx), osig->pin(idx)); |
| 406 | + break; |
| 407 | + } |
| 408 | + |
| 409 | + default: { |
| 410 | + cerr << get_line() << ": internal error: " |
| 411 | + << "NetEBDiv has unexpeced op() code: " |
| 412 | + << op() << endl; |
| 413 | + des->errors += 1; |
| 414 | + |
| 415 | + delete osig; |
| 416 | + return 0; |
| 417 | + } |
| 418 | + } |
| 419 | + |
| 420 | + return osig; |
370 | 421 | }
|
371 | 422 |
|
372 | 423 | NetNet* NetEBLogic::synthesize(Design*des)
|
@@ -828,6 +879,9 @@ NetNet* NetESignal::synthesize(Design*des)
|
828 | 879 |
|
829 | 880 | /*
|
830 | 881 | * $Log: expr_synth.cc,v $
|
| 882 | + * Revision 1.57 2004/06/12 15:00:02 steve |
| 883 | + * Support / and % in synthesized contexts. |
| 884 | + * |
831 | 885 | * Revision 1.56 2004/06/01 01:04:57 steve
|
832 | 886 | * Fix synthesis method for logical and/or
|
833 | 887 | *
|
|
0 commit comments