Advanced pattern (advanced_pattern)
advanced_pattern is an asset in the ocpi.assets.util_comps component library. Implementations include advanced_pattern RCC Worker (advanced_pattern.rcc). Tested platforms include Rocky9, xilinx24_1_aarch32.
Design
The Advanced Pattern Component provides predefined data to assist in the testing of other Components.
The data can be arranged in messages of up to 2048 bytes at a time with each block having a specific opcode. By default, 32 of these messages are available, but that configuration is exposed as a build-time parameter with a default configuration building additional Workers allowing for 64, 128, and 256 messages.
Note
This Component provides minimal error checking and is not recommended for production use, but is only intended for prototyping and testing of other Components.
A block diagram representation of the implementation is given in Figure 156:
Figure 156: advanced_pattern block diagram.
Interface
<ComponentSpec>
<Port Name="out" numberofopcodes='256' Producer="true">
</Port>
<!-- Playback pattern -->
<Property name="maxPatternLength" type="ULong" parameter="true" default="32"/>
<Property name="Pattern" type="Struct" initial="true" sequenceLength="maxPatternLength">
<Member name='Opcode' type='uChar' default='0'/>
<Member name='Bytes' type='uChar' default='0' sequenceLength="2048"/>
</Property>
<Property name='LoopCount' type='ULongLong' initial="true" default='1'/>
<Property name='ZLM' type='UShort' initial="true" default='0'/>
<!-- Statistics for each opcode -->
<Property name="current" type="Struct" volatile="true">
<Member name="Total" type="Struct">
<Member name="bytes" type="ULongLong"/>
<Member name="messages" type="ULongLong"/>
</Member>
<Member name="Opcode" type="Struct" arrayLength="256">
<Member name="bytes" type="ULongLong"/>
<Member name="messages" type="ULongLong"/>
</Member>
</Property>
</ComponentSpec>
Properties
maxPatternLengthType:
ulongAccess:
Parameter:
TrueWritable:
FalseInitial:
FalseVolatile:
False
Default value:
32
PatternType:
structSequence length:
maxPatternLengthMembers:
Opcode:
data_type:
uchar
Bytes:
data_type:
ucharsequencelength:
2048
Access:
Parameter:
FalseWritable:
FalseInitial:
TrueVolatile:
False
Default value:
None
LoopCountType:
ulonglongAccess:
Parameter:
FalseWritable:
FalseInitial:
TrueVolatile:
False
Default value:
1
ZLMType:
ushortAccess:
Parameter:
FalseWritable:
FalseInitial:
TrueVolatile:
False
Default value:
0
currentType:
structMembers:
Total:
bytes:
data_type:
ulonglong
messages:
data_type:
ulonglong
Opcode:
bytes:
data_type:
ulonglong
messages:
data_type:
ulonglong
Access:
Parameter:
FalseWritable:
FalseInitial:
FalseVolatile:
True
Default value:
None
Ports
Inputs:
None.
Outputs:
outProtocol:
NoneOptional:
False
Implementations
advanced_pattern(RCC)
Dependencies
The dependencies to other elements in OpenCPI are:
:math:`<`\ assets\ :math:`>`/components/util_comps/advanced_pattern.rcc/advanced_pattern.cc
Limitations
Limitations of advanced_pattern are:
None.
Testing
The advanced_pattern worker is tested using five cases. All cases are verified using the md5 hashes of different properties and or the output file against the expected md5 hashes. A sixth case, test_05, is present but not tested due to sending a ZLM with opcode 1. The file_write component cannot currently stop on ZLM with opcodes other than 0.
case 00 runs default values and sends a single ZLM with opcode 0. The output file and the contents of the current property are compared to the expected.
case 01 also runs default values but does not send a ZLM and instead times out after 10 seconds. The current property is compared to the expected.
case 02 generates the Pattern property (generate.py 2) and sends three bytes every tenth opcode. The maxPatternLength property is explicitly set to be 256. The output file, contents of the current property, and, contents of the maxPatternLength property are compared to the expected.
case 03 generates the Pattern property (generate.py 3) and sends three bytes every tenth opcode, 50 times. There is no ZLM sent and the test case times out after 10 seconds. The maxPatternLength property is set to 64. For clarity, an Output_03.out file is created to see from where the output hashes are gotten. The output file, contents of the current property, and, contents of the maxPatternLength property are compared to the expected.
case 04 generates 2048 bytes of data for the Pattern property (generate.py 4) and sends 3 bytes with opcode 0 for 10 seconds. The contents of the maxPatternLength property, and the end cut of the current property are compared to the expected.