Zero pad (zero_pad)
zero_pad is an asset in the ocpi.assets.util_comps component library. Implementations include zero_pad HDL Worker (zero_pad.hdl) and zero_pad RCC Worker (zero_pad.rcc). Tested platforms include xsim, zed.
Design
The Zero Pad component inputs samples and inserts a configurable number of zeros between output samples.
A block diagram representation of the implementation is given in Figure 174:
Figure 174: zero_pad block diagram.
Interface
<ComponentSpec>
<Property Name="DWIDTH_p" Type="ulong" Default="16" Parameter="true"/>
<Property Name="num_zeros" Type="ushort" Writable="true"/>
<DataInterfaceSpec Name="in" Producer="false"/>
<DataInterfaceSpec Name="out" Producer="true"/>
</ComponentSpec>
Properties
DWIDTH_pType:
ulongAccess:
Parameter:
TrueWritable:
FalseInitial:
FalseVolatile:
False
Default value:
16
num_zerosType:
ushortAccess:
Parameter:
FalseWritable:
TrueInitial:
FalseVolatile:
False
Default value:
None
Ports
Inputs:
inProtocol:
NoneOptional:
False
Outputs:
outProtocol:
NoneOptional:
False
Implementations
Dependencies
The dependencies to other elements in OpenCPI are:
projects/assets/components/util_comps/zero_pad.hdl/zero_pad.vhd
projects/assets/components/util_comps/zero_pad.rcc/zero_pad.cc
Limitations
Limitations of zero_pad are:
None.
Testing
Data widths of 8/16/32/64 are supported and fully tested on both RCC and HDL worker implementations. These widths combinations are tested with num_zeros equal to 0, 7, 8, 38, 127, and 255.
Input data is generated by a python script with an input parameter that defines the number of 32-bit words to produce. The input file consists of a repeating pattern of 0x0123456789ABCDEF. The number of 32-bit words for each test case is 2048, which results in 1024 64-bit samples, 2048 32-bit samples, 4096 16-bit samples, or 8192 8-bit samples. Thus for each test case the 64-bit test pattern is repeated 1024 times to produce a file of 65,536 bits (or 8192 bytes).
The Zero Pad component inputs each sample and num_zeros zeros are inserted between each output sample.
For verification, the output file is first checked that the data is not all zero, and is then checked for the expected length. Once these quick checks are made the output data is compared against expected results sample-by-sample without use of any gold files.