15
15
from .pyrtlexceptions import PyrtlError , PyrtlInternalError
16
16
from .wire import WireVector , Input , Output , Const , Register
17
17
from .transform import net_transform , _get_new_block_mem_instance , copy_block , replace_wires
18
- from . import transform # transform.all_nets looks better than all_nets
18
+ from . import transform
19
+ from pyrtl import wire # transform.all_nets looks better than all_nets
19
20
20
21
21
22
# --------------------------------------------------------------------
@@ -411,6 +412,7 @@ def synthesize(update_working_block=True, merge_io_vectors=True, block=None):
411
412
# to the original io wirevector found in block_pre. We use it to create
412
413
# the block_out.io_map that is returned to the user.
413
414
orig_io_map = {temp : orig for orig , temp in block_in .io_map .items ()}
415
+ orig_reg_map = {temp : orig for orig , temp in block_in .reg_map .items ()}
414
416
415
417
# Next, create all of the new wires for the new block
416
418
# from the original wires and store them in the wirevector_map
@@ -430,9 +432,11 @@ def synthesize(update_working_block=True, merge_io_vectors=True, block=None):
430
432
if len (wirevector ) > 1 :
431
433
new_name += '[' + str (i ) + ']'
432
434
new_wirevector = wirevector .__class__ (name = new_name , bitwidth = 1 )
433
- block_out .io_map [orig_io_map [wirevector ]] = new_wirevector
435
+ block_out .io_map [orig_io_map [wirevector ]]. append ( new_wirevector )
434
436
else :
435
437
new_wirevector = wirevector .__class__ (name = new_name , bitwidth = 1 )
438
+ if isinstance (wirevector , Register ):
439
+ block_out .reg_map [orig_reg_map [wirevector ]].append (new_wirevector )
436
440
wirevector_map [(wirevector , i )] = new_wirevector
437
441
438
442
# Now connect up the inputs and outputs to maintain the interface
@@ -441,12 +445,12 @@ def synthesize(update_working_block=True, merge_io_vectors=True, block=None):
441
445
input_vector = Input (name = wirevector .name , bitwidth = len (wirevector ))
442
446
for i in range (len (wirevector )):
443
447
wirevector_map [(wirevector , i )] <<= input_vector [i ]
444
- block_out .io_map [orig_io_map [wirevector ]] = [ input_vector ]
448
+ block_out .io_map [orig_io_map [wirevector ]]. append ( input_vector )
445
449
for wirevector in block_in .wirevector_subset (Output ):
446
450
output_vector = Output (name = wirevector .name , bitwidth = len (wirevector ))
447
451
output_bits = [wirevector_map [(wirevector , i )] for i in range (len (output_vector ))]
448
452
output_vector <<= concat_list (output_bits )
449
- block_out .io_map [orig_io_map [wirevector ]] = [ output_vector ]
453
+ block_out .io_map [orig_io_map [wirevector ]]. append ( output_vector )
450
454
451
455
# Now that we have all the wires built and mapped, walk all the blocks
452
456
# and map the logic to the equivalent set of primitives in the system
0 commit comments