Bar
SpaceWire UK
Specialist providers of VHDL Intellectual Property & Design Services
BarBarBarBar
SpaceWire Switch Core Testbench - PGive
The PGive VHDL testbench module is used to generate 9-bit SpaceWire data and is for use with the SpaceWire Switch Core (Router). The data generation is controlled by an external file and uses the same handshake mechanism as the Autonomous Cascadable Dual Port FIFO.


PGive control files can be used to create exotic test patterns from the combination of the very simple elements described below.



Comments
Comment lines start with a hash (#) character at the very first position of the line.

Example: # Hello I'm a comment!



Numbers
A number in the range 0-257 followed by a comma or new-line will generate a one-byte data, eop or eep token.

Example: 25, 256, 34, 76, 257 will generate 25, eop, 34, and 76, eep.

A number followed by a star will generate multiple copies of whatever follows the star. A zero will naturally generate nothing (zero copies).

Example: 2*256, 0*65, 1*77, 3*5 will generate eop, eop, 77, 5, 5, 5.



Commas
Commas separate tokens and do not generate anything themselves.

Example: 22,33, 44 , 55 will generate 22, 33, 44, 55.



Stars
A Star generates multiple copies of whatever follows it.

Example: 2*(2*(2*9)) will generate 9, 9, 9, 9, 9, 9, 9, 9.



Brackets
Brackets are used to isolate sets of tokens and do not generate anything themselves.

Example: 45, 2*(5, 2*(6, 7)) will generate 45, 5, 6, 7, 6, 7, 5, 6, 7, 6, 7.



Packet Terminators
Packet Terminators (EOP or EEP) generate end of packet or an error end of packet tokens. An EOP or EEP can also be generated by using the number 256 or 257.

Example 1: 5, 0, eop will generate 5, 0, eop.
Example 2: 45, 257, eop will generate 45, eep, eop.
Example 3: 2*(3, 256, 2*eep) will generate 3, eop, eep, eep, 3, eop, eep, eep.



Ascending
An ascending character (A) generates a data token that is one more than the last data token. If the last data token was 255 then the next data token will be 0.

Example 1: 5, 6, A, 8, 9 will generate 5, 6, 7, 8, 9.
Example 2: 1, 5*A, eop will generate 1, 2, 3, 4, 5, 6, eop.



Descending
A descending character (D) generates a data token that is one less than the last data token. If the last data token was 0 then the next data token will be 255.

Example 1: 9, 8, D, 6, 5 will generate 9, 8, 7, 6, 5.
Example 2: 1, 10, 3*D, eep will generate 1, 10, 9, 8, 7, eep.



Random
A random character (R) followed by a comma or new-line will generate a random one-byte data token in the range Lower Limit to Upper Limit.

Example 1: R, R, R, R could well generate 3, 76, 99, and 56.
Example 2: 5*R could well generate 45, 199, 207, 3, 55.

A random character (R) followed by a star will generate a random number of whatever follows the star. If the random number happens to be zero then nothing will be generated. This random number will also be in the range Lower Limit to Upper Limit.

Example 1: R*21, R*20, R*eop could well generate 21, 20, 20, 20, eop, eop.
Example 2: R*R could well generate 6, 255, 74, 33, 17, 22, 101.



Gap
A gap character (G) generates a one-cycle wait state where no data will be transferred.

Example 1: 1, G, 2, 3, G, 4 will generate 1, one-cycle gap, 2, 3, one-cycle gap, 4.
Example 2: 22, 5*G, 33 will generate 22, five-cycle gap, 33.



Set-up
A set-up character (S) adds wait states on the front of all subsequent data transfers. The default set-up value is 0.

Example 1: 1, 2, S, 3, 4 will generate 1, 2, one-cycle gap, 3, one-cycle gap, 4.
Example 2: 10, 4*S, 11, 12 will generate 10, four-cycle gap, 11, four-cycle gap, 12.
Example 3: 5, 2*S, 6, 0*S, 7 will generate 5, two-cycle gap, 6, 7.



Lower Limit
A lower-limit character (L) sets the lower limit of all subsequent random numbers. The default lower-limit value is 0.

Example: R, 254*L, 5*R could well generate 3, 254, 254, 255, 254, 255.



Upper Limit
An upper-limit character (U) sets the upper limit of all subsequent random numbers. The default upper-limit value is 255.

Example: R, 2*U, 5*R could well generate 65, 2, 0, 1, 1, 2.



Some Real World Examples
This control sequence will generate 10 packets that have a header of 3, vary in length from 2 to 5 bytes, contain random bytes in the range 64-255 and are terminated with either an eop or eep.
  • 10*(3, 2*L, 5*U, R*(64*L, 255*U, R), 256*L, 257*U, R)
This control sequence will generate 15 packets that have a random header in the range 1 to 7 and a body of 10 random bytes in the range 0-255.
  • 15*(1*L, 7*U, R, 0*L, 255*U, 10*R, eop)
This control sequence will generate a random number of packets (500-1000) that have a random header in the range 1 to 31 and a random length body (100-200 bytes) that contains totally random bytes.
  • L*500, U*1000, R*(1*L, 31*U, R, 100*L, 200*U, R*(0*L, 255*U, R), eop)
This control sequence will generate 1000 bytes of ascending data that have random set-up times in the range 0 to 50 cycles.
  • 0*L, 50*U, R*S, 1000*A