[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] help me to design a hierarchical block

From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] help me to design a hierarchical block
Date: Tue, 4 Feb 2014 11:39:44 +0000

On Mon, Feb 3, 2014 at 6:00 PM, Tom McDermott <address@hidden> wrote:
> Hi Maheshkumar,
> Here's some details on making a hierarchical block when using Gnuradio
> Companion:
> 1. From an open GRC flow graph, mouse-select the connected elements that you
> want to turn into a hierarchical block. The blocks and interconnect will
> turn green.
> 2. Right click, then select Create Hier.  This will create a new page. There
> should be Pad Source(s) and/or Sink(s). These are the inputs and outputs of
> the block,. GRC will provide default names like In, or Out. Double click the
> Pad Source and edit the label to be something useful.  These will be the
> names of the inputs and outputs when any top_block uses your hierarchical
> block.
> 3. If some of the blocks in your hierarchical block have values set by
> variables (like samp_rate) then those will become parameters in the
> hierarchical block. If the same variable name was used for several different
> blocks, you'll get duplicate parameter blocks, colored red (due to dupe
> naming). For example, if 3 blocks in the hierarchical block all were set by
> samp_rate, you'll get 3 parameters all with the same name. You would in that
> case just delete two of those parameter blocks, and leave the variable name
> in all three GRC blocks set at samp_rate. That parameter name is what
> top_block sees when it passes something to your hiararchical block. You can
> have multiple parameters, but the names must be different.
> 4. Double click the Options block. You may want to edit the Category to be
> something other than Custom. This affects where the hierarchical block shows
> up in the block selection menu in GRC. I for example, change it to something
> appropriate to the function of the new hierarchical block, or leave it as
> Custom. Also change the ID in the options block to a name that you want to
> use for your new hierarchical block. This will be the name that is listed in
> the block picker in GRC.
> 5. Click the button with the triangle/arrow/circle in the GRC menu bar
> 'Generate the flow graph'. This will compile the hierarchical block into
> python code and xml file, and place both files in the ~/.grc_gnuradio folder
> (hidden by default) in your home directory. It will also ask you to save the
> GRC hierarchical flowgraph. This allows you to later edit the hierarchical
> block, or look at it. I usually save it to the desktop, then move it to
> ~/.grc_gnuradio later on when I'm happy with the block. Having all 3 files
> (.grc, .py, .xml) in the same folder makes it easier to keep track for stuff
> (for me).  Once you've created the .py and .xml files, you don't actually
> need the .grc file, but I like to keep it around in case there is a need to
> understand or change something later on.
> You can edit the xml file if you wish with a text editor. For example, add
> <doc>  your docs can be spelled
> out as text here
> </doc>
> tags to the xml to add documentation to your hierarchical block.
> 6. Close then restart GRC and your new hierarchical block should be
> available. You can distribute your hierarchical block to others by giving
> them the 3 files.
> -- Tom, N5EG

Just a quick note. You no longer have to exit GRC and relaunch it when
you make changes to or add xml blocks. You can just reload the block
trees using the button "Reload Blocks" in the toolbar. It should
generally look like an arrow making a circle (depending on your
windows manager) on the of the toolbar.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]