In this section, we’ll start to optimize the design. Before we do this, we’ll create a new component. The advantage to this is that we can apply our optimizations to the new component while keeping the existing component open and unchanged to make for easier comparisons.
In the VITIS COMPONENTS panel, right-click the HLS Component you created in the previous section and select
Clone Component
.Inside the newly created component, expand
Sources
, then openbeamformer.cpp
.
Note that this file is actually the same file that is being referenced by the original component. This happens when the source file is included by reference. To copy and keep separate copies of code, the code needs to be copied into the component directory and referenced locally. This is helpful if your optimizations might include code changes as well as changes to compiler. In our case, we happen to know that we won’t be changing the code, so our preference is to keep just one copy of the code that all components will reference. But, that means we need to move our pragmas from the source file to the config file of the original component before optimizing the new component:
In the FLOW Panel, set the Component to the original component.
In the HLS DIRECTIVE Panel hover over one of the
HLS PIPELINE off
pragmas to highlight it, then click the pencil icon.In the Edit Directive window that opens up, select the radio icon next to
Config File
. Repeat this for all threePIPELINE
directives.
If you wish to inspect the new location of the directives, press the gear next the the Component in the FLOW panel. That will show you the config file, hls_config.cfg
. The compiler directives are now in that file and they will be visible in the Design Directives section of the Settings window. In addition, there is an icon at the top of that window to inspect the config file text directly. Now these compiler directives apply only to the original component because they are in a local config file instead of the shared source file. Here is a snippet of the directives in your config file for the original component:
syn.directive.pipeline=beamformer/L1 off
syn.directive.pipeline=beamformer/L2 off
syn.directive.pipeline=beamformer/L3 off
Now, when you return to the beamformer.cpp
file, the pragmas will be removed. Then, when you return to the new component, we can apply some new optimizations.