From a4ac44d7adbd9c6cdd107ec7985e294fea81845a Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 21 Apr 2011 11:02:28 -0700 Subject: grc: fix hier block generation w/ multiple pad blocks --- grc/python/flow_graph.tmpl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 7a74cf84c..d5e53b52b 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -74,8 +74,8 @@ class $(class_name)(gr.top_block): def __init__($param_str): gr.top_block.__init__(self, "$title") #elif $generate_options == 'hb' - #set $in_sigs = $flow_graph.get_input_signaturev() - #set $out_sigs = $flow_graph.get_output_signaturev() + #set $in_sigs = $flow_graph.get_io_signaturev('in') + #set $out_sigs = $flow_graph.get_io_signaturev('out') class $(class_name)(gr.hier_block2): #def make_io_sig($io_sigs) #set $size_strs = ['%s*%s'%(io_sig['size'], io_sig['vlen']) for io_sig in $io_sigs] @@ -153,11 +153,13 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))]) ## The port name should be the id of the parent block. ## However, port names for IO pads should be self. ######################################################## -#def make_port_name($port) - #if $port.get_parent().get_key().startswith('pad_') -self#slurp +#def make_port_sig($port) + #if $port.get_parent().get_key() == 'pad_source' +(self, $flow_graph.get_pad_sources().index($port.get_parent()))#slurp + #elif $port.get_parent().get_key() == 'pad_sink' +(self, $flow_graph.get_pad_sinks().index($port.get_parent()))#slurp #else -self.$port.get_parent().get_id()#slurp +(self.$port.get_parent().get_id(), $port.get_key())#slurp #end if #end def #if $connections @@ -175,7 +177,7 @@ self.$port.get_parent().get_id()#slurp #end if ##do not generate connections with virtual sinks #if not $sink.get_parent().is_virtual_sink() - self.connect(($make_port_name($source), $source.get_key()), ($make_port_name($sink), $sink.get_key())) + self.connect($make_port_sig($source), $make_port_sig($sink)) #end if #end for -- cgit