Bar
SpaceWire UK
Specialist providers of VHDL Intellectual Property & Design Services
BarBarBarBar
SpaceWire Serial Testbench Module - SGive
The SGive testbench module is used to generate serial SpaceWire Data & Strobe signals that can be used to stimulate any SpaceWire CODEC. The testbench module also has the ability to reset the CODEC that it is sending data to. A simple block diagram for the testbench module is shown below.


The testbench signal generation is controlled by an external file that is passed to the testbench via a VHDL Generic. This file is a basic ASCII file that uses the very simple token syntax given below.



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

Examples:-
  • # Hello I'm a comment!



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

Examples:-
  • 2*null, 3*fct will generate null, null, fct, fct, fct.



Commas
Commas separate tokens and do not generate anything themselves.

Examples:-
  • null,fct, eop , eep will generate null, fct, eop, eep.



Stars
A Star generates multiple copies of whatever follows it.

Examples:-
  • 2*(2*null,fct) will generate null, null, fct, null, null, fct.



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

Examples:-
  • null, 2*(fct, 1*(null, fct)) will generate fct, null, fct, fct, null, fct.



Null
A Null generates a NULL token that is used to fill gaps when no other tokens are available.

Examples:-
  • null, null, null will generate null, null, null.
  • 2*null will generate null, null.
To generate a null with a double parity error start the keyword with a capital letter, i.e. Null. Single parity errors can be obtained with the token pair Esc, fct and esc, Fct.



Flow Control
A Flow Control generates a FCT token that can be used to control NChar (data, eop & eep) traffic allowance.

Examples:-
  • fct, fct will generate fct, fct.
  • 5*fct will generate fct, fct, fct, fct, fct.
To generate a fct with a parity error start the keyword with a capital letter, i.e. Fct.



Escape
An Escape generates an Escape token that can be used to manually generate NULL's or Time-Codes, or used to generate Escape errors.

Examples:-
  • esc, fct will generate null.
  • esc, data=15 will generate time-code(15).
  • esc, null, fct will esc, null, fct.
To generate an esc with a parity error start the keyword with a capital letter, i.e. Esc.



Time
Time generates time-code tokens that can be used to transfer the current system time.

There are four possible values that can follow the time keyword:-
  • 0-255 - Generates a time-code in the range 0 to 255.
  • A - Generates an Ascending time-code.
  • D - Generates a Descending time-code.
  • R - Generates a time-code with a Random value.
Examples:-
  • time=0, time=10, time=20 will generate time-code(0), time-code(10), time-code(20)
  • time=50, 2*time=a, time=53 will generate time-code(50), time-code(51), time-code(52), time-code(53).
  • time=200, time=d, time=198 will generate time-code(200), time-code(199), time-code(198).
  • 2*time=r could well generate time-code(28), time-code(231).
To generate a time-code with a double parity error start the keyword with a capital letter, i.e. Time. Single parity errors can be obtained with the token pair Esc, data=3 and esc, Data=56.



Packet Data
Packet Data generates data tokens that can be used to make up the byte content of a packet.

There are four possible values that can follow the data keyword:-
  • 0-257 - Generates a byte in the range 0 to 255 or an EOP/EEP packet terminator.
  • A - Generates an Ascending data byte.
  • D - Generates a Descending data byte.
  • R - Generates a byte with a Random value.
Examples:-
  • data=0, data=1, data=2, eop will generate data(0), data(1), data(2), eop.
  • data=50, 2*data=a, eep will generate data(50), data(51), data(52), eep.
  • data=200, 2*data=d, eop will generate data(200), data(199), data(198), eop.
  • 5*data=r could well generate data(2), data(19), data(76), data(71), data(0).
To generate a data byte with a parity error start the keyword with a capital letter, i.e. Data.



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 data=256 or data=257.

Examples:-
  • data=5, data=0, eop will generate data(5), data(0), eop.
  • data=45, data=257, eop will generate data(45), eep, eop.
  • 2*(data=3, data=256, 2*eep) will generate data(3), eop, eep, eep, data(3), eop, eep, eep.
To generate an eop/eep with a parity error start the keyword with a capital letter, i.e. Eop/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.

Examples:-
  • data=5, data=6, data=a, data=8, eop will generate data(5), data(6), data(7), data(8), eop.
  • data=1, 3*data=a, eep will generate data(1), data(2), data(3), data(4), eep.




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.

Examples:-
  • data=8, data=d, data=d, data=5, eep will generate data(8), data(7), data(6), data(5), eep.
  • data=10, 2*data=d, eop will generate data(10), data(9), data(8), eop.




Random
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.

Examples:-
  • r*null, r*fct, r*null could well generate null, fct, fct, null, null, null.
  • r*data=0, r*data=1 could well generate data(0), data(0), data(0), data(1).
A random character (R) following a data keyword will generate a random data byte in the range Lower Limit to Upper Limit. This random number will also be in the range Lower Limit to Upper Limit.

Examples:-
  • data=r, data=r, data=r could well generate data(255), data(79), data(3).
  • r*data=r could well generate data(5), data(93), data(2), data(192), data(88).



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

Examples:-
  • data=r, 254*l, 3*data=r could well generate data(3), data(254), data(255), data(255).



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

Examples:-
  • data=r, 2*u, 3*data=r could well generate data(65), data(2), data(0), data(1).



Gap
A gap character (G) generates a 1ns quiet time where no signal transitions take place.

Examples:-
  • null, g, null will generate null, 1ns quite time, null.
  • null, 850*g, fct will generate null, 850ns quite time, fct.



Set-up
A set-up character (S) sets the set-up time (bit-gap time) in ns multiples of all subsequent Data & Strobe signal transitions. The default set-up value is 100 (10MBit/s).

Examples:-
  • null, 10*s, null will generate null[10MBit/s], null[100MBit/s].
  • data=10, s, data=11 will generate data(10)[10MBit/s], data(11)[1GBit/s].



Halt
A Halt character (H) is used to output a 100ns reset pulse on the active high reset output.

Examples:-
  • h, null, null will generate [100ns Reset], null, null.
  • 10*h, null, null, fct will generate [1us Reset], null, null, fct.



Some Real World Examples
This control sequence will generate 25 NULL's followed by 7 FCT's.
  • 25*null, 7*fct
This control sequence will generate 50 NULL's where the middle one has a double parity error.
  • 24*null, Null, 25*null
This control sequence will generate 20 packets that have a header of 10, vary in length from 5 to 10 bytes, contain random bytes in the range 128-255 and are terminated with either an eop or eep.
  • 20*(data=10, 5*l, 10*u, r*(128*l, 255*u, data=r), 256*l, 257*u, data=r)
This control sequence will generate 25 packets that have a random header in the range 1 to 15 and a body of 10 random bytes in the range 0-255.
  • 25*(1*l, 15*u, data=r, 0*l, 255*u, 10*data=r, eop)