BATS Parser Description


The BATS.Parser has the following interface:

Source Code:


  • Reset [Bool]
  • Data [U8[8]]
  • Data.Valid [Bool]
  • Ready.For.Debug [Bool]
  • Ready.For.OrderBook.Command [Bool]


  • Ready.For.Udp.Input [Bool]
  • Debug.Element [U64]
  • Debug.Valid [Bool]
  • OrderBook.Command
    • OrderBook.Command.Type [Cluster]
    • Side [U8]
    • Order Id [U64]
    • Quantity [U32]
    • Symbol [U64]
    • Price [U64]
    • Executed Quantity [U32]
    • Canceled Quantity [U32]
    • Remaining Quantity [U32]
    • Seconds [U64]
    • Nanoseconds [U64]
    • OrderBook.Command.Valid [Bool]

The BATS.Parser IP is expecting UDP (or TCP) application-level data coming from a connection to the CBOE/BATS exchange in the PITCH format. Data is expected to come in 64-bits per clock cycle, which is the speed that a 10gigabit MAC receives data from the network. A Sequenced Unit Header encapsulates 1 or more Market Data messages. If the number of messages inside a Sequenced Unit Header is 0, then the message is treated as a heartbeat. Data is read into a local array of U64s. Once an entire message has been read in it is parsed and the resulting message is normalized into the ‘OrderBook.Command’ format and is sent out using the output pins described above. These output pins are plugged directly into the Filter or to a test harness for testing and validation.


  • Handle gaps in messages:
    • Modify BATS.Parser to take gaps in sequence numbers into account.
      • Store all incoming Sequenced Unit Headers, along with their associated payloads into SRAMThis new SCTL will:
      • After writing a Sequenced Unit Header into SRAM, if it is in proper order, send a signal via a Target-scoped-FIFO to the BATS.Parser IP to signal that a new packet of data is available in the SRAM, its starting address and its size. After the BATS.Parser finishes parsing, in addition to sending any normalized OrderBook commands to the Filter it will also send an acknowledgement to the new IP that the packet has been successfully processed.
        • References to blocks of memory will be stored in a separate memory and will have to be searched in a linear fashion in order to find a free memory for writing the next Sequenced Unit Header.
      • If an incoming Sequenced Unit Header is detected to be out-of-order, a message is sent to the host indicating this error and the host will handle sending a gap request message and upon receiving this gap response it will handle it like any normal/received in order Sequenced Unit Header.
  • Handle A/B feed arbitration.
    • Insert a Single-Cycle-Timed-Loop between two UDP/TCP outputs and the BATS.Parser Input.
    • At the start of each ‘Read.Seq.Unit.Header’ state, randomly or in a round-robin fashion select either interface A or interface B. Upon reading a Sequenced Unit Header check whether it has already been successfully read in. If not write it to the shared SRAM and send the appropriate signal to the BATS.Parser.
    • If an out-of-order Sequenced Unit Header is detected, follow the same procedure as above and send a message to the host which will handle a gap request message.

Leave a Comment